用户接口对接
This commit is contained in:
@@ -3,34 +3,34 @@
|
||||
<view slot="body">
|
||||
<view class="index">
|
||||
<template v-if="step == 1">
|
||||
<uni-forms ref="form">
|
||||
<uni-forms ref="form" :rules="rules" :modelValue="formData">
|
||||
<uni-forms-item name="phone">
|
||||
<uni-easyinput disabled type="text" v-model="formData.phone" placeholder="请输入手机号" />
|
||||
<uni-easyinput disabled type="text" v-model="formData.phoneShow" placeholder="请输入手机号" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item name="code">
|
||||
<view class="login-box-input mt40">
|
||||
<view class="login-box-input">
|
||||
<uni-easyinput type="number" v-model="formData.code" 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>
|
||||
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
|
||||
<button class="login-box-input-btn" v-else @click="getCode(5)" size="mini">获取验证码</button>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<button type="default" class="submit-btn" @click="firstSubmit">下一步</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<uni-forms ref="form">
|
||||
<uni-forms ref="form" :rules="rules" :modelValue="formData">
|
||||
<uni-forms-item name="phone">
|
||||
<uni-easyinput type="number" v-model="formData.phone2" placeholder="请输入新手机号" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item name="code">
|
||||
<view class="login-box-input mt40">
|
||||
<view class="login-box-input">
|
||||
<uni-easyinput type="number" v-model="formData.code" 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>
|
||||
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
|
||||
<button class="login-box-input-btn" v-else @click="getCode(4)" size="mini">获取验证码</button>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
@@ -50,7 +50,8 @@ export default {
|
||||
waitTime: 0,
|
||||
// 表单数据
|
||||
formData: {
|
||||
phone: '150****0083',
|
||||
phone: '',
|
||||
phoneShow: '',
|
||||
code: '',
|
||||
phone2: '',
|
||||
code2: '',
|
||||
@@ -72,19 +73,19 @@ export default {
|
||||
}
|
||||
]
|
||||
},
|
||||
password: {
|
||||
phone2: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: "请填写新密码"
|
||||
errorMessage: "请填写新手机号"
|
||||
}
|
||||
]
|
||||
},
|
||||
password2: {
|
||||
code2: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: "请填写确认密码"
|
||||
errorMessage: "请填写验证码"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -92,17 +93,39 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad () {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
getCode () {
|
||||
this.waitTime = 60
|
||||
this.inter = setInterval(() => {
|
||||
if (this.waitTime == 0) {
|
||||
clearInterval(this.inter)
|
||||
} else {
|
||||
this.waitTime--
|
||||
}
|
||||
}, 1000)
|
||||
getCode (type) {
|
||||
if (!this.formData.phone) {
|
||||
return this.$util.toast('请输入手机号!')
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '请稍等'
|
||||
})
|
||||
apiGetYms({
|
||||
phone: this.formData.phone,
|
||||
type,
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
console.log(res);
|
||||
this.waitTime = 60
|
||||
this.inter = setInterval(() => {
|
||||
if (this.waitTime == 0) {
|
||||
clearInterval(this.inter)
|
||||
} else {
|
||||
this.waitTime--
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err);
|
||||
})
|
||||
},
|
||||
init () {
|
||||
this.formData.phone = uni.getStorageSync('userInfo').phone
|
||||
// 150****0083
|
||||
this.formData.phoneShow = this.formData.phone.substr(0, 3) + '****' + this.formData.phone.substr(7)
|
||||
},
|
||||
firstSubmit () {
|
||||
this.step = 2
|
||||
|
||||
Reference in New Issue
Block a user