mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-20 00:06:45 +08:00
弹出窗口的逻辑处理
This commit is contained in:
@@ -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