@conecli/cone-render 0.9.1-shop2.7 → 0.9.1-shop2.9
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/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/sgmCustomCode.ts +1 -0
- package/dist/common/token/token.ts +1 -1
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CountDown/index.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/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +5 -0
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/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/floorItem.jd.tsx +1 -1
- package/dist/components/floorItem.weapp.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/const.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/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.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/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/jump copy.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/sass/app.h5.scss +39 -3
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.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 +1 -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
|
WXAPP_LOGIN,
|
|
94
94
|
WXAPP_BIZ,
|
|
95
95
|
WXAPP_USER_INFO,
|
|
96
96
|
WXAPP_NAVIGATOR,
|
|
97
97
|
WXAPP_REPORT_GDT,
|
|
98
98
|
WXAPP_PARAMS_SIGN,
|
|
99
99
|
WXAPP_FINGER_REPORT,
|
|
100
100
|
WXAPP_REPORT_MANAGE,
|
|
101
101
|
BUSINESS_TYPE,
|
|
102
102
|
SHOP_MENU_ID_TYPE,
|
|
103
103
|
SHOP_MENU_ID_NAME,
|
|
104
104
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
105
105
|
SECTION_HOME_TAB_TYPE,
|
|
106
106
|
TaroEventType,
|
|
107
107
|
WX_BUSINESS_TYPE,
|
|
108
108
|
WXAPP_BIZ_KEY,
|
|
109
109
|
getSystemInfos,
|
|
110
110
|
getTaroStorageKeyValue,
|
|
111
111
|
getWxAppCookieStr,
|
|
112
112
|
objectToUrlEncode,
|
|
113
113
|
floorVideInfo: {},
|
|
114
114
|
productVideInfo: {},
|
|
115
115
|
updateShopInfosAllState: false,
|
|
116
116
|
isJdShowNativeImmersivePlayer: false,
|
|
117
117
|
pageIdxHeightInfo: {
|
|
118
118
|
list: []
|
|
119
119
|
},
|
|
120
120
|
originQueryInfo: {},
|
|
121
121
|
jdBottomBarHeight: 0,
|
|
122
122
|
jdNativeHeaderHeight: 0,
|
|
123
123
|
shopInfo: {},
|
|
124
124
|
openAppData: {}
|
|
125
125
|
public info: CommonInterFace.BaseConfigInfo
|
|
126
126
|
public config: {
|
|
127
127
|
[key: string]: any
|
|
128
128
|
}
|
|
129
129
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
130
130
|
public rootEleNode: HTMLElement | null
|
|
131
131
|
public miniApplogUtil: CommonInterFace.MiniApplogUtil
|
|
132
132
|
public miniAppLogInstance: CommonInterFace.MiniAppLog | null
|
|
133
133
|
public checkStatusAndLoginPromise: object | null
|
|
134
134
|
public wxAppLoginInstance: CommonInterFace.WxAppLogin
|
|
135
135
|
public wxAppBizInstance: CommonInterFace.WxAppUserInfo
|
|
136
136
|
public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo
|
|
137
137
|
public wxAppReportManageInstance: CommonInterFace.wxAppReportManage
|
|
138
138
|
public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT
|
|
139
139
|
public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator
|
|
140
140
|
public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign
|
|
141
141
|
public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign
|
|
142
142
|
public wxAppSubsGuider: CommonInterFace.wxAppParamsSign
|
|
143
143
|
constructor(opt) {
|
|
144
144
|
this.info = this._getConfig(opt)
|
|
145
145
|
this.config = {}
|
|
146
146
|
this.lazyContainer = {
|
|
147
147
|
[SECTION_HOME_TAB_NAME_TYPE[
|
|
148
148
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
149
149
|
]]: {
|
|
150
150
|
appLazyContainerList: [],
|
|
151
151
|
appLazyFinishContainerList: [],
|
|
152
152
|
},
|
|
153
153
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]:
|
|
154
154
|
{
|
|
155
155
|
appLazyContainerList: [],
|
|
156
156
|
appLazyFinishContainerList: [],
|
|
157
157
|
},
|
|
158
158
|
}
|
|
159
159
|
this.rootEleNode = null
|
|
160
160
|
this.miniApplogUtil = MiniAppLogUtil
|
|
161
161
|
this.miniAppLogInstance = null
|
|
162
162
|
this.checkStatusAndLoginPromise = null
|
|
163
163
|
this.wxAppLoginInstance = WXAPP_LOGIN
|
|
164
164
|
this.wxAppBizInstance = WXAPP_BIZ
|
|
165
165
|
this.wxAppUserInfoInstance = WXAPP_USER_INFO
|
|
166
166
|
this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE
|
|
167
167
|
this.wxAppReportGDTInstance = WXAPP_REPORT_GDT
|
|
168
168
|
this.wxAppNavigatorInstance = WXAPP_NAVIGATOR
|
|
169
169
|
this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN
|
|
170
170
|
this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {}
|
|
171
171
|
this.wxAppSubsGuider = null
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
taskTimeoutPromise(callBack, timeout = 2000){
|
|
175
175
|
return new Promise((resolve) => {
|
|
176
176
|
setTimeout(() => {
|
|
177
177
|
const getCallBackRes = typeof callBack === 'function' && callBack()
|
|
178
178
|
return resolve(getCallBackRes || false)
|
|
179
179
|
}, timeout)
|
|
180
180
|
})
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
getTabBarHeight(systemInfo) {
|
|
184
184
|
const { statusBarHeight, isAndroid, isIOS } = systemInfo
|
|
185
185
|
let result = 50
|
|
186
186
|
if (statusBarHeight > 20) {
|
|
187
187
|
if (isIOS) {
|
|
188
188
|
result = 84
|
|
189
189
|
} else if (isAndroid) {
|
|
190
190
|
result = 53
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
return result
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
getSystemInfo() {
|
|
197
197
|
const info: UtilsInterFace.taroGetSystemInfoSyncRes =
|
|
198
198
|
getSystemInfos() || {}
|
|
199
199
|
const actualNavBarHeight =
|
|
200
200
|
(info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0)
|
|
201
201
|
const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0)
|
|
202
202
|
const fullScreenHeight = this.getFullScreenHeight(info)
|
|
203
203
|
const tabBarHeight = this.getTabBarHeight(info)
|
|
204
204
|
const safeContentHeight = fullScreenHeight - headerHeight
|
|
205
205
|
this.info.sysInfo = {
|
|
206
206
|
...this.info.sysInfo,
|
|
207
207
|
...info,
|
|
208
208
|
actualNavBarHeight,
|
|
209
209
|
headerHeight,
|
|
210
210
|
fullScreenHeight,
|
|
211
211
|
tabBarHeight,
|
|
212
212
|
safeContentHeight,
|
|
213
213
|
}
|
|
214
214
|
if (this.info.sysInfo['hostVersionName']) {
|
|
215
215
|
this.info.sysInfo['hostAppVersion'] = Number(
|
|
216
216
|
this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
|
|
217
217
|
)
|
|
218
218
|
}
|
|
219
219
|
console.log('获取系统信息', this.info.sysInfo)
|
|
220
220
|
this.getNetWorkType()
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
getNetWorkType() {
|
|
224
224
|
Taro.getNetworkType().then((getRes) => {
|
|
225
225
|
getRes &&
|
|
226
226
|
getRes.networkType &&
|
|
227
227
|
(this.info.sysInfo['netWorkType'] = getRes.networkType)
|
|
228
228
|
})
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
checkStatusAndLogin(options = {}) {
|
|
232
232
|
this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
|
|
233
233
|
console.log(
|
|
234
234
|
'微信小程序登录状态及获取cookie状态的promise,之前登录状态',
|
|
235
235
|
this.info.loginState,
|
|
236
236
|
)
|
|
237
237
|
this.toLogin(options)
|
|
238
238
|
.then((res) => {
|
|
239
239
|
console.log('微信小程序登录状态结果,成功', res)
|
|
240
240
|
this.info.loginState = true
|
|
241
241
|
resolve(res)
|
|
242
242
|
})
|
|
243
243
|
.catch((err) => {
|
|
244
244
|
console.log('微信小程序登录异常状态结果', err)
|
|
245
245
|
this.doLogin(options)
|
|
246
246
|
.then((res2) => {
|
|
247
247
|
console.log(
|
|
248
248
|
'微信小程序wxDoLogin强制登陆成功:',
|
|
249
249
|
res2,
|
|
250
250
|
)
|
|
251
251
|
this.info.loginState = true
|
|
252
252
|
resolve(res2)
|
|
253
253
|
})
|
|
254
254
|
.catch((err2) => {
|
|
255
255
|
console.log(
|
|
256
256
|
'微信小程序wxDoLogin强制登陆失败:',
|
|
257
257
|
err2,
|
|
258
258
|
)
|
|
259
259
|
this.checkStatusAndLoginPromise = null
|
|
260
260
|
reject(err2)
|
|
261
261
|
})
|
|
262
262
|
})
|
|
263
263
|
})
|
|
264
264
|
return this.checkStatusAndLoginPromise
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
checkJdStatusAndLogin(options){
|
|
268
268
|
return this.checkStatusAndLogin(options)
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
doLoginForJdPin(options = {}) {
|
|
272
272
|
return this.doLogin(options)
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
toLogin(options = {}): Promise<any> {
|
|
276
276
|
return this.wxAppLoginInstance
|
|
277
277
|
.getLoginPromise({
|
|
278
278
|
mode: 'silent',
|
|
279
279
|
loginColor: {
|
|
280
280
|
biz: WXAPP_BIZ_KEY,
|
|
281
281
|
dpin: 0,
|
|
282
282
|
},
|
|
283
283
|
...options,
|
|
284
284
|
})
|
|
285
285
|
.then((res) => {
|
|
286
286
|
console.log(
|
|
287
287
|
'微信app登录返回信息,微信侧返回code为0表示成功',
|
|
288
288
|
res,
|
|
289
289
|
)
|
|
290
290
|
setTimeout(() => {
|
|
291
291
|
console.log("微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie")
|
|
292
292
|
this.getLoginCookie(`${Date.now()}`)
|
|
293
293
|
},500)
|
|
294
294
|
})
|
|
295
295
|
.catch((err) => {
|
|
296
296
|
console.log('微信app登录异常返回信息,也获取cookie', err)
|
|
297
297
|
this.getLoginCookie(`${Date.now()}`)
|
|
298
298
|
})
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
doLogin(options) {
|
|
302
302
|
console.log('触发松果小程序 doLogin() new new')
|
|
303
303
|
return new Promise((resolve, reject) => {
|
|
304
304
|
jd.login({
|
|
305
305
|
success: (res) => {
|
|
306
306
|
if (res.code) {
|
|
307
307
|
console.log("[common]松果小程序登录成功", res.code)
|
|
308
308
|
jd.redirectTo({
|
|
309
309
|
url: `/pages/shopx/pages/index/index?${objectToUrlEncode({
|
|
310
310
|
...this.info.originQueryInfo
|
|
311
311
|
})}`
|
|
312
312
|
})
|
|
313
313
|
resolve(res)
|
|
314
314
|
} else {
|
|
315
315
|
console.error("[common]松果小程序登录失败", res.errMsg)
|
|
316
316
|
reject()
|
|
317
317
|
}
|
|
318
318
|
},
|
|
319
319
|
fail: (res) => {
|
|
320
320
|
console.error("[common]松果小程序登录失败", res.errMsg)
|
|
321
321
|
reject()
|
|
322
322
|
}
|
|
323
323
|
})
|
|
324
324
|
})
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
getLoginCookie(updateKey = 'wxapp') {
|
|
328
328
|
return new Promise((resolve) => {
|
|
329
329
|
console.log("开始获取更新wxapp中的cookie信息", updateKey)
|
|
330
330
|
if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
|
|
331
331
|
console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
|
|
332
332
|
resolve({
|
|
333
333
|
wqCookie: this.config.wqCookie,
|
|
334
334
|
wqCookieStr: this.config.wqCookieStr,
|
|
335
335
|
})
|
|
336
336
|
}else {
|
|
337
337
|
if (isPublishToWxapp) {
|
|
338
338
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
339
339
|
if (getWxappCookieObj) {
|
|
340
340
|
const getCookieObj = getWxappCookieObj['_data']
|
|
341
341
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
342
342
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
|
|
343
343
|
this.info.loginState = true
|
|
344
344
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
345
345
|
this.info.userInfo.wqVisitkey = visitkey
|
|
346
346
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
347
347
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
348
348
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
349
349
|
if (getUserAddress) {
|
|
350
350
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
351
351
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo
|
|
352
352
|
.address
|
|
353
353
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
354
354
|
: ''
|
|
355
355
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
356
356
|
Taro.eventCenter.trigger(
|
|
357
357
|
TaroEventType.USER_AREA_UPDATE,
|
|
358
358
|
this.info.pageInfo.address,
|
|
359
359
|
)
|
|
360
360
|
}
|
|
361
361
|
if(this.miniAppLogInstance){
|
|
362
362
|
this.miniAppLogInstance.set({
|
|
363
363
|
account: pin,
|
|
364
364
|
unionid: wq_unionid,
|
|
365
365
|
openid: wxapp_openid,
|
|
366
366
|
})
|
|
367
367
|
}
|
|
368
368
|
this.config.wqCookie = wqCookie
|
|
369
369
|
this.config.wqCookieStr = wqCookieStr
|
|
370
370
|
this.config.getWqCookieKey = updateKey
|
|
371
371
|
console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
|
|
372
372
|
resolve({
|
|
373
373
|
wqCookie,
|
|
374
374
|
wqCookieStr,
|
|
375
375
|
})
|
|
376
376
|
}else {
|
|
377
377
|
console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
|
|
378
378
|
resolve({
|
|
379
379
|
wqCookie: false,
|
|
380
380
|
wqCookieStr: false,
|
|
381
381
|
})
|
|
382
382
|
}
|
|
383
383
|
}else {
|
|
384
384
|
resolve({
|
|
385
385
|
wqCookie: false,
|
|
386
386
|
wqCookieStr: false,
|
|
387
387
|
})
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
})
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
|
|
394
394
|
checkLoginStatus() {
|
|
395
395
|
return this.getLoginCookie()
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
getAddressCachePromise = () => {
|
|
399
399
|
return Promise.reject("该方法只在APP内适用")
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
updatePageAndLogInfo(updateQuery = {}) {
|
|
403
403
|
const createUpdateQueryInfo: {
|
|
404
404
|
query: {
|
|
405
405
|
shopId?: string | number
|
|
406
406
|
venderId?: string | number
|
|
407
407
|
},
|
|
408
408
|
updateShopInfoState: boolean,
|
|
409
409
|
} = Object.assign({}, {
|
|
410
410
|
query: {},
|
|
411
411
|
updateShopInfoState: false
|
|
412
412
|
}, updateQuery)
|
|
413
413
|
console.log("获取当前下发的店铺查询参数",updateQuery, '获取之前保存的shopInfo店铺查询参数', this.info?.shopInfo)
|
|
414
414
|
const {query, updateShopInfoState} = createUpdateQueryInfo
|
|
415
415
|
const {shopId, venderId} = query
|
|
416
416
|
if (updateShopInfoState) {
|
|
417
417
|
this.info.queryInfo = {
|
|
418
418
|
...this.info.queryInfo,
|
|
419
419
|
...query,
|
|
420
420
|
}
|
|
421
421
|
if(shopId && venderId){
|
|
422
422
|
this.info.shopInfo = {
|
|
423
423
|
shopId: `${shopId}`,
|
|
424
424
|
venderId: `${venderId}`
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
} else {
|
|
428
428
|
this.info.queryInfo = {
|
|
429
429
|
...query
|
|
430
430
|
}
|
|
431
431
|
this.info.originQueryInfo = {
|
|
432
432
|
...query
|
|
433
433
|
}
|
|
434
434
|
if(this.info.shopInfo?.shopId && this.info.shopInfo?.venderId && (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)){
|
|
435
435
|
this.info.queryInfo.shopId = this.info.shopInfo.shopId
|
|
436
436
|
this.info.queryInfo.venderId = this.info.shopInfo.venderId
|
|
437
437
|
console.log("当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数", this.info.queryInfo)
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
this.info.queryInfo['shopId'] &&
|
|
441
441
|
(this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`)
|
|
442
442
|
this.info.queryInfo['venderId'] &&
|
|
443
443
|
(this.info.queryInfo[
|
|
444
444
|
'venderId'
|
|
445
445
|
] = `${this.info.queryInfo['venderId']}`)
|
|
446
446
|
console.log(
|
|
447
447
|
'weapp===获取店铺下发查询参数\n',
|
|
448
448
|
query,
|
|
449
449
|
'\n获取店铺最后查询参数\n',
|
|
450
450
|
this.info.queryInfo,
|
|
451
451
|
'\n是否为更新店铺状态\n',
|
|
452
452
|
updateShopInfoState
|
|
453
453
|
)
|
|
454
454
|
}
|
package/dist/common/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
floorVideInfo: {},
|
|
3
2
|
productVideInfo: {},
|
|
4
3
|
isVipShop: false,
|
|
5
4
|
isJdShowNativeImmersivePlayer: false,
|
|
6
5
|
pageIdxHeightInfo: {
|
|
7
6
|
list: []
|
|
8
7
|
},
|
|
9
8
|
jdBottomBarHeight: 0,
|
|
10
9
|
jdNativeHeaderHeight: 0,
|
|
11
10
|
openAppData: {}
|
|
12
11
|
public config: {
|
|
13
12
|
[key: string]: any
|
|
14
13
|
}
|
|
15
14
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
16
15
|
this.config = {}
|
|
17
16
|
|
|
18
17
|
doLoginForJdPin(options = {}) {
|
|
19
18
|
return this.doLogin(options)
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
getLoginCookie(updateKey = 'wxapp') {
|
|
23
22
|
return new Promise((resolve) => {
|
|
24
23
|
console.log("开始获取更新wxapp中的cookie信息", updateKey)
|
|
25
24
|
if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
|
|
26
25
|
console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
|
|
27
26
|
resolve({
|
|
28
27
|
wqCookie: this.config.wqCookie,
|
|
29
28
|
wqCookieStr: this.config.wqCookieStr,
|
|
30
29
|
})
|
|
31
30
|
}else {
|
|
32
31
|
if (isPublishToWxapp) {
|
|
33
32
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
34
33
|
if (getWxappCookieObj) {
|
|
35
34
|
const getCookieObj = getWxappCookieObj['_data']
|
|
36
35
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
37
36
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
|
|
38
37
|
this.info.loginState = true
|
|
39
38
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
40
39
|
this.info.userInfo.wqVisitkey = visitkey
|
|
41
40
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
42
41
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
43
42
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
44
43
|
if (getUserAddress) {
|
|
45
44
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
46
45
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo
|
|
47
46
|
.address
|
|
48
47
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
49
48
|
: ''
|
|
50
49
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
51
50
|
Taro.eventCenter.trigger(
|
|
52
51
|
TaroEventType.USER_AREA_UPDATE,
|
|
53
52
|
this.info.pageInfo.address,
|
|
54
53
|
)
|
|
55
54
|
}
|
|
56
55
|
if(this.miniAppLogInstance){
|
|
57
56
|
this.miniAppLogInstance.set({
|
|
58
57
|
account: pin,
|
|
59
58
|
unionid: wq_unionid,
|
|
60
59
|
openid: wxapp_openid,
|
|
61
60
|
})
|
|
62
61
|
}
|
|
63
62
|
this.config.wqCookie = wqCookie
|
|
64
63
|
this.config.wqCookieStr = wqCookieStr
|
|
65
64
|
this.config.getWqCookieKey = updateKey
|
|
66
65
|
console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
|
|
67
66
|
resolve({
|
|
68
67
|
wqCookie,
|
|
69
68
|
wqCookieStr,
|
|
70
69
|
})
|
|
71
70
|
}else {
|
|
72
71
|
console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
|
|
73
72
|
resolve({
|
|
74
73
|
wqCookie: false,
|
|
75
74
|
wqCookieStr: false,
|
|
76
75
|
})
|
|
77
76
|
}
|
|
78
77
|
}else {
|
|
79
78
|
resolve({
|
|
80
79
|
wqCookie: false,
|
|
81
80
|
wqCookieStr: false,
|
|
82
81
|
})
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
84
|
})
|
|
86
85
|
}
|
|
87
86
|
return this.getLoginCookie()
|
|
88
87
|
|
|
89
88
|
getAddressCachePromise = () => {
|
|
90
89
|
return Promise.reject("该方法只在APP内适用")
|
|
91
90
|
}
|
|
91
|
+
import Taro from '@tarojs/taro'
|
|
92
92
|
floorVideInfo: {},
|
|
93
93
|
productVideInfo: {},
|
|
94
94
|
isVipShop: false,
|
|
95
95
|
isJdShowNativeImmersivePlayer: false,
|
|
96
96
|
pageIdxHeightInfo: {
|
|
97
97
|
list: []
|
|
98
98
|
},
|
|
99
99
|
jdBottomBarHeight: 0,
|
|
100
100
|
jdNativeHeaderHeight: 0,
|
|
101
101
|
openAppData: {}
|
|
102
102
|
public config: {
|
|
103
103
|
[key: string]: any
|
|
104
104
|
}
|
|
105
105
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
106
106
|
public renderedIsvComponents: CommonInterFace.renderedIsvComponents
|
|
107
107
|
this.config = {}
|
|
108
108
|
this.renderedIsvComponents = {}
|
|
109
109
|
|
|
110
110
|
taskTimeoutPromise(callBack, timeout = 2000){
|
|
111
111
|
return new Promise((resolve) => {
|
|
112
112
|
setTimeout(() => {
|
|
113
113
|
const getCallBackRes = typeof callBack === 'function' && callBack()
|
|
114
114
|
return resolve(getCallBackRes || false)
|
|
115
115
|
}, timeout)
|
|
116
116
|
})
|
|
117
117
|
}
|
|
118
118
|
removeJdAndroidRquestEventForTouchStart(){}
|
|
119
119
|
checkStatusAndLogin(options = {}) {
|
|
120
120
|
|
|
121
121
|
checkJdStatusAndLogin(options){
|
|
122
122
|
return this.checkStatusAndLogin(options)
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
doLoginForJdPin(options = {}) {
|
|
126
126
|
return this.doLogin(options)
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
getLoginCookie(updateKey = 'wxapp') {
|
|
130
130
|
return new Promise((resolve) => {
|
|
131
131
|
console.log("开始获取更新wxapp中的cookie信息", updateKey)
|
|
132
132
|
if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
|
|
133
133
|
console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
|
|
134
134
|
resolve({
|
|
135
135
|
wqCookie: this.config.wqCookie,
|
|
136
136
|
wqCookieStr: this.config.wqCookieStr,
|
|
137
137
|
})
|
|
138
138
|
}else {
|
|
139
139
|
if (isPublishToWxapp) {
|
|
140
140
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
141
141
|
if (getWxappCookieObj) {
|
|
142
142
|
const getCookieObj = getWxappCookieObj['_data']
|
|
143
143
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
144
144
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
|
|
145
145
|
this.info.loginState = true
|
|
146
146
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
147
147
|
this.info.userInfo.wqVisitkey = visitkey
|
|
148
148
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
149
149
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
150
150
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
151
151
|
if (getUserAddress) {
|
|
152
152
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
153
153
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo
|
|
154
154
|
.address
|
|
155
155
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
156
156
|
: ''
|
|
157
157
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
158
158
|
Taro.eventCenter.trigger(
|
|
159
159
|
TaroEventType.USER_AREA_UPDATE,
|
|
160
160
|
this.info.pageInfo.address,
|
|
161
161
|
)
|
|
162
162
|
}
|
|
163
163
|
if(this.miniAppLogInstance){
|
|
164
164
|
this.miniAppLogInstance.set({
|
|
165
165
|
account: pin,
|
|
166
166
|
unionid: wq_unionid,
|
|
167
167
|
openid: wxapp_openid,
|
|
168
168
|
})
|
|
169
169
|
}
|
|
170
170
|
this.config.wqCookie = wqCookie
|
|
171
171
|
this.config.wqCookieStr = wqCookieStr
|
|
172
172
|
this.config.getWqCookieKey = updateKey
|
|
173
173
|
console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
|
|
174
174
|
resolve({
|
|
175
175
|
wqCookie,
|
|
176
176
|
wqCookieStr,
|
|
177
177
|
})
|
|
178
178
|
}else {
|
|
179
179
|
console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
|
|
180
180
|
resolve({
|
|
181
181
|
wqCookie: false,
|
|
182
182
|
wqCookieStr: false,
|
|
183
183
|
})
|
|
184
184
|
}
|
|
185
185
|
}else {
|
|
186
186
|
resolve({
|
|
187
187
|
wqCookie: false,
|
|
188
188
|
wqCookieStr: false,
|
|
189
189
|
})
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
})
|
|
193
193
|
}
|
|
194
194
|
return this.getLoginCookie()
|
|
195
195
|
|
|
196
196
|
getAddressCachePromise = () => {
|
|
197
197
|
return Promise.reject("该方法只在APP内适用")
|
|
198
198
|
}
|