Browse Source

修改登录

cr 4 years ago
parent
commit
de27a8efa5
4 changed files with 12 additions and 12 deletions
  1. 3 0
      releaselog.md
  2. 3 4
      src/common/api/ajax.js
  3. 5 7
      src/common/js/plugin.js
  4. 1 1
      src/pages/manage/index.vue

+ 3 - 0
releaselog.md

@@ -1,4 +1,7 @@
1 1
 
2
+# 0.2.7 (20.11.21 18:00)
3
+### 增加微信登录
4
+
2 5
 # 0.2.6 (20.11.20 18:00)
3 6
 ### 增加图表
4 7
 

+ 3 - 4
src/common/api/ajax.js

@@ -205,10 +205,9 @@ const http = {
205 205
                     data: fn.objSetKey(response.data.data, map, true),
206 206
                 }
207 207
             } else if (response.statusCode === 401) {
208
-                // await plugin.getToken()
209
-                // data = await self.ajax(request[0], request[1], request[2], request[3])
210
-                router.replace('/pages/index/login');
211
-                return;
208
+                await plugin.getToken()
209
+                data = await self.ajax(request[0], request[1], request[2], request[3])
210
+                // router.replace('/pages/index/login');
212 211
             } else {
213 212
                 console.error(response.data)
214 213
             }

+ 5 - 7
src/common/js/plugin.js

@@ -251,16 +251,14 @@ export default {
251 251
             uni.login({
252 252
                 provider: 'weixin',
253 253
                 success: async result => {
254
-                    api.get('/Login/RefreshToken', {
254
+                    api.post('/Login/Login', {
255 255
                         code: result.code,
256 256
                         appId: config.appId,
257 257
                     }).then(res => {
258
-                        let token = res.data.tokenStr
259
-
260
-                        if (token) {
261
-                            store.commit('user/update', {
262
-                                token: token,
263
-                            })
258
+                        if (res.success) {
259
+                            store.commit("user/login", res.data);
260
+                        }else{
261
+                            router.replace('/pages/index/login');
264 262
                         }
265 263
 
266 264
                         resolve()

+ 1 - 1
src/pages/manage/index.vue

@@ -55,7 +55,7 @@
55 55
 
56 56
         <button class="btn" @click="layout">退出登录</button>
57 57
 
58
-        <div class="ver">0.2.62</div>
58
+        <div class="ver">0.2.7</div>
59 59
     </div>
60 60
 </template>
61 61