USER-20230908AJ\Administrator před 10 měsíci
rodič
revize
982e1ff68e

+ 1 - 1
src/api/common.js

@@ -2,4 +2,4 @@ import request from '@/utils/request'
 
 
 //邮箱验证码发送
-export const sendEmail = (data) => request('api/common/send_email', 'post', data)
+export const sendEmail = (data) => request('api/common/send_email', 'post', data,true)

+ 7 - 7
src/utils/request.js

@@ -9,9 +9,9 @@ const service = axios.create({
 const lang = localStorage.getItem('lang') || 'cn'
 service.interceptors.request.use(
   config => {
-    // if (config.isLoading) {
-    //   startLoading()
-    // }
+    if (config.isLoading) {
+      startLoading()
+    }
     if (localStorage.getItem('userToken')) {
       config.headers.Authorization = localStorage.getItem('userToken')
     }
@@ -24,9 +24,9 @@ service.interceptors.request.use(
 
 service.interceptors.response.use(
   response => {
-    // if (response.config.isLoading) {
-    //   endLoading();
-    // }
+    if (response.config.isLoading) {
+      endLoading();
+    }
     const res = response.data
     if (res.code === 0) {
       // Message({
@@ -77,7 +77,7 @@ let loading
 function startLoading() {
   loading = Loading.service({
     lock: true,
-    text: '加载中',
+    text: 'loading...',
     background: 'rgba(0, 0, 0, 0.7)'
   })
 }

+ 1 - 1
src/views/Forestage/login/forget-password.vue

@@ -9,7 +9,7 @@
           <input type="text" :placeholder="$t('LoginIndex.syyxhm')" v-model="fromData.email">
           <div class="p-f">
             <input type="text" :placeholder="$t('LoginIndex.syyxyzm')" v-model="fromData.code">
-            <getCheckCode class="getCheckCode" :type="'retrieve'"></getCheckCode>
+            <getCheckCode :value="fromData.email" class="getCheckCode" :type="'retrieve'"></getCheckCode>
           </div>
 
           <input type="password" :placeholder="$t('LoginIndex.sdxmm')" v-model="fromData.pass">

+ 10 - 1
src/views/Forestage/login/module/getCheckCode.vue

@@ -24,7 +24,8 @@ export default {
           formData:{
             email:'',
             type:'', //login 登录  reset重置
-          }
+          },
+        isAjax:false
       }
     },
     mounted() {
@@ -41,6 +42,10 @@ export default {
     },
     methods:{
       getCode(){
+        if(this.isAjax){
+          return
+        }
+        this.isAjax=true
         sendEmail(this.formData).then((res)=>{
           if(res.code === 1){
             tools.success(res.msg)
@@ -51,8 +56,12 @@ export default {
               if (this.time===0) {
                 clearInterval(timer);
                 this.text = "";
+                this.isAjax=false
               }
             },1000);
+          }else {
+            tools.error(res.msg)
+            this.isAjax=false
           }
         })
       },