222 lines
5.9 KiB
Vue
Raw Normal View History

2024-02-19 10:44:33 +08:00
<template>
2024-03-21 14:36:34 +08:00
<view class="register absolute" :style="viewColor">
<!-- <view class="shading">
<view class="pictrue acea-row row-center-wrapper">
2024-02-19 10:44:33 +08:00
<image :src="login_logo" v-if="login_logo" />
2024-03-21 14:36:34 +08:00
</view>
</view> -->
2024-05-06 18:19:05 +08:00
<view class="whiteBg" style="margin: 0;width: 100%;padding: 50rpx 60rpx;"
:style="{ 'background-image': `url(${domain}/static/images/logo_bgl.png)`}">
2024-02-19 10:44:33 +08:00
<view class="login_title">
<view class="title_h">找回密码</view>
</view>
2024-03-21 14:36:34 +08:00
<form class="list">
<view class="item">
2024-05-06 18:19:05 +08:00
<input type="number" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account"
autocomplete="off" />
2024-03-21 14:36:34 +08:00
<!-- <input type="text" style="height: 0;opacity: 0"> -->
</view>
<view class="item">
2024-05-06 18:19:05 +08:00
<input type="password" placeholder="填写您的新密码" placeholder-class="placeholder" v-model="password"
autocomplete="off" />
2024-03-21 14:36:34 +08:00
</view>
<view class="item">
2024-05-06 18:19:05 +08:00
<input type="password" placeholder="再次输入新密码" placeholder-class="placeholder" v-model="confirm_pwd"
autocomplete="off" />
2024-03-21 14:36:34 +08:00
</view>
<view class="item" style="display: flex;justify-content: space-between;">
2024-05-06 18:19:05 +08:00
<input type="number" placeholder="填写验证码" maxlength="4" placeholder-class="placeholder"
class="codeIput" v-model="captcha" autocomplete="off" />
<button class="code" style="color: #fff;" :disabled="disabled"
:class="disabled === true ? 'on' : ''" @click="handleVerify">
2024-02-19 10:44:33 +08:00
{{ text }}
</button>
2024-03-21 14:36:34 +08:00
</view>
</form>
<view class="logon" @click="registerReset">确认</view>
2024-05-06 18:19:05 +08:00
<!-- <view class="tip">
2024-02-19 10:44:33 +08:00
<text @click="back">立即登录</text>
2024-05-06 18:19:05 +08:00
</view> -->
2024-03-21 14:36:34 +08:00
</view>
<view class="bottom"></view>
2024-05-06 18:19:05 +08:00
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }"
ref="verify"></Verify>
2024-03-21 14:36:34 +08:00
</view>
2024-02-19 10:44:33 +08:00
</template>
<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
const app = getApp();
2024-05-06 18:19:05 +08:00
import {
mapGetters
} from "vuex";
2024-02-19 10:44:33 +08:00
import sendVerifyCode from "@/mixins/SendVerifyCode";
import {
registerVerify,
registerForget,
getCodeApi,
getCaptcha
} from "@/api/user";
2024-05-06 18:19:05 +08:00
import {
validatorDefaultCatch
} from "@/utils/dialog";
2024-02-19 10:44:33 +08:00
import attrs, {
required,
alpha_num,
chs_phone
} from "@/utils/validate";
2024-05-06 18:19:05 +08:00
import {
configMap
} from '@/utils';
import {
HTTP_REQUEST_URL
} from '@/config/app';
import Verify from '@/components/verify/verify.vue';
2024-02-19 10:44:33 +08:00
export default {
name: "RetrievePassword",
2024-05-06 18:19:05 +08:00
components: {
Verify
2024-02-19 10:44:33 +08:00
},
mixins: [sendVerifyCode],
data: function() {
return {
account: "",
password: "",
confirm_pwd: "",
captcha: "",
codeKey: "",
codeUrl: "",
codeVal: "",
isShowCode: false,
domain: HTTP_REQUEST_URL,
};
},
computed: configMap(['login_logo'], mapGetters(['viewColor'])),
2024-05-06 18:19:05 +08:00
onReady() {},
mounted: function() {},
2024-02-19 10:44:33 +08:00
methods: {
back() {
uni.navigateBack();
},
again() {
2024-05-06 18:19:05 +08:00
this.codeUrl = VUE_APP_API_URL + "/captcha?" + this.keyCode + Date.parse(new Date());
2024-02-19 10:44:33 +08:00
},
async code(data) {
let that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
await registerVerify({
phone: that.account,
type: 'change_pwd',
2024-05-06 18:19:05 +08:00
captchaType: 'blockPuzzle',
2024-02-19 10:44:33 +08:00
captchaVerification: data.captchaVerification
})
.then(res => {
that.$util.Tips({
title: res.message
});
that.sendCode();
}).catch(res => {
that.$util.Tips({
title: res
});
});
},
getcaptcha() {
let that = this
getCaptcha().then(data => {
that.codeUrl = data.data.captcha; //图片路径
that.codeVal = data.data.code; //图片验证码
that.codeKey = data.data.key //图片验证码key
})
that.isShowCode = true;
},
async registerReset() {
var that = this;
if (!that.account) return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
title: '请输入正确的手机号码'
});
if (that.password == '123456') return that.$util.Tips({
title: '您输入的密码过于简单'
});
if (that.password != that.confirm_pwd) return that.$util.Tips({
title: '两次密码不一致'
});
if (!that.captcha) return that.$util.Tips({
title: '请填写验证码'
});
registerForget({
phone: that.account,
sms_code: that.captcha,
pwd: that.password,
confirm_pwd: that.confirm_pwd
})
.then(res => {
that.$util.Tips({
title: res.message
}, {
tab: 3
})
})
.catch(res => {
that.$util.Tips({
title: res
})
});
},
2024-05-06 18:19:05 +08:00
success(data) {
2024-02-19 10:44:33 +08:00
this.$refs.verify.hide();
this.code(data);
},
handleVerify() {
this.$refs.verify.show();
}
}
};
</script>
<style lang="scss" scoped>
2024-05-06 18:19:05 +08:00
.register {
2024-02-19 10:44:33 +08:00
background: #ffffff;
height: 100vh;
}
2024-05-06 18:19:05 +08:00
2024-02-19 10:44:33 +08:00
.register .list .item .code {
color: var(--view-theme);
}
2024-05-06 18:19:05 +08:00
2024-02-19 10:44:33 +08:00
.whiteBg .logon {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 86rpx;
margin-top: 48rpx;
2024-05-06 18:19:05 +08:00
background-color: var(--view-theme);
2024-02-19 10:44:33 +08:00
border-radius: 120rpx;
color: #FFFFFF;
font-size: 30rpx;
}
2024-05-06 18:19:05 +08:00
.whiteBg {
2024-02-19 10:44:33 +08:00
background-repeat: no-repeat;
background-size: 100% auto;
}
2024-05-06 18:19:05 +08:00
</style>