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

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