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" :close-on-click-modal="false"
:visible.sync="interestCollection" :visible.sync="interestCollection"
:append-to-body="true" :append-to-body="true"
width="967px" @close="closeDialog"> min-width="770px"
<div style="margin-top:65px"> max-width="950px"
>
<div style="margin-top:10px">
<div class="interest" v-for="(sys,index) in sysTypeListMap" :key="sys.id"> <div class="interest" v-for="(sys,index) in sysTypeListMap" :key="sys.id">
<p class="portal-title-tow interest-title">{{sys.name}}</p> <p class="portal-title-tow interest-title">{{sys.name}}</p>
<el-checkbox-group v-model="checkboxGroup" v-if="sys.children.length > 0"> <el-checkbox-group v-model="checkboxGroup" v-if="sys.children.length > 0">
@@ -13,7 +16,7 @@
</div> </div>
</div> </div>
<div slot="footer" class="dialog-footer"> <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-button @click="notYet()" class="btn-tow" type="text">暂不选择</el-button></div>
</div> </div>
</el-dialog> </el-dialog>
@@ -31,31 +34,26 @@
data(){ data(){
return { return {
checkboxGroup:[], checkboxGroup:[],
interestCollection:false, // 兴趣采集弹窗默认不显示 interestCollection:false,// 兴趣采集
sysTypeListMap:[], sysTypeListMap:[]
btn_insterest_status:0,
dialog_session_show:0
} }
}, },
created() { created() {
// this.userAvatar=require("@/assets/images/user/default.png"); // this.userAvatar=require("@/assets/images/user/default.png");
apiUserhobby.has().then(res=>{ apiUserhobby.has().then(res=>{
if(res.status != 200) {return;} if(res.status == 200) {
// 1. 判断用户是否选择过兴趣偏好
if(res.data == false){
this.interestCollection = true;
}
// 2. 判断用户是否点击过"暂不选择"按钮,如果用户点击过"暂不选择"按钮则判断点击"暂不选择"按钮天数是否大于15天如果大于则弹出兴趣偏好框否则不弹
let time = localStorage.getItem('notYet'); let time = localStorage.getItem('notYet');
if(time == '') { if(time == '') {
this.interestCollection = true; this.interestCollection = true;
} else { } else {
let time = localStorage.getItem('notYet');
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;
}
}
} }
// 3. 判断用户是否点击"关闭"按钮,如果点击"关闭"按钮则在当前session不在弹窗
let dialog_session_show = localStorage.getItem('dialog_session_show');
if(dialog_session_show == 1){this.interestCollection = false;}
}) })
}, },
mounted() { mounted() {
@@ -71,13 +69,7 @@
...mapActions({ ...mapActions({
getSysTypeTree: 'sysType/getSysTypeTree', getSysTypeTree: 'sysType/getSysTypeTree',
}), }),
closeDialog() {
localStorage.setItem('dialog_session_show',1);
},
saveInterest() { saveInterest() {
this.btn_insterest_status = 0; // 禁用按钮
let data = [] let data = []
if(this.checkboxGroup.length < 3) { if(this.checkboxGroup.length < 3) {
this.$message.error('至少选择三个兴趣偏好!') this.$message.error('至少选择三个兴趣偏好!')
@@ -116,6 +108,9 @@
</script> </script>
<style scoped lang="scss"> <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{ ::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; border-radius: 8px;
@@ -141,9 +136,9 @@
color: #333333; color: #333333;
} }
.interest{ .interest{
margin-left: 50px; margin-left: 40px;
.interest-title{ .interest-title{
margin-bottom: 18px; margin-bottom: 15px;
margin-top: 10px; margin-top: 10px;
} }
::v-deep .el-checkbox__input{ ::v-deep .el-checkbox__input{