Commit 1d2085c9 by 陈玉桐

首页刷新机制

parent 785b3df4
...@@ -99,7 +99,8 @@ ...@@ -99,7 +99,8 @@
<view id="commonList"> <view id="commonList">
<view class="commonItem" wx:for="{{appList}}" wx:key> <view class="commonItem" wx:for="{{appList}}" wx:key>
<image wx:if="{{item.icon}}" src="{{item.icon}}" /> <image wx:if="{{item.icon}}" src="{{item.icon}}" />
<view wx:else class="commonItemNo"></view> <!-- <view wx:else class="commonItemNo"></view> -->
<image wx:else src="../../assets/appNull.png" />
<text>{{item.title}}</text> <text>{{item.title}}</text>
</view> </view>
<view wx:if="{{appList.length<5}}" class="commonItemNo">空</view> <view wx:if="{{appList.length<5}}" class="commonItemNo">空</view>
......
...@@ -424,8 +424,16 @@ Page({ ...@@ -424,8 +424,16 @@ Page({
guideId: 1,//引导顺序 guideId: 1,//引导顺序
isLoading: false, isLoading: false,
isImgOk: '',//图片是否加载成功
}, },
onReady() { onLoad() {
wx.removeStorage({
key: 'isImgOk'
})
this.setData({
isImgOk: false
})
}, },
swiperChange: function(e) { swiperChange: function(e) {
this.setData({ this.setData({
...@@ -438,6 +446,19 @@ Page({ ...@@ -438,6 +446,19 @@ Page({
}, },
onShow() { onShow() {
let me = this; let me = this;
// 获取状态
wx.getStorage({
key: 'isImgOk',
success(res){
me.setData({
isImgOk: res.data
})
console.log(me.data.isImgOk)
}
})
console.log(me.data.isImgOk)
if(me.data.indexTimer){ if(me.data.indexTimer){
clearInterval(me.data.indexTimer) clearInterval(me.data.indexTimer)
} }
...@@ -512,8 +533,8 @@ Page({ ...@@ -512,8 +533,8 @@ Page({
}) })
} }
console.log(res.data.data.bindDeviceStatus) console.log(res.data.data.bindDeviceStatus)
// 未绑定设备不刷新图片 // 绑定设备刷新图片 且 没加载出图片
if(res.data.data.bindDeviceStatus==1){ if(res.data.data.bindDeviceStatus==1 && !me.data.isImgOk){
//获取当前时间戳 //获取当前时间戳
var timestamp = Date.parse(new Date()); var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000; timestamp = timestamp / 1000;
...@@ -584,19 +605,24 @@ Page({ ...@@ -584,19 +605,24 @@ Page({
trainingTime: res.data.data.nowTrainingDuration trainingTime: res.data.data.nowTrainingDuration
}) })
clearInterval(indexTimer) clearInterval(indexTimer)
// 设置加载状态
wx.setStorage({
key: "isImgOk",
data: true
})
} }
}else{ }else{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线 // 设备未在线
me.setData({ me.setData({
trainingStatus: 3,//训练状态 1正在训练 0:未训练 trainingStatus: 3,//训练状态 1正在训练 0:未训练
checkImg: '../../assets/indexDefault.png' checkImg: '../../assets/indexDefault.png'
}) })
clearInterval(indexTimer) clearInterval(indexTimer)
// 设置加载状态
wx.setStorage({
key: "isImgOk",
data: true
})
} }
} }
}) })
...@@ -606,11 +632,6 @@ Page({ ...@@ -606,11 +632,6 @@ Page({
}) })
} }
}else{ }else{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线 // 设备未在线
me.setData({ me.setData({
trainingStatus: 3,//训练状态 1正在训练 0:未训练 trainingStatus: 3,//训练状态 1正在训练 0:未训练
......
...@@ -141,7 +141,7 @@ Page({ ...@@ -141,7 +141,7 @@ Page({
trainList: res.data.data.list trainList: res.data.data.list
}) })
for(let i=0;i<me.data.trainList.length;i++){ for(let i=0;i<me.data.trainList.length;i++){
console.log(me.data.trainList[i].historyId) // console.log(me.data.trainList[i].historyId)
me.selectComponent('#mychart-'+i).init((canvas, width, height) => { me.selectComponent('#mychart-'+i).init((canvas, width, height) => {
const chart = echarts.init(canvas, null, { const chart = echarts.init(canvas, null, {
width: width, width: width,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment