no message
Showing
2 changed files
with
10 additions
and
7 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) { | ||
11 | resolve(); | ||
12 | } else { | ||
13 | wx.login({ | 10 | wx.login({ |
14 | success: function (res) { | 11 | success: function (res) { |
15 | isWxLogin = true; | 12 | // isWxLogin = true; |
16 | Store.setItem('wxcode', res.code); | 13 | Store.setItem('wxcode', res.code); |
17 | resolve(); | 14 | resolve(); |
18 | } | 15 | } |
19 | }); | 16 | }); |
20 | } | ||
21 | }); | 17 | }); |
22 | } | 18 | } |
23 | 19 | ... | ... |
-
Please register or sign in to post a comment