diff --git a/src/views/home/expert/index.vue b/src/views/home/expert/index.vue index ffafc1d..4f05793 100644 --- a/src/views/home/expert/index.vue +++ b/src/views/home/expert/index.vue @@ -10,7 +10,7 @@

完善信息,立即领取免费咨询卡(1小时)

-
+

您已领取一小时免费咨询权益,可向专家进行提问

@@ -103,6 +103,7 @@ }, data() { return { + isExpire: false, //是否过有效期 consult_amount: 0, //是否领取咨询机会 current: 0, isConfirm: false, @@ -130,6 +131,13 @@ if(JSON.parse(localStorage.getItem("ddEntrance"))){ this.ddEntrance = JSON.parse(localStorage.getItem("ddEntrance")); } + // 获取当前时间 + let date2 = new Date(); + let dateNumber = ''; + dateNumber = dateNumber.concat(date2.getFullYear(),date2.getMonth()+1,date2.getDate()); + if(parseInt(dateNumber) > 2022614){ + this.isExpire = true; + } }, mounted() { this.getBanner(); diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 4385042..ae2781c 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -12,7 +12,7 @@
-
+
完善信息,立即领取免费咨询卡(1小时)
@@ -139,6 +139,7 @@ expertData: [], //专家列表 video: null, isPaused: true, + isExpire:false, //是否过有效期 }; }, created() { @@ -147,11 +148,20 @@ localStorage.token = JSON.stringify(token); localStorage.ddEntrance = JSON.stringify('yes'); this.getUserData(); + }else{ + // 获取用户类型 + this.consult_amount = (JSON.parse(localStorage.getItem("centerUserData"))).consult_amount; + } + + + // 获取当前时间 + let date2 = new Date(); + let dateNumber = ''; + dateNumber = dateNumber.concat(date2.getFullYear(),date2.getMonth()+1,date2.getDate()); + if(parseInt(dateNumber) > 2022614){ + this.isExpire = true; } - // 获取用户类型 - this.consult_amount = (JSON.parse(localStorage.getItem("centerUserData"))).consult_amount; - console.log(this.consult_amount,3636) }, mounted() { this.getBanner(); @@ -161,8 +171,11 @@ methods: { //查询用户信息 getUserData() { + let that = this; this.axios.post(this.HOME + "/api/user/center-info").then(function(res) { console.log(res.data.data) + // 获取用户类型 + that.consult_amount = res.data.data.consult_amount; localStorage.centerUserData = JSON.stringify(res.data.data); }); }, diff --git a/src/views/login/verification.vue b/src/views/login/verification.vue index 40fe9c9..982a26a 100644 --- a/src/views/login/verification.vue +++ b/src/views/login/verification.vue @@ -92,11 +92,6 @@ }, computed: {}, methods: { - getUserData() { - this.axios.post(this.HOME + "/api/user/center-info").then(function(res) { - localStorage.centerUserData = JSON.stringify(res.data.data); - }); - }, hideKeyboard() { // 输入完成隐藏键盘 var that = this; @@ -113,17 +108,8 @@ localStorage.userData = JSON.stringify(res.data.data); localStorage.token = JSON.stringify(res.data.data.token); if (res.data.code == 0) { + console.log(res.data.code,'缓存123') that.getUserData(); - if(res.data.data.userType == 1){ - that.$router.push('/consultant'); - }else{ - if(that.source){ - window.localStorage.removeItem('source'); - that.$router.push('/evaluation/entrance'); - }else{ - that.$router.push('/index'); - } - } } else { that.toastText = '验证码错误!'; that.sms_code = ''; @@ -137,6 +123,24 @@ console.log(error); }); }, + // 获取用户信息 + getUserData() { + let that = this; + this.axios.post(this.HOME + "/api/user/center-info").then(function(res) { + that.userData = res.data.data; + localStorage.centerUserData = JSON.stringify(res.data.data); + if(res.data.data.type == 1){ + that.$router.push('/consultant'); + }else{ + if(that.source){ + window.localStorage.removeItem('source'); + that.$router.push('/evaluation/entrance'); + }else{ + that.$router.push('/index'); + } + } + }); + }, handleSubmit() { this.$emit("input", this.value); diff --git a/src/views/user/ucenter/index.vue b/src/views/user/ucenter/index.vue index 55ae5cb..a7c203b 100644 --- a/src/views/user/ucenter/index.vue +++ b/src/views/user/ucenter/index.vue @@ -18,7 +18,7 @@
立即使用 立即领取 -

有效期:{{startTime}}-{{endTime}}

+

有效期:{{startTime}}-2022.6.14

@@ -175,19 +175,24 @@ // 获取有效时期 getDate() { let starTime = (JSON.parse(localStorage.getItem("centerUserData"))).student.student_first_complete; - + console.log(starTime,'111111') let date = new Date(starTime.replace(/-/g, '/')); this.startTime = date.getFullYear()+"."+(date.getMonth()+1)+"."+date.getDate(); //有效期开始时间 - console.log(this.startTime,2222222) + console.log(this.startTime,'2222222') let date1 = new Date(starTime.replace(/-/g, '/')); date1.setDate(date.getDate()+7); this.endTime = date1.getFullYear()+"."+(date1.getMonth()+1)+"."+date1.getDate(); //有效期结束时间 // 获取当前时间 let date2 = new Date(); - if(date1.setDate(date.getDate()+7) <= date2.setDate(date.getDate())){ + let dateNumber = ''; + dateNumber = dateNumber.concat(date2.getFullYear(),date2.getMonth()+1,date2.getDate()); + if(parseInt(dateNumber) > 2022614){ this.isExpire = true; } + // if(date1.setDate(date.getDate()+7) <= date2.setDate(date.getDate())){ + // this.isExpire = true; + // } }, // 退出登录