diff --git a/common/http.interceptor.js b/common/http.interceptor.js index f1ad98d..5a5a7a8 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,6 +1,6 @@ const install = (Vue, vm) => { Vue.prototype.$u.http.setConfig({ - baseUrl: 'http://124.221.246.124:2291', + baseUrl: 'http://192.168.2.143:3202', // baseUrl: 'https://fen.ccttiot.com/prod-api', loadingText: '努力加载中~', loadingTime: 800, diff --git a/manifest.json b/manifest.json index 85567f1..6d2dfc3 100644 --- a/manifest.json +++ b/manifest.json @@ -53,7 +53,10 @@ "libVersion" : "latest", "appid" : "wxe092159cf34ef21a", "setting" : { - "urlCheck" : false + "urlCheck" : false, + "minified" : true, + "postcss" : true, + "es6" : true }, "usingComponents" : true, "optimization" : { @@ -78,5 +81,6 @@ "uniStatistics" : { "enable" : false }, - "vueVersion" : "2" + "vueVersion" : "2", + "fallbackLocale" : "zh-Hans" } diff --git a/page_Beehive/Beehive_detail.vue b/page_Beehive/Beehive_detail.vue index 8adda9b..8f8de03 100644 --- a/page_Beehive/Beehive_detail.vue +++ b/page_Beehive/Beehive_detail.vue @@ -113,9 +113,14 @@ {{obj.lastOnlineTime == undefined ? '--' : obj.lastOnlineTime}} - - - + + + + {{obj.surplusPowerPoint == undefined ? '--' : obj.surplusPowerPoint}}% @@ -123,7 +128,8 @@ 温度 - + 当前 {{obj.innerTemperature == undefined ? '--' : obj.innerTemperature}}℃ @@ -148,7 +154,8 @@ 湿度 - + 当前 {{obj.innerHumidity}}% @@ -173,7 +180,8 @@ 重量 - + 当前 {{obj.totalWeight == 999999 ? '--' : (obj.totalWeight / 1000).toFixed(1)}}kg @@ -198,7 +206,8 @@ 进出量 - + 当前 {{obj.ioCountDay}}只 @@ -223,7 +232,8 @@ 频率 - + 当前 {{obj.volume / 1000 == 0 ? obj.volume : (obj.volume / 1000).toFixed(1)}}khz @@ -248,7 +258,8 @@ 二氧化碳 - + 当前 {{obj.innerCo2}}ppm @@ -293,14 +304,17 @@ {{item.textDay}} - + {{item.windDirDay}} - + + @@ -387,15 +401,17 @@ daytime: '', covers: [], dtflag: false, - modelTags:[], - - height:false, - io:false, - xnwd:false, - xnsd:false, - sypl:false, - eyht:false, - beep:false + modelTags: [], + + height: false, + io: false, + xnwd: false, + xnsd: false, + sypl: false, + eyht: false, + beep: false, + + timer: null, } }, onLoad(option) { @@ -429,12 +445,65 @@ this.getchartData4() this.getchartData5() this.getchartData6() + // 每次进入执行定时器 + this.startTimer() + }, + onUnload() { + // 页面即将销毁时销毁定时器 + this.clearTimer() }, methods: { + // 跳转天气 + btntqxq(){ + + }, // 每30秒上报数据 - - - + startTimer() { + if (this.timer) { + clearInterval(this.timer); // 如果已存在,先清除 + } + this.timer = setInterval(() => { + // 这里写你的定时任务 + this.$u.put(`/app/beehive/iot/${this.beehiveId}/upload`).then(res => { + if (res.code == 200) { + setTimeout(() => { + this.$refs.canvas1.init(this.initChart) + this.$refs.canvas2.init(this.initChart2) + this.$refs.canvas3.init(this.initChart3) + this.$refs.canvas4.init(this.initChart4) + this.$refs.canvas5.init(this.initChart5) + this.$refs.canvas6.init(this.initChart6) + this.$refs.canvas7.init(this.initChart7) + }, 1000) + this.getobj() + let now = new Date(); + let previousDay = new Date(now) + this.yeartime.year = now.getFullYear() + this.yeartime.month = String(previousDay.getMonth() + 1).padStart(2, '0') + this.yeartime.day = String(now.getDate()).padStart(2, '0') + previousDay.setDate(now.getDate() - 7) + this.yeartimes.year = previousDay.getFullYear() + this.yeartimes.month = String(previousDay.getMonth() + 1).padStart(2, '0') + this.yeartimes.day = String(previousDay.getDate()).padStart(2, '0') + this.getchartData1() + this.getchartData2() + this.getchartData3() + this.getchartData4() + this.getchartData5() + this.getchartData6() + } + }) + }, 30000); // 30秒 + }, + clearTimer() { + // 清除定时器 + if (this.timer) { + clearInterval(this.timer); + this.timer = null; // 清除引用,避免内存泄漏 + } + }, + + // 跳转图标详情 btnec(num) { uni.navigateTo({ @@ -443,7 +512,8 @@ }, btnvideo() { uni.navigateTo({ - url: '/page_Beehive/Beehive_log?apiaryId=' + this.obj.apiaryId + ' &name=' + this.obj.apiaryName + url: '/page_Beehive/Beehive_log?apiaryId=' + this.obj.apiaryId + ' &name=' + this.obj + .apiaryName }) }, btngd() { @@ -502,11 +572,11 @@ let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day this.$u.get(`/farmer/report/weightDay?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then( - res => { - if (res.code == 200) { - this.chartData3 = res.data.map(item => item.value) - } - }) + res => { + if (res.code == 200) { + this.chartData3 = res.data.map(item => item.value) + } + }) }, // 进出量图表 getchartData4() { @@ -670,18 +740,18 @@ this.longitude = res.data.lng this.modelTags = res.data.modelTags this.modelTags.forEach(item => { - if(item == 1){ + if (item == 1) { this.height = true - }else if(item == 2){ + } else if (item == 2) { this.io = true - }else if(item == 3){ + } else if (item == 3) { this.xnwd = true this.xnsd = true - }else if(item == 10){ + } else if (item == 10) { this.sypl = true - }else if(item == 9){ + } else if (item == 9) { this.eyht = true - }else if(item == 13){ + } else if (item == 13) { this.beep = true } }) @@ -696,8 +766,9 @@ this.jrkg = '开' } if (res.data.lat == 0 && res.data.lng == 0) { - console.log('未找到位置信息'); - this.zoomSize = 5 + this.latitude = 39.56 + this.longitude = 116.20 + this.zoomSize = 1 this.dtflag = true } else { this.dtflag = false @@ -1557,7 +1628,7 @@ .page { // position: relative; - + padding: 38rpx; padding-bottom: 200rpx; width: 750rpx; @@ -1605,7 +1676,7 @@ text-align: center; width: 72rpx; font-weight: 600; - font-size: 36rpx; + font-size: 24rpx; color: #50565A; } @@ -1993,7 +2064,8 @@ opacity: .5; z-index: 99; color: #fff; - text-align: center; + // text-align: center; + padding-left: 10rpx; font-size: 36rpx; padding-top: 288rpx; box-sizing: border-box; diff --git a/page_Beehive/add_Beehive.vue b/page_Beehive/add_Beehive.vue index ad31c55..0b80856 100644 --- a/page_Beehive/add_Beehive.vue +++ b/page_Beehive/add_Beehive.vue @@ -10,7 +10,7 @@ - + { - this.sn = res.result + let url = res.result + let sIndex = url.indexOf('s=') + if (sIndex !== -1) { + this.sn = url.substring(sIndex + 2); + } else { + this.sn = res.result + } }, fail: err => { - console.error('扫描失败:', err) uni.showToast({ title: '扫描失败', icon: 'none' diff --git a/page_user/user_set.vue b/page_user/user_set.vue index 74cba22..6c2b773 100644 --- a/page_user/user_set.vue +++ b/page_user/user_set.vue @@ -8,19 +8,21 @@ 除螨设置 - + 间隔时长 每隔 天/次    除螨工作 + placeholder-class="my-placeholder" /> 天/次    除螨工作 - + 保护设置 - + 电量保护(%) @@ -164,25 +166,32 @@ }, methods: { - btncz(){ - this.miteInterval = 15 - this.minPower = 20 - this.minHeat = 0 - this.maxHeat = 5 - this.maxFan = 35 - this.minFan = 20 - this.minCo2 = 400 - this.maxCo2 = 440 - this.list.forEach(item => { - if (item.checked) { - item.checked = false; - } - }) - this.lists.forEach(item => { - if (item.checked) { - item.checked = false; - } + btncz() { + this.$u.get(`/farm/userSetting/default`).then(res => { + if (res.code == 200) { + this.miteInterval = res.data.miteInterval + this.minPower = res.data.minPower + this.minHeat = res.data.minHeat + this.maxHeat = res.data.maxHeat + this.maxFan = res.data.maxFan + this.minFan = res.data.minFan + this.minCo2 = res.data.minCo2 + this.maxCo2 = res.data.maxCo2 + this.value = [] + this.values = [] + this.list.forEach(item => { + if (item.checked) { + item.checked = false; + } + }) + this.lists.forEach(item => { + if (item.checked) { + item.checked = false; + } + }) + } }) + }, checkboxChange(e) { let index = this.value.indexOf(e) @@ -235,7 +244,7 @@ minHeat: this.minHeat, maxHeat: this.maxHeat, maxFan: this.maxFan, - minFan:this.minFan, + minFan: this.minFan, minCo2: this.minCo2, maxCo2: this.maxCo2, singleNotice: this.value, @@ -248,9 +257,9 @@ icon: 'success', duration: 1000 }) - }else if(res.code == 401){ + } else if (res.code == 401) { uni.navigateTo({ - url:'/pages/login/login' + url: '/pages/login/login' }) } else { uni.showToast({ @@ -267,9 +276,10 @@