| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <template>
- <view class="wrapper" :style="colorStyle">
- <view class="bag">
- <img :src="imgHost+'/statics/images/users/login-bg.jpg'" alt="" srcset="">
- </view>
- <!-- #ifdef MP -->
- <view class="title-bar" style="height: 43px;">
- <view class="icon" @click="back" v-if="!isHome">
- <image src="../static/left.png"></image>
- </view>
- <view class="icon" @click="home" v-else>
- <image src="../static/home.png"></image>
- </view>
- {{pageTitle}}
- </view>
- <!-- #endif -->
- <view class="page-msg">
- <view class="title">
- 找回密码
- </view>
- <view class="tip"></view>
- </view>
- <view class="page-form">
- <view class="item">
- <input type='number' placeholder='请输入手机号码' placeholder-class='placeholder' v-model="account"
- :maxlength="11"></input>
- </view>
- <view class="item acea-row row-between-wrapper">
- <input type='number' placeholder='请输入验证码' placeholder-class='placeholder' :maxlength="6"
- class="codeIput" v-model="captcha"></input>
- <view class="line">
- </view>
- <button class="code font-num" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code">
- {{ text }}
- </button>
- </view>
- <view class="item">
- <input type='password' placeholder='请输入密码' placeholder-class='placeholder' v-model="password"
- :maxlength="28"></input>
- </view>
- <view class="item">
- <input type='password' placeholder='请再次确认密码' placeholder-class='placeholder' v-model="passwordAgain"
- :maxlength="28"></input>
- </view>
- <view class="btn" @click="registerReset">
- 确认
- </view>
- <view class="text-center fs-32 text--w111-999 mt-32" @click="back">立即登录</view>
- </view>
- <Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }"
- ref="verify"></Verify>
- </view>
- </template>
- <script>
- import sendVerifyCode from "@/mixins/SendVerifyCode";
- import colors from '@/mixins/color.js';
- import Verify from '../components/verify/verify.vue';
- import {
- registerVerify,
- registerReset,
- getCodeApi
- } from "@/api/user";
- import { HTTP_REQUEST_URL } from '@/config/app';
- export default {
- name: "RetrievePassword",
- components: {
- Verify
- },
- data: function() {
- return {
- account: "",
- password: "",
- passwordAgain:'',
- captcha: "",
- keyCode: "",
- codeUrl: "",
- codeVal: "",
- isShowCode: false,
- imgHost: HTTP_REQUEST_URL,
- type:'register'
- };
- },
- mixins: [sendVerifyCode,colors],
- mounted: function() {
- // this.getCode();
- },
- methods: {
- back() {
- uni.navigateBack();
- },
- again() {
- this.codeUrl =
- VUE_APP_API_URL + "/captcha?" + this.keyCode + Date.parse(new Date());
- },
- 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.captcha) return that.$util.Tips({
- title: '请填写验证码'
- });
- if (!that.password) return that.$util.Tips({
- title: '请填写新密码'
- });
- if (that.password != that.passwordAgain) return that.$util.Tips({
- title: '两次密码不一致'
- });
- registerReset({
- account: that.account,
- captcha: that.captcha,
- password: that.password,
- code: that.codeVal
- })
- .then(res => {
- that.$util.Tips({
- title: res.msg
- }, {
- tab: 3
- })
- })
- .catch(res => {
- that.$util.Tips({
- title: res
- })
- });
- },
- success(data) {
- console.log(data,'data');
- this.$refs.verify.hide()
- getCodeApi()
- .then(res => {
- this.keyCode = res.data.key;
- this.getCode(data);
- })
- .catch(res => {
- this.$util.Tips({
- title: res
- });
- });
- },
- 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: '请输入正确的手机号码'
- });
- this.$refs.verify.show()
- },
- async getCode(data){
- console.log('data-------',data);
- let that = this;
- await registerVerify({
- phone: that.account,
- type: that.type,
- key: that.keyCode,
- captchaType: 'blockPuzzle',
- captchaVerification: data.captchaVerification,
- })
- .then(res => {
- that.$util.Tips({
- title: res.msg
- });
- that.sendCode();
- })
- .catch(res => {
- that.$util.Tips({
- title: res
- });
- });
- },
- }
- };
- </script>
- <style lang="scss" scoped>
- .wrapper {
- background-color: #fff;
- min-height: 100vh;
- position: relative;
- .bag {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 0;
- /* #ifdef H5 */
- z-index: 0;
-
- /* #endif */
- img {
- width: 100%;
- height: 544rpx;
- }
- }
- .page-msg {
- padding-top: 160rpx;
- margin-left: 72rpx;
- z-index: 2;
- position: relative;
- .title {
- font-size: 48rpx;
- font-weight: 500;
- color: #333333;
- line-height: 68rpx;
- }
- .tip {
- font-size: 28rpx;
- font-weight: 400;
- color: #333333;
- line-height: 40rpx;
- }
- }
- .page-form {
- width: 606rpx;
- margin: 100rpx auto 0 auto;
- z-index: 2;
- position: relative;
- .item {
- width: 100%;
- height: 88rpx;
- background: #F5F5F5;
- border-radius: 45rpx;
- padding: 24rpx 48rpx;
- margin-bottom: 32rpx;
- input {
- width: 100%;
- height: 100%;
- font-size: 32rpx;
- }
- .placeholder {
- color: #BBBBBB;
- font-size: 28rpx;
- }
- input.codeIput {
- width: 300rpx;
- }
- .line {
- width: 2rpx;
- height: 28rpx;
- background: #CCCCCC;
- }
- .code {
- font-size: 28rpx;
- color: var(--view-theme);
- background-color: rgba(255, 255, 255, 0);
- }
- .code.on {
- color: #BBBBBB !important;
- }
- }
- .btn {
- width: 606rpx;
- height: 88rpx;
- background: var(--view-theme);
- border-radius: 200rpx 200rpx 200rpx 200rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 32rpx;
- font-family: PingFang SC-Regular, PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 44rpx;
- margin-top: 48rpx;
- letter-spacing: 1px;
- }
- }
- }
- .title-bar {
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 34rpx;
- font-weight: 500;
- color: #333333;
- line-height: 48rpx;
- }
- .icon {
- position: absolute;
- left: 30rpx;
- top: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 80rpx;
- height: 80rpx;
- image {
- width: 35rpx;
- height: 35rpx;
- }
- }
- </style>
|