GivenSir 4 gadi atpakaļ
vecāks
revīzija
cf95e7d5e4
4 mainītis faili ar 49 papildinājumiem un 39 dzēšanām
  1. 1 2
      src/store/modules/common.js
  2. 23 10
      src/views/login/index.vue
  3. 14 16
      src/views/recharge/index.vue
  4. 11 11
      vue.config.js

+ 1 - 2
src/store/modules/common.js

@@ -5,8 +5,7 @@ const actions = {
   getSmsCode({ commit }, mobile) {
     return new Promise((resolve, reject) => {
       getSmsCode({ tel: mobile, type: 3 }).then(response => {
-        const { message } = response
-        resolve(message)
+        resolve(response)
       }).catch(error => {
         reject(error)
       })

+ 23 - 10
src/views/login/index.vue

@@ -127,16 +127,24 @@ export default {
   methods: {
     // 获取验证码
     getCode() {
-      this.$store.dispatch('common/getSmsCode', this.loginForm.mobile).then(() => {
-        this.times = 10
-        this.times_show = false
-        this.timer = setInterval(() => {
-          this.times--
-          if (this.times === 0) {
-            this.times_show = true
-            clearInterval(this.timer)
-          }
-        }, 1000)
+      this.$store.dispatch('common/getSmsCode', this.loginForm.mobile).then((res) => {
+        const { code, message } = res
+        if (code === 200) {
+          this.times = 10
+          this.times_show = false
+          this.timer = setInterval(() => {
+            this.times--
+            if (this.times === 0) {
+              this.times_show = true
+              clearInterval(this.timer)
+            }
+          }, 1000)
+        }
+        return Message({
+          message: message,
+          type: 'warning',
+          duration: 5 * 1000
+        })
       }).catch((error) => {
         return Message({
           message: error.message,
@@ -153,6 +161,11 @@ export default {
           this.$store.dispatch('user/login', this.loginForm).then((res) => {
             const { code, message } = res
             if (code === 200) {
+              Message({
+                message: message,
+                type: 'warning',
+                duration: 5 * 1000
+              })
               this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
             } else {
               Message({

+ 14 - 16
src/views/recharge/index.vue

@@ -316,6 +316,12 @@ export default {
             confirmButtonText: '确认',
             cancelButtonText: '取消'
           }).then(({ value }) => {
+            // 遮屏
+            this.loading = Loading.service({
+              lock: true,
+              text: '处理中, 请稍等...',
+              background: 'rgba(0, 0, 0, 0.7)'
+            })
             this.sublmeRecharge(accountLists, value)
           }).catch(() => {
             return Message({
@@ -354,13 +360,6 @@ export default {
                 this.thenAccountNum++
 
                 if (loadingNum > 1) {
-                  // 遮屏
-                  this.loading = Loading.service({
-                    lock: true,
-                    text: '处理中, 请稍等...',
-                    background: 'rgba(0, 0, 0, 0.7)'
-                  })
-
                   // 成功后处理剩下账号数据
                   accountLists = LodashArray.drop(accountLists) // 删除第一个账户
                   accountLists.forEach(async(item, index) => {
@@ -376,6 +375,7 @@ export default {
                 this.catchAccount = this.catchAccount + oneAccount + '\n'
                 this.catchAccountNum++
 
+                this.cloneLoading()
                 return Message({
                   type: 'warning',
                   message: message
@@ -385,6 +385,7 @@ export default {
               this.catchAccount = this.catchAccount + oneAccount + '\n'
               this.catchAccountNum++
 
+              this.cloneLoading()
               return Message({
                 type: 'error',
                 message: error.message
@@ -394,7 +395,8 @@ export default {
             this.noExistence = this.noExistence + oneAccount + '\n'
             this.noExistenceNum++
 
-            Message({
+            this.cloneLoading()
+            return Message({
               type: 'error',
               message: '检测:' + message
             })
@@ -404,7 +406,8 @@ export default {
           this.catchAccount = this.catchAccount + oneAccount + '\n'
           this.catchAccountNum++
 
-          Message({
+          this.cloneLoading()
+          return Message({
             type: 'error',
             message: '检测:' + error.message
           })
@@ -417,13 +420,6 @@ export default {
             this.thenAccountNum++
 
             if (loadingNum > 1) {
-              // 遮屏
-              this.loading = Loading.service({
-                lock: true,
-                text: '处理中, 请稍等...',
-                background: 'rgba(0, 0, 0, 0.7)'
-              })
-
               // 成功后处理剩下账号数据
               accountLists = LodashArray.drop(accountLists) // 删除第一个账户
               accountLists.forEach(async(item, index) => {
@@ -439,6 +435,7 @@ export default {
             this.catchAccount = this.catchAccount + oneAccount + '\n'
             this.catchAccountNum++
 
+            this.cloneLoading()
             return Message({
               type: 'warning',
               message: message
@@ -448,6 +445,7 @@ export default {
           this.catchAccount = this.catchAccount + oneAccount + '\n'
           this.catchAccountNum++
 
+          this.cloneLoading()
           return Message({
             type: 'error',
             message: error.message

+ 11 - 11
vue.config.js

@@ -35,19 +35,19 @@ module.exports = {
     overlay: {
       warnings: true,
       errors: true
-    },
+    }
     // before: require('./mock/mock-server.js'),
 
-    proxy: {
-      [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
-        target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
-        changeOrigin: true, // 必须加上这个才能跨域请求
-        logLevel: 'debug',
-        pathRewrite: { // 重命名
-          ['^/' + process.env.VUE_APP_BASE_API]: ''
-        }
-      }
-    }
+    // proxy: {
+    //   [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
+    //     target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
+    //     changeOrigin: true, // 必须加上这个才能跨域请求
+    //     logLevel: 'debug',
+    //     pathRewrite: { // 重命名
+    //       ['^/' + process.env.VUE_APP_BASE_API]: ''
+    //     }
+    //   }
+    // }
   },
   configureWebpack: {
     // provide the app's title in webpack's name field, so that