修改兴趣偏好弹出框逻辑。

This commit is contained in:
weinan2087
2022-10-12 19:36:08 +08:00
parent 551a196ab5
commit 6e1b54ba0e

View File

@@ -2,18 +2,18 @@
<el-dialog
:close-on-click-modal="false"
:visible.sync="interestCollection"
:append-to-body="true"
width="967px">
:append-to-body="true"
width="967px" @close="closeDialog">
<div style="margin-top:65px">
<div class="interest" v-for="(sys,index) in sysTypeListMap" :key="sys.id">
<p class="portal-title-tow interest-title">{{sys.name}}</p>
<el-checkbox-group v-model="checkboxGroup" v-if="sys.children.length > 0">
<el-checkbox size="medium" border v-for="ch in sys.children" :label="ch.id" :key="ch.id">{{ch.name}}</el-checkbox>
</el-checkbox-group>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<div><el-button type="primary" class="btn-one" @click="saveInterest()">生成我的兴趣偏好</el-button></div>
<div><el-button v-disabled="500" type="primary" class="btn-one" :disabled="btn_insterest_status==1" @click="saveInterest()">生成我的兴趣偏好</el-button></div>
<div><el-button @click="notYet()" class="btn-tow" type="text">暂不选择</el-button></div>
</div>
</el-dialog>
@@ -31,26 +31,31 @@
data(){
return {
checkboxGroup:[],
interestCollection:false,// 兴趣采集
sysTypeListMap:[]
interestCollection:false, // 兴趣采集弹窗默认不显示
sysTypeListMap:[],
btn_insterest_status:0,
dialog_session_show:0
}
},
created() {
// this.userAvatar=require("@/assets/images/user/default.png");
apiUserhobby.has().then(res=>{
if(res.status == 200) {
let time = localStorage.getItem('notYet');
if(time == '') {
this.interestCollection = true;
} else {
let time = localStorage.getItem('notYet');
let day = (new Date() - new Date(time))/(1000*60*60*24);
if(day > 15){
this.interestCollection = true;
}
}
if(res.status != 200) {return;}
// 1. 判断用户是否选择过兴趣偏好
if(res.data == false){
this.interestCollection = true;
}
// 2. 判断用户是否点击过"暂不选择"按钮,如果用户点击过"暂不选择"按钮则判断点击"暂不选择"按钮天数是否大于15天如果大于则弹出兴趣偏好框否则不弹
let time = localStorage.getItem('notYet');
if(time == '') {
this.interestCollection = true;
} else {
let day = (new Date() - new Date(time))/(1000*60*60*24);
if(day > 15){this.interestCollection = true;}
}
// 3. 判断用户是否点击"关闭"按钮,如果点击"关闭"按钮则在当前session不在弹窗
let dialog_session_show = localStorage.getItem('dialog_session_show');
if(dialog_session_show == 1){this.interestCollection = false;}
})
},
mounted() {
@@ -66,7 +71,13 @@
...mapActions({
getSysTypeTree: 'sysType/getSysTypeTree',
}),
closeDialog() {
localStorage.setItem('dialog_session_show',1);
},
saveInterest() {
this.btn_insterest_status = 0; // 禁用按钮
let data = []
if(this.checkboxGroup.length < 3) {
this.$message.error('至少选择三个兴趣偏好!')
@@ -95,10 +106,10 @@
}
},
watch:{
},
computed:{
},
}
@@ -106,7 +117,7 @@
<style scoped lang="scss">
::v-deep .el-dialog{
background: #fff url('/images/homeWu/interest.png') no-repeat;
background: #fff url('/images/homeWu/interest.png') no-repeat;
border-radius: 8px;
// height: 840px;
}
@@ -118,7 +129,7 @@
margin-bottom: 20px;
margin-left: 0px;
margin-right: 23px;
}
}
.el-checkbox.is-bordered.is-checked{
border-color: #4677F4;
}