This commit is contained in:
weinan2087
2022-10-13 14:31:36 +08:00

View File

@@ -3,8 +3,11 @@
:close-on-click-modal="false"
:visible.sync="interestCollection"
:append-to-body="true"
width="967px" @close="closeDialog">
<div style="margin-top:65px">
min-width="770px"
max-width="950px"
>
<div style="margin-top:10px">
<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">
@@ -13,7 +16,7 @@
</div>
</div>
<div slot="footer" class="dialog-footer">
<div><el-button v-disabled="500" type="primary" class="btn-one" :disabled="btn_insterest_status==1" @click="saveInterest()">生成我的兴趣偏好</el-button></div>
<div><el-button type="primary" class="btn-one" @click="saveInterest()">生成我的兴趣偏好</el-button></div>
<div><el-button @click="notYet()" class="btn-tow" type="text">暂不选择</el-button></div>
</div>
</el-dialog>
@@ -31,31 +34,26 @@
data(){
return {
checkboxGroup:[],
interestCollection:false, // 兴趣采集弹窗默认不显示
sysTypeListMap:[],
btn_insterest_status:0,
dialog_session_show:0
interestCollection:false,// 兴趣采集
sysTypeListMap:[]
}
},
created() {
// this.userAvatar=require("@/assets/images/user/default.png");
apiUserhobby.has().then(res=>{
if(res.status != 200) {return;}
// 1. 判断用户是否选择过兴趣偏好
if(res.data == false){
this.interestCollection = true;
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;
}
}
}
// 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() {
@@ -71,13 +69,7 @@
...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('至少选择三个兴趣偏好!')
@@ -116,6 +108,9 @@
</script>
<style scoped lang="scss">
::v-deep .el-button+.el-button, .el-checkbox.is-bordered+.el-checkbox.is-bordered{
margin-left: 0 !important;
}
::v-deep .el-dialog{
background: #fff url('/images/homeWu/interest.png') no-repeat;
border-radius: 8px;
@@ -141,9 +136,9 @@
color: #333333;
}
.interest{
margin-left: 50px;
margin-left: 40px;
.interest-title{
margin-bottom: 18px;
margin-bottom: 15px;
margin-top: 10px;
}
::v-deep .el-checkbox__input{