任务缓存优化
This commit is contained in:
parent
6710481852
commit
d1bca91769
|
|
@ -47,7 +47,7 @@
|
|||
src="../../static/images/signIn_icon1.png" mode="" />
|
||||
<view class="radius"></view>
|
||||
<view class="_label">{{item.showText}}</view>
|
||||
<view class="_label" style="font-size: 18rpx;color: #999;margin-top: 2rpx;">{{item.signDay.slice(5,10)}}</view>
|
||||
<view class="_label" style="font-size: 18rpx;color: #999;margin-top: 2rpx;">{{item.signDay.slice(6,10)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -98,6 +98,10 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {$cache_renwu} from '@/store/cashe.js'
|
||||
import {isEmpty} from '@/utils/util.js'
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
|
|
@ -114,7 +118,6 @@
|
|||
recordList: [
|
||||
],
|
||||
signInBtn: '点击签到',
|
||||
isShowMoneyPay: true,
|
||||
isIos: false,
|
||||
isAndroid: false,
|
||||
adRewardedVideo: true,
|
||||
|
|
@ -128,18 +131,6 @@
|
|||
this.signInList = []
|
||||
this.getTaskdata()
|
||||
this.getsignIn()
|
||||
this.$Request.getT("app/common/type/919", {}).then(res => {
|
||||
if (res.code == 0) {
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
let isIos = sysInfo.platform == 'ios'
|
||||
this.isIos = /iOS/.test(sysInfo.platform);
|
||||
// 判断是否是安卓设备
|
||||
|
||||
|
||||
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
|
||||
}
|
||||
});
|
||||
|
||||
this.$nextTick(()=>{
|
||||
this.adRewardedVideoloadNum = 0
|
||||
this.$refs.adRewardedVideo.load();
|
||||
|
|
@ -214,6 +205,12 @@
|
|||
* 获取签到数据
|
||||
*/
|
||||
getsignIn() {
|
||||
if($cache_renwu.signInList&&!isEmpty($cache_renwu.signDays)&&!isEmpty($cache_renwu.enable) ){
|
||||
this.signInList =$cache_renwu.signInList
|
||||
this.signDays =$cache_renwu.signDays
|
||||
this.enable =$cache_renwu.enable
|
||||
return
|
||||
}
|
||||
this.$Request.getT('app/userSignRecord/getUserSignData', {}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.signInList = res.data.recordList
|
||||
|
|
@ -228,6 +225,9 @@
|
|||
this.signInBtn = '已签到'
|
||||
}
|
||||
})
|
||||
$cache_renwu.set('signInList',this.signInList)
|
||||
$cache_renwu.set('signDays',this.signDays)
|
||||
$cache_renwu.set('enable',this.enable)
|
||||
} else {
|
||||
// uni.showToast({
|
||||
// title: res.msg,
|
||||
|
|
@ -318,6 +318,7 @@
|
|||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
$cache_renwu.clear()
|
||||
this.getTaskdata()
|
||||
this.getsignIn()
|
||||
}, 1000)
|
||||
|
|
@ -333,6 +334,12 @@
|
|||
* 获取任务列表
|
||||
*/
|
||||
getTaskdata() {
|
||||
if($cache_renwu.list){
|
||||
this.list= $cache_renwu.list
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
console.log('获取服务器 任务列表')
|
||||
this.list= [];
|
||||
this.$Request.getT('app/taskCenter/selectTaskCenter', {}).then(res => {
|
||||
if (res.code == 0) {
|
||||
|
|
@ -350,8 +357,7 @@
|
|||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
|
||||
$cache_renwu.set('list',this.list)
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
|
|
@ -362,6 +368,8 @@
|
|||
*/
|
||||
onPullDownRefresh: function() {
|
||||
console.log(2)
|
||||
$cache_renwu.clear()
|
||||
this.getsignIn()
|
||||
this.getTaskdata();
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue