Commit 798cee58 authored by ziyu's avatar ziyu

improvement: 修改bug,优化

parent 8fc54288
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -37,15 +37,16 @@ const request = async (url, options) => { ...@@ -37,15 +37,16 @@ const request = async (url, options) => {
method: options.method, method: options.method,
header: options.header header: options.header
}).then(res => { }).then(res => {
let msg = res.data.msg || '服务器异常';
if (res.statusCode === 200) { if (res.statusCode === 200) {
if (res.data.code === 2000) { if (res.data.code === 2000) {
return res.data.data; return res.data.data;
} }
Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop }); Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop });
throw new Error(res.data.msg || '服务器异常,请求url:' + url); throw new Error(msg + ',请求url:' + url + '请求返回:' + res.data);
} }
Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop }); Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop });
throw new Error(res.data.msg || '服务器异常,请求url:' + url); throw new Error(msg + ',请求url:' + url + '请求返回:' + res.data);
}); });
}; };
......
...@@ -582,10 +582,10 @@ ...@@ -582,10 +582,10 @@
this.mainInfo = await getUserInfo(wx.getStorageSync('openId')); this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));
this.sign = this.mainInfo && this.mainInfo.signin; this.sign = this.mainInfo && this.mainInfo.signin;
wx.setStorageSync('hasPhone', this.mainInfo.phone); wx.setStorageSync('hasPhone', this.mainInfo.phone);
if(this.mainInfo&&this.mainInfo.innerActivity) { if (this.mainInfo && this.mainInfo.innerActivity) {
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity); wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
} else { } else {
wx.setStorageSync('innerActivity','') wx.setStorageSync('innerActivity', '');
} }
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) { if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
this.showShareModal = true; this.showShareModal = true;
......
...@@ -140,6 +140,10 @@ ...@@ -140,6 +140,10 @@
Notify({message: '请填写身份证号'}); Notify({message: '请填写身份证号'});
return; return;
} }
if (!/^[0-9]+[Xx]?$/.test(this.idNumber)) {
Notify({message: '请填写正确的身份证号'});
return;
}
if (!this.city) { if (!this.city) {
Notify({message: '请选择所在地区'}); Notify({message: '请选择所在地区'});
return; return;
......
...@@ -266,16 +266,17 @@ ...@@ -266,16 +266,17 @@
photoUrl: '', photoUrl: '',
btnfont: '立即参与', btnfont: '立即参与',
hasPhone: false, hasPhone: false,
isInnerDone:'hide', isInnerDone: 'hide',
innerActivity:'', innerActivity: '',
isError:false, isError: false,
code:'', code: ''
}, },
methods: { methods: {
check() { check() {
this.isCheck = !this.isCheck; this.isCheck = !this.isCheck;
}, },
async getPhoneNumber(e) { async getPhoneNumber(e) {
// 用户获取手机号之前一定要登录
if (this.btnfont !== '立即参与') { return; } if (this.btnfont !== '立即参与') { return; }
let that = this; let that = this;
let detail = e.$wx.detail || {}; let detail = e.$wx.detail || {};
...@@ -290,9 +291,14 @@ ...@@ -290,9 +291,14 @@
} }
if (detail.encryptedData) { if (detail.encryptedData) {
this.btnfont = '参与中...'; this.btnfont = '参与中...';
wx.checkSession({
async fail () {
// session_key 已经失效,需要重新执行登录流程
const { code } = await wepy.wx.login(); const { code } = await wepy.wx.login();
await login(code); await login(code);
goprize(); goprize();
}
});
} else { } else {
Notify({message: '参与失败,请重新授权!'}); Notify({message: '参与失败,请重新授权!'});
} }
...@@ -301,6 +307,7 @@ ...@@ -301,6 +307,7 @@
let title = ['参与成功!', '参与失败!', '参与失败!']; let title = ['参与成功!', '参与失败!', '参与失败!'];
let message = ['参与成功,坐等开奖。', '当前抽奖已结束。', '当前奖品已经没有库存了。']; let message = ['参与成功,坐等开奖。', '当前抽奖已结束。', '当前奖品已经没有库存了。'];
// 如果用户还未注册 // 如果用户还未注册
// 用户抽奖之前一定要注册
let isRegister = wx.getStorageSync('isRegister'); let isRegister = wx.getStorageSync('isRegister');
if (isRegister === false) { if (isRegister === false) {
await register(store.state.userInfo); await register(store.state.userInfo);
...@@ -327,10 +334,10 @@ ...@@ -327,10 +334,10 @@
return; return;
} }
if (this.hasPhone) { if (this.hasPhone) {
//当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal // 当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
if(this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) { if (this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) {
this.showModal(); this.showModal();
}else { } else {
this.confirmRaff(); this.confirmRaff();
} }
} }
...@@ -356,14 +363,14 @@ ...@@ -356,14 +363,14 @@
this.code = ''; this.code = '';
}, },
checkCode () { checkCode () {
checkInnerCode({code:this.code}).then(data=>{ checkInnerCode({code: this.code}).then(data => {
if(+data.checkCode === 0) { if (+data.checkCode === 0) {
this.closeModal(); this.closeModal();
this.confirmRaff(); this.confirmRaff();
}else{ } else {
this.isError = true; this.isError = true;
} }
}) });
} }
}, },
computed: { computed: {
...@@ -377,7 +384,7 @@ ...@@ -377,7 +384,7 @@
}, },
watch: { watch: {
code(val) { code(val) {
if(!val.length&&this.isError) { if (!val.length && this.isError) {
this.isError = false; this.isError = false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment