完善用户兴趣采集弹出逻辑。

This commit is contained in:
weinan2087
2022-10-18 12:34:53 +08:00
parent 8a8ab315ef
commit 356be29e53

View File

@@ -34,7 +34,7 @@
data(){
return {
checkboxGroup:[],
interestCollection:false,// 兴趣采集
interestCollection:false,// 兴趣采集 false - 不显示弹框; true - 显示弹框
sysTypeListMap:[],
btn_insterest_status:0,
dialog_session_show:0
@@ -50,16 +50,17 @@
}
if(res.result == true){this.interestCollection = false;return;}
// 2. 判断用户是否点击过"暂不选择"按钮,如果用户点击过"暂不选择"按钮则判断点击"暂不选择"按钮天数是否大于15天如果大于则弹出兴趣偏好框否则不弹
let time = localStorage.getItem('notYet');
if(time == '') {
this.interestCollection = true;
} else {
let time = localStorage.getItem('notYet'+this.userInfo.aid);
if(!time == '' || time != null) {
let day = (new Date() - new Date(time))/(1000*60*60*24);
if(day > 15){this.interestCollection = true;}
if(day > 15){
this.interestCollection = true;
return;
}
}
// 3. 判断用户是否点击"关闭"按钮,如果点击"关闭"按钮则在当前session不在弹窗
let dialog_session_show = localStorage.getItem('dialog_session_show');
if(dialog_session_show == 1){this.interestCollection = false;}
let current_session = sessionStorage.getItem('dialog_session_show'+this.userInfo.aid);
if(current_session == 1){this.interestCollection = false;}
})
},
mounted() {
@@ -70,14 +71,16 @@
methods:{
notYet() {
this.interestCollection = false;
localStorage.setItem('notYet',new Date());
localStorage.setItem('notYet'+this.userInfo.aid,new Date());
},
...mapActions({
getSysTypeTree: 'sysType/getSysTypeTree',
}),
// 关闭兴趣偏好弹窗
closeDialog() {
localStorage.setItem('dialog_session_show',1);
},
sessionStorage.setItem('dialog_session_show'+this.userInfo.aid,1);
},
saveInterest() {
let data = []
if(this.checkboxGroup.length < 3) {
@@ -110,7 +113,7 @@
},
computed:{
...mapGetters(['userInfo','studyTaskCount']),
},
}