Commit 0f4c85cd by 胡悦

修复学习任务频繁弹窗问题

1 parent 7185ba53
......@@ -330,14 +330,21 @@ export default {
if (res && res.commissions) {
const commissions = res.commissions.find(i => i.configType == 3)
const commissionsOther = res.commissions.filter(i => i.configType == 1)
this.commissionsInfoQG = []
console.log(commissionsOther, 'commissionsInfoQG')
commissionsOther.forEach(i => {
this.commissionsInfoQG = [...this.commissionsInfoQG, ...(i.nscene0PenetrationRateGoodsCommissions || [])]
})
console.log(this.commissionsInfoQG, 'commissionsInfoQG')
this.scene0PenetrationRateCommissions = commissions?.scene0PenetrationRateCommissions || []
this.getCommissionsInfo()
if (commissions || commissionsOther.length > 0) {
this.commissionsInfoQG = []
console.log(commissionsOther, 'commissionsInfoQG')
commissionsOther.forEach(i => {
this.commissionsInfoQG = [...this.commissionsInfoQG, ...(i.nscene0PenetrationRateGoodsCommissions || [])]
})
console.log(this.commissionsInfoQG, 'commissionsInfoQG')
this.scene0PenetrationRateCommissions = commissions?.scene0PenetrationRateCommissions || []
this.getCommissionsInfo()
} else {
this.commissionsInfo = [{}]
this.commissionsInfoQG = []
this.scene0PenetrationRateCommissions = []
}
} else {
this.commissionsInfo = [{}]
this.commissionsInfoQG = []
......
......@@ -153,10 +153,11 @@ export default {
console.log('studyCenter')
this.changeIndex(3, this.tabs[3])
});
this.getMessageInfo()
this.getUnreadCount()
this.getSopCount() // 获取Ai集市未读个数
this.findBeiSenSSOToken() // 获取北森token
this.findBeiSenSSOToken().then(() => {
this.getMessageInfo()
}) // 获取北森token后再获取消息
},
inject: ['showPage'],
methods: {
......@@ -290,6 +291,21 @@ export default {
},
// 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop () {
// 获取今天日期字符串
const today = new Date().toISOString().slice(0, 10)
// 获取当前用户手机号
const userInfo = uni.$storage.get('userInfo') || {}
const phone = userInfo.phone || ''
// 读取缓存
let shownData = uni.$storage.get('messagePopShownDate') || {}
// shownData 结构: { [phone]: date }
// 把手机号也存到一个变量中
const cachePhone = phone
if (shownData[phone] === today) {
// 今天已经弹过窗,直接返回
await this.getMessage()
return
}
const res = await uni.$api.commonApi.getMessagePop({})
console.log(res, 'res111')
if (res.ids && res.ids.length > 0) {
......@@ -300,11 +316,17 @@ export default {
this.messageType = 'study'
this.messageData = res
this.$refs.kfRef.open()
// 记录今日已弹窗
shownData[phone] = today
uni.$storage.set('messagePopShownDate', shownData)
}
} else {
this.messageType = 'system'
this.messageData = res
this.$refs.kfRef.open()
// 记录今日已弹窗
shownData[phone] = today
uni.$storage.set('messagePopShownDate', shownData)
}
} else {
await this.getMessage()
......
......@@ -39,5 +39,6 @@ export const STORAGE_OBJECTKEY = {
appInfoList: 'appInfoList',
leadPage: 'leadPage',
recordTrackList: 'recordTrackList',
beisenToken: 'beisenToken'
beisenToken: 'beisenToken',
messagePopShownDate: 'messagePopShownDate'
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!