@conecli/cone-render 0.9.1-shop2.8 → 0.10.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.ts +1 -1
- package/dist/assets/icon_blue_info.svg +1 -0
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -0
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/jdplayerSdk.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -0
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.module.scss +7 -0
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/debug/DebugLayout/index.module.scss +67 -0
- package/dist/components/debug/DebugLayout/index.tsx +1 -0
- package/dist/components/debug/DebugLayout/utils.ts +1 -0
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/interface/utils.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.jd.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
- package/dist/jumpEventReport/web.tjapp.ts +1 -0
- package/dist/jumpEventReport/web.tjm.ts +1 -0
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/sass/app.h5.scss +5 -0
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/draExceptionAndProfile.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/sgmCodeUtils.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +42 -39
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
package/dist/common/index.jd.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
floorVideInfo: {},
|
|
3
2
|
productVideInfo: {},
|
|
4
3
|
isJdShowNativeImmersivePlayer: false,
|
|
5
4
|
pageIdxHeightInfo: {
|
|
6
5
|
list: []
|
|
7
6
|
},
|
|
8
7
|
jdBottomBarHeight: 0,
|
|
9
8
|
jdNativeHeaderHeight: 0,
|
|
10
9
|
shopInfo: {},
|
|
11
10
|
openAppData: {}
|
|
12
11
|
public config: object
|
|
13
12
|
this.config = {}
|
|
14
13
|
|
|
15
14
|
doLoginForJdPin(options = {}) {
|
|
16
15
|
return this.doLogin(options)
|
|
17
16
|
}
|
|
18
17
|
return new Promise((resolve, reject) => {
|
|
19
18
|
if (typeof jd !== 'undefined' && jd.requestWebCookie) {
|
|
20
19
|
jd.requestWebCookie({
|
|
21
20
|
needpin: 1,
|
|
22
21
|
success: (res) => {
|
|
23
22
|
console.log(res)
|
|
24
23
|
const { ticket, pt_pin } = res
|
|
25
24
|
console.log('requestWebCookie.success', res)
|
|
26
25
|
this.info.userInfo = {
|
|
27
26
|
pin: pt_pin,
|
|
28
27
|
encodePin: encodeURIComponent(pt_pin),
|
|
29
28
|
ptkey: ticket,
|
|
30
29
|
}
|
|
31
30
|
this.miniAppLogInstance &&
|
|
32
31
|
this.miniAppLogInstance.set({
|
|
33
32
|
account: pt_pin,
|
|
34
33
|
})
|
|
35
34
|
this.info.loginState = true
|
|
36
35
|
resolve(res)
|
|
37
36
|
},
|
|
38
37
|
fail(res) {
|
|
39
38
|
console.log('requestWebCookie.fail', res)
|
|
40
39
|
reject(res)
|
|
41
40
|
},
|
|
42
41
|
})
|
|
43
42
|
} else {
|
|
44
43
|
resolve({
|
|
45
44
|
pin: '',
|
|
46
45
|
ptkey: '',
|
|
47
46
|
mock: true
|
|
48
47
|
})
|
|
49
48
|
}
|
|
50
49
|
})
|
|
51
50
|
this.checkLoginStatus().then(res => {
|
|
52
51
|
console.log(
|
|
53
52
|
'jdLoadCheckStatusAndLogin hasUserLogined.success: ',
|
|
54
53
|
res,
|
|
55
54
|
)
|
|
56
55
|
resolve(res)
|
|
57
56
|
}).catch(err => {
|
|
58
57
|
console.warn(
|
|
59
58
|
'jdLoadCheckStatusAndLogin hasUserLogined.fail: ',
|
|
60
59
|
err,
|
|
61
60
|
)
|
|
62
61
|
this.toLogin().then(res => {
|
|
63
62
|
resolve(res)
|
|
64
63
|
}).catch(err => {
|
|
65
64
|
reject(err)
|
|
66
65
|
})
|
|
67
66
|
})
|
|
68
67
|
return this.checkStatusAndLoginPromise
|
|
69
68
|
return new Promise((resolve,reject) => {
|
|
70
69
|
if (typeof jd !== 'undefined' && jd.hasUserLogined) {
|
|
71
70
|
jd.hasUserLogined({
|
|
72
71
|
success: (res) => {
|
|
73
72
|
console.log('hasUserLogined.success: ', res)
|
|
74
73
|
if (res.status === 1) {
|
|
75
74
|
this.getLoginCookie()
|
|
76
75
|
resolve(res)
|
|
77
76
|
}else {
|
|
78
77
|
reject(res)
|
|
79
78
|
}
|
|
80
79
|
},
|
|
81
80
|
fail: (res) => {
|
|
82
81
|
console.warn('hasUserLogined.fail: ', res)
|
|
83
82
|
reject(res)
|
|
84
83
|
},
|
|
85
84
|
})
|
|
86
85
|
} else {
|
|
87
86
|
reject(false)
|
|
88
87
|
}
|
|
89
88
|
})
|
|
90
89
|
|
|
91
90
|
getAddressCachePromise = () => {
|
|
92
91
|
return Promise.reject("该方法只在APP内适用")
|
|
92
|
+
import Taro from '@tarojs/taro'
|
|
93
93
|
appEid,
|
|
94
94
|
userPinKey,
|
|
95
95
|
jdUserLoginState,
|
|
96
96
|
WXAPP_LOGIN,
|
|
97
97
|
WXAPP_BIZ,
|
|
98
98
|
WXAPP_USER_INFO,
|
|
99
99
|
WXAPP_NAVIGATOR,
|
|
100
100
|
WXAPP_REPORT_GDT,
|
|
101
101
|
WXAPP_PARAMS_SIGN,
|
|
102
102
|
WXAPP_FINGER_REPORT,
|
|
103
103
|
WXAPP_REPORT_MANAGE,
|
|
104
104
|
BUSINESS_TYPE,
|
|
105
105
|
SHOP_MENU_ID_TYPE,
|
|
106
106
|
SHOP_MENU_ID_NAME,
|
|
107
107
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
108
108
|
SECTION_HOME_TAB_TYPE,
|
|
109
109
|
TaroEventType,
|
|
110
110
|
WX_BUSINESS_TYPE,
|
|
111
111
|
WXAPP_BIZ_KEY,
|
|
112
112
|
getSystemInfos,
|
|
113
113
|
getTaroStorageKeyValue,
|
|
114
114
|
removeTaroStorageKey,
|
|
115
115
|
setTaroStorage,
|
|
116
116
|
getWxAppCookieStr,
|
|
117
117
|
objectToUrlEncode,
|
|
118
118
|
loginState: jdUserLoginState,
|
|
119
119
|
cookiesStr: '',
|
|
120
120
|
userInfo: userPinKey,
|
|
121
121
|
pageInfo: {
|
|
122
122
|
wxBusinessType: WX_BUSINESS_TYPE.SHOP,
|
|
123
123
|
address: '',
|
|
124
124
|
addressCommaStr: '',
|
|
125
125
|
un_area: '',
|
|
126
126
|
vapptype: '1',
|
|
127
127
|
pageType: 'home',
|
|
128
128
|
dataType: BUSINESS_TYPE.ONLINE,
|
|
129
129
|
floorExposureInfo: {},
|
|
130
130
|
floorVideInfo: {},
|
|
131
131
|
productVideInfo: {},
|
|
132
132
|
tabsLoadAllDataInfo: {
|
|
133
133
|
[SECTION_HOME_TAB_NAME_TYPE[
|
|
134
134
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
135
135
|
]]: false,
|
|
136
136
|
[SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
|
|
137
137
|
},
|
|
138
138
|
updateShopInfosAllState: false,
|
|
139
139
|
isVipShop: false,
|
|
140
140
|
isJdShowNativeImmersivePlayer: false,
|
|
141
141
|
...shopConfig,
|
|
142
142
|
pageScrollTop: 0,
|
|
143
143
|
pageIdxHeightInfo: {
|
|
144
144
|
list: [],
|
|
145
145
|
},
|
|
146
146
|
shopNavBarHeight: 0,
|
|
147
147
|
},
|
|
148
148
|
defaultQueryLogInfo: {
|
|
149
149
|
sourceType: 'JDshop',
|
|
150
150
|
sourceValue: '',
|
|
151
151
|
moduleId: 'none',
|
|
152
152
|
entrance: 'none',
|
|
153
153
|
},
|
|
154
154
|
originQueryInfo: {},
|
|
155
155
|
sysInfo: {
|
|
156
156
|
windowWidth: 0,
|
|
157
157
|
windowHeight: 0,
|
|
158
158
|
eid: appEid,
|
|
159
159
|
netWorkType: '4g',
|
|
160
160
|
jdBottomBarHeight: 0,
|
|
161
161
|
jdNativeHeaderHeight: 0,
|
|
162
162
|
},
|
|
163
163
|
queryInfo: {},
|
|
164
164
|
shopInfo: {},
|
|
165
165
|
openAppData: {},
|
|
166
166
|
public info: CommonInterFace.BaseConfigInfo
|
|
167
167
|
public config: {
|
|
168
168
|
[key: string]: any
|
|
169
169
|
}
|
|
170
170
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
171
171
|
public rootEleNode: HTMLElement | null
|
|
172
172
|
public miniApplogUtil: CommonInterFace.MiniApplogUtil
|
|
173
173
|
public miniAppLogInstance: CommonInterFace.MiniAppLog | null
|
|
174
174
|
public checkStatusAndLoginPromise: object | null
|
|
175
175
|
public wxAppLoginInstance: CommonInterFace.WxAppLogin
|
|
176
176
|
public wxAppBizInstance: CommonInterFace.WxAppUserInfo
|
|
177
177
|
public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo
|
|
178
178
|
public wxAppReportManageInstance: CommonInterFace.wxAppReportManage
|
|
179
179
|
public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT
|
|
180
180
|
public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator
|
|
181
181
|
public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign
|
|
182
182
|
public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign
|
|
183
183
|
public wxAppSubsGuider: CommonInterFace.wxAppParamsSign
|
|
184
184
|
constructor(opt) {
|
|
185
185
|
this.info = this._getConfig(opt)
|
|
186
186
|
this.config = {}
|
|
187
187
|
this.lazyContainer = {
|
|
188
188
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
|
|
189
189
|
appLazyContainerList: [],
|
|
190
190
|
appLazyFinishContainerList: [],
|
|
191
191
|
},
|
|
192
192
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
|
|
193
193
|
appLazyContainerList: [],
|
|
194
194
|
appLazyFinishContainerList: [],
|
|
195
195
|
},
|
|
196
196
|
}
|
|
197
197
|
this.rootEleNode = null
|
|
198
198
|
this.miniApplogUtil = MiniAppLogUtil
|
|
199
199
|
this.miniAppLogInstance = null
|
|
200
200
|
this.checkStatusAndLoginPromise = null
|
|
201
201
|
this.wxAppLoginInstance = WXAPP_LOGIN
|
|
202
202
|
this.wxAppBizInstance = WXAPP_BIZ
|
|
203
203
|
this.wxAppUserInfoInstance = WXAPP_USER_INFO
|
|
204
204
|
this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE
|
|
205
205
|
this.wxAppReportGDTInstance = WXAPP_REPORT_GDT
|
|
206
206
|
this.wxAppNavigatorInstance = WXAPP_NAVIGATOR
|
|
207
207
|
this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN
|
|
208
208
|
this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT
|
|
209
209
|
? new WXAPP_FINGER_REPORT()
|
|
210
210
|
: {}
|
|
211
211
|
this.wxAppSubsGuider = null
|
|
212
212
|
}
|
|
213
213
|
_getConfig(opt) {
|
|
214
214
|
return Object.assign({}, DefaultConfig, opt)
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
taskTimeoutPromise(callBack, timeout = 2000) {
|
|
218
218
|
return new Promise(resolve => {
|
|
219
219
|
setTimeout(() => {
|
|
220
220
|
const getCallBackRes = typeof callBack === 'function' && callBack()
|
|
221
221
|
return resolve(getCallBackRes || false)
|
|
222
222
|
}, timeout)
|
|
223
223
|
})
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
updateBusinessDomainAndApi(domain, api) {
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
getFullScreenHeight(systemInfo) {
|
|
230
230
|
const { screenHeight, statusBarHeight, isAndroid } = systemInfo
|
|
231
231
|
let result = screenHeight
|
|
232
232
|
if (statusBarHeight > 20 && isAndroid) {
|
|
233
233
|
result = screenHeight + statusBarHeight
|
|
234
234
|
}
|
|
235
235
|
return result
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
getTabBarHeight(systemInfo) {
|
|
239
239
|
const { statusBarHeight, isAndroid, isIOS } = systemInfo
|
|
240
240
|
let result = 50
|
|
241
241
|
if (statusBarHeight > 20) {
|
|
242
242
|
if (isIOS) {
|
|
243
243
|
result = 84
|
|
244
244
|
} else if (isAndroid) {
|
|
245
245
|
result = 53
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
return result
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
getSystemInfo() {
|
|
252
252
|
const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {}
|
|
253
253
|
const actualNavBarHeight =
|
|
254
254
|
(info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0)
|
|
255
255
|
const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0)
|
|
256
256
|
const fullScreenHeight = this.getFullScreenHeight(info)
|
|
257
257
|
const tabBarHeight = this.getTabBarHeight(info)
|
|
258
258
|
const safeContentHeight = fullScreenHeight - headerHeight
|
|
259
259
|
this.info.sysInfo = {
|
|
260
260
|
...this.info.sysInfo,
|
|
261
261
|
...info,
|
|
262
262
|
actualNavBarHeight,
|
|
263
263
|
headerHeight,
|
|
264
264
|
fullScreenHeight,
|
|
265
265
|
tabBarHeight,
|
|
266
266
|
safeContentHeight,
|
|
267
267
|
}
|
|
268
268
|
this.getEid().then((res: { eid: string }) => {
|
|
269
269
|
res && res.eid && (this.info.sysInfo['eid'] = res.eid)
|
|
270
270
|
})
|
|
271
271
|
if (this.info.sysInfo['hostVersionName']) {
|
|
272
272
|
this.info.sysInfo['hostAppVersion'] = Number(
|
|
273
273
|
this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
|
|
274
274
|
)
|
|
275
275
|
}
|
|
276
276
|
this.info.sysInfo['wifiVideoAutoPlay'] = false
|
|
277
277
|
this.getNetWorkType()
|
|
278
278
|
}
|
|
279
279
|
async updateMPaasConfig() {}
|
|
280
280
|
|
|
281
281
|
getNetWorkType() {
|
|
282
282
|
Taro.getNetworkType().then(getRes => {
|
|
283
283
|
getRes &&
|
|
284
284
|
getRes.networkType &&
|
|
285
285
|
(this.info.sysInfo['netWorkType'] = getRes.networkType)
|
|
286
286
|
})
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
checkStatusAndLogin(options = {}) {
|
|
290
290
|
this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
|
|
291
291
|
console.log(
|
|
292
292
|
'微信小程序登录状态及获取cookie状态的promise,之前登录状态',
|
|
293
293
|
this.info.loginState,
|
|
294
294
|
)
|
|
295
295
|
this.toLogin(options)
|
|
296
296
|
.then(res => {
|
|
297
297
|
console.log('微信小程序登录状态结果,成功', res)
|
|
298
298
|
this.info.loginState = true
|
|
299
299
|
resolve(res)
|
|
300
300
|
})
|
|
301
301
|
.catch(err => {
|
|
302
302
|
console.log('微信小程序登录异常状态结果', err)
|
|
303
303
|
this.doLogin(options)
|
|
304
304
|
.then(res2 => {
|
|
305
305
|
console.log('微信小程序wxDoLogin强制登陆成功:', res2)
|
|
306
306
|
this.info.loginState = true
|
|
307
307
|
resolve(res2)
|
|
308
308
|
})
|
|
309
309
|
.catch(err2 => {
|
|
310
310
|
console.log('微信小程序wxDoLogin强制登陆失败:', err2)
|
|
311
311
|
this.checkStatusAndLoginPromise = null
|
|
312
312
|
reject(err2)
|
|
313
313
|
})
|
|
314
314
|
})
|
|
315
315
|
})
|
|
316
316
|
return this.checkStatusAndLoginPromise
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
checkJdStatusAndLogin(options) {
|
|
320
320
|
return this.checkStatusAndLogin(options)
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
|
|
324
324
|
doLoginForJdPin(options = {}) {
|
|
325
325
|
return this.doLogin(options)
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
getEid() {
|
|
329
329
|
if (typeof jd !== 'undefined' && jd.getEid) {
|
|
330
330
|
return new Promise((resolve, reject) => {
|
|
331
331
|
jd.getEid({
|
|
332
332
|
success: (res: { eid: string }) => {
|
|
333
333
|
resolve(res)
|
|
334
334
|
},
|
|
335
335
|
fail: (err: any) => {
|
|
336
336
|
reject(err)
|
|
337
337
|
},
|
|
338
338
|
})
|
|
339
339
|
})
|
|
340
340
|
} else {
|
|
341
341
|
return Promise.resolve(false)
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
toLogin(options = {}): Promise<any> {
|
|
346
346
|
return this.wxAppLoginInstance
|
|
347
347
|
.getLoginPromise({
|
|
348
348
|
mode: 'silent',
|
|
349
349
|
loginColor: {
|
|
350
350
|
biz: WXAPP_BIZ_KEY,
|
|
351
351
|
dpin: 0,
|
|
352
352
|
},
|
|
353
353
|
...options,
|
|
354
354
|
})
|
|
355
355
|
.then(res => {
|
|
356
356
|
console.log('微信app登录返回信息,微信侧返回code为0表示成功', res)
|
|
357
357
|
setTimeout(() => {
|
|
358
358
|
console.log(
|
|
359
359
|
'微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
|
|
360
360
|
)
|
|
361
361
|
this.getLoginCookie(`${Date.now()}`)
|
|
362
362
|
}, 500)
|
|
363
363
|
})
|
|
364
364
|
.catch(err => {
|
|
365
365
|
console.log('微信app登录异常返回信息,也获取cookie', err)
|
|
366
366
|
this.getLoginCookie(`${Date.now()}`)
|
|
367
367
|
})
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
doLogin(options) {
|
|
371
371
|
console.log('触发松果小程序 doLogin() new new')
|
|
372
372
|
return new Promise((resolve, reject) => {
|
|
373
373
|
jd.login({
|
|
374
374
|
success: res => {
|
|
375
375
|
if (res.code) {
|
|
376
376
|
console.log('[common]松果小程序登录成功', res.code)
|
|
377
377
|
jd.redirectTo({
|
|
378
378
|
url: `/pages/shopx/pages/index/index?${objectToUrlEncode({
|
|
379
379
|
...this.info.originQueryInfo,
|
|
380
380
|
})}`,
|
|
381
381
|
})
|
|
382
382
|
resolve(res)
|
|
383
383
|
} else {
|
|
384
384
|
console.error('[common]松果小程序登录失败', res.errMsg)
|
|
385
385
|
reject()
|
|
386
386
|
}
|
|
387
387
|
},
|
|
388
388
|
fail: res => {
|
|
389
389
|
console.error('[common]松果小程序登录失败', res.errMsg)
|
|
390
390
|
reject()
|
|
391
391
|
},
|
|
392
392
|
})
|
|
393
393
|
})
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
getLoginCookie(updateKey = 'wxapp') {
|
|
397
397
|
return new Promise(resolve => {
|
|
398
398
|
console.log('开始获取更新wxapp中的cookie信息', updateKey)
|
|
399
399
|
if (
|
|
400
400
|
this.config.wqCookie &&
|
|
401
401
|
this.config.wqCookieStr &&
|
|
402
402
|
this.config.getWqCookieKey === updateKey
|
|
403
403
|
) {
|
|
404
404
|
console.log('已有存储wxapp中的cookie信息,直接返回', this.config)
|
|
405
405
|
resolve({
|
|
406
406
|
wqCookie: this.config.wqCookie,
|
|
407
407
|
wqCookieStr: this.config.wqCookieStr,
|
|
408
408
|
})
|
|
409
409
|
} else {
|
|
410
410
|
if (isPublishToWxapp) {
|
|
411
411
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
412
412
|
if (getWxappCookieObj) {
|
|
413
413
|
const getCookieObj = getWxappCookieObj['_data']
|
|
414
414
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
415
415
|
const {
|
|
416
416
|
pin = '',
|
|
417
417
|
visitkey = '-1',
|
|
418
418
|
wq_unionid = '',
|
|
419
419
|
wxapp_openid = '',
|
|
420
420
|
} = wqCookie
|
|
421
421
|
this.info.loginState = true
|
|
422
422
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
423
423
|
this.info.userInfo.wqVisitkey = visitkey
|
|
424
424
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
425
425
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
426
426
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
427
427
|
if (getUserAddress) {
|
|
428
428
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
429
429
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
|
|
430
430
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
431
431
|
: ''
|
|
432
432
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
433
433
|
Taro.eventCenter.trigger(
|
|
434
434
|
TaroEventType.USER_AREA_UPDATE,
|
|
435
435
|
this.info.pageInfo.address,
|
|
436
436
|
)
|
|
437
437
|
}
|
|
438
438
|
if (this.miniAppLogInstance) {
|
|
439
439
|
this.miniAppLogInstance.set({
|
|
440
440
|
account: pin,
|
|
441
441
|
unionid: wq_unionid,
|
|
442
442
|
openid: wxapp_openid,
|
|
443
443
|
})
|
|
444
444
|
}
|
|
445
445
|
this.config.wqCookie = wqCookie
|
|
446
446
|
this.config.wqCookieStr = wqCookieStr
|
|
447
447
|
this.config.getWqCookieKey = updateKey
|
|
448
448
|
console.log('解析wxapp中的cookie信息成功,返回后存储', this.config)
|
|
449
449
|
resolve({
|
|
450
450
|
wqCookie,
|
|
451
451
|
wqCookieStr,
|
|
452
452
|
})
|
|
453
453
|
} else {
|
|
454
454
|
console.log(
|
|
455
455
|
'解析wxapp中的cookie信息异常,返回异常结果',
|
|
456
456
|
this.config,
|
|
457
457
|
)
|
|
458
458
|
resolve({
|
|
459
459
|
wqCookie: false,
|
|
460
460
|
wqCookieStr: false,
|
|
461
461
|
})
|
|
462
462
|
}
|
|
463
463
|
} else {
|
|
464
464
|
resolve({
|
|
465
465
|
wqCookie: false,
|
|
466
466
|
wqCookieStr: false,
|
|
467
467
|
})
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
})
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
|
|
474
474
|
checkLoginStatus() {
|
|
475
475
|
return this.getLoginCookie()
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
getAddressCachePromise = () => {
|
|
479
479
|
return Promise.reject('该方法只在APP内适用')
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
getDynamicConfig(key: string) {
|
|
483
483
|
console.warn(
|
|
484
484
|
'调用松果小程序的 getDynamicConfig(),注意,此方法还未实现!',
|
|
485
485
|
)
|
|
486
486
|
return null
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
updatePageAndLogInfo(updateQuery = {}) {
|
|
490
490
|
const createUpdateQueryInfo: {
|
|
491
491
|
query: {
|
|
492
492
|
shopId?: string | number
|
|
493
493
|
venderId?: string | number
|
|
494
494
|
}
|
|
495
495
|
updateShopInfoState: boolean
|
|
496
496
|
} = Object.assign(
|
|
497
497
|
{},
|
|
498
498
|
{
|
|
499
499
|
query: {},
|
|
500
500
|
updateShopInfoState: false,
|
|
501
501
|
},
|
|
502
502
|
updateQuery,
|
|
503
503
|
)
|
|
504
504
|
console.log(
|
|
505
505
|
'获取当前下发的店铺查询参数',
|
|
506
506
|
updateQuery,
|
|
507
507
|
'获取之前保存的shopInfo店铺查询参数',
|
|
508
508
|
this.info?.shopInfo,
|
|
509
509
|
)
|
|
510
510
|
const { query, updateShopInfoState } = createUpdateQueryInfo
|
|
511
511
|
const { shopId, venderId } = query
|
|
512
512
|
if (updateShopInfoState) {
|
|
513
513
|
this.info.queryInfo = {
|
|
514
514
|
...this.info.queryInfo,
|
|
515
515
|
...query,
|
|
516
516
|
}
|
|
517
517
|
if (shopId && venderId) {
|
|
518
518
|
this.info.shopInfo = {
|
|
519
519
|
shopId: `${shopId}`,
|
|
520
520
|
venderId: `${venderId}`,
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
} else {
|
|
524
524
|
this.info.queryInfo = {
|
|
525
525
|
...query,
|
|
526
526
|
}
|
|
527
527
|
this.info.originQueryInfo = {
|
|
528
528
|
...query,
|
|
529
529
|
}
|
|
530
530
|
if (
|
|
531
531
|
this.info.shopInfo?.shopId &&
|
|
532
532
|
this.info.shopInfo?.venderId &&
|
|
533
533
|
(this.info.shopInfo.shopId == shopId ||
|
|
534
534
|
this.info.shopInfo.venderId == venderId)
|
|
535
535
|
) {
|
|
536
536
|
this.info.queryInfo.shopId = this.info.shopInfo.shopId
|
|
537
537
|
this.info.queryInfo.venderId = this.info.shopInfo.venderId
|
|
538
538
|
console.log(
|
|
539
539
|
'当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
|
|
540
540
|
this.info.queryInfo,
|
|
541
541
|
)
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
this.info.queryInfo['shopId'] &&
|
|
545
545
|
(this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`)
|
|
546
546
|
this.info.queryInfo['venderId'] &&
|
|
547
547
|
(this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`)
|
|
548
548
|
console.log(
|
|
549
549
|
'weapp===获取店铺下发查询参数\n',
|
|
550
550
|
query,
|
|
551
551
|
'\n获取店铺最后查询参数\n',
|
|
552
552
|
this.info.queryInfo,
|
|
553
553
|
'\n是否为更新店铺状态\n',
|
|
554
554
|
updateShopInfoState,
|
|
555
555
|
)
|
|
556
556
|
}
|