登录模块接口对接完毕

This commit is contained in:
仲么了
2023-03-22 14:09:51 +08:00
parent c308a7131b
commit 02e950130d
4 changed files with 61 additions and 14 deletions

View File

@@ -26,7 +26,7 @@
</uni-forms-item>
<uni-forms-item name="code">
<view class="login-box-input">
<uni-easyinput type="number" v-model="formData.code" placeholder="请输入验证码" />
<uni-easyinput type="number" v-model="formData.code2" placeholder="请输入验证码" />
<view class="ml40"
style="margin-left:40rpx;font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
@@ -41,6 +41,7 @@
</Cn-page>
</template>
<script>
import { apiGetYms, apiComfirmCode, apiRebindPhone } from '@/common/api/user'
export default {
name: "jiaban",
data () {
@@ -104,7 +105,7 @@ export default {
title: '请稍等'
})
apiGetYms({
phone: this.formData.phone,
phone: type == 5 ? this.formData.phone : this.formData.phone2,
type,
}).then(res => {
uni.hideLoading()
@@ -128,11 +129,32 @@ export default {
this.formData.phoneShow = this.formData.phone.substr(0, 3) + '****' + this.formData.phone.substr(7)
},
firstSubmit () {
this.step = 2
apiComfirmCode({
phone: this.formData.phone,
code: this.formData.code,
}).then(res => {
this.step = 2
clearInterval(this.inter)
this.waitTime = 0
}).catch(err => {
console.log(err);
})
},
secondSubmit () {
uni.navigateBack({ delta: 1 })
apiRebindPhone({
phone: this.formData.phone2,
code: this.formData.code2,
}).then(res => {
this.$util.toast('绑定成功')
uni.clearStorageSync();
setTimeout(() => {
uni.redirectTo({
url: '/pages/user/login'
})
}, 1500);
}).catch(err => {
console.log(err);
})
}
}
};