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