校验短信验证码
This commit is contained in:
@@ -20,6 +20,10 @@ export const getLoginBySms = data => {
|
|||||||
export const getResetPassword = data => {
|
export const getResetPassword = data => {
|
||||||
return post('/api/butler/auth/forgetPassword', data)
|
return post('/api/butler/auth/forgetPassword', data)
|
||||||
}
|
}
|
||||||
|
// 忘记密码 校验短信验证码
|
||||||
|
export const verifySmsCode = (data) =>{
|
||||||
|
return post('/api/butler/auth/verifySmsCode',data)
|
||||||
|
}
|
||||||
|
|
||||||
// ======首页=====
|
// ======首页=====
|
||||||
// 获取小区列表
|
// 获取小区列表
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!-- 手机号输入框 -->
|
<!-- 手机号输入框 -->
|
||||||
<view class="input-item">
|
<view class="input-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="http://wuye.ckdzkj.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image src="https://wuye.ckdzkj.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" trim="all"
|
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" trim="all"
|
||||||
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
<!-- 验证码输入 + 获取验证码按钮 -->
|
<!-- 验证码输入 + 获取验证码按钮 -->
|
||||||
<view class="input-item verify-item">
|
<view class="input-item verify-item">
|
||||||
<view class="input-icon">
|
<view class="input-icon">
|
||||||
<image src="http://wuye.ckdzkj.com/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
<image src="https://wuye.ckdzkj.com/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all"
|
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all"
|
||||||
@@ -29,21 +29,21 @@
|
|||||||
<!-- 下一步 -->
|
<!-- 下一步 -->
|
||||||
<button
|
<button
|
||||||
class="forget-btn"
|
class="forget-btn"
|
||||||
:disabled="!canRegister"
|
:disabled="!canRegister || submitting"
|
||||||
@click="handleNext"
|
@click="handleNext">
|
||||||
>
|
{{ submitting ? '校验中...' : '下一步' }}
|
||||||
下一步
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onUnmounted } from 'vue';
|
import { ref, computed, onUnmounted } from 'vue';
|
||||||
import {getSendCode} from '../../api/api.js'
|
import {getSendCode,verifySmsCode} from '../../api/api.js'
|
||||||
|
|
||||||
// ====响应式数据======
|
// ====响应式数据======
|
||||||
const phoneNumber = ref('')
|
const phoneNumber = ref('')
|
||||||
const verifyCode = ref('')
|
const verifyCode = ref('')
|
||||||
|
const submitting = ref(false)
|
||||||
|
|
||||||
const countDown = ref(0)
|
const countDown = ref(0)
|
||||||
let timer = null;
|
let timer = null;
|
||||||
@@ -85,6 +85,11 @@ const getVerifyCode = () => {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}).catch((err)=>{
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -99,18 +104,34 @@ const canRegister = computed(() => {
|
|||||||
});
|
});
|
||||||
// 下一步
|
// 下一步
|
||||||
const handleNext = () =>{
|
const handleNext = () =>{
|
||||||
// 把参数存到本地缓存
|
if(!canRegister.value){
|
||||||
uni.setStorageSync('tempChangePwdParams', {
|
uni.showToast({ title: '请输入正确的手机号和验证码',icon: 'error'});
|
||||||
phoneNumber:phoneNumber.value,
|
return
|
||||||
verifyCode: verifyCode.value
|
}
|
||||||
});
|
if(submitting.value) return
|
||||||
if(!canRegister.value){
|
submitting.value = true
|
||||||
uni.showToast({ title: '请输入',icon: 'error'});
|
// 后端验证短信
|
||||||
return
|
verifySmsCode({
|
||||||
}
|
phone: phoneNumber.value,
|
||||||
uni.navigateTo({
|
smsCode: verifyCode.value,
|
||||||
url: '/pageSubPack/loginSub/change-pwd'
|
scene: 'reset'
|
||||||
});
|
}).then(res =>{
|
||||||
|
// 把参数存到本地缓存
|
||||||
|
uni.setStorageSync('tempChangePwdParams', {
|
||||||
|
phoneNumber:phoneNumber.value,
|
||||||
|
verifyCode: verifyCode.value
|
||||||
|
});
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageSubPack/loginSub/change-pwd'
|
||||||
|
});
|
||||||
|
}).catch(err =>{
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg || '验证码错误',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}).finally(() =>{
|
||||||
|
submitting.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user