提交 604d5c08 编写于 作者: tao.wu's avatar tao.wu

经与产品商榷,校验用户浏览器是否有登录缓存,此缓存为纯前端缓存,与token之类的无关

上级 709aac22
...@@ -89,8 +89,26 @@ ...@@ -89,8 +89,26 @@
}, },
mounted(){ mounted(){
document.querySelector('body').setAttribute('style', 'background: #FE9A51;'); document.querySelector('body').setAttribute('style', 'background: #FE9A51;');
this.checkCache();
}, },
methods: { methods: {
// 校验用户浏览器是否有登录缓存,此缓存为纯前端缓存,与token之类的无关
checkCache(){
const mobilePhoneCache = window.localStorage.getItem('mobilePhone');
const statusCache = window.localStorage.getItem('status');
let status = 'false';
// 如果有缓存则是第二次进入,就要显示已领取,也就是false
if(mobilePhoneCache && statusCache){
window.localStorage.setItem('status', status);
this.$router.push({
name: 'shareResult',
query: {
status
}
})
}
// 如果没有缓存,则停留当前页面
},
// 点击刷新验证码 // 点击刷新验证码
getCaptcha(){ getCaptcha(){
getCaptchaGet().then(res=>{ getCaptchaGet().then(res=>{
...@@ -107,6 +125,11 @@ ...@@ -107,6 +125,11 @@
if(this.mobilePhone=='' || this.mobilePhone.length!=11){ if(this.mobilePhone=='' || this.mobilePhone.length!=11){
this.$toast('请输入正确的手机号'); this.$toast('请输入正确的手机号');
return; return;
}
// 校验图形验证码
if(this.captchaAnswer==''){
this.$toast('请输入图形验证码');
return;
} }
if(this.authCode==''){ if(this.authCode==''){
this.$toast('请输入短信验证码'); this.$toast('请输入短信验证码');
...@@ -121,8 +144,12 @@ ...@@ -121,8 +144,12 @@
taskId, taskId,
activityId activityId
}).then(res=>{ }).then(res=>{
// res.data true 登记成功 、 false 登记失败
if(res.code=='000000'){ if(res.code=='000000'){
// res.data true 登记成功 、 false 登记失败 // 将手机号和状态存入浏览器缓存,用户再次进来就能直接进入领取结果页面
// 注意,如果清除微信或者浏览器缓存,则将停留在当前这个页面并且再次填写手机号以做登录
window.localStorage.setItem('mobilePhone', mobilePhone);
window.localStorage.setItem('status', res.data);
this.$router.push({ this.$router.push({
name: 'shareResult', name: 'shareResult',
query: { query: {
...@@ -146,8 +173,6 @@ ...@@ -146,8 +173,6 @@
return; return;
} }
// this.notSend = false;
const { mobilePhone, flag, captchaToken, captchaAnswer } = this; const { mobilePhone, flag, captchaToken, captchaAnswer } = this;
getAuthCode({mobilePhone, flag, captchaToken, captchaAnswer}).then(res=>{ getAuthCode({mobilePhone, flag, captchaToken, captchaAnswer}).then(res=>{
// 发送成功 // 发送成功
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册