Commit 438e51d5 authored by ziyu's avatar ziyu

improvement: 优化

parent 22886f97
...@@ -238,10 +238,10 @@ ...@@ -238,10 +238,10 @@
<view> <view>
<input type="text" class="inner-input" v-model="code"> <input type="text" class="inner-input" v-model="code">
</view> </view>
<view class="error-text" v-show="isError">邀请码错误,请重新输入</view> <view class="error-text" v-show="isError">{{errorText}}</view>
<view class="inner-footer"> <view class="inner-footer">
<view class="cancel button" bindtap="closeModal">内测结束再抽</view> <view class="cancel button" bindtap="closeModal">内测结束再抽</view>
<view class="confirm button" bindtap="checkCode">确定</view> <view class="confirm button" bindtap="checkCode">{{errorBtn}}</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -270,6 +270,8 @@ ...@@ -270,6 +270,8 @@
innerActivity: '', innerActivity: '',
isError: false, isError: false,
code: '', code: '',
errorText:'',
errorBtn:'确定',
}, },
methods: { methods: {
check() { check() {
...@@ -372,16 +374,27 @@ ...@@ -372,16 +374,27 @@
}, },
checkCode () { checkCode () {
if(this.code === '') { if(this.code === '') {
this.errorText = '请输入邀请码';
this.isError = true; this.isError = true;
return; return;
} }
if(this.errorBtn !== '确定') {
return;
}
this.errorBtn = '验证中...';
checkInnerCode({code: this.code}).then(data => { checkInnerCode({code: this.code}).then(data => {
this.errorBtn = '确定';
if (+data.checkCode === 0) { if (+data.checkCode === 0) {
this.closeModal(); this.closeModal();
this.confirmRaff(); this.confirmRaff();
} else { } else {
let index = data.checkCode+2;
let mesg = ['邀请码错误,请重新输入','该邀请码已被使用,请重新输入']
this.errorText = mesg[index];
this.isError = true; this.isError = true;
} }
}).catch(()=>{
this.errorBtn = '确定';
}); });
} }
}, },
......
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