优化修改密码部分

master
lemon橪 2021-08-26 09:48:32 +08:00
parent 25fb26b7d0
commit 9a91e58f2c
3 changed files with 12 additions and 13 deletions

View File

@ -18,9 +18,9 @@ export function resetByMobile(params) {
* 发送验证码
* @param mobile
*/
export function sendMobile(mobile) {
export function sendMobile(mobile,type='LOGIN') {
return http.request({
url: `${api.common}/sms/LOGIN/${mobile}`,
url: `${api.common}/sms/${type}/${mobile}`,
method: "GET",
});
}

View File

@ -9,17 +9,17 @@
<u-form :model="codeForm" class="form" ref="validateCodeForm">
<view v-if="!validateFlage">
<u-form-item label-width="120" label="手机号" prop="mobile">
<u-input v-model="codeForm.mobile" placeholder="请输入您的手机号" />
<u-input maxlength="11" v-model="codeForm.mobile" placeholder="请输入您的手机号" />
</u-form-item>
<u-form-item class="sendCode" label-width="120" prop="code" label="验证码">
<u-input v-model="codeForm.code" placeholder="请输入验证码" />
<u-input v-model="codeForm.code" placeholder="请输入验证码" />
<u-verification-code unique-key="page-edit" :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange"></u-verification-code>
<view @tap="getCode" class="text-tips">{{ tips }}</view>
</u-form-item>
<view class="submit" @click="validatePhone"></view>
<myVerification keep-running @send="verification" class="verification" ref="verification" business="LOGIN" />
<myVerification keep-running @send="verification" class="verification" ref="verification" business="FIND_USER" />
</view>
<view v-if="validateFlage">
<u-form-item label-width="120" label="旧密码">
@ -40,7 +40,7 @@
<script>
import { sendMobile, resetByMobile, modifyPass } from "@/api/login";
import storage from "@/utils/storage.js";
import { md5 } from "@/utils/md5.js"; // md5
import myVerification from "@/components/verification/verification.vue"; //
import uuid from "@/utils/uuid.modified.js";
@ -108,7 +108,7 @@ export default {
uni.showLoading({
title: "正在获取验证码",
});
sendMobile(this.codeForm.mobile).then((res) => {
sendMobile(this.codeForm.mobile, "FIND_USER").then((res) => {
uni.hideLoading();
// this.start()
if (res.data.code == 200) {
@ -161,8 +161,7 @@ export default {
if (valid) {
resetByMobile(this.codeForm).then((res) => {
if (res.data.success) {
storage.setAccessToken(res.data.result.accessToken);
storage.setRefreshToken(res.data.result.refreshToken);
this.validateFlage = !this.validateFlage;
//
uni.showToast({
title: "验证成功!",
@ -238,6 +237,9 @@ page {
padding: 80rpx 0;
border-radius: 20rpx;
}
.submit {
background: $light-color;
}
.box-tips {
margin: 0 72rpx;
}

View File

@ -17,13 +17,10 @@ export default {
methods: {
navigateTo(url) {
uni.navigateTo({
url: url + `?mobile=${this.mobile}`,
url: url,
});
},
},
onLoad(option) {
this.mobile = option.mobile;
},
};
</script>