Commit 0a251a21 authored by 王建威's avatar 王建威

bug fix

parent 42ae619c
......@@ -66,11 +66,7 @@
this.$jump(`${php}app=my_address`);
},
changePass(type) {
if(type === 'phone') {
this.$jump(`/pages/setinfo/setinfo?type=${type}&phone=${this.data.phone_mob}`, 2);
return
}
this.$jump(`/pages/setinfo/setinfo?type=${type}`, 2)
this.$jump(`/pages/setinfo/setinfo?type=${type}&phone=${this.data.phone_mob}`, 2)
},
uploadImage() {
uni.chooseImage({
......
<template>
<view class="main">
<TopBar title="修改登录密码"/>
<view>
<view class="set_title">请输入旧登录密码</view>
<input password class="set_input" v-model="old_password" placeholder="输入旧密码">
<view v-if="!next">
<view class="set_title">请完成以下认证</view>
<view class="set_subtitle">请输入{{phone.replace(/(\d{3})\d*(\d{4})/,"$1****$2")}}收到的短信验证码</view>
<view class="flex confirm_box">
<input type="text" class="code_input" v-model="code" placeholder="请输入手机验证码">
<text class="get_code" v-if="codeFlag" @click="getCode()">获取验证码</text>
<text v-else class="get_code grey_bg">{{countdown}}</text>
</view>
<view class="nextstep" @click="nextStep()">下一步</view>
</view>
<view v-else>
<view class="set_title" style="margin-top: 40rpx;">设置新登录密码</view>
<view class="set_tip">密码至少包含字母/数字,长度不小于6</view>
<input password class="set_input" v-model="new_password" placeholder="设置6位登录密码">
......@@ -28,10 +36,72 @@
old_password: '',
new_password: '',
new_password_repeat: '',
changeSuccess: false
changeSuccess: false,
next: false,
codeFlag: true,
countdown: '(60)重新获取',
code: ''
}
},
props: {
phone: {
type: String
}
},
methods: {
getCode() {
if(this.codeFlag) {
uni.request({
url: `/uni/api/mobile_msg/change/${this.phone}`,
method: 'GET',
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
uni.showToast({
title: '短信已发送',
icon: 'none'
})
}
}
});
let seconds = 60;
this.codeFlag = false;
let timer = setInterval(() => {
seconds-=1;
this.countdown = `(${seconds})重新获取`;
if(seconds === 0) {
clearInterval(timer);
this.codeFlag = true;
this.countdown = '(60)重新获取';
}
}, 1000);
}
},
nextStep() {
if(!/^\d{6}$/.test(this.code)) {
uni.showToast({
title: '请输入6位数字验证码',
icon: 'none'
})
return
}
uni.request({
url: `/uni/api/member/check_code/${this.code}`,
method: 'GET',
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
this.next = true;
this.countdown = '(60)重新获取';
} else {
uni.showToast({
title: res.data.message,
icon: 'none'
});
}
}
})
},
checkPass() {
const reg = /^[0-9a-zA-Z_]{6,}$/;
if(this.new_password !== this.new_password_repeat) {
......@@ -53,7 +123,6 @@
url: '/uni/api/member/change_password',
method: 'POST',
data: {
old_password: md5(this.old_password),
newpassword: md5(this.new_password),
confirm_password: md5(this.new_password_repeat)
},
......@@ -86,12 +155,22 @@
<style lang="less" scoped>
.main {
padding: 80rpx 40rpx 0;
.flex {
display: flex;
}
.set_title {
font-size: 32rpx;
color: #212121;
line-height: 44rpx;
margin-top: 24rpx;
}
.set_subtitle {
font-size: 28rpx;
color: #212121;
line-height: 40rpx;
margin-top: 16rpx;
font-size: 30rpx;
}
.set_tip {
color: #7C7C7C;
font-size: 26rpx;
......@@ -146,4 +225,45 @@
}
}
}
.nextstep {
background-color: #FFCD00;
border-radius: 16rpx;
text-align: center;
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
margin: 208rpx auto 0;
font-size: 30rpx;
}
.confirm_box {
justify-content: space-between;
margin-top: 24rpx;
.code_input {
width: 400rpx;
height: 88rpx;
line-height: 88rpx;
background-color: #f5f5f5;
color: #212121;
font-size: 30rpx;
padding-left: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
}
.code_input::placeholder {
color: #aeaeae;
}
.get_code {
width: 250rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 30rpx;
background-color: #FFCD00;
border-radius: 16rpx;
}
.grey_bg {
background-color: #ECECEC;
color: #7c7c7c;
}
}
</style>
\ No newline at end of file
<template>
<view class="main">
<TopBar title="修改支付密码"/>
<view>
<view v-if="!next">
<view class="set_title">请完成以下认证</view>
<view class="set_subtitle">请输入{{phone.replace(/(\d{3})\d*(\d{4})/,"$1****$2")}}收到的短信验证码</view>
<view class="flex confirm_box">
<input type="text" class="code_input" v-model="code" placeholder="请输入手机验证码">
<text class="get_code" v-if="codeFlag" @click="getCode()">获取验证码</text>
<text v-else class="get_code grey_bg">{{countdown}}</text>
</view>
<view class="nextstep" @click="nextStep()">下一步</view>
</view>
<view v-else>
<view class="set_title" style="margin-top: 40rpx;">请完成以下认证</view>
<view class="set_tip">验证后更换支付密码</view>
<input password class="set_input" v-model="old_password" placeholder="请输入旧支付密码">
<view class="set_title" style="margin-top: 40rpx;">设置新的支付密码</view>
<input password class="set_input" v-model="new_password" placeholder="设置6位支付密码">
<input password class="set_input" v-model="new_password_repeat" placeholder="再一次输入支付密码">
......@@ -27,10 +35,72 @@
old_password: '',
new_password: '',
new_password_repeat: '',
changeSuccess: false
changeSuccess: false,
next: false,
codeFlag: true,
countdown: '(60)重新获取',
code: '',
}
},
props: {
phone: {
type: String
}
},
methods: {
getCode() {
if(this.codeFlag) {
uni.request({
url: `/uni/api/mobile_msg/change/${this.phone}`,
method: 'GET',
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
uni.showToast({
title: '短信已发送',
icon: 'none'
})
}
}
});
let seconds = 60;
this.codeFlag = false;
let timer = setInterval(() => {
seconds-=1;
this.countdown = `(${seconds})重新获取`;
if(seconds === 0) {
clearInterval(timer);
this.codeFlag = true;
this.countdown = '(60)重新获取';
}
}, 1000);
}
},
nextStep() {
if(!/^\d{6}$/.test(this.code)) {
uni.showToast({
title: '请输入6位数字验证码',
icon: 'none'
})
return
}
uni.request({
url: `/uni/api/member/check_code/${this.code}`,
method: 'GET',
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
this.next = true;
this.countdown = '(60)重新获取';
} else {
uni.showToast({
title: res.data.message,
icon: 'none'
});
}
}
})
},
checkPass() {
if(this.new_password !== this.new_password_repeat) {
uni.showToast({
......@@ -81,12 +151,22 @@
<style lang="less" scoped>
.main {
padding: 80rpx 40rpx 0;
.flex {
display: flex;
}
.set_title {
font-size: 32rpx;
color: #212121;
line-height: 44rpx;
margin-top: 24rpx;
}
.set_subtitle {
font-size: 28rpx;
color: #212121;
line-height: 40rpx;
margin-top: 16rpx;
font-size: 30rpx;
}
.set_tip {
color: #7C7C7C;
font-size: 26rpx;
......@@ -141,4 +221,45 @@
}
}
}
.nextstep {
background-color: #FFCD00;
border-radius: 16rpx;
text-align: center;
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
margin: 208rpx auto 0;
font-size: 30rpx;
}
.confirm_box {
justify-content: space-between;
margin-top: 24rpx;
.code_input {
width: 400rpx;
height: 88rpx;
line-height: 88rpx;
background-color: #f5f5f5;
color: #212121;
font-size: 30rpx;
padding-left: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
}
.code_input::placeholder {
color: #aeaeae;
}
.get_code {
width: 250rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 30rpx;
background-color: #FFCD00;
border-radius: 16rpx;
}
.grey_bg {
background-color: #ECECEC;
color: #7c7c7c;
}
}
</style>
......@@ -109,7 +109,7 @@
this.newCountDown = `(${seconds})重新获取`;
if(seconds === 0) {
clearInterval(timer);
this.codeFlag = true;
this.newPhoneCodeFlag = true;
this.newCountDown = '(60)重新获取';
}
}, 1000);
......
<template>
<view>
<ChangePhone v-if="type === 'phone'" :phone="phone" />
<ChangeLoginPass v-if="type === 'login'" />
<ChangePayPass v-if="type === 'pay'" />
<ChangeLoginPass v-if="type === 'login'" :phone="phone" />
<ChangePayPass v-if="type === 'pay'" :phone="phone" />
</view>
</template>
......
......@@ -24,6 +24,7 @@
</view>
</view>
<button type="primary" class="submit-btn" :loading="loading" @click="handleSumit">立即支付</button>
<view class="forget_btn" @click="forget()">忘记密码?</view>
</view>
</template>
......@@ -40,7 +41,8 @@
order_price: '',
order_id: '',
password: '',
loading: false
loading: false,
phone_mob: ''
}
},
onLoad(option){
......@@ -48,6 +50,14 @@
this.money = money || '0.00';
this.order_price = amount || '0.00';
this.order_id = order_id || '';
uni.request({
url: '/uni/api/member/profile',
method: 'GET',
dataType: 'json',
success: (res) => {
this.phone_mob = res.data.data.phone_mob;
}
})
},
methods: {
handleSumit(){
......@@ -81,6 +91,9 @@
},
goBack(){
this.$backup();
},
forget() {
this.$jump(`/pages/setinfo/setinfo?type=pay&phone=${this.phone_mob}`, 2)
}
}
}
......@@ -177,4 +190,10 @@
position: absolute;
right: 0;
}
.forget_btn {
text-align: center;
color: #5875E3;
font-size: 24rpx;
margin-top: 30rpx;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment