mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 03:16:42 +08:00
弹出窗口的逻辑处理
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="guideCollection"
|
||||
:append-to-body="true"
|
||||
@closed="closeDlg"
|
||||
top="90px"
|
||||
:width="clientWidth">
|
||||
<div class="gui-box">
|
||||
@@ -36,10 +37,10 @@
|
||||
import { swiper, swiperSlide } from 'vue-awesome-swiper';
|
||||
export default {
|
||||
props:{
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
// show:{
|
||||
// type:Boolean,
|
||||
// default:false
|
||||
// }
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
@@ -96,15 +97,18 @@
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
//只是在显示时才调用
|
||||
this.getlist();
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.getlist();
|
||||
},
|
||||
methods:{
|
||||
show(){
|
||||
this.guideCollection=true;
|
||||
},
|
||||
closeDlg(){
|
||||
this.$emit('close');
|
||||
},
|
||||
goHome() {
|
||||
this.$router.push('/index')
|
||||
},
|
||||
|
||||
@@ -2,12 +2,8 @@
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="interestCollection"
|
||||
:append-to-body="true"
|
||||
min-width="770px"
|
||||
max-width="950px"
|
||||
@close="closeDialog"
|
||||
>
|
||||
<div style="margin-top:10px">
|
||||
:append-to-body="true" @close="closeDialog">
|
||||
<div style="margin-top:10px;min-width: 770px;max-width:950px;">
|
||||
<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">
|
||||
@@ -26,10 +22,10 @@
|
||||
import apiUserhobby from "@/api/phase2/userhobby.js"
|
||||
export default {
|
||||
props:{
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
// show:{
|
||||
// type:Boolean,
|
||||
// default:false
|
||||
// }
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
@@ -42,30 +38,30 @@
|
||||
},
|
||||
created() {
|
||||
// this.userAvatar=require("@/assets/images/user/default.png");
|
||||
apiUserhobby.has().then(res=>{
|
||||
if(res.status != 200) {return;}
|
||||
// 1. 判断用户是否选择过兴趣偏好
|
||||
if(res.result == false){
|
||||
this.interestCollection = true;
|
||||
}
|
||||
if(res.result == true){this.interestCollection = false;return;}
|
||||
// 2. 判断用户是否点击过"暂不选择"按钮,如果用户点击过"暂不选择"按钮则判断点击"暂不选择"按钮天数是否大于15天,如果大于则弹出兴趣偏好框,否则不弹
|
||||
let time = localStorage.getItem('notYet'+this.userInfo.aid);
|
||||
if(!time == '' || time != null) {
|
||||
let day = (new Date() - new Date(time))/(1000*60*60*24);
|
||||
if(day > 15){
|
||||
this.interestCollection = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 3. 判断用户是否点击"关闭"按钮,如果点击"关闭"按钮则在当前session不在弹窗
|
||||
let current_session = sessionStorage.getItem('dialog_session_show'+this.userInfo.aid);
|
||||
if(current_session == 1){
|
||||
this.interestCollection = false;
|
||||
}else {
|
||||
this.interestCollection = true;
|
||||
}
|
||||
})
|
||||
// apiUserhobby.has().then(res=>{
|
||||
// if(res.status != 200) {return;}
|
||||
// // 1. 判断用户是否选择过兴趣偏好
|
||||
// if(res.result == false){
|
||||
// this.interestCollection = true;
|
||||
// }
|
||||
// if(res.result == true){this.interestCollection = false;return;}
|
||||
// // 2. 判断用户是否点击过"暂不选择"按钮,如果用户点击过"暂不选择"按钮则判断点击"暂不选择"按钮天数是否大于15天,如果大于则弹出兴趣偏好框,否则不弹
|
||||
// let time = localStorage.getItem('notYet'+this.userInfo.aid);
|
||||
// if(!time == '' || time != null) {
|
||||
// let day = (new Date() - new Date(time))/(1000*60*60*24);
|
||||
// if(day > 15){
|
||||
// this.interestCollection = true;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// // 3. 判断用户是否点击"关闭"按钮,如果点击"关闭"按钮则在当前session不在弹窗
|
||||
// let current_session = sessionStorage.getItem('dialog_session_show'+this.userInfo.aid);
|
||||
// if(current_session == 1){
|
||||
// this.interestCollection = false;
|
||||
// }else {
|
||||
// this.interestCollection = true;
|
||||
// }
|
||||
// })
|
||||
},
|
||||
mounted() {
|
||||
this.getSysTypeTree().then(rs => {
|
||||
@@ -73,17 +69,21 @@
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
show(){
|
||||
this.interestCollection=true;
|
||||
},
|
||||
notYet() {
|
||||
//15天控制
|
||||
this.interestCollection = false;
|
||||
localStorage.setItem('notYet'+this.userInfo.aid,new Date());
|
||||
},
|
||||
...mapActions({
|
||||
getSysTypeTree: 'sysType/getSysTypeTree',
|
||||
}),
|
||||
|
||||
// 关闭兴趣偏好弹窗
|
||||
closeDialog() {
|
||||
sessionStorage.setItem('dialog_session_show'+this.userInfo.aid,1);
|
||||
//本地登录的设置
|
||||
sessionStorage.setItem('user-hobby-'+this.userInfo.aid,1);
|
||||
},
|
||||
saveInterest() {
|
||||
let data = []
|
||||
|
||||
@@ -390,8 +390,8 @@
|
||||
</div>
|
||||
<portal-footer></portal-footer>
|
||||
<portalFloatTools></portalFloatTools>
|
||||
<interest-Collection></interest-Collection> <!-- 兴趣偏好 -->
|
||||
<guide-box ref="guide"></guide-box> <!-- 引导页 -->
|
||||
<interest-Collection ref="userCollection"></interest-Collection> <!-- 兴趣偏好 -->
|
||||
<guide-box ref="guide" @close="closeGuide"></guide-box> <!-- 引导页 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -429,9 +429,7 @@
|
||||
import authorImg from '@/components/Portal/authorImg.vue';
|
||||
import apiStart from '@/api/phase2/stat.js'
|
||||
import apiIndex from '@/api/phase2/index.js'
|
||||
|
||||
|
||||
|
||||
import apiUserhobby from "@/api/phase2/userhobby.js"
|
||||
export default {
|
||||
name: 'index',
|
||||
components: {
|
||||
@@ -453,10 +451,12 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userData: {
|
||||
uvalue:0,
|
||||
totalStudyHour:0
|
||||
userData: { uvalue:0, totalStudyHour:0 },
|
||||
userHobby:{
|
||||
needShow:false,
|
||||
localKeyPre:'user-hobby-' //本地存储的key
|
||||
},
|
||||
needHobbyShow:false,//是否显示兴趣爱好
|
||||
formatNum:formatUserNumber,
|
||||
cutOrgNamePath:cutOrgNamePath,
|
||||
//userInfo: {},
|
||||
@@ -529,10 +529,43 @@
|
||||
this.getLevel();
|
||||
this.getQaAnswers();
|
||||
|
||||
// 控制引导页弹框显示
|
||||
apiGuide.hasUser().then(res=>{
|
||||
this.$refs.guide.guideCollection = res.result ? false : true;
|
||||
});
|
||||
//检查兴趣爱好是否已填报,
|
||||
//先检查本地session和 local 15天, 这两个值是在组件中设置的
|
||||
// let sessionHobby=sessionStorage.getItem('user-hobby-'+this.userInfo.aid);
|
||||
// let localHobbyTime=localStorage.getItem('notYet'+this.userInfo.aid);
|
||||
// if(!sessionHobby){ //只有session中不存在,才会验证
|
||||
// //本地15天验证,localHobby,后续完善
|
||||
// let flag=true;//请求检查
|
||||
// if(localHobbyTime) {
|
||||
// let day = (new Date() - new Date(localHobbyTime))/(1000*60*60*24);
|
||||
// if(day< 15){
|
||||
// flag = false;
|
||||
// }
|
||||
// }
|
||||
// if(flag){
|
||||
// apiUserhobby.has().then(res=>{
|
||||
// if(res.status == 200) {
|
||||
// if(!res.result){
|
||||
// //设置需要显示兴趣爱好收集窗口
|
||||
// this.userHobby.needShow=true;
|
||||
// }
|
||||
// }else{
|
||||
// console.log('兴趣爱好检查失败'+res.message);
|
||||
// }
|
||||
// //检查引导页
|
||||
// this.checkAndShowGuide();
|
||||
// });
|
||||
// }else{
|
||||
// this.checkAndShowGuide();
|
||||
// }
|
||||
// }else{
|
||||
// //不用检查引导页
|
||||
// //this.checkAndShowGuide();
|
||||
// }
|
||||
|
||||
//测试环境中
|
||||
this.userHobby.needShow=true;
|
||||
this.checkAndShowGuide();
|
||||
|
||||
},
|
||||
computed: {
|
||||
@@ -542,6 +575,39 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//检查并弹出引导页
|
||||
checkAndShowGuide(){
|
||||
//引导页弹框是否显示
|
||||
//检查本地,减少服务器请求的次数
|
||||
// let localGuide=localStorage.getItem('user-guide-'+this.userInfo.aid);
|
||||
// if(!localGuide){
|
||||
// apiGuide.hasUser().then(res=>{
|
||||
// if(res.status==200){
|
||||
// if(!res.result){
|
||||
// this.$refs.guide.show();
|
||||
// }else{
|
||||
// if(this.userHobby.needShow){ this.$refs.userCollection.show();}
|
||||
// }
|
||||
// localStorage.setItem('user-guide-'+this.userInfo.aid,1);
|
||||
// }else{
|
||||
// console.log('获取引导页检查失败'+res.message);
|
||||
// //this.$message.error('')
|
||||
// if(this.userHobby.needShow){this.$refs.userCollection.show();}
|
||||
// }
|
||||
// });
|
||||
// }else {
|
||||
// if(this.userHobby.needShow){ this.$refs.userCollection.show();}
|
||||
// }
|
||||
|
||||
//测试情况下
|
||||
this.$refs.guide.show();
|
||||
},
|
||||
closeGuide(){ //关闭引导页
|
||||
if(this.userHobby.needShow){
|
||||
//需要弹出兴趣收集页,弹出兴趣收集页
|
||||
this.$refs.userCollection.show();
|
||||
}
|
||||
},
|
||||
jumstudy(){
|
||||
this.$router.push({path:'../views/study/TaskList.vue'});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user