Procházet zdrojové kódy

解决图片上传问题

李帅 před 2 měsíci
rodič
revize
736dd8d781

+ 3 - 0
.env.development

@@ -10,6 +10,9 @@ ENV = 'development'
10 10
 VUE_APP_BASE_API = 'http://192.168.3.142:8080/api'
11 11
 VUE_APP_BASE_WSS = 'ws://192.168.3.142:8002/ws'
12 12
 
13
+# VUE_APP_BASE_API = 'http://106.74.15.131:81/api'
14
+# VUE_APP_BASE_WSS = 'ws://106.74.15.131:81/ws'
15
+
13 16
 # VUE_APP_BASE_API = 'http://192.168.3.21:8080/api'
14 17
 # VUE_APP_BASE_API = 'http://39.106.66.72/api'
15 18
 

+ 1 - 1
src/api/system/user.js

@@ -115,7 +115,7 @@ export function upload(data) {
115 115
   return request({
116 116
     url: '/common/upload',
117 117
     method: 'post',
118
-    data: cyptoTool.methods.encrypt(JSON.stringify(data))
118
+    data
119 119
   })
120 120
 }
121 121
 

+ 7 - 2
src/store/modules/user.js

@@ -57,9 +57,14 @@ const user = {
57 57
 
58 58
       return new Promise((resolve, reject) => {
59 59
         login(username, password, code, uuid).then(res => {
60
-          setToken(res.token)
61
-          commit('SET_TOKEN', res.token)
60
+          if(res.token){
61
+           setToken(res.token)
62
+           commit('SET_TOKEN', res.token)
63
+           resolve()
64
+         }else {
62 65
           resolve()
66
+          return false
67
+         }
63 68
         }).catch(error => {
64 69
           reject(error)
65 70
         })

+ 4 - 0
src/utils/request.js

@@ -130,6 +130,10 @@ service.interceptors.response.use(res => {
130 130
       if(res.data.msg && res.data.msg ==="退出成功"){
131 131
         return res.data
132 132
       } else {
133
+        if(JSON.parse(cyptoTool.methods.decrypt(res.data)).code === 500) {
134
+          JSON.parse(cyptoTool.methods.decrypt(res.data)) 
135
+          return Message.error(JSON.parse(cyptoTool.methods.decrypt(res.data)).msg)
136
+        }
133 137
         return  JSON.parse(cyptoTool.methods.decrypt(res.data)) 
134 138
       }
135 139
     }

+ 4 - 0
src/views/login.vue

@@ -195,6 +195,10 @@ export default {
195 195
             .dispatch('Login', this.loginForm)
196 196
             .then(() => {
197 197
               this.$router.push({ path: this.redirect || '/' }).catch(() => {})
198
+              if (this.captchaEnabled) {
199
+                this.loading = false
200
+                this.getCode()
201
+              }
198 202
             })
199 203
             .catch(() => {
200 204
               this.loading = false