mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 20:06:44 +08:00
修改兴趣偏好弹出框逻辑。
This commit is contained in:
@@ -2,18 +2,18 @@
|
|||||||
<el-dialog
|
<el-dialog
|
||||||
: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">
|
width="967px" @close="closeDialog">
|
||||||
<div style="margin-top:65px">
|
<div style="margin-top:65px">
|
||||||
<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">
|
||||||
<el-checkbox size="medium" border v-for="ch in sys.children" :label="ch.id" :key="ch.id">{{ch.name}}</el-checkbox>
|
<el-checkbox size="medium" border v-for="ch in sys.children" :label="ch.id" :key="ch.id">{{ch.name}}</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<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-button @click="notYet()" class="btn-tow" type="text">暂不选择</el-button></div>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -31,26 +31,31 @@
|
|||||||
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) {
|
if(res.status != 200) {return;}
|
||||||
let time = localStorage.getItem('notYet');
|
// 1. 判断用户是否选择过兴趣偏好
|
||||||
if(time == '') {
|
if(res.data == false){
|
||||||
this.interestCollection = true;
|
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() {
|
mounted() {
|
||||||
@@ -66,7 +71,13 @@
|
|||||||
...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('至少选择三个兴趣偏好!')
|
||||||
@@ -95,10 +106,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
|
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -106,7 +117,7 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
::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;
|
||||||
// height: 840px;
|
// height: 840px;
|
||||||
}
|
}
|
||||||
@@ -118,7 +129,7 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
margin-right: 23px;
|
margin-right: 23px;
|
||||||
}
|
}
|
||||||
.el-checkbox.is-bordered.is-checked{
|
.el-checkbox.is-bordered.is-checked{
|
||||||
border-color: #4677F4;
|
border-color: #4677F4;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user