Commit 1d2085c9 by 陈玉桐

首页刷新机制

parent 785b3df4
......@@ -99,7 +99,8 @@
<view id="commonList">
<view class="commonItem" wx:for="{{appList}}" wx:key>
<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>
</view>
<view wx:if="{{appList.length<5}}" class="commonItemNo">空</view>
......
......@@ -424,8 +424,16 @@ Page({
guideId: 1,//引导顺序
isLoading: false,
isImgOk: '',//图片是否加载成功
},
onReady() {
onLoad() {
wx.removeStorage({
key: 'isImgOk'
})
this.setData({
isImgOk: false
})
},
swiperChange: function(e) {
this.setData({
......@@ -438,6 +446,19 @@ Page({
},
onShow() {
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){
clearInterval(me.data.indexTimer)
}
......@@ -512,8 +533,8 @@ Page({
})
}
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());
timestamp = timestamp / 1000;
......@@ -584,19 +605,24 @@ Page({
trainingTime: res.data.data.nowTrainingDuration
})
clearInterval(indexTimer)
// 设置加载状态
wx.setStorage({
key: "isImgOk",
data: true
})
}
}else{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线
me.setData({
trainingStatus: 3,//训练状态 1正在训练 0:未训练
checkImg: '../../assets/indexDefault.png'
})
clearInterval(indexTimer)
// 设置加载状态
wx.setStorage({
key: "isImgOk",
data: true
})
}
}
})
......@@ -606,11 +632,6 @@ Page({
})
}
}else{
// wx.showModal({
// title: '提示',
// showCancel: false,
// content: res.data.msg
// })
// 设备未在线
me.setData({
trainingStatus: 3,//训练状态 1正在训练 0:未训练
......
......@@ -141,7 +141,7 @@ Page({
trainList: res.data.data.list
})
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) => {
const chart = echarts.init(canvas, null, {
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