no message
Showing
2 changed files
with
16 additions
and
13 deletions
... | @@ -31,7 +31,7 @@ Component({ | ... | @@ -31,7 +31,7 @@ Component({ |
31 | getUserInfo(e) { | 31 | getUserInfo(e) { |
32 | let _this = this; | 32 | let _this = this; |
33 | app.globalData.userInfo = e.userInfo; | 33 | app.globalData.userInfo = e.userInfo; |
34 | console.log("before register : code = ", app.store.getItem("wxcode") ) | 34 | console.log("before register : code = ", app.store.getItem("wxcode")) |
35 | app.post({ | 35 | app.post({ |
36 | url: app.api.register, | 36 | url: app.api.register, |
37 | sid: false, | 37 | sid: false, |
... | @@ -43,6 +43,13 @@ Component({ | ... | @@ -43,6 +43,13 @@ Component({ |
43 | } | 43 | } |
44 | }).then((res2) => { | 44 | }).then((res2) => { |
45 | wx.hideLoading(); | 45 | wx.hideLoading(); |
46 | if (res2 && res2.sessionId) { | ||
47 | app.store.setItem('sessionId', res2.sessionId); | ||
48 | // wx.showToast({ | ||
49 | // title: '授权成功', | ||
50 | // icon: 'none' | ||
51 | // }) | ||
52 | } | ||
46 | _this.hideMask(); | 53 | _this.hideMask(); |
47 | }).catch((err) => {}) | 54 | }).catch((err) => {}) |
48 | }, | 55 | }, | ... | ... |
... | @@ -3,21 +3,17 @@ let Store = require('./../utils/stroage'); | ... | @@ -3,21 +3,17 @@ let Store = require('./../utils/stroage'); |
3 | let Router = require('./../router/index'); | 3 | let Router = require('./../router/index'); |
4 | const errMsg = '服务异常,请稍后重试'; | 4 | const errMsg = '服务异常,请稍后重试'; |
5 | 5 | ||
6 | let isWxLogin = false; | 6 | // let isWxLogin = false; |
7 | 7 | ||
8 | function wxLogin() { | 8 | function wxLogin() { |
9 | return new Promise((resolve, reject) => { | 9 | return new Promise((resolve, reject) => { |
10 | if (isWxLogin) { | 10 | wx.login({ |
11 | resolve(); | 11 | success: function (res) { |
12 | } else { | 12 | // isWxLogin = true; |
13 | wx.login({ | 13 | Store.setItem('wxcode', res.code); |
14 | success: function (res) { | 14 | resolve(); |
15 | isWxLogin = true; | 15 | } |
16 | Store.setItem('wxcode', res.code); | 16 | }); |
17 | resolve(); | ||
18 | } | ||
19 | }); | ||
20 | } | ||
21 | }); | 17 | }); |
22 | } | 18 | } |
23 | 19 | ... | ... |
-
Please register or sign in to post a comment