|
|
@@ -1,245 +1,269 @@
|
|
1
|
1
|
import {
|
|
2
|
|
- selectMerchant,
|
|
3
|
|
- queryStoreBranch,
|
|
4
|
|
- getImUser
|
|
5
|
|
-} from '@/commit/api.js'
|
|
|
2
|
+ selectMerchant,
|
|
|
3
|
+ queryStoreBranch,
|
|
|
4
|
+ getImUser
|
|
|
5
|
+} from "@/commit/api.js";
|
|
6
|
6
|
import {
|
|
7
|
|
- emConnect,
|
|
8
|
|
-} from '@/EaseIM/emApis';
|
|
9
|
|
-import loginStore from '@/store/modules/login.js';
|
|
|
7
|
+ getPhpGlobalToken
|
|
|
8
|
+} from "@/commit/order.js";
|
|
|
9
|
+import { emConnect } from "@/EaseIM/emApis";
|
|
|
10
|
+import loginStore from "@/store/modules/login.js";
|
|
10
|
11
|
|
|
11
|
|
-
|
|
12
|
|
-const {
|
|
13
|
|
- loginWithPassword
|
|
14
|
|
-} = emConnect();
|
|
|
12
|
+const { loginWithPassword } = emConnect();
|
|
15
|
13
|
|
|
16
|
14
|
const setEMUserLoginInfosToStorage = (userId, token) => {
|
|
17
|
|
- const params = {
|
|
18
|
|
- key: `EM_LOGIN_INFOS`,
|
|
19
|
|
- data: {
|
|
20
|
|
- userId: userId,
|
|
21
|
|
- token: token
|
|
22
|
|
- },
|
|
23
|
|
- };
|
|
24
|
|
- uni.setStorage({
|
|
25
|
|
- ...params
|
|
26
|
|
- });
|
|
27
|
|
-}
|
|
|
15
|
+ const params = {
|
|
|
16
|
+ key: `EM_LOGIN_INFOS`,
|
|
|
17
|
+ data: {
|
|
|
18
|
+ userId: userId,
|
|
|
19
|
+ token: token
|
|
|
20
|
+ }
|
|
|
21
|
+ };
|
|
|
22
|
+ uni.setStorage({
|
|
|
23
|
+ ...params
|
|
|
24
|
+ });
|
|
|
25
|
+};
|
|
28
|
26
|
|
|
29
|
27
|
const loginWithUserId = async () => {
|
|
30
|
|
- let loginEaseIMId = uni.getStorageSync('im_userid')
|
|
31
|
|
- try {
|
|
32
|
|
- const res = await loginWithPassword(
|
|
33
|
|
- loginEaseIMId,
|
|
34
|
|
- uni.getStorageSync('im_pass')
|
|
35
|
|
- );
|
|
36
|
|
- loginStore.mutations['SET_LOGIN_USER_BASE_INFOS']({
|
|
37
|
|
- loginUserId: loginEaseIMId,
|
|
38
|
|
- });
|
|
39
|
|
- setEMUserLoginInfosToStorage(
|
|
40
|
|
- loginEaseIMId.toLowerCase(),
|
|
41
|
|
- res.accessToken
|
|
42
|
|
- //注意:res.accessToken
|
|
43
|
|
- );
|
|
44
|
|
- } catch (error) {
|
|
45
|
|
- console.log('>>>>>>', error);
|
|
46
|
|
- uni.showToast({
|
|
47
|
|
- title: '登录失败',
|
|
48
|
|
- icon: 'none',
|
|
49
|
|
- });
|
|
50
|
|
- } finally {
|
|
51
|
|
- loginEaseIMId = '';
|
|
52
|
|
- }
|
|
53
|
|
-}
|
|
|
28
|
+ let loginEaseIMId = uni.getStorageSync("im_userid");
|
|
|
29
|
+ try {
|
|
|
30
|
+ const res = await loginWithPassword(
|
|
|
31
|
+ loginEaseIMId,
|
|
|
32
|
+ uni.getStorageSync("im_pass")
|
|
|
33
|
+ );
|
|
|
34
|
+ loginStore.mutations["SET_LOGIN_USER_BASE_INFOS"]({
|
|
|
35
|
+ loginUserId: loginEaseIMId
|
|
|
36
|
+ });
|
|
|
37
|
+ setEMUserLoginInfosToStorage(
|
|
|
38
|
+ loginEaseIMId.toLowerCase(),
|
|
|
39
|
+ res.accessToken
|
|
|
40
|
+ //注意:res.accessToken
|
|
|
41
|
+ );
|
|
|
42
|
+ } catch (error) {
|
|
|
43
|
+ console.log(">>>>>>", error);
|
|
|
44
|
+ uni.showToast({
|
|
|
45
|
+ title: "登录失败",
|
|
|
46
|
+ icon: "none"
|
|
|
47
|
+ });
|
|
|
48
|
+ } finally {
|
|
|
49
|
+ loginEaseIMId = "";
|
|
|
50
|
+ }
|
|
|
51
|
+};
|
|
54
|
52
|
|
|
55
|
53
|
const llwFunc = async () => {
|
|
56
|
|
- //lww
|
|
57
|
|
- let storeStaff = uni.getStorageSync('storeStaff')
|
|
58
|
|
- if (storeStaff != null) {
|
|
59
|
|
- const res = await queryStoreBranch({
|
|
60
|
|
- id: storeStaff.department
|
|
61
|
|
- })
|
|
62
|
|
- if (res.data.status == 200) {
|
|
63
|
|
- uni.setStorageSync('jurisdiction', paramsData.jurisdiction);
|
|
64
|
|
- }
|
|
65
|
|
- } else {
|
|
66
|
|
- uni.setStorageSync('jurisdiction', [7, 9, 5, 3]);
|
|
67
|
|
- }
|
|
68
|
|
-
|
|
69
|
|
- // TODO 需要明确含义,目前逻辑是undifined
|
|
70
|
|
- let type;
|
|
71
|
|
-
|
|
72
|
|
- if (type == 1) {
|
|
73
|
|
- console.log('返回上一页')
|
|
74
|
|
- uni.navigateBack({
|
|
75
|
|
- delta: 1
|
|
76
|
|
- })
|
|
77
|
|
- } else {
|
|
78
|
|
- uni.switchTab({
|
|
79
|
|
- url: '../pages/cashier/index'
|
|
80
|
|
- });
|
|
81
|
|
- }
|
|
82
|
|
-}
|
|
|
54
|
+ //lww
|
|
|
55
|
+ let storeStaff = uni.getStorageSync("storeStaff");
|
|
|
56
|
+ if (storeStaff != null) {
|
|
|
57
|
+ const res = await queryStoreBranch({
|
|
|
58
|
+ id: storeStaff.department
|
|
|
59
|
+ });
|
|
|
60
|
+ if (res.data.status == 200) {
|
|
|
61
|
+ uni.setStorageSync("jurisdiction", paramsData.jurisdiction);
|
|
|
62
|
+ }
|
|
|
63
|
+ } else {
|
|
|
64
|
+ uni.setStorageSync("jurisdiction", [7, 9, 5, 3]);
|
|
|
65
|
+ }
|
|
|
66
|
+
|
|
|
67
|
+ // TODO 需要明确含义,目前逻辑是undifined
|
|
|
68
|
+ let type;
|
|
|
69
|
+
|
|
|
70
|
+ if (type == 1) {
|
|
|
71
|
+ console.log("返回上一页");
|
|
|
72
|
+ uni.navigateBack({
|
|
|
73
|
+ delta: 1
|
|
|
74
|
+ });
|
|
|
75
|
+ } else {
|
|
|
76
|
+ uni.switchTab({
|
|
|
77
|
+ url: "../pages/cashier/index"
|
|
|
78
|
+ });
|
|
|
79
|
+ }
|
|
|
80
|
+};
|
|
83
|
81
|
|
|
84
|
82
|
const readQuery = () => {
|
|
85
|
|
- const hash = window.location.hash; // 例如:#/?param1=value1¶m2=value2
|
|
|
83
|
+ const hash = window.location.hash; // 例如:#/?param1=value1¶m2=value2
|
|
86
|
84
|
|
|
87
|
|
- // 检查 hash 是否为空
|
|
88
|
|
- if (hash) {
|
|
89
|
|
- // 创建一个 URLSearchParams 实例
|
|
90
|
|
- const queryString = hash.split('?')[1]; // 获取 '?' 后面的部分
|
|
91
|
|
- const params = new URLSearchParams(queryString);
|
|
|
85
|
+ // 检查 hash 是否为空
|
|
|
86
|
+ if (hash) {
|
|
|
87
|
+ // 创建一个 URLSearchParams 实例
|
|
|
88
|
+ const queryString = hash.split("?")[1]; // 获取 '?' 后面的部分
|
|
|
89
|
+ const params = new URLSearchParams(queryString);
|
|
92
|
90
|
|
|
93
|
|
- return JSON.parse(decodeURIComponent(params.get('data')))
|
|
94
|
|
- }
|
|
95
|
|
-}
|
|
|
91
|
+ return JSON.parse(decodeURIComponent(params.get("data")));
|
|
|
92
|
+ }
|
|
|
93
|
+};
|
|
96
|
94
|
|
|
97
|
95
|
const func = async () => {
|
|
98
|
|
- try {
|
|
99
|
|
- const paramsData = readQuery()
|
|
100
|
|
- if(!paramsData) {
|
|
101
|
|
- return;
|
|
102
|
|
- }
|
|
103
|
|
-
|
|
104
|
|
- console.log('%c [ 1. 读取url登录信息url参数 ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', paramsData)
|
|
105
|
|
-
|
|
106
|
|
- const paramsData1 = {
|
|
107
|
|
- "storeStaff": null,
|
|
108
|
|
- "x_token": "MTYzMzYxODYzMjY4MTA0NTIwMjUtMDEtMDYgYXQgMjI6MDA6MDkgQ1NU",
|
|
109
|
|
- "user": {
|
|
110
|
|
- "uid": 16336,
|
|
111
|
|
- "wechat_user_id": "0",
|
|
112
|
|
- "ali_user_id": "0",
|
|
113
|
|
- "account": "18632681045",
|
|
114
|
|
- "real_name": "",
|
|
115
|
|
- "label_id": null,
|
|
116
|
|
- "group_id": "11",
|
|
117
|
|
- "nickname": "用户1045",
|
|
118
|
|
- "avatar": "https://app.bjtdba.com/uploads/logo.jpg",
|
|
119
|
|
- "phone": "18632681045",
|
|
120
|
|
- "now_score": null,
|
|
121
|
|
- "score": 0,
|
|
122
|
|
- "now_money": 0,
|
|
123
|
|
- "brokerage_price": 0,
|
|
124
|
|
- "admin_agent_rate": null,
|
|
125
|
|
- "locktime": null,
|
|
126
|
|
- "user_number": null,
|
|
127
|
|
- "im": 0,
|
|
128
|
|
- "im_uuid": null,
|
|
129
|
|
- "last_ip": "20.100.5.11",
|
|
130
|
|
- "identity": 5,
|
|
131
|
|
- "spreadUid": null,
|
|
132
|
|
- "user_type": "MP",
|
|
133
|
|
- "pwd": "$2y$10$XARVMD82YRAl9NMwzLcrKeSozdzlnUj7IXp2dvPGYGobzYFlf0j5K",
|
|
134
|
|
- "mer_id": 0,
|
|
135
|
|
- "spread_count": 0,
|
|
136
|
|
- "first_sign": 0
|
|
137
|
|
- }
|
|
138
|
|
- }
|
|
139
|
|
-
|
|
140
|
|
- uni.setStorageSync('userinfo', paramsData.user);
|
|
141
|
|
- uni.setStorageSync('authorization', paramsData.x_token);
|
|
142
|
|
- uni.setStorageSync('storeStaff', paramsData.storeStaff);
|
|
143
|
|
-
|
|
144
|
|
- // 用户状态判断
|
|
145
|
|
- const userInfoData = await selectMerchant({
|
|
146
|
|
- uid: paramsData.user.uid
|
|
147
|
|
- });
|
|
148
|
|
-
|
|
149
|
|
- console.log('%c [ 2. 获取用户信息 ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', userInfoData)
|
|
150
|
|
-
|
|
151
|
|
- if(userInfoData.data.status === 200) {
|
|
152
|
|
- // 新逻辑
|
|
153
|
|
- uni.setStorageSync('selectmerchant', userInfoData.data.data);
|
|
154
|
|
- let storeStaff = uni.getStorageSync('storeStaff')
|
|
155
|
|
- console.log('%c [ storeStaff ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', storeStaff, storeStaff != null)
|
|
156
|
|
- console.log('%c [ 本地存储用户信息 userInfo ]-4', 'font-size:13px; background:pink; color:#bf2c9f;', uni.getStorageSync('userinfo'))
|
|
157
|
|
- localStorage.setItem('aaa', '33333')
|
|
158
|
|
- console.log('读原生的', localStorage.getItem('aaa'))
|
|
159
|
|
-
|
|
160
|
|
- if (storeStaff) {
|
|
161
|
|
- queryStoreBranch({
|
|
162
|
|
- id: storeStaff.department
|
|
163
|
|
- }).then(res => {
|
|
164
|
|
- if (res.data.status == 200) {
|
|
165
|
|
- uni.setStorageSync('jurisdiction', res.data.data.jurisdiction);
|
|
166
|
|
- }
|
|
167
|
|
- })
|
|
168
|
|
- } else {
|
|
169
|
|
- uni.setStorageSync('jurisdiction', [7, 9, 5, 3]);
|
|
170
|
|
- }
|
|
171
|
|
- // uni.showToast({
|
|
172
|
|
- // title: res.data.message,
|
|
173
|
|
- // icon: "none"
|
|
174
|
|
- // })
|
|
175
|
|
- setTimeout(function() {
|
|
176
|
|
- console.log('%c [ 3. 获取用户信息成功,跳转页面 ]-4', 'font-size:13px; background:pink; color:#bf2c9f;')
|
|
177
|
|
- uni.switchTab({
|
|
178
|
|
- url: '../../cashier/index'
|
|
179
|
|
- });
|
|
180
|
|
- }, 700);
|
|
181
|
|
- }
|
|
182
|
|
-
|
|
183
|
|
-
|
|
184
|
|
-
|
|
185
|
|
-
|
|
186
|
|
- return;
|
|
187
|
|
- // 之前的逻辑
|
|
188
|
|
-
|
|
189
|
|
- uni.setStorageSync('selectmerchant', data.data.data);
|
|
190
|
|
-
|
|
191
|
|
- const {
|
|
192
|
|
- merchantIntention = {},
|
|
193
|
|
- } = userInfoData.data.data || {};
|
|
194
|
|
-
|
|
195
|
|
- uni.setStorage({
|
|
196
|
|
- key: 'myUsername',
|
|
197
|
|
- data: JSON.stringify(uni.getStorageSync('userinfo').uid),
|
|
198
|
|
- });
|
|
199
|
|
- uni.setStorage({
|
|
200
|
|
- key: 'mer_id',
|
|
201
|
|
- data: merchantIntention.mer_id,
|
|
202
|
|
- });
|
|
203
|
|
-
|
|
204
|
|
- if (userInfoData.data.status == 200) {
|
|
205
|
|
- uni.setStorageSync('selectmerchant', userInfoData.data.data);
|
|
206
|
|
-
|
|
207
|
|
- const imUserData = await getImUser({
|
|
208
|
|
- mer_id: uni.getStorageSync('mer_id'),
|
|
209
|
|
- });
|
|
210
|
|
- // actionEMReconnect();
|
|
211
|
|
- const {
|
|
212
|
|
- loginWithPassword
|
|
213
|
|
- } = emConnect();
|
|
214
|
|
- uni.setStorage({
|
|
215
|
|
- key: 'im_userid',
|
|
216
|
|
- data: imUserData.data.data.im_userid
|
|
217
|
|
- })
|
|
218
|
|
- uni.setStorage({
|
|
219
|
|
- key: 'im_pass',
|
|
220
|
|
- data: imUserData.data.data.im_pass
|
|
221
|
|
- })
|
|
222
|
|
- uni.setStorage({
|
|
223
|
|
- key: 'im_uuid',
|
|
224
|
|
- data: imUserData.data.data.im_uuid
|
|
225
|
|
- })
|
|
226
|
|
- //环信注册成功 登录
|
|
227
|
|
- if (imUserData.data.status == 200) {
|
|
228
|
|
- console.log('>>>>>>>>环信注册成功 登录')
|
|
229
|
|
- await loginWithUserId()
|
|
230
|
|
- }
|
|
231
|
|
-
|
|
232
|
|
-
|
|
233
|
|
-
|
|
234
|
|
- await llwFunc();
|
|
235
|
|
-
|
|
236
|
|
- }
|
|
237
|
|
- } catch (error) {
|
|
238
|
|
- console.error(error);
|
|
239
|
|
- //TODO handle the exception
|
|
240
|
|
- }
|
|
|
96
|
+ try {
|
|
|
97
|
+ const paramsData = readQuery();
|
|
|
98
|
+ if (!paramsData) {
|
|
|
99
|
+ return;
|
|
|
100
|
+ }
|
|
|
101
|
+
|
|
|
102
|
+ console.log(
|
|
|
103
|
+ "%c [ 1. 读取url登录信息url参数 ]-4",
|
|
|
104
|
+ "font-size:13px; background:pink; color:#bf2c9f;",
|
|
|
105
|
+ paramsData
|
|
|
106
|
+ );
|
|
|
107
|
+
|
|
|
108
|
+ const paramsData1 = {
|
|
|
109
|
+ storeStaff: null,
|
|
|
110
|
+ x_token: "MTYzMzYxODYzMjY4MTA0NTIwMjUtMDEtMDYgYXQgMjI6MDA6MDkgQ1NU",
|
|
|
111
|
+ user: {
|
|
|
112
|
+ uid: 16336,
|
|
|
113
|
+ wechat_user_id: "0",
|
|
|
114
|
+ ali_user_id: "0",
|
|
|
115
|
+ account: "18632681045",
|
|
|
116
|
+ real_name: "",
|
|
|
117
|
+ label_id: null,
|
|
|
118
|
+ group_id: "11",
|
|
|
119
|
+ nickname: "用户1045",
|
|
|
120
|
+ avatar: "https://app.bjtdba.com/uploads/logo.jpg",
|
|
|
121
|
+ phone: "18632681045",
|
|
|
122
|
+ now_score: null,
|
|
|
123
|
+ score: 0,
|
|
|
124
|
+ now_money: 0,
|
|
|
125
|
+ brokerage_price: 0,
|
|
|
126
|
+ admin_agent_rate: null,
|
|
|
127
|
+ locktime: null,
|
|
|
128
|
+ user_number: null,
|
|
|
129
|
+ im: 0,
|
|
|
130
|
+ im_uuid: null,
|
|
|
131
|
+ last_ip: "20.100.5.11",
|
|
|
132
|
+ identity: 5,
|
|
|
133
|
+ spreadUid: null,
|
|
|
134
|
+ user_type: "MP",
|
|
|
135
|
+ pwd: "$2y$10$XARVMD82YRAl9NMwzLcrKeSozdzlnUj7IXp2dvPGYGobzYFlf0j5K",
|
|
|
136
|
+ mer_id: 0,
|
|
|
137
|
+ spread_count: 0,
|
|
|
138
|
+ first_sign: 0
|
|
|
139
|
+ }
|
|
|
140
|
+ };
|
|
|
141
|
+
|
|
|
142
|
+ uni.setStorageSync("userinfo", paramsData.user);
|
|
|
143
|
+ uni.setStorageSync("authorization", paramsData.x_token);
|
|
|
144
|
+ uni.setStorageSync("storeStaff", paramsData.storeStaff);
|
|
|
145
|
+
|
|
|
146
|
+ // 用户状态判断
|
|
|
147
|
+ const userInfoData = await selectMerchant({
|
|
|
148
|
+ uid: paramsData.user.uid
|
|
|
149
|
+ });
|
|
|
150
|
+
|
|
|
151
|
+ console.log(
|
|
|
152
|
+ "%c [ 2. 获取用户信息 ]-4",
|
|
|
153
|
+ "font-size:13px; background:pink; color:#bf2c9f;",
|
|
|
154
|
+ userInfoData
|
|
|
155
|
+ );
|
|
|
156
|
+
|
|
|
157
|
+ if (userInfoData.data.status === 200) {
|
|
|
158
|
+ // 新逻辑
|
|
|
159
|
+ uni.setStorageSync("selectmerchant", userInfoData.data.data);
|
|
|
160
|
+ let storeStaff = uni.getStorageSync("storeStaff");
|
|
|
161
|
+ console.log(
|
|
|
162
|
+ "%c [ storeStaff ]-4",
|
|
|
163
|
+ "font-size:13px; background:pink; color:#bf2c9f;",
|
|
|
164
|
+ storeStaff,
|
|
|
165
|
+ storeStaff != null
|
|
|
166
|
+ );
|
|
|
167
|
+ console.log(
|
|
|
168
|
+ "%c [ 本地存储用户信息 userInfo ]-4",
|
|
|
169
|
+ "font-size:13px; background:pink; color:#bf2c9f;",
|
|
|
170
|
+ uni.getStorageSync("userinfo")
|
|
|
171
|
+ );
|
|
|
172
|
+ localStorage.setItem("aaa", "33333");
|
|
|
173
|
+ console.log("读原生的", localStorage.getItem("aaa"));
|
|
|
174
|
+
|
|
|
175
|
+ if (storeStaff) {
|
|
|
176
|
+ queryStoreBranch({
|
|
|
177
|
+ id: storeStaff.department
|
|
|
178
|
+ }).then((res) => {
|
|
|
179
|
+ if (res.data.status == 200) {
|
|
|
180
|
+ uni.setStorageSync("jurisdiction", res.data.data.jurisdiction);
|
|
|
181
|
+ }
|
|
|
182
|
+ });
|
|
|
183
|
+ } else {
|
|
|
184
|
+ uni.setStorageSync("jurisdiction", [7, 9, 5, 3]);
|
|
|
185
|
+ }
|
|
|
186
|
+ // uni.showToast({
|
|
|
187
|
+ // title: res.data.message,
|
|
|
188
|
+ // icon: "none"
|
|
|
189
|
+ // })
|
|
|
190
|
+ setTimeout(function () {
|
|
|
191
|
+ console.log(
|
|
|
192
|
+ "%c [ 3. 获取用户信息成功,跳转页面 ]-4",
|
|
|
193
|
+ "font-size:13px; background:pink; color:#bf2c9f;"
|
|
|
194
|
+ );
|
|
|
195
|
+ uni.switchTab({
|
|
|
196
|
+ url: "../../cashier/index"
|
|
|
197
|
+ });
|
|
|
198
|
+ }, 700);
|
|
|
199
|
+ }
|
|
|
200
|
+
|
|
|
201
|
+ return;
|
|
|
202
|
+ // 之前的逻辑
|
|
|
203
|
+
|
|
|
204
|
+ uni.setStorageSync("selectmerchant", data.data.data);
|
|
|
205
|
+
|
|
|
206
|
+ const { merchantIntention = {} } = userInfoData.data.data || {};
|
|
|
207
|
+
|
|
|
208
|
+ uni.setStorage({
|
|
|
209
|
+ key: "myUsername",
|
|
|
210
|
+ data: JSON.stringify(uni.getStorageSync("userinfo").uid)
|
|
|
211
|
+ });
|
|
|
212
|
+ uni.setStorage({
|
|
|
213
|
+ key: "mer_id",
|
|
|
214
|
+ data: merchantIntention.mer_id
|
|
|
215
|
+ });
|
|
|
216
|
+
|
|
|
217
|
+ if (userInfoData.data.status == 200) {
|
|
|
218
|
+ uni.setStorageSync("selectmerchant", userInfoData.data.data);
|
|
|
219
|
+
|
|
|
220
|
+ const imUserData = await getImUser({
|
|
|
221
|
+ mer_id: uni.getStorageSync("mer_id")
|
|
|
222
|
+ });
|
|
|
223
|
+ // actionEMReconnect();
|
|
|
224
|
+ const { loginWithPassword } = emConnect();
|
|
|
225
|
+ uni.setStorage({
|
|
|
226
|
+ key: "im_userid",
|
|
|
227
|
+ data: imUserData.data.data.im_userid
|
|
|
228
|
+ });
|
|
|
229
|
+ uni.setStorage({
|
|
|
230
|
+ key: "im_pass",
|
|
|
231
|
+ data: imUserData.data.data.im_pass
|
|
|
232
|
+ });
|
|
|
233
|
+ uni.setStorage({
|
|
|
234
|
+ key: "im_uuid",
|
|
|
235
|
+ data: imUserData.data.data.im_uuid
|
|
|
236
|
+ });
|
|
|
237
|
+ //环信注册成功 登录
|
|
|
238
|
+ if (imUserData.data.status == 200) {
|
|
|
239
|
+ console.log(">>>>>>>>环信注册成功 登录");
|
|
|
240
|
+ await loginWithUserId();
|
|
|
241
|
+ }
|
|
241
|
242
|
|
|
|
243
|
+ await llwFunc();
|
|
|
244
|
+ }
|
|
|
245
|
+ } catch (error) {
|
|
|
246
|
+ console.error(error);
|
|
|
247
|
+ //TODO handle the exception
|
|
|
248
|
+ }
|
|
|
249
|
+};
|
|
|
250
|
+export default func;
|
|
242
|
251
|
|
|
|
252
|
+export async function getPhpToken() {
|
|
|
253
|
+ let phpToken = uni.getStorageSync("phpToken");
|
|
|
254
|
+ let selectmerchant = uni.getStorageSync("selectmerchant");
|
|
|
255
|
+ if (!phpToken && selectmerchant) {
|
|
243
|
256
|
|
|
|
257
|
+ try {
|
|
|
258
|
+ const res = await getPhpGlobalToken({
|
|
|
259
|
+ merId: selectmerchant.merId || ""
|
|
|
260
|
+ }, merId)
|
|
|
261
|
+ if (res.data.status == 200) {
|
|
|
262
|
+ const token = res.data.data.token || "";
|
|
|
263
|
+ uni.setStorageSync("phpToken", token);
|
|
|
264
|
+ } else {
|
|
|
265
|
+ uni.setStorageSync("phpToken", "");
|
|
|
266
|
+ }
|
|
|
267
|
+ } catch (error) {}
|
|
|
268
|
+ }
|
|
244
|
269
|
}
|
|
245
|
|
-export default func;
|