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

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