Jacob
2026-10-12 486450d6a4a0cc1b7de4c053cf561e54b7aafc85
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<template>
   <div class="register absolute">
       <div class="shading">
           <div class="pictrue acea-row row-center-wrapper">
               <image src="https://ossacmall.bluedeer.com.cn/app/static/images/logo2.png" />
           </div>
       </div>
       <div class="whiteBg">
           <div class="title">找回密码</div>
           <div class="list">
               <div class="item">
                   <div class="acea-row row-middle">
                       <image src="https://ossacmall.bluedeer.com.cn/app/static/images/phone_1.png"></image>
                       <input type="text" placeholder="输入手机号码" v-model="account" />
                   </div>
               </div>
               <div class="item">
 
                   <div class="acea-row row-middle">
                       <image src="https://ossacmall.bluedeer.com.cn/app/static/images/code_2.png"></image>
                       <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
                       <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
                           {{ text }}
                       </button>
                   </div>
               </div>
               <div class="item">
                   <div class="acea-row row-middle">
                       <image src="https://ossacmall.bluedeer.com.cn/app/static/images/code_2.png"></image>
                       <input type="password" placeholder="填写您的新密码" v-model="password" />
                   </div>
               </div>
               <div class="item" v-if="isShowCode">
                   <div class="align-left">
                       <input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
                       <div class="code" @click="again"><img :src="codeUrl" /></div>
                   </div>
               </div>
           </div>
           <div class="logon" @click="registerReset">确认</div>
           <div class="tip">
               <span class="font-color-red" @click="back">立即登录</span>
           </div>
       </div>
       <div class="bottom"></div>
   </div>
</template>
 
<script>
   import sendVerifyCode from "@/mixins/SendVerifyCode";
   import {
       registerVerify,
       registerReset,
       getCodeApi
   } from "@/api/user";
   // import { validatorDefaultCatch } from "@/utils/dialog";
   // import attrs, { required, alpha_num, chs_phone } from "@utils/validate";
   // import { VUE_APP_API_URL } from "@utils";
 
   export default {
       name: "RetrievePassword",
       data: function() {
           return {
               account: "",
               password: "",
               captcha: "",
               keyCode: "",
               codeUrl: "",
               codeVal: "",
               isShowCode: false
           };
       },
       mixins: [sendVerifyCode],
       mounted: function() {
           this.getCode();
       },
       methods: {
           back() {
               uni.navigateBack();
           },
           again() {
               this.codeUrl =
                   VUE_APP_API_URL + "/captcha?" + this.keyCode + Date.parse(new Date());
           },
           getCode() {
               getCodeApi()
                   .then(res => {
                       this.keyCode = res.data.key;
                   })
                   .catch(err => {
                       this.$dialog.error((err&&err.message)?err.message:err);
                   });
           },
           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: '请填写验证码'
               });
               registerReset({
                       account: that.account,
                       captcha: that.captcha,
                       password: that.password,
                       code: that.codeVal
                   })
                   .then(res => {
                       that.$util.Tips({
                           title: res.message
                       }, {
                           tab: 3
                       })
                   })
                   .catch(err => {
                       that.$util.Tips({
                           title: (err&&err.message)?err.message:err
                       })
                   });
           },
           async code() {
               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: '请输入正确的手机号码'
               });
               if (that.formItem == 2) that.type = "register";
               await registerVerify({
                       phone: that.account,
                       type: that.type,
                       key: that.keyCode,
                       code: that.codeVal
                   })
                   .then(res => {
                       that.$dialog.success(res.message);
                       that.sendCode();
                   })
                   .catch(err => {
                       // if (res.data.status === 402) {
                       //     that.codeUrl = `${VUE_APP_API_URL}/sms_captcha?key=${that.keyCode}`;
                       //     that.isShowCode = true;
                       // }
                       that.$util.Tips({
                           title: (err&&err.message)?err.message:err
                       });
                   });
           },
       }
   };
</script>
<style scoped>
   .code img {
       width: 100%;
       height: 100%;
   }
</style>