|
@@ -1,4 +1,5 @@
|
1
|
1
|
const app = getApp();
|
|
2
|
+const webSocket = require('../../../utils/websocket.js');
|
2
|
3
|
Page({
|
3
|
4
|
|
4
|
5
|
|
|
@@ -90,20 +91,29 @@ Page({
|
90
|
91
|
console.log(res.data);
|
91
|
92
|
// console.log(res.data.access_key);
|
92
|
93
|
// console.log(res.data.access_token);
|
|
94
|
+ webSocket.sendSocketMessage({
|
|
95
|
+ msg: JSON.stringify({
|
|
96
|
+ form_id: res.data.access_token,
|
|
97
|
+ type: 'login'
|
|
98
|
+ }),
|
|
99
|
+ success: function (e) {
|
|
100
|
+ console.log('socket登录成功');
|
|
101
|
+ }
|
|
102
|
+ })
|
|
103
|
+ // 全局同步传参
|
|
104
|
+ try {
|
|
105
|
+ wx.setStorageSync('access_key', res.data.access_key)
|
|
106
|
+ wx.setStorageSync('access_token', res.data.access_token)
|
|
107
|
+ wx.setStorageSync('access_user', res.data.access_user)
|
|
108
|
+ wx.setStorageSync('user', that.data.user)
|
|
109
|
+ } catch (e) {
|
93
|
110
|
|
|
111
|
+ }
|
94
|
112
|
wx.switchTab({ // 跳转首页
|
95
|
113
|
url: '/pages/index/index'
|
96
|
114
|
})
|
97
|
115
|
|
98
|
|
- // 全局同步传参
|
99
|
|
- try {
|
100
|
|
- wx.setStorageSync('access_key', res.data.access_key)
|
101
|
|
- wx.setStorageSync('access_token', res.data.access_token)
|
102
|
|
- wx.setStorageSync('access_user', res.data.access_user)
|
103
|
|
- wx.setStorageSync('user', that.data.user)
|
104
|
|
- } catch (e) {
|
105
|
|
-
|
106
|
|
- }
|
|
116
|
+
|
107
|
117
|
|
108
|
118
|
return;
|
109
|
119
|
|