提交 bbee561d 编写于 作者: R Renic1

新增缓存

上级 54b3d950
......@@ -14,6 +14,9 @@
name:'',
type:'',
icon:'',
teamNameStorageCount:1,
runningRecordStorageCount:1,
walkingRecordStorageCount:1,
}
}
</script>
......
......@@ -59,6 +59,7 @@
schoolName: '',
teamName: '新野生动物营',
userId: '',
teamNameStorageCount:1,
}
},
methods: {
......@@ -108,7 +109,17 @@
.then(res => {
console.log(res);
this.teamName = res.result.data.team;
let that =this;
uni.setStorage({
key: 'teamName_key',
data: this.teamName,
success: function () {
console.log(that.teamName);
}
})
getApp().globalData.teamNameStorageCount=0;
});
console.log(this.teamName)
},
},
onLoad() {
......@@ -119,7 +130,18 @@
this.nickname = getApp().globalData.name;
this.schoolName = getApp().globalData.school;
this.userId = getApp().globalData.userId;
this.getData();
if(getApp().globalData.teamNameStorageCount==1) {//增删改查
this.getData();
}else {
uni.getStorage({
key: 'teamName_key',
success: function (res) {
console.log(res.data);
this.teamName=res.data;
console.log(this.teamName);
}
})
}
}
}
</script>
......
......@@ -68,7 +68,15 @@
item.duration = this.formatSeconds(item.duration);
item.startDatetime = this.formatDate(item.startDatetime);
});
let that =this;
uni.setStorage({
key: 'runningRecord_key',
data: this.runningrecordList,
success: function () {
console.log(that.runningrecordList);
}
})
getApp().globalData.runningRecordStorageCount=0;
});
},
formatSeconds(value) {
......@@ -112,7 +120,22 @@
return arr[0];
},
onLoad() {
this.getData();
if(getApp().globalData.runningRecordStorageCount==1) {
this.getData();
}else {
uni.getStorage({
key: 'runningRecord_key',
success: (res)=> {
console.log(res.data);
this.runningrecordList=res.data;
console.log(this.runningrecordList);
this.runningrecordList.forEach((item, index) => {
item.duration = this.formatSeconds(item.duration);
item.startDatetime = this.formatDate(item.startDatetime);
});
}
})
}
}
}
}
......
......@@ -69,6 +69,15 @@
item.duration = this.formatSeconds(item.duration);
item.startDatetime = this.formatDate(item.startDatetime);
});
let that =this;
uni.setStorage({
key: 'walkingRecord_key',
data: this.walkingrecordList,
success: function () {
console.log(that.walkingrecordList);
}
})
getApp().globalData.walkingRecordStorageCount=0;
});
},
formatDate(value) {
......@@ -112,7 +121,23 @@
return result;
},
onLoad() {
this.getData();
if(getApp().globalData.walkingRecordStorageCount==1) {
this.getData();
}else {
uni.getStorage({
key: 'walkingRecord_key',
success: (res)=> {
console.log(res.data);
this.walkingrecordList=res.data;
console.log(this.walkingrecordList);
this.walkingrecordList.forEach((item, index) => {
item.duration = this.formatSeconds(item.duration);
item.startDatetime = this.formatDate(item.startDatetime);
});
}
})
}
}
}
}
......
......@@ -197,6 +197,7 @@
uni.showToast({
title: '退出成功'
});
getApp().globalData.teamNameStorageCount=1;
} else {
uni.showToast({
title: '退出失败',
......@@ -220,6 +221,7 @@
.then(res => {
this.code = res.result.code
console.log(this.userId)
getApp().globalData.teamNameStorageCount=1;
})
this.$refs['popupDialog2'].close();
await this.showTorM();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册