cr преди 4 години
родител
ревизия
de27a8efa5
променени са 4 файла, в които са добавени 12 реда и са изтрити 12 реда
  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
 # 0.2.6 (20.11.20 18:00)
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
                     data: fn.objSetKey(response.data.data, map, true),
205
                     data: fn.objSetKey(response.data.data, map, true),
206
                 }
206
                 }
207
             } else if (response.statusCode === 401) {
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
             } else {
211
             } else {
213
                 console.error(response.data)
212
                 console.error(response.data)
214
             }
213
             }

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

@@ -251,16 +251,14 @@ export default {
251
             uni.login({
251
             uni.login({
252
                 provider: 'weixin',
252
                 provider: 'weixin',
253
                 success: async result => {
253
                 success: async result => {
254
-                    api.get('/Login/RefreshToken', {
254
+                    api.post('/Login/Login', {
255
                         code: result.code,
255
                         code: result.code,
256
                         appId: config.appId,
256
                         appId: config.appId,
257
                     }).then(res => {
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
                         resolve()
264
                         resolve()

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

@@ -55,7 +55,7 @@
55
 
55
 
56
         <button class="btn" @click="layout">退出登录</button>
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
     </div>
59
     </div>
60
 </template>
60
 </template>
61
 
61