瀏覽代碼

解决图片上传问题

李帅 1 月之前
父節點
當前提交
736dd8d781
共有 5 個文件被更改,包括 19 次插入3 次删除
  1. 3 0
      .env.development
  2. 1 1
      src/api/system/user.js
  3. 7 2
      src/store/modules/user.js
  4. 4 0
      src/utils/request.js
  5. 4 0
      src/views/login.vue

+ 3 - 0
.env.development

@@ -10,6 +10,9 @@ ENV = 'development'
10
 VUE_APP_BASE_API = 'http://192.168.3.142:8080/api'
10
 VUE_APP_BASE_API = 'http://192.168.3.142:8080/api'
11
 VUE_APP_BASE_WSS = 'ws://192.168.3.142:8002/ws'
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
 # VUE_APP_BASE_API = 'http://192.168.3.21:8080/api'
16
 # VUE_APP_BASE_API = 'http://192.168.3.21:8080/api'
14
 # VUE_APP_BASE_API = 'http://39.106.66.72/api'
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
   return request({
115
   return request({
116
     url: '/common/upload',
116
     url: '/common/upload',
117
     method: 'post',
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
       return new Promise((resolve, reject) => {
58
       return new Promise((resolve, reject) => {
59
         login(username, password, code, uuid).then(res => {
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
           resolve()
65
           resolve()
66
+          return false
67
+         }
63
         }).catch(error => {
68
         }).catch(error => {
64
           reject(error)
69
           reject(error)
65
         })
70
         })

+ 4 - 0
src/utils/request.js

@@ -130,6 +130,10 @@ service.interceptors.response.use(res => {
130
       if(res.data.msg && res.data.msg ==="退出成功"){
130
       if(res.data.msg && res.data.msg ==="退出成功"){
131
         return res.data
131
         return res.data
132
       } else {
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
         return  JSON.parse(cyptoTool.methods.decrypt(res.data)) 
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
             .dispatch('Login', this.loginForm)
195
             .dispatch('Login', this.loginForm)
196
             .then(() => {
196
             .then(() => {
197
               this.$router.push({ path: this.redirect || '/' }).catch(() => {})
197
               this.$router.push({ path: this.redirect || '/' }).catch(() => {})
198
+              if (this.captchaEnabled) {
199
+                this.loading = false
200
+                this.getCode()
201
+              }
198
             })
202
             })
199
             .catch(() => {
203
             .catch(() => {
200
               this.loading = false
204
               this.loading = false