From ee33abc2c84846c5554d24cf7fff70c9af1f1902 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Fri, 17 May 2024 18:11:32 +0800 Subject: [PATCH] aaa --- pages/fengchang/index.vue | 1 - pages/fengxiang/index.vue | 55 +++++++++++-------- pages/index/index.vue | 8 ++- .../pages/fengxiangDetail/index.vue | 32 ++++++++--- .../pages/fengxiangDetailtwo/index.vue | 6 +- 5 files changed, 64 insertions(+), 38 deletions(-) diff --git a/pages/fengchang/index.vue b/pages/fengchang/index.vue index f000d34..0e34216 100644 --- a/pages/fengchang/index.vue +++ b/pages/fengchang/index.vue @@ -275,7 +275,6 @@ this.showloading=false uni.hideLoading() } - }) // console.log(res.data.data) diff --git a/pages/fengxiang/index.vue b/pages/fengxiang/index.vue index 06d8322..3d65d85 100644 --- a/pages/fengxiang/index.vue +++ b/pages/fengxiang/index.vue @@ -411,7 +411,6 @@ // uni.hideLoading() }) setTimeout(() => { - uni.hideLoading() setTimeout(() => { request.get('/api/beehive/detail/' + item.id, {}).then(res => { const newData = res.data.data; @@ -426,7 +425,8 @@ } }) }, 500) - }, 4000) + uni.hideLoading() + }, 6000) } else { uni.showToast({ icon: "none", @@ -581,28 +581,35 @@ mask: true }) request.post('/api/beehive/removePeel/' + item.id, {}).then(res => { - uni.hideLoading() - // that.loadData() - request.get('/api/beehive/detail/' + item.id, {}).then(res => { - const newData = res.data.data; // 提取新数据 - // 查找具有相同id的项 - const existingItem = this.listData.find(item => item.id === - newData.id); - if (existingItem) { - // 如果找到,替换原数据 - const index = this.listData.indexOf(existingItem); - this.listData.splice(index, 1, - newData); // 删除旧数据并插入新数据 - } else { - // 如果没有找到,添加到数组中 - this.listData.push(newData); - } - console.log(this.listData, 101010); - }) - uni.showToast({ - icon: "none", - title: res.data.msg - }) + request.get('/api/beehive/detail/' + item.id, {}).then(res => { + const newData = res.data.data; + const existingItem = that.listData.find(item => item.id === newData.id); + if (existingItem) { + // 如果找到,替换原数据 + const index = that.listData.indexOf(existingItem); + that.listData.splice(index, 1, newData); + } else { + that.listData.push(newData); + } + // uni.hideLoading() + }) + setTimeout(() => { + setTimeout(() => { + request.get('/api/beehive/detail/' + item.id, {}).then(res => { + const newData = res.data.data; + const existingItem = that.listData.find(item => item.id === newData + .id); + if (existingItem) { + // 如果找到,替换原数据 + const index = that.listData.indexOf(existingItem); + that.listData.splice(index, 1, newData); + } else { + that.listData.push(newData); + } + }) + }, 500) + uni.hideLoading() + }, 6000) }) } else if (res.cancel) {} diff --git a/pages/index/index.vue b/pages/index/index.vue index f5decad..36dc6da 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -156,7 +156,8 @@ </view> <view class="charts-box" > <qiun-data-charts v-if="logoflag" type="column" :opts="optsZhu" :chartData="chartDataZhu" :errorShow="false" :errorReload="false" :animation="false" :tooltipShow="false" :tapLegend="false" /> - <view class="" v-else style="color: #ccc;font-size: 36rpx;width: 100%;text-align: center;margin-top: 50rpx;">暂无蜂箱...</view> + <view class="" v-else style="color: #ccc;font-size: 36rpx;width: 100%;text-align: center;margin-top: 50rpx;">暂无蜂箱... + <view @click="djdl" style="width: 200rpx;height: 80rpx;text-align: center;line-height: 80rpx;background-color: #3CA272;margin: auto;margin-top: 30rpx;border-radius: 30rpx;color: #fff;padding: 0rpx 20rpx;box-sizing: border-box;">点击登录</view> </view> </view> </view> <!-- 折线 --> @@ -468,6 +469,11 @@ clearInterval(this.intervalId); }, methods: { + djdl(){ + uni.navigateTo({ + url:'/pages/login/index' + }) + }, topage(num) { if (this.tokenflag == true) { if (num == 1) { diff --git a/pagesFengXiang/pages/fengxiangDetail/index.vue b/pagesFengXiang/pages/fengxiangDetail/index.vue index 72542ac..8ce2f56 100644 --- a/pagesFengXiang/pages/fengxiangDetail/index.vue +++ b/pagesFengXiang/pages/fengxiangDetail/index.vue @@ -790,6 +790,7 @@ // 接收参数 onLoad(option) { console.log(option); + this.getuserid() if (option.scene) { let sceneValue = option.scene let decodedValue = decodeURIComponent(sceneValue); @@ -805,7 +806,7 @@ } else { this.id = option.id if (!wx.getStorageSync('userToken')) { - uni.navigateTo({ + uni.reLaunch({ url: '/pagesFengXiang/pages/fengxiangDetailtwo/index?id=' + this.id }) } else { @@ -816,9 +817,22 @@ } }, onShow() { - + }, methods: { + getuserid(){ + let page = 1 + let qrcode = '' + request.get('/api/apiary/index', {page,qrcode}).then(res => { + this.user_id = res.data.data[0].user_id + console.log(wx.getStorageSync('user_id'),this.user_id); + if (wx.getStorageSync('user_id') != this.user_id) { + uni.reLaunch({ + url: '/pagesFengXiang/pages/fengxiangDetailtwo/index?id=' + this.id + }) + } + }) + }, fenlampbut() { if (this.switchk) { this.switchk = false @@ -869,13 +883,13 @@ listDataFn() { request.get('/api/beehive/detail/' + this.id, {}).then(res => { this.idss = res.data.data.id - this.user_id = res.data.data.user_id - console.log(wx.getStorageSync('user_id'),this.user_id); - if (wx.getStorageSync('user_id') != this.user_id) { - uni.navigateTo({ - url: '/pagesFengXiang/pages/fengxiangDetailtwo/index?id=' + this.id - }) - } + // this.user_id = res.data.data.user_id + // console.log(wx.getStorageSync('user_id'),this.user_id); + // if (wx.getStorageSync('user_id') != this.user_id) { + // uni.reLaunch({ + // url: '/pagesFengXiang/pages/fengxiangDetailtwo/index?id=' + this.id + // }) + // } this.getServerDatas() console.log(res); this.listdata = { diff --git a/pagesFengXiang/pages/fengxiangDetailtwo/index.vue b/pagesFengXiang/pages/fengxiangDetailtwo/index.vue index 783d2e6..ca8461e 100644 --- a/pagesFengXiang/pages/fengxiangDetailtwo/index.vue +++ b/pagesFengXiang/pages/fengxiangDetailtwo/index.vue @@ -221,10 +221,10 @@ markers: [{ latitude: null, longitude: null, - width: 25, - height: 25, + width: 15, + height: 15, id: 0, - iconPath: '../../../static/dwicon.png', + iconPath: '../../../static/a11.png', }], }, // 折线图1