修改意见反馈以及修改密码发现的bug

master
lemon橪 2022-07-06 18:32:53 +08:00
parent 93fc20c825
commit d6fffc43e4
3 changed files with 281 additions and 262 deletions

View File

@ -2,8 +2,8 @@
"name" : "lili商城", "name" : "lili商城",
"appid" : "__UNI__EC9FD60", "appid" : "__UNI__EC9FD60",
"description" : "", "description" : "",
"versionName" : "4.2.5", "versionName" : "4.2.6",
"versionCode" : 4000250, "versionCode" : 4000260,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"compatible" : { "compatible" : {

View File

@ -16,9 +16,9 @@
<!-- 上传凭证 --> <!-- 上传凭证 -->
<div class="feedBack-box"> <div class="feedBack-box">
<view class="opt-view"> <view class="opt-view">
<view class="img-title">上传凭证最多5</view> <view class="img-title">上传凭证最多2</view>
<view class="images-view"> <view class="images-view">
<u-upload :header=" { accessToken: storage.getAccessToken() }" :action="action" width="150" @on-uploaded="onUploaded" :max-count="5" :show-progress="false"></u-upload> <u-upload :header=" { accessToken: storage.getAccessToken() }" :action="action" width="150" @on-uploaded="onUploaded" :max-count="2" :show-progress="false"></u-upload>
</view> </view>
</view> </view>
</div> </div>

View File

@ -1,258 +1,277 @@
<template> <template>
<view class="box"> <view class="box">
<view class="box-tips"> <view class="box-tips">
<h2 class='h2'> <h2 class='h2'>
{{verificationTitle[validateFlage==false ? 0 : 1].title}} {{verificationTitle[validateFlage==false ? 0 : 1].title}}
</h2> </h2>
<view class="verification">{{verificationTitle[step].desc}}</view> <view class="verification">{{verificationTitle[step].desc}}</view>
</view> </view>
<view class="form"> <view class="form">
<u-form :model="codeForm" ref="validateCodeForm"> <u-form :model="codeForm" ref="validateCodeForm">
<view v-if="!validateFlage"> <view v-if="!validateFlage">
<u-form-item label-width="120" label="手机号" prop="mobile"> <u-form-item label-width="120" label="手机号" prop="mobile">
<u-input maxlength="11" v-model="codeForm.mobile" placeholder="请输入您的手机号" /> <u-input maxlength="11" v-model="codeForm.mobile" placeholder="请输入您的手机号" />
</u-form-item> </u-form-item>
<u-form-item class="sendCode" label-width="120" prop="code" label="验证码"> <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> <u-verification-code unique-key="page-edit" :seconds="seconds" @end="end" @start="start"
<view @tap="getCode" class="text-tips">{{ tips }}</view> ref="uCode" @change="codeChange"></u-verification-code>
</u-form-item> <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="FIND_USER" /> <view class="submit" @click="validatePhone"></view>
</view> <myVerification keep-running @send="verification" class="verification" ref="verification"
<view v-if="validateFlage"> business="FIND_USER" />
<u-form-item label-width="120" label="旧密码"> </view>
<u-input type="password" v-model="password" placeholder="请输入您的旧密码" /> <view v-if="validateFlage">
</u-form-item> <u-form-item label-width="120" label="旧密码">
<u-input type="password" v-model="password" placeholder="请输入您的旧密码" />
<u-form-item label-width="120" label="新密码"> </u-form-item>
<u-input type="password" v-model="newPassword" placeholder="请输入您的新密码" /> <u-form-item label-width="120" label="新密码">
</u-form-item> <u-input type="password" v-model="newPassword" placeholder="请输入您的新密码" />
<view class="submit" @click="updatePassword"></view> </u-form-item>
</view>
</u-form> <view class="submit" @click="updatePassword"></view>
</view> </view>
</view> </u-form>
</template> </view>
</view>
<script> </template>
import { sendMobile, resetByMobile, modifyPass } from "@/api/login";
<script>
import { md5 } from "@/utils/md5.js"; // md5 import {
import myVerification from "@/components/verification/verification.vue"; // sendMobile,
import uuid from "@/utils/uuid.modified.js"; resetByMobile,
export default { modifyPass
components: { } from "@/api/login";
myVerification,
}, import {
data() { md5
return { } from "@/utils/md5.js"; // md5
uuid, import myVerification from "@/components/verification/verification.vue"; //
validateFlage: false, // import uuid from "@/utils/uuid.modified.js";
verificationTitle: [ export default {
{ components: {
title: "安全验证", myVerification,
desc: "请输入当前手机号进行安全验证", },
}, data() {
{ return {
title: "修改密码", uuid,
desc: "请输入新密码", validateFlage: false, //
}, verificationTitle: [{
], title: "安全验证",
step: 0, // desc: "请输入当前手机号进行安全验证",
flage: false, // },
{
codeForm: { title: "修改密码",
mobile: "", // desc: "请输入新密码",
code: "", // },
}, ],
newPassword: "", // step: 0, //
password: "", // flage: false, //
tips: "", //
seconds: 60, // 60s codeForm: {
mobile: "", //
// code: "", //
codeRules: { },
mobile: [ newPassword: "", //
{ password: "", //
validator: (rule, value, callback) => { tips: "", //
return this.$u.test.mobile(value); seconds: 69, // 60s
},
message: "手机号码不正确", //
trigger: ["blur"], codeRules: {
}, mobile: [{
], validator: (rule, value, callback) => {
code: [ return this.$u.test.mobile(value);
{ },
min: 4, message: "手机号码不正确",
max: 6, trigger: ["blur"],
required: true, }, ],
message: "请输入验证码", code: [{
trigger: ["blur"], min: 4,
}, max: 6,
], required: true,
}, message: "请输入验证码",
}; trigger: ["blur"],
}, }, ],
onReady() { },
// onReadyonLoad };
this.$refs.validateCodeForm.setRules(this.codeRules); },
}, onReady() {
watch: { // onReadyonLoad
flage(val) { this.$refs.validateCodeForm.setRules(this.codeRules);
if (val) { },
if (this.$refs.uCode.canGetCode) { watch: {
uni.showLoading({ flage(val) {
title: "正在获取验证码", if (val) {
});
sendMobile(this.codeForm.mobile, "FIND_USER").then((res) => { if (this.$refs.uCode.canGetCode) {
uni.hideLoading(); uni.showLoading({
// this.start() title: "正在获取验证码",
if (res.data.code == 200) { });
this.$refs.uCode.start(); sendMobile(this.codeForm.mobile, "FIND_USER").then((res) => {
} else { uni.hideLoading();
uni.showToast({ // this.start()
title: res.data.message, if (res.data.success) {
duration: 2000, this.$refs.uCode.start();
icon: "none", } else {
}); uni.showToast({
} title: res.data.message,
}); duration: 2000,
} else { icon: "none",
this.$u.toast("请倒计时结束后再发送"); });
} this.flage = false;
} this.$refs.verification.getCode();
}, }
}, })
} else {
methods: { this.$u.toast("请倒计时结束后再发送");
// }
updatePassword() { }
modifyPass({ },
newPassword: md5(this.newPassword), },
password: md5(this.password),
}).then((res) => { methods: {
if (res.data.success) { //
uni.showToast({ updatePassword() {
title: "修改成功!", modifyPass({
duration: 2000, newPassword: md5(this.newPassword),
icon: "none", password: md5(this.password),
}); }).then((res) => {
setTimeout(() => { if (res.data.success) {
uni.navigateBack({ uni.showToast({
delta: 1, title: "修改成功!",
}); duration: 2000,
}, 1000); icon: "none",
} });
}); setTimeout(() => {
}, uni.navigateBack({
delta: 1,
// });
verification(val) { }, 1000);
this.flage = val == this.$store.state.verificationKey ? true : false; }
}, });
},
//
validatePhone() { //
this.$refs.validateCodeForm.validate((valid) => { verification(val) {
if (valid) { this.flage = val == this.$store.state.verificationKey ? true : false;
resetByMobile(this.codeForm).then((res) => { },
if (res.data.success) {
this.validateFlage = !this.validateFlage; //
// validatePhone() {
uni.showToast({ this.$refs.validateCodeForm.validate((valid) => {
title: "验证成功!", if (valid) {
icon: "none", resetByMobile(this.codeForm).then((res) => {
}); if (res.data.success) {
} this.validateFlage = !this.validateFlage;
}); //
} uni.showToast({
}); title: "验证成功!",
}, icon: "none",
});
codeChange(text) { }
this.tips = text; });
}, }
end() {}, });
},
/**判断是否是当前用户的手机号 */
isUserPhone() { codeChange(text) {
let flage = false; this.tips = text;
let user = this.$options.filters.isLogin(); },
if (user.mobile != this.codeForm.mobile) { end() {
uni.showToast({
title: "请输入当前绑定手机号", this.flage = false;
icon: "none", this.$refs.verification.getCode()
}); },
flage = false;
} else { /**判断是否是当前用户的手机号 */
flage = true; isUserPhone() {
} let flage = false;
let user = this.$options.filters.isLogin();
return flage; if (user.mobile != this.codeForm.mobile) {
}, uni.showToast({
/**获取验证码 */ title: "请输入当前绑定手机号",
getCode() { icon: "none",
if (this.isUserPhone()) { });
if (this.tips == "重新获取") { flage = false;
this.flage = true; } else {
} flage = true;
if (!this.$u.test.mobile(this.codeForm.mobile)) { }
uni.showToast({
title: "请输入正确手机号", return flage;
icon: "none", },
}); /**获取验证码 */
return false; getCode() {
} if (this.isUserPhone()) {
if (!this.flage) { if (this.tips == "重新获取") {
this.$refs.verification.hide(); this.$refs.verification.error(); //
return false; }
} if (!this.$u.test.mobile(this.codeForm.mobile)) {
} uni.showToast({
}, title: "请输入正确手机号",
start() { icon: "none",
this.$u.toast("验证码已发送"); });
this.flage = false; return false;
}, }
}, if (!this.flage) {
}; this.$refs.verification.error(); //
</script> return false;
<style lang="scss" scoped> }
@import url("@/pages/passport/login.scss"); }
/deep/ .u-form-item { },
margin: 40rpx 0; start() {
} this.$u.toast("验证码已发送");
.sendCode { this.flage = true;
/deep/ .u-form-item--right__content__slot {
display: flex; this.$refs.verification.hide();
} },
} },
.h2{ };
font-size: 40rpx; </script>
font-weight: bold; <style lang="scss" scoped>
} @import url("@/pages/passport/login.scss");
page {
background: #fff; /deep/ .u-form-item {
} margin: 40rpx 0;
.box { }
padding: 80rpx 0;
border-radius: 20rpx; .sendCode {
} /deep/ .u-form-item--right__content__slot {
.submit { display: flex;
background: $light-color; }
} }
.box-tips {
margin: 0 72rpx; .h2 {
} font-size: 40rpx;
.verification { font-weight: bold;
font-size: 24rpx; }
color: #999;
margin-top: 10rpx; page {
} background: #fff;
}
</style>
.box {
padding: 80rpx 0;
border-radius: 20rpx;
}
.submit {
background: $light-color;
}
.box-tips {
margin: 0 72rpx;
}
.verification {
font-size: 24rpx;
color: #999;
margin-top: 10rpx;
}
</style>