Commit 0f4c85cd by 胡悦

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

1 parent 7185ba53
...@@ -330,14 +330,21 @@ export default { ...@@ -330,14 +330,21 @@ export default {
if (res && res.commissions) { if (res && res.commissions) {
const commissions = res.commissions.find(i => i.configType == 3) const commissions = res.commissions.find(i => i.configType == 3)
const commissionsOther = res.commissions.filter(i => i.configType == 1) const commissionsOther = res.commissions.filter(i => i.configType == 1)
this.commissionsInfoQG = []
console.log(commissionsOther, 'commissionsInfoQG') if (commissions || commissionsOther.length > 0) {
commissionsOther.forEach(i => { this.commissionsInfoQG = []
this.commissionsInfoQG = [...this.commissionsInfoQG, ...(i.nscene0PenetrationRateGoodsCommissions || [])] console.log(commissionsOther, 'commissionsInfoQG')
}) commissionsOther.forEach(i => {
console.log(this.commissionsInfoQG, 'commissionsInfoQG') this.commissionsInfoQG = [...this.commissionsInfoQG, ...(i.nscene0PenetrationRateGoodsCommissions || [])]
this.scene0PenetrationRateCommissions = commissions?.scene0PenetrationRateCommissions || [] })
this.getCommissionsInfo() console.log(this.commissionsInfoQG, 'commissionsInfoQG')
this.scene0PenetrationRateCommissions = commissions?.scene0PenetrationRateCommissions || []
this.getCommissionsInfo()
} else {
this.commissionsInfo = [{}]
this.commissionsInfoQG = []
this.scene0PenetrationRateCommissions = []
}
} else { } else {
this.commissionsInfo = [{}] this.commissionsInfo = [{}]
this.commissionsInfoQG = [] this.commissionsInfoQG = []
......
...@@ -153,10 +153,11 @@ export default { ...@@ -153,10 +153,11 @@ export default {
console.log('studyCenter') console.log('studyCenter')
this.changeIndex(3, this.tabs[3]) this.changeIndex(3, this.tabs[3])
}); });
this.getMessageInfo()
this.getUnreadCount() this.getUnreadCount()
this.getSopCount() // 获取Ai集市未读个数 this.getSopCount() // 获取Ai集市未读个数
this.findBeiSenSSOToken() // 获取北森token this.findBeiSenSSOToken().then(() => {
this.getMessageInfo()
}) // 获取北森token后再获取消息
}, },
inject: ['showPage'], inject: ['showPage'],
methods: { methods: {
...@@ -290,6 +291,21 @@ export default { ...@@ -290,6 +291,21 @@ export default {
}, },
// 学习中心消息弹窗,优先级高于有修改话术弹窗 // 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop () { 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({}) const res = await uni.$api.commonApi.getMessagePop({})
console.log(res, 'res111') console.log(res, 'res111')
if (res.ids && res.ids.length > 0) { if (res.ids && res.ids.length > 0) {
...@@ -300,11 +316,17 @@ export default { ...@@ -300,11 +316,17 @@ export default {
this.messageType = 'study' this.messageType = 'study'
this.messageData = res this.messageData = res
this.$refs.kfRef.open() this.$refs.kfRef.open()
// 记录今日已弹窗
shownData[phone] = today
uni.$storage.set('messagePopShownDate', shownData)
} }
} else { } else {
this.messageType = 'system' this.messageType = 'system'
this.messageData = res this.messageData = res
this.$refs.kfRef.open() this.$refs.kfRef.open()
// 记录今日已弹窗
shownData[phone] = today
uni.$storage.set('messagePopShownDate', shownData)
} }
} else { } else {
await this.getMessage() await this.getMessage()
......
...@@ -39,5 +39,6 @@ export const STORAGE_OBJECTKEY = { ...@@ -39,5 +39,6 @@ export const STORAGE_OBJECTKEY = {
appInfoList: 'appInfoList', appInfoList: 'appInfoList',
leadPage: 'leadPage', leadPage: 'leadPage',
recordTrackList: 'recordTrackList', 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!