增加数据缓存,去除部分请求的重复/

This commit is contained in:
2024-12-30 16:31:01 +08:00
parent cbcd1c857c
commit 6fb98974d6
15 changed files with 697 additions and 320 deletions

View File

@@ -262,8 +262,8 @@
import ttMsg from '../../components/ttMsg/ttMsg.vue'
import httpsRequest from '../../common/httpRequest.js'
import otherXuanfu from '@/components/other-xuafu.vue'
import {$cache_user} from '@/store/cashe.js'
console.log($cache_user);
export default {
components: {
ttMsg,
@@ -289,8 +289,8 @@
invitationCode: '',
token: '',
endTime: '', //会员到期时间
moneyNum: 0, //余额
jifen: 0, //积分
moneyNum:$cache_user.moneyNum|| 0, //余额
jifen:$cache_user.jifen|| 0, //积分
isVips: '否', //是否显示会员
myLoveNum: 0, //我的喜欢个数
myZhui: 0, //我的追剧数量
@@ -300,13 +300,18 @@
twoRate: 0,
kmPaySel: '否',
isWxIosPay: true, //微信下是否显示支付功能
userInfo: {},
userInfo:$cache_user.userInfo|| {},
isShowMoneyPay: true,
}
},
onLoad() {
this.getBannerList()
},
onPullDownRefresh() {
$cache_user.clear()
this.getMyMoney()
this.getPoints()
},
onShow() {
const systemInfo = uni.getSystemInfoSync();
@@ -333,6 +338,11 @@
this.invitationCode = res.data.invitationCode
this.rate = res.data.rate || 0
this.twoRate = res.data.twoRate || 0
$cache_user.set('userName',this.userName)
$cache_user.set('avatar',this.avatar)
$cache_user.set('invitationCode',this.invitationCode)
$cache_user.set('rate',this.rate)
$cache_user.set('twoRate',this.twoRate)
}
})
@@ -473,6 +483,7 @@
} else {
this.jifen = 0
}
$cache_user.set('jifen',this.jifen)
})
},
/**
@@ -495,6 +506,8 @@
if (res.code === 0) {
this.moneyNum = res.data.money
this.userInfo = res.data
$cache_user.set('userInfo',res.data)
$cache_user.set('moneyNum',res.data.money)
// this.$Request.getT('/app/invite/selectInviteMoney').then(ret => {
// if (ret.code == 0) {
// if (ret.data.inviteMoney && ret.data.inviteMoney.money) {