225 lines
5.5 KiB
Vue
225 lines
5.5 KiB
Vue
|
<template>
|
|||
|
<view>
|
|||
|
<view class="ChangePassword">
|
|||
|
<form @submit="editPwd" report-submit='true'>
|
|||
|
<view class="phone">当前手机号:{{phone}}</view>
|
|||
|
<view class="list">
|
|||
|
<view class="item">
|
|||
|
<input type='password' placeholder='设置新密码' placeholder-class='placeholder' name="password" :value="password"></input>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<input type='password' placeholder='确认新密码' placeholder-class='placeholder' name="qr_password" :value="qr_password"></input>
|
|||
|
</view>
|
|||
|
<view class="item acea-row row-between-wrapper">
|
|||
|
<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" name="captcha" :value="captcha"></input>
|
|||
|
<button class="code font-color" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="handleVerify">
|
|||
|
{{ text }}
|
|||
|
</button>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<button form-type="submit" class="confirmBnt bg-color">确认修改</button>
|
|||
|
</form>
|
|||
|
</view>
|
|||
|
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
|
|||
|
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
|||
|
import {
|
|||
|
phoneRegisterReset,
|
|||
|
registerVerify
|
|||
|
} from '@/api/api.js';
|
|||
|
import {
|
|||
|
getUserInfo
|
|||
|
} from '@/api/user.js';
|
|||
|
import {
|
|||
|
mapGetters
|
|||
|
} from "vuex";
|
|||
|
import authorize from '@/components/Authorize';
|
|||
|
import Verify from '@/components/verify/verify.vue';
|
|||
|
export default {
|
|||
|
mixins: [sendVerifyCode],
|
|||
|
components: {
|
|||
|
authorize,
|
|||
|
Verify
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
userInfo: {},
|
|||
|
phone: '',
|
|||
|
password: '',
|
|||
|
captcha: '',
|
|||
|
qr_password: '',
|
|||
|
isAuto: false, //没有授权的不会自动授权
|
|||
|
isShowAuth: false //是否隐藏授权
|
|||
|
};
|
|||
|
},
|
|||
|
computed: mapGetters(['isLogin']),
|
|||
|
onLoad() {
|
|||
|
if (this.isLogin) {
|
|||
|
this.getUserInfo();
|
|||
|
} else {
|
|||
|
this.isAuto = true;
|
|||
|
this.isShowAuth = true
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
/**
|
|||
|
* 授权回调
|
|||
|
*/
|
|||
|
onLoadFun: function(e) {
|
|||
|
this.isShowAuth = false;
|
|||
|
this.getUserInfo();
|
|||
|
},
|
|||
|
// 授权关闭
|
|||
|
authColse: function(e) {
|
|||
|
this.isShowAuth = e
|
|||
|
},
|
|||
|
/**
|
|||
|
* 获取个人用户信息
|
|||
|
*/
|
|||
|
getUserInfo: function() {
|
|||
|
let that = this;
|
|||
|
getUserInfo().then(res => {
|
|||
|
let tel = res.data.phone;
|
|||
|
let phone = tel.substr(0, 3) + "****" + tel.substr(7);
|
|||
|
that.$set(that, 'userInfo', res.data);
|
|||
|
that.phone = phone;
|
|||
|
});
|
|||
|
},
|
|||
|
/**
|
|||
|
* 发送验证码
|
|||
|
*
|
|||
|
*/
|
|||
|
async code(data) {
|
|||
|
let that = this;
|
|||
|
if (!that.userInfo.phone) return that.$util.Tips({
|
|||
|
title: '手机号码不存在,无法发送验证码!'
|
|||
|
});
|
|||
|
await registerVerify(that.userInfo.phone).then(res => {
|
|||
|
that.$util.Tips({
|
|||
|
title: res.msg
|
|||
|
});
|
|||
|
that.sendCode();
|
|||
|
}).catch(err => {
|
|||
|
return that.$util.Tips({
|
|||
|
title: err
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
/**
|
|||
|
* H5登录 修改密码
|
|||
|
*
|
|||
|
*/
|
|||
|
editPwd: function(e) {
|
|||
|
let that = this,
|
|||
|
password = e.detail.value.password,
|
|||
|
qr_password = e.detail.value.qr_password,
|
|||
|
captcha = e.detail.value.captcha;
|
|||
|
if (!password) return that.$util.Tips({
|
|||
|
title: '请输入新密码'
|
|||
|
});
|
|||
|
if (qr_password != password) return that.$util.Tips({
|
|||
|
title: '两次输入的密码不一致!'
|
|||
|
});
|
|||
|
if (!captcha) return that.$util.Tips({
|
|||
|
title: '请输入验证码'
|
|||
|
});
|
|||
|
phoneRegisterReset({
|
|||
|
account: that.userInfo.phone,
|
|||
|
captcha: captcha,
|
|||
|
password: password
|
|||
|
}).then(res => {
|
|||
|
return that.$util.Tips({
|
|||
|
title: res.msg
|
|||
|
}, {
|
|||
|
tab: 3,
|
|||
|
url: 1
|
|||
|
});
|
|||
|
}).catch(err => {
|
|||
|
return that.$util.Tips({
|
|||
|
title: err
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
success(data) {
|
|||
|
this.$refs.verify.hide();
|
|||
|
this.code(data);
|
|||
|
},
|
|||
|
handleVerify() {
|
|||
|
this.$refs.verify.show();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|
|||
|
|
|||
|
<style lang="scss" scoped>
|
|||
|
page {
|
|||
|
background-color: #fff !important;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .phone {
|
|||
|
font-size: 32rpx;
|
|||
|
font-weight: bold;
|
|||
|
text-align: center;
|
|||
|
margin-top: 55rpx;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .list {
|
|||
|
width: 580rpx;
|
|||
|
margin: 53rpx auto 0 auto;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .list .item {
|
|||
|
width: 100%;
|
|||
|
height: 110rpx;
|
|||
|
border-bottom: 2rpx solid #f0f0f0;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .list .item input {
|
|||
|
width: 100%;
|
|||
|
height: 100%;
|
|||
|
font-size: 32rpx;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .list .item .placeholder {
|
|||
|
color: #b9b9bc;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .list .item input.codeIput {
|
|||
|
width: 340rpx;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .list .item .code {
|
|||
|
font-size: 32rpx;
|
|||
|
background-color: #fff;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .list .item .code.on {
|
|||
|
color: #b9b9bc !important;
|
|||
|
}
|
|||
|
|
|||
|
.ChangePassword .confirmBnt {
|
|||
|
font-size: 32rpx;
|
|||
|
width: 580rpx;
|
|||
|
height: 90rpx;
|
|||
|
border-radius: 45rpx;
|
|||
|
color: #fff;
|
|||
|
margin: 92rpx auto 0 auto;
|
|||
|
text-align: center;
|
|||
|
line-height: 90rpx;
|
|||
|
}
|
|||
|
</style>
|