@conecli/cone-render 0.10.1-shop3.1 → 0.10.1-shop3.100

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.
Files changed (129) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +1 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.ts +1 -1
  12. package/dist/common/jssdk.weapp.ts +1 -0
  13. package/dist/common/pageType.ts +1 -1
  14. package/dist/common/token/index.h5.ts +1 -1
  15. package/dist/common/token/token.jd.ts +1 -1
  16. package/dist/common/wxappApi.ascf.ts +1 -0
  17. package/dist/common/wxappApi.ts +1 -1
  18. package/dist/components/ErrorBoundary.tsx +1 -1
  19. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  20. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  21. package/dist/components/base/CountDown/index.module.scss +49 -44
  22. package/dist/components/base/CountDown/index.tsx +1 -1
  23. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  24. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  25. package/dist/components/base/CustomVideo/index.tsx +1 -1
  26. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  27. package/dist/components/base/Dialog/index.module.scss +11 -0
  28. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  29. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  30. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  31. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  32. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  33. package/dist/components/base/InViewRender/index.tsx +1 -1
  34. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  35. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  36. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  37. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  39. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  40. package/dist/components/base/NetworkDataError/const.ts +1 -1
  41. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  42. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  43. package/dist/components/base/Price/Base/index.module.scss +12 -0
  44. package/dist/components/base/Price/Base/index.tsx +1 -1
  45. package/dist/components/base/Price/Double/index.module.scss +33 -1
  46. package/dist/components/base/Price/Double/index.tsx +1 -1
  47. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  48. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  49. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  50. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  51. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  52. package/dist/components/floorItem.tsx +1 -1
  53. package/dist/components/floorItem.weapp.tsx +1 -1
  54. package/dist/components/isv/Floor/index.tsx +1 -1
  55. package/dist/components/remoteFloorItem.tsx +1 -1
  56. package/dist/config/env.ts +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/jumpEventReport/base.ts +1 -1
  62. package/dist/jumpEventReport/const.ts +1 -1
  63. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  64. package/dist/jumpEventReport/index.h5.ts +1 -1
  65. package/dist/jumpEventReport/index.jd.ts +1 -1
  66. package/dist/jumpEventReport/index.weapp.ts +1 -1
  67. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  68. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  69. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -1
  77. package/dist/jumpEventReport/web.pc.ts +1 -1
  78. package/dist/jumpEventReport/web.tjapp.ts +1 -1
  79. package/dist/jumpEventReport/web.tjm.ts +1 -1
  80. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  81. package/dist/language/en_US.json +395 -0
  82. package/dist/language/zh_CN.json +395 -0
  83. package/dist/language/zh_HK.json +395 -0
  84. package/dist/libs/openShopBridge.js +161 -0
  85. package/dist/libs/openShopBridge.min.js +1 -0
  86. package/dist/libs/taroAppReport.js +2 -2
  87. package/dist/modules/ContainerFloorList/index.h5.module.scss +80 -53
  88. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  89. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  90. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  91. package/dist/open/api/environment.ts +1 -1
  92. package/dist/open/api/shopMember.ts +1 -1
  93. package/dist/open/api/shopMember.weapp.ts +1 -0
  94. package/dist/open/api/track.ts +1 -1
  95. package/dist/open/api/util.ts +1 -1
  96. package/dist/open/components/index.ts +1 -1
  97. package/dist/open/index.ts +1 -1
  98. package/dist/sass/app.h5.scss +278 -224
  99. package/dist/sass/base.scss +150 -145
  100. package/dist/service/fetchGateway.ts +1 -1
  101. package/dist/service/fetchGateway.weapp.ts +1 -0
  102. package/dist/service/fetchJsonp.weapp.ts +1 -0
  103. package/dist/service/http/colorSign.ts +1 -1
  104. package/dist/service/http/const.ts +1 -1
  105. package/dist/service/http/h5Http.ts +1 -1
  106. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  107. package/dist/service/requestServer.h5.ts +1 -1
  108. package/dist/service/requestServer.ts +1 -1
  109. package/dist/service/requestServer.weapp.ts +1 -0
  110. package/dist/utils/connectNativeJsBridge.ts +1 -1
  111. package/dist/utils/h5Utils.ts +1 -1
  112. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  113. package/dist/utils/harmonyCallRouter.ts +0 -0
  114. package/dist/utils/index.h5.ts +1 -1
  115. package/dist/utils/index.ts +1 -1
  116. package/dist/utils/index.weapp.ts +1 -1
  117. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  118. package/dist/utils/jumpExtMapUtil.ts +1 -0
  119. package/dist/utils/jumpExtMapUtil.weapp.ts +1 -0
  120. package/dist/utils/log.ts +1 -0
  121. package/dist/utils/sColor.ts +1 -0
  122. package/dist/utils/sColor.weapp.ts +1 -0
  123. package/dist/utils/utils.ts +1 -1
  124. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  125. package/dist/wxapp/common/user_info.js +1 -1
  126. package/package.json +162 -141
  127. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  128. package/dist/utils/memberFormatUtils.js +0 -1
  129. package/dist/utils/priceUtils.js +0 -1
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  SECTION_HOME_TAB_TYPE,
3
2
  SECTION_HOME_TAB_NAME_TYPE,
4
3
  SHOP_MENU_ID_NAME,
5
4
  SHOP_MENU_ID_TYPE,
6
5
 
7
6
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
8
7
  console.log('[降级H5] jdJumpToShopHome index.weapp')
9
8
  const getInfo = Object.assign(
10
9
  {},
11
10
  {
12
11
  shopId: global.info.queryInfo.shopId,
13
12
  venderId: global.info.queryInfo.venderId,
14
13
  },
15
14
  shopInfo,
16
15
  )
17
16
  this.jdJumpToShopBase(getInfo)
18
17
  }
19
18
 
20
19
  jdJumpToShopCategory(shopId, venderId, logEventInfo = {}) {
21
20
  console.log('[降级H5] jdJumpToShopCategory index.weapp')
22
21
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
23
22
  shopId,
24
23
  venderId,
25
24
  tabActive: SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY],
26
25
  logEventInfo,
27
26
  })
28
27
  }
29
28
 
30
29
  jdJumpToShopBase(shopInfo) {
31
30
  console.log('[降级H5] jdJumpToShopBase index.weapp')
32
31
  this.jdNavigateToNative(
33
32
  `${this.jumpMiniPath.shopx}?${objectToUrlEncode(
34
33
  this.getShopIdOrVenderIdParams(shopInfo),
35
34
  )}`,
36
35
  {
37
36
  ...shopInfo,
38
37
  },
39
38
  )
40
39
  }
41
40
 
42
41
  jdJumpToShopLight(shopInfo) {
43
42
  this.jdNavigateToNative(
44
43
  `${this.jumpMiniPath.shopLight}?${objectToUrlEncode(
45
44
  this.getShopIdOrVenderIdParams(shopInfo),
46
45
  )}`,
47
46
  {
48
47
  ...shopInfo,
49
48
  },
50
49
  )
51
50
  }
52
51
 
53
52
  jdJumpToProduct(skuIds, logEventInfo) {
54
53
  skuIds = skuIds.toString().trim()
55
54
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
56
55
  console.log('京购商详页跳转2:', this.jumpMiniPath.detail)
57
56
  this.jdNavigateToNative(
58
57
  `${this.jumpMiniPath.detail}?sku=${getSkuId}`,
59
58
  logEventInfo,
60
59
  )
61
60
  }
62
61
 
63
62
  jdJumpToCoupon(
64
63
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
65
64
  logInfo,
66
65
  ) {
67
66
  if (
68
67
  nowUrlParams.batchId &&
69
68
  (nowUrlParams.bindType === 1 || nowUrlParams.bindType === 3)
70
69
  ) {
71
70
  const couponUrlParams = {
72
71
  batch: nowUrlParams.batchId,
73
72
  kind: nowUrlParams.bindType,
74
73
  startTime: nowUrlParams.startTime,
75
74
  endTime: nowUrlParams.endTime,
76
75
  quangoufrom: 6,
77
76
  }
78
77
  this.jdNavigateToNative(
79
78
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(
80
79
  couponUrlParams,
81
80
  )}`,
82
81
  {
83
82
  ...logInfo,
84
83
  },
85
84
  )
86
85
  } else if (
87
86
  nowUrlParams.batchId &&
88
87
  nowUrlParams.bindType !== 1 &&
89
88
  nowUrlParams.bindType !== 3
90
89
  ) {
91
90
  const couponUrlParams = {
92
91
  ...this.getShopIdOrVenderIdParams(global.info.queryInfo),
93
92
  sceneId: 1002,
94
93
  }
95
94
  this.jdNavigateToNative(
96
95
  `${this.jumpMiniPath.shop}?${objectToUrlEncode(couponUrlParams)}`,
97
96
  {
98
97
  ...logInfo,
99
98
  },
100
99
  )
101
100
  }
102
101
  }
103
102
 
104
103
  jdJumpToJTCoupon(
105
104
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
106
105
  logInfo,
107
106
  ) {
108
107
  const couponUrlParams = {
109
108
  batch: nowUrlParams.batchId,
110
109
  kind: nowUrlParams.bindType,
111
110
  startTime: nowUrlParams.startTime,
112
111
  endTime: nowUrlParams.endTime,
113
112
  quangoufrom: 6,
114
113
  }
115
114
  this.jdNavigateToNative(
116
115
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(couponUrlParams)}`,
117
116
  {
118
117
  ...logInfo,
119
118
  },
120
119
  )
121
120
  }
122
121
 
123
122
  jdJumpToRankList(contentId: string | number, rankType = 10, logEventInfo) {
124
123
  const rankUrl = `${this.jumpWebUrl.rank}?contentId=${contentId}&sku=&rankType=${rankType}&fromName=dcpws&hideAd=1`
125
124
  this.jdJumpToWeb(rankUrl, {
126
125
  contentId,
127
126
  ...logEventInfo,
128
127
  })
129
128
  }
130
129
 
131
130
  jdJumpToWeb(spUrl, logEventInfo) {
132
131
  this.jdNavigateToNative(
133
132
  `${this.jumpMiniPath.h5}?encode_url=${encodeURIComponent(spUrl)}`,
134
133
  {
135
134
  ...logEventInfo,
136
135
  },
137
136
  )
138
137
  }
139
138
 
140
139
  weappRedirectToWeb(
141
140
  url: string,
142
141
  logEventInfo: JumpEventReportInterFace.OptEventLogParams = {},
143
142
  ) {
144
143
  const encodeUrl = `/pages/h5/index?encode_url=${encodeURIComponent(url)}`
145
144
  try {
146
145
  this.clickEventLog(logEventInfo)
147
146
  } catch (e) {
148
147
  console.log(e)
149
148
  }
150
149
  setTimeout(() => {
151
150
  Taro.redirectTo({ url: encodeUrl })
152
151
  .then((res) => {
153
152
  console.log('weappRedirectToWeb.success', res)
154
153
  })
155
154
  .catch((err) => {
156
155
  console.log('weappRedirectToWeb.fail', err)
157
156
  })
158
157
  }, 200)
159
158
  }
160
159
 
161
160
  jdJumpToLive(liveInfo, logEventInfo = {}) {
162
161
  if (liveInfo?.liveId) {
163
162
  this.jdJumpToWeb(
164
163
  `${this.jumpWebUrl.mLive}/${liveInfo?.liveId}?origin=0&appid=jdgw`,
165
164
  logEventInfo,
166
165
  )
167
166
  }
168
167
  }
169
168
 
170
169
  jdJumpToActivityPlace(spUrl, logEventInfo) {
171
170
  this.jdJumpToWeb(spUrl, logEventInfo)
172
171
  }
173
172
 
174
173
  jdJumpToShopFans(fansParams, logEventInfo) {
175
174
  this.jdNavigateToNative(
176
175
  `${this.jumpMiniPath.shopFans}?${objectToUrlEncode(fansParams)}`,
177
176
  {
178
177
  ...logEventInfo,
179
178
  },
180
179
  )
181
180
  }
182
181
 
183
182
  jdJumpToShopDetail(shopInfo) {
184
183
  const getInfo = Object.assign(
185
184
  {},
186
185
  {
187
186
  shopId: global.info.queryInfo.shopId,
188
187
  venderId: global.info.queryInfo.venderId,
189
188
  },
190
189
  shopInfo,
191
190
  )
192
191
  const getShopInfo = this.getShopIdOrVenderIdParams(getInfo)
193
192
  this.jdJumpToWeb(
194
193
  `${this.jumpWebUrl.shopIntroduce}?${objectToUrlEncode(getShopInfo)}`,
195
194
  getInfo,
196
195
  )
197
196
  }
198
197
 
199
198
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
200
199
  this.jdNavigateToNative(
201
200
  `${this.jumpMiniPath.couponSearch}?batch=${couponId}`,
202
201
  logEventInfo,
203
202
  )
204
203
  }
205
204
 
206
205
  jdJumpToShopActivity(shopInfo) {
207
206
  const { configDataValue, logEventInfo, projectId } = shopInfo
208
207
  if (projectId && configDataValue) {
209
208
  this.jdJumpToWeb(
210
209
  `${this.jumpWebUrl.shopSecondActivity}/${configDataValue.data}.html`,
211
210
  logEventInfo,
212
211
  )
213
212
  }
214
213
  }
215
214
 
216
215
  _checkUrlIsProductAndGetSkuInfo(url) {
217
216
  let skuId = null
218
217
  if (/\/\/item\.jd\.com\/(\d+)\.html/.test(url)) {
219
218
  const getSkuRes = url.match(/\/\/item\.jd\.com\/(\d+)\.html/)
220
219
  if (getSkuRes && getSkuRes[1]) {
221
220
  skuId = getSkuRes[1]
222
221
  }
223
222
  } else if (/\/\/item\.m\.jd.com\/product\/(\d+)\.html/.test(url)) {
224
223
  const getSkuRes2 = url.match(/\/\/item\.m\.jd\.com\/product\/(\d+)\.html/)
225
224
  if (getSkuRes2 && getSkuRes2[1]) {
226
225
  skuId = getSkuRes2[1]
227
226
  }
228
227
  }
229
228
  return skuId
230
229
  }
231
230
 
232
231
  jdJumpConfigUrl(detail, logEventInfo = {}) {
233
232
  const { configDataType, configDataValue } = detail
234
233
  switch (configDataType) {
235
234
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
236
235
  if(logEventInfo?.jsonParam?.logBaseInfo?.mInfo){
237
236
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds
238
237
  }
239
238
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
240
239
  break
241
240
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
242
241
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
243
242
  const getShopSearchParams = this.jdOpenAppParams(
244
243
  configDataValue.clickUrl,
245
244
  )
246
245
  getShopSearchParams &&
247
246
  this.jdJumpToShopSearch(
248
247
  Object.assign({}, getShopSearchParams, {
249
248
  logEventInfo,
250
249
  }),
251
250
  )
252
251
  } else {
253
252
  this.jdJumpToShopSearch(
254
253
  configDataValue['cid']
255
254
  ? Object.assign(
256
255
  {},
257
256
  {
258
257
  shopId: global.info.queryInfo.shopId,
259
258
  categoryId: configDataValue.cid,
260
259
  ...configDataValue,
261
260
  logEventInfo,
262
261
  },
263
262
  )
264
263
  : {
265
264
  shopId: global.info.queryInfo.shopId,
266
265
  logEventInfo,
267
266
  },
268
267
  )
269
268
  }
270
269
  break
271
270
  case LinkConfigType.CONFIG_TYPE_MEMBER:
272
271
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
273
272
  const getShopMemberParams = this.jdOpenAppParams(
274
273
  configDataValue.clickUrl,
275
274
  )
276
275
  getShopMemberParams &&
277
276
  this.jdJumpToShopMember(
278
277
  Object.assign({}, getShopMemberParams, {
279
278
  logEventInfo,
280
279
  }),
281
280
  )
282
281
  } else {
283
282
  this.jdJumpToShopMember({
284
283
  shopId: global.info.queryInfo.shopId,
285
284
  venderId: configDataValue.shopDetail,
286
285
  logEventInfo,
287
286
  })
288
287
  }
289
288
  break
290
289
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
291
290
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
292
291
  const getShopActivityParams = this.jdOpenAppParams(
293
292
  configDataValue.clickUrl,
294
293
  )
295
294
  if (
296
295
  getShopActivityParams &&
297
296
  getShopActivityParams['des'] == 'jshopActivity'
298
297
  ) {
299
298
  this.jdJumpToShopActivity({
300
299
  projectId: configDataValue['projectId'],
301
300
  configDataValue,
302
301
  logEventInfo,
303
302
  })
304
303
  }
305
304
  } else if (configDataValue['projectId']) {
306
305
  this.jdJumpToShopActivity({
307
306
  projectId: configDataValue['projectId'],
308
307
  configDataValue,
309
308
  logEventInfo,
310
309
  })
311
310
  }
312
311
  break
313
312
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
314
313
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
315
314
  const _url = configDataValue.linkUrl
316
315
  if (
317
316
  _url.indexOf('to=') === -1 &&
318
317
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
319
318
  ) {
320
319
  const _shopId = _url.match(/\d+/g)[0]
321
320
  this.jdJumpToShopHome({
322
321
  shopId: `${_shopId}`,
323
322
  logEventInfo,
324
323
  })
325
324
  } else if (this.isOpenJdAppUrl(_url)) {
326
325
  const getOpenAppParams: any = this.jdOpenAppParams(_url)
327
326
  if (getOpenAppParams) {
328
327
  if (getOpenAppParams.jumpTab == 'allProduct') {
329
328
  this.jdJumpToTabAllProduct(
330
329
  global.info.queryInfo.shopId,
331
330
  global.info.queryInfo.venderId,
332
331
  )
333
332
  } else if (
334
333
  getOpenAppParams.des == 'productList' &&
335
334
  getOpenAppParams.from == 'couponBatch'
336
335
  ) {
337
336
  console.log('优惠券跳转至京购优惠券可用商品列表')
338
337
  this.jdJumpToCouponSearchProductList(getOpenAppParams?.couponId)
339
338
  } else if (getOpenAppParams.des == 'vapp') {
340
339
  this.jdJumpToWeb(
341
340
  `https://conecli.com/apps/mpshare/index.html?category=${
342
341
  getOpenAppParams.category
343
342
  }&des=${getOpenAppParams.des}&vapptype=${
344
343
  getOpenAppParams.vapptype
345
344
  }&appId=${getOpenAppParams.appId}&path=${
346
345
  getOpenAppParams.path
347
346
  }&param=${encodeURI(JSON.stringify(getOpenAppParams.param))}`,
348
347
  logEventInfo,
349
348
  )
350
349
  } else {
351
350
  this.jdNavigateToNative(
352
351
  '',
353
352
  Object.assign({}, getOpenAppParams, {
354
353
  logEventInfo,
355
354
  }),
356
355
  )
357
356
  }
358
357
  }
359
358
  } else {
360
359
  const getSkuId = this._checkUrlIsProductAndGetSkuInfo(_url)
361
360
  getSkuId
362
361
  ? this.jdJumpToProduct(getSkuId, logEventInfo)
363
362
  : this.jdJumpToWeb(_url, logEventInfo)
364
363
  }
365
364
  break
366
365
  }
367
366
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
368
367
  this.jdJumpToShopDetail({
369
368
  venderId: global.info.queryInfo.venderId,
370
369
  shopId: global.info.queryInfo.shopId,
371
370
  logEventInfo,
372
371
  })
373
372
  break
374
373
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
375
374
  this.jdJumpToShopHome({
376
375
  ...configDataValue,
377
376
  logEventInfo,
378
377
  })
379
378
  break
380
379
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
381
380
  this.jdJumpToShopCategory(
382
381
  global.info.queryInfo.shopId,
383
382
  global.info.queryInfo.venderId,
384
383
  )
385
384
  break
386
385
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
387
386
  break
388
387
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
389
388
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
390
389
  const getShoppingGuideParams = this.jdOpenAppParams(
391
390
  configDataValue.clickUrl,
392
391
  )
393
392
  getShoppingGuideParams &&
394
393
  this.jdJumpToShopActivity(
395
394
  Object.assign({}, getShoppingGuideParams, {
396
395
  logEventInfo,
397
396
  }),
398
397
  )
399
398
  }
400
399
  break
401
400
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
402
401
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
403
402
  const search = linkUrl.match(/\?.+/)
404
403
  if (search) {
405
404
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
406
405
  parseQueryUrlString(linkUrl)
407
406
  try {
408
407
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
409
408
  } catch (e) {
410
409
  console.warn('解析小程序 param 错误:', miniQueryData.param)
411
410
  }
412
411
  this.jdJumpToMiniProgram(miniQueryData)
413
412
  } else {
414
413
  console.warn('小程序地址错误:', linkUrl)
415
414
  }
416
415
  break
417
416
  }
418
417
  default:
419
418
  }
420
419
  }
421
420
 
422
421
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
423
422
  console.log('index.weapp.ts - jdJumpToTabAllProduct')
424
423
  if(typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId
425
424
  if(typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId
426
425
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
427
426
  shopId,
428
427
  venderId,
429
428
  tabActive: SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT],
430
429
  logEventInfo,
431
430
  })
432
431
  }
433
432
 
434
433
  jdJumpToTopTabBase(type, shopInfo = {}) {
435
434
  const getInfo = Object.assign(
436
435
  {},
437
436
  {
438
437
  shopId: global.info.queryInfo.shopId,
439
438
  venderId: global.info.queryInfo.venderId,
440
439
  },
441
440
  shopInfo,
442
441
  )
443
442
  console.log('小程序原生跳转 jdJumpToTopTabBase')
444
443
  const { shopId, venderId, ...logEventInfo } = getInfo
445
444
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
446
445
  shopId,
447
446
  venderId,
448
447
  tabActive: type,
449
448
  ...logEventInfo,
450
449
  })
451
450
  }
452
451
 
453
452
  jdJumpToSearch(shopId, suggestWord) {
454
453
  if(typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId
455
454
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopSearch, {
456
455
  shopId,
457
456
  })
458
457
  }
459
458
 
460
459
  jdJumpToAppHome(params = {}) {
461
460
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.jingGouHome, params)
462
461
  }
463
462
 
464
463
  jdJumpToThreePlatform(spUrl, logEventInfo) {
465
464
  this.jdJumpToWeb(spUrl, logEventInfo)
466
465
  }
467
466
 
468
467
  jdJumpToMiniProgram({
469
468
  appId,
470
469
  path,
471
470
  param = {},
472
471
  }: JumpEventReportInterFace.LinkMiniParams) {
473
472
  const pageName = param['pageType'] || 'home'
474
473
  path = `pages/${pageName}/index`
475
474
  if (appId === global.info.pageInfo?.appId) {
476
475
  Taro.navigateTo({
477
476
  url: `/${path}?${objectToUrlEncode(param)}`,
478
477
  }).catch((err) => {
479
478
  console.warn('跳转小程序页面错误:', err)
480
479
  })
481
480
  } else {
482
481
  console.log('一个小程序跳转到另一个小程序暂无此业务')
483
482
  }
484
483
  }
485
484
 
486
485
  jdJumpToAppMiniProgram(
487
486
  path: string,
488
487
  param = {},
489
488
  successBack?: Function,
490
489
  failBack?: Function,
491
490
  ) {
492
491
  this.jdNavigateToNative(path, param, successBack, failBack)
493
492
  }
494
493
 
495
494
  jdNavigateToNative(
496
495
  url: string,
497
496
  params: {
498
497
  logEventInfo?: object
499
498
  } = {},
500
499
  successBack?: Function,
501
500
  failBack?: Function,
502
501
  ) {
503
502
  const { logEventInfo, ...otherParams } = params
504
503
  const getEparam = logEventInfo || params
505
504
  console.log('[降级H5] index.weapp jdNavigateToNative params: ', params)
506
505
  console.log('wxmini logEventInfo params: ', logEventInfo)
507
506
  try {
508
507
  this.clickEventLog(getEparam)
509
508
  } catch (e) {
510
509
  console.log(e)
511
510
  }
512
511
  setTimeout(() => {
513
512
  console.log('进来了啊 first~')
514
513
  const goToPath = `${url}${
515
514
  otherParams ? (url.includes('?')? '&': '?') + objectToUrlEncode(otherParams) : ''
516
515
  }`
517
516
  console.log('打印跳转地址path', goToPath)
518
517
  const isDetail = url.substring(0, url.indexOf('?')) === this.jumpMiniPath.detail
519
518
  console.log('isDetail isDetail isDetail:', isDetail)
520
519
  if (url === this.jumpMiniPath.jingGouHome) {
521
520
  Taro.switchTab({
522
521
  url: goToPath,
523
522
  })
524
523
  .then((res) => {
525
524
  typeof successBack === 'function' && successBack(res)
526
525
  console.log('navigateToWxapp.success', res)
527
526
  })
528
527
  .catch((err) => {
529
528
  typeof failBack === 'function' && failBack(err)
530
529
  console.log('navigateToWxapp.fail', err)
531
530
  })
532
531
  } else {
533
532
  console.log('进来了啊 new new')
534
533
  try{
535
534
  global.wxAppNavigatorInstance.goto(goToPath)
536
535
  typeof successBack === 'function' && successBack()
537
536
  console.log('navigateToWxapp.success')
538
537
  }catch(err){
539
538
  typeof failBack === 'function' && failBack(err)
540
539
  console.log('navigateToWxapp.fail', err)
541
540
  }
542
541
  }
543
542
  }, 200)
544
543
  }
545
544
 
546
545
  clickEventLog(
547
546
  opts: JumpEventReportInterFace.OptEventLogParams = {},
548
547
  clickKey = 'click',
549
548
  ) {
550
549
  const { eventId, jsonParam, eventLevel = 3, skuId, ...otherParams } = opts
551
550
  if (eventId && jsonParam) {
552
551
  if (/TerminatorNew_/.test(eventId + '')) {
553
552
  console.log('mini eventId==========', eventId)
554
553
  }
555
554
  const { etModelInfo, logBaseInfo } = jsonParam
556
555
  const getJsonParam =
557
556
  etModelInfo && logBaseInfo
558
557
  ? logBaseInfo
559
558
  : Object.assign(
560
559
  {},
561
560
  {
562
561
  shopid: global.info.queryInfo?.shopId,
563
562
  },
564
563
  jsonParam,
565
564
  )
566
565
  const miniLogParams = {
567
566
  eid: eventId,
568
567
  elevel: eventLevel,
569
568
  eparam: JSON.stringify(getJsonParam),
570
569
  pageId: this.logPageId,
571
570
  pname: this.logPname,
572
571
  pparam: JSON.stringify(this.routerInfo.params),
573
572
  target: this.routerInfo.path,
574
573
  event: this.nativeEvent,
575
574
  ...otherParams,
576
575
  }
577
576
  if (clickKey === 'addToCart' && skuId) {
578
577
  miniLogParams['shoppingList'] = {
579
578
  [skuId]: 1,
580
579
  }
581
580
  }
582
581
  global.miniAppLogInstance &&
583
582
  global.miniAppLogInstance[clickKey](miniLogParams)
584
583
  } else {
585
584
  console.log('暂无埋点参数eventId和eventParam')
586
585
  }
587
586
  }
588
587
 
589
588
  exposureEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}) {
590
589
  return this.clickEventLog(opts, 'exposure')
591
590
  }
591
+ import Taro from '@tarojs/taro';
592
592
  SECTION_HOME_TAB_TYPE,
593
593
  SECTION_HOME_TAB_NAME_TYPE,
594
594
  SHOP_MENU_ID_NAME,
595
595
  SHOP_MENU_ID_TYPE,
596
596
 
597
597
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
598
598
  console.log('[降级H5] jdJumpToShopHome index.weapp');
599
599
  const currentShopInfo = {
600
600
  shopId: global.info.queryInfo.shopId,
601
601
  venderId: global.info.queryInfo.venderId,
602
602
  };
603
603
  const restParams =
604
604
  (shopInfo?.shopId && shopInfo.shopId !== currentShopInfo.shopId) ||
605
605
  (shopInfo?.venderId && shopInfo.venderId !== currentShopInfo.venderId)
606
606
  ? {}
607
607
  : currentShopInfo;
608
608
  const getInfo = Object.assign({}, restParams, shopInfo);
609
609
  this.jdJumpToShopBase(getInfo);
610
610
  }
611
611
 
612
612
  jdJumpToShopCategory(shopId, venderId, logEventInfo = {}) {
613
613
  console.log('[降级H5] jdJumpToShopCategory index.weapp');
614
614
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
615
615
  shopId,
616
616
  venderId,
617
617
  tabActive: SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY],
618
618
  logEventInfo,
619
619
  });
620
620
  }
621
621
 
622
622
  jdJumpToShopBase(shopInfo) {
623
623
  console.log('[降级H5] jdJumpToShopBase index.weapp');
624
624
  this.jdNavigateToNative(
625
625
  `${this.jumpMiniPath.shopx}?${objectToUrlEncode(this.getShopIdOrVenderIdParams(shopInfo))}`,
626
626
  {
627
627
  ...shopInfo,
628
628
  },
629
629
  );
630
630
  }
631
631
 
632
632
  jdJumpToShopLight(shopInfo) {
633
633
  this.jdNavigateToNative(
634
634
  `${this.jumpMiniPath.shopLight}?${objectToUrlEncode(
635
635
  this.getShopIdOrVenderIdParams(shopInfo),
636
636
  )}`,
637
637
  {
638
638
  ...shopInfo,
639
639
  },
640
640
  );
641
641
  }
642
642
 
643
643
  jdJumpToProduct(skuIds, logEventInfo) {
644
644
  skuIds = skuIds.toString().trim();
645
645
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds;
646
646
  console.log('京购商详页跳转2:', this.jumpMiniPath.detail);
647
647
  this.jdNavigateToNative(`${this.jumpMiniPath.detail}?sku=${getSkuId}`, logEventInfo);
648
648
  }
649
649
 
650
650
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
651
651
  const getSkuId = skuInfo?.skuId;
652
652
  console.log('松果小程序跳转商详页:', this.jumpMiniPath.detail);
653
653
  getSkuId &&
654
654
  this.jdNavigateToNative(`${this.jumpMiniPath.detail}?sku=${getSkuId}`, logEventInfo);
655
655
  }
656
656
 
657
657
  jdJumpToCoupon(nowUrlParams: JumpEventReportInterFace.CouponUrlParams, logInfo) {
658
658
  if (nowUrlParams.batchId && (nowUrlParams.bindType === 1 || nowUrlParams.bindType === 3)) {
659
659
  const couponUrlParams = {
660
660
  batch: nowUrlParams.batchId,
661
661
  kind: nowUrlParams.bindType,
662
662
  startTime: nowUrlParams.startTime,
663
663
  endTime: nowUrlParams.endTime,
664
664
  quangoufrom: 6,
665
665
  };
666
666
  this.jdNavigateToNative(
667
667
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(couponUrlParams)}`,
668
668
  {
669
669
  ...logInfo,
670
670
  },
671
671
  );
672
672
  } else if (nowUrlParams.batchId && nowUrlParams.bindType !== 1 && nowUrlParams.bindType !== 3) {
673
673
  const couponUrlParams = {
674
674
  ...this.getShopIdOrVenderIdParams(global.info.queryInfo),
675
675
  sceneId: 1002,
676
676
  };
677
677
  this.jdNavigateToNative(`${this.jumpMiniPath.shop}?${objectToUrlEncode(couponUrlParams)}`, {
678
678
  ...logInfo,
679
679
  });
680
680
  }
681
681
  }
682
682
 
683
683
  jdJumpToJTCoupon(nowUrlParams: JumpEventReportInterFace.CouponUrlParams, logInfo) {
684
684
  const couponUrlParams = {
685
685
  batch: nowUrlParams.batchId,
686
686
  kind: nowUrlParams.bindType,
687
687
  startTime: nowUrlParams.startTime,
688
688
  endTime: nowUrlParams.endTime,
689
689
  quangoufrom: 6,
690
690
  };
691
691
  this.jdNavigateToNative(
692
692
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(couponUrlParams)}`,
693
693
  {
694
694
  ...logInfo,
695
695
  },
696
696
  );
697
697
  }
698
698
 
699
699
  jdJumpToRankList(contentId: string | number, rankType = 10, logEventInfo) {
700
700
  const rankUrl = `${this.jumpWebUrl.rank}?contentId=${contentId}&sku=&rankType=${rankType}&fromName=dcpws&hideAd=1`;
701
701
  this.jdJumpToWeb(rankUrl, {
702
702
  contentId,
703
703
  ...logEventInfo,
704
704
  });
705
705
  }
706
706
 
707
707
  jdJumpToWeb(spUrl, logEventInfo) {
708
708
  this.jdNavigateToNative(`${this.jumpMiniPath.h5}?encode_url=${encodeURIComponent(spUrl)}`, {
709
709
  ...logEventInfo,
710
710
  });
711
711
  }
712
712
 
713
713
  weappRedirectToWeb(url: string, logEventInfo: JumpEventReportInterFace.OptEventLogParams = {}) {
714
714
  const encodeUrl = `/pages/h5/index?encode_url=${encodeURIComponent(url)}`;
715
715
  try {
716
716
  this.clickEventLog(logEventInfo);
717
717
  } catch (e) {
718
718
  console.log(e);
719
719
  }
720
720
  setTimeout(() => {
721
721
  Taro.redirectTo({ url: encodeUrl })
722
722
  .then((res) => {
723
723
  console.log('weappRedirectToWeb.success', res);
724
724
  })
725
725
  .catch((err) => {
726
726
  console.log('weappRedirectToWeb.fail', err);
727
727
  });
728
728
  }, 200);
729
729
  }
730
730
 
731
731
  jdJumpToLive(liveInfo, logEventInfo = {}) {
732
732
  if (liveInfo?.liveId) {
733
733
  this.jdJumpToWeb(
734
734
  `${this.jumpWebUrl.mLive}/${liveInfo?.liveId}?origin=0&appid=jdgw`,
735
735
  logEventInfo,
736
736
  );
737
737
  }
738
738
  }
739
739
 
740
740
  jdJumpToActivityPlace(spUrl, logEventInfo) {
741
741
  this.jdJumpToWeb(spUrl, logEventInfo);
742
742
  }
743
743
 
744
744
  jdJumpToShopFans(fansParams, logEventInfo) {
745
745
  this.jdNavigateToNative(`${this.jumpMiniPath.shopFans}?${objectToUrlEncode(fansParams)}`, {
746
746
  ...logEventInfo,
747
747
  });
748
748
  }
749
749
 
750
750
  jdJumpToShopDetail(shopInfo) {
751
751
  const getInfo = Object.assign(
752
752
  {},
753
753
  {
754
754
  shopId: global.info.queryInfo.shopId,
755
755
  venderId: global.info.queryInfo.venderId,
756
756
  },
757
757
  shopInfo,
758
758
  );
759
759
  const getShopInfo = this.getShopIdOrVenderIdParams(getInfo);
760
760
  this.jdJumpToWeb(`${this.jumpWebUrl.shopIntroduce}?${objectToUrlEncode(getShopInfo)}`, getInfo);
761
761
  }
762
762
 
763
763
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
764
764
  this.jdNavigateToNative(`${this.jumpMiniPath.couponSearch}?batch=${couponId}`, logEventInfo);
765
765
  }
766
766
 
767
767
  jdJumpToShopActivity(shopInfo) {
768
768
  const { configDataValue, logEventInfo, projectId } = shopInfo;
769
769
  if (projectId && configDataValue) {
770
770
  this.jdJumpToWeb(
771
771
  `${this.jumpWebUrl.shopSecondActivity}/${configDataValue.data}.html`,
772
772
  logEventInfo,
773
773
  );
774
774
  }
775
775
  }
776
776
 
777
777
  _checkUrlIsProductAndGetSkuInfo(url) {
778
778
  let skuId = null;
779
779
  if (/\/\/item\.jd\.com\/(\d+)\.html/.test(url)) {
780
780
  const getSkuRes = url.match(/\/\/item\.jd\.com\/(\d+)\.html/);
781
781
  if (getSkuRes && getSkuRes[1]) {
782
782
  skuId = getSkuRes[1];
783
783
  }
784
784
  } else if (/\/\/item\.m\.jd.com\/product\/(\d+)\.html/.test(url)) {
785
785
  const getSkuRes2 = url.match(/\/\/item\.m\.jd\.com\/product\/(\d+)\.html/);
786
786
  if (getSkuRes2 && getSkuRes2[1]) {
787
787
  skuId = getSkuRes2[1];
788
788
  }
789
789
  }
790
790
  return skuId;
791
791
  }
792
792
 
793
793
  jdJumpConfigUrl(detail, logEventInfo = {}) {
794
794
  const { configDataType, configDataValue } = detail;
795
795
  switch (configDataType) {
796
796
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
797
797
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
798
798
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
799
799
  }
800
800
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
801
801
  break;
802
802
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
803
803
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
804
804
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
805
805
  getShopSearchParams &&
806
806
  this.jdJumpToShopSearch(
807
807
  Object.assign({}, getShopSearchParams, {
808
808
  logEventInfo,
809
809
  }),
810
810
  );
811
811
  } else {
812
812
  this.jdJumpToShopSearch(
813
813
  configDataValue['cid']
814
814
  ? Object.assign(
815
815
  {},
816
816
  {
817
817
  shopId: global.info.queryInfo.shopId,
818
818
  categoryId: configDataValue.cid,
819
819
  ...configDataValue,
820
820
  logEventInfo,
821
821
  },
822
822
  )
823
823
  : {
824
824
  shopId: global.info.queryInfo.shopId,
825
825
  logEventInfo,
826
826
  },
827
827
  );
828
828
  }
829
829
  break;
830
830
  case LinkConfigType.CONFIG_TYPE_MEMBER:
831
831
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
832
832
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
833
833
  getShopMemberParams &&
834
834
  this.jdJumpToShopMember(
835
835
  Object.assign({}, getShopMemberParams, {
836
836
  logEventInfo,
837
837
  }),
838
838
  );
839
839
  } else {
840
840
  this.jdJumpToShopMember({
841
841
  shopId: global.info.queryInfo.shopId,
842
842
  venderId: configDataValue.shopDetail,
843
843
  logEventInfo,
844
844
  });
845
845
  }
846
846
  break;
847
847
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
848
848
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
849
849
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
850
850
  if (getShopActivityParams && getShopActivityParams['des'] == 'jshopActivity') {
851
851
  this.jdJumpToShopActivity({
852
852
  projectId: configDataValue['projectId'],
853
853
  configDataValue,
854
854
  logEventInfo,
855
855
  });
856
856
  }
857
857
  } else if (configDataValue['projectId']) {
858
858
  this.jdJumpToShopActivity({
859
859
  projectId: configDataValue['projectId'],
860
860
  configDataValue,
861
861
  logEventInfo,
862
862
  });
863
863
  }
864
864
  break;
865
865
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
866
866
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
867
867
  const _url = configDataValue.linkUrl;
868
868
  if (
869
869
  _url.indexOf('to=') === -1 &&
870
870
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
871
871
  ) {
872
872
  const _shopId = _url.match(/\d+/g)[0];
873
873
  this.jdJumpToShopHome({
874
874
  shopId: `${_shopId}`,
875
875
  logEventInfo,
876
876
  });
877
877
  } else if (this.isOpenJdAppUrl(_url)) {
878
878
  const getOpenAppParams: any = this.jdOpenAppParams(_url);
879
879
  if (getOpenAppParams) {
880
880
  if (getOpenAppParams.jumpTab == 'allProduct') {
881
881
  this.jdJumpToTabAllProduct(
882
882
  global.info.queryInfo.shopId,
883
883
  global.info.queryInfo.venderId,
884
884
  );
885
885
  } else if (
886
886
  getOpenAppParams.des == 'productList' &&
887
887
  getOpenAppParams.from == 'couponBatch'
888
888
  ) {
889
889
  console.log('优惠券跳转至京购优惠券可用商品列表');
890
890
  this.jdJumpToCouponSearchProductList(getOpenAppParams?.couponId);
891
891
  } else if (getOpenAppParams.des == 'vapp') {
892
892
  this.jdJumpToWeb(
893
893
  `https://conecli.com/apps/mpshare/index.html?category=${
894
894
  getOpenAppParams.category
895
895
  }&des=${getOpenAppParams.des}&vapptype=${getOpenAppParams.vapptype}&appId=${
896
896
  getOpenAppParams.appId
897
897
  }&path=${getOpenAppParams.path}&param=${encodeURI(
898
898
  JSON.stringify(getOpenAppParams.param),
899
899
  )}`,
900
900
  logEventInfo,
901
901
  );
902
902
  } else {
903
903
  this.jdNavigateToNative(
904
904
  '',
905
905
  Object.assign({}, getOpenAppParams, {
906
906
  logEventInfo,
907
907
  }),
908
908
  );
909
909
  }
910
910
  }
911
911
  } else {
912
912
  const getSkuId = this._checkUrlIsProductAndGetSkuInfo(_url);
913
913
  getSkuId
914
914
  ? this.jdJumpToProduct(getSkuId, logEventInfo)
915
915
  : this.jdJumpToWeb(_url, logEventInfo);
916
916
  }
917
917
  break;
918
918
  }
919
919
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
920
920
  this.jdJumpToShopDetail({
921
921
  venderId: global.info.queryInfo.venderId,
922
922
  shopId: global.info.queryInfo.shopId,
923
923
  logEventInfo,
924
924
  });
925
925
  break;
926
926
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
927
927
  this.jdJumpToShopHome({
928
928
  ...configDataValue,
929
929
  logEventInfo,
930
930
  });
931
931
  break;
932
932
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
933
933
  this.jdJumpToShopCategory(global.info.queryInfo.shopId, global.info.queryInfo.venderId);
934
934
  break;
935
935
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
936
936
  break;
937
937
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
938
938
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
939
939
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
940
940
  getShoppingGuideParams &&
941
941
  this.jdJumpToShopActivity(
942
942
  Object.assign({}, getShoppingGuideParams, {
943
943
  logEventInfo,
944
944
  }),
945
945
  );
946
946
  }
947
947
  break;
948
948
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
949
949
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
950
950
  const search = linkUrl.match(/\?.+/);
951
951
  if (search) {
952
952
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
953
953
  parseQueryUrlString(linkUrl);
954
954
  try {
955
955
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
956
956
  } catch (e) {
957
957
  console.warn('解析小程序 param 错误:', miniQueryData.param);
958
958
  }
959
959
  this.jdJumpToMiniProgram(miniQueryData);
960
960
  } else {
961
961
  console.warn('小程序地址错误:', linkUrl);
962
962
  }
963
963
  break;
964
964
  }
965
965
  default:
966
966
  }
967
967
  }
968
968
 
969
969
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
970
970
  console.log('index.weapp.ts - jdJumpToTabAllProduct');
971
971
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
972
972
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
973
973
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
974
974
  shopId,
975
975
  venderId,
976
976
  tabActive: SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT],
977
977
  logEventInfo,
978
978
  });
979
979
  }
980
980
 
981
981
  jdJumpToTopTabBase(type, shopInfo = {}) {
982
982
  const getInfo = Object.assign(
983
983
  {},
984
984
  {
985
985
  shopId: global.info.queryInfo.shopId,
986
986
  venderId: global.info.queryInfo.venderId,
987
987
  },
988
988
  shopInfo,
989
989
  );
990
990
  console.log('小程序原生跳转 jdJumpToTopTabBase');
991
991
  const { shopId, venderId, ...logEventInfo } = getInfo;
992
992
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
993
993
  shopId,
994
994
  venderId,
995
995
  tabActive: type,
996
996
  ...logEventInfo,
997
997
  });
998
998
  }
999
999
 
1000
1000
  jdJumpToSearch(shopId, suggestWord) {
1001
1001
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
1002
1002
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopSearch, {
1003
1003
  shopId,
1004
1004
  });
1005
1005
  }
1006
1006
 
1007
1007
  jdJumpToAppHome(params = {}) {
1008
1008
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.jingGouHome, params);
1009
1009
  }
1010
1010
 
1011
1011
  jdJumpToThreePlatform(spUrl, logEventInfo) {
1012
1012
  this.jdJumpToWeb(spUrl, logEventInfo);
1013
1013
  }
1014
1014
 
1015
1015
  jdJumpToMiniProgram({ appId, path, param = {} }: JumpEventReportInterFace.LinkMiniParams) {
1016
1016
  const pageName = param['pageType'] || 'home';
1017
1017
  path = `pages/${pageName}/index`;
1018
1018
  if (appId === global.info.pageInfo?.appId) {
1019
1019
  Taro.navigateTo({
1020
1020
  url: `/${path}?${objectToUrlEncode(param)}`,
1021
1021
  }).catch((err) => {
1022
1022
  console.warn('跳转小程序页面错误:', err);
1023
1023
  });
1024
1024
  } else {
1025
1025
  console.log('一个小程序跳转到另一个小程序暂无此业务');
1026
1026
  }
1027
1027
  }
1028
1028
 
1029
1029
  jdJumpToAppMiniProgram(path: string, param = {}, successBack?: Function, failBack?: Function) {
1030
1030
  this.jdNavigateToNative(path, param, successBack, failBack);
1031
1031
  }
1032
1032
 
1033
1033
  jdNavigateToNative(
1034
1034
  url: string,
1035
1035
  params: {
1036
1036
  logEventInfo?: object;
1037
1037
  } = {},
1038
1038
  successBack?: Function,
1039
1039
  failBack?: Function,
1040
1040
  ) {
1041
1041
  const { logEventInfo, ...otherParams } = params;
1042
1042
  const getEparam = logEventInfo || params;
1043
1043
  console.log('[降级H5] index.weapp jdNavigateToNative params: ', params);
1044
1044
  console.log('wxmini logEventInfo params: ', logEventInfo);
1045
1045
  try {
1046
1046
  this.clickEventLog(getEparam);
1047
1047
  } catch (e) {
1048
1048
  console.log(e);
1049
1049
  }
1050
1050
  setTimeout(() => {
1051
1051
  console.log('进来了啊 first~');
1052
1052
  const goToPath = `${url}${
1053
1053
  otherParams ? (url.includes('?') ? '&' : '?') + objectToUrlEncode(otherParams) : ''
1054
1054
  }`;
1055
1055
  console.log('打印跳转地址path', goToPath);
1056
1056
  const isDetail = url.substring(0, url.indexOf('?')) === this.jumpMiniPath.detail;
1057
1057
  console.log('isDetail isDetail isDetail:', isDetail);
1058
1058
  if (url === this.jumpMiniPath.jingGouHome) {
1059
1059
  Taro.switchTab({
1060
1060
  url: goToPath,
1061
1061
  })
1062
1062
  .then((res) => {
1063
1063
  typeof successBack === 'function' && successBack(res);
1064
1064
  console.log('navigateToWxapp.success', res);
1065
1065
  })
1066
1066
  .catch((err) => {
1067
1067
  typeof failBack === 'function' && failBack(err);
1068
1068
  console.log('navigateToWxapp.fail', err);
1069
1069
  });
1070
1070
  } else {
1071
1071
  console.log('进来了啊 new new');
1072
1072
  try {
1073
1073
  global.wxAppNavigatorInstance.goto(goToPath);
1074
1074
  typeof successBack === 'function' && successBack();
1075
1075
  console.log('navigateToWxapp.success');
1076
1076
  } catch (err) {
1077
1077
  typeof failBack === 'function' && failBack(err);
1078
1078
  console.log('navigateToWxapp.fail', err);
1079
1079
  }
1080
1080
  }
1081
1081
  }, 200);
1082
1082
  }
1083
1083
 
1084
1084
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, clickKey = 'click') {
1085
1085
  const { eventId, jsonParam, eventLevel = 3, skuId, ...otherParams } = opts;
1086
1086
  if (eventId && jsonParam) {
1087
1087
  if (/TerminatorNew_/.test(eventId + '')) {
1088
1088
  console.log('mini eventId==========', eventId);
1089
1089
  }
1090
1090
  const { etModelInfo, logBaseInfo } = jsonParam;
1091
1091
  const getJsonParam =
1092
1092
  etModelInfo && logBaseInfo
1093
1093
  ? logBaseInfo
1094
1094
  : Object.assign(
1095
1095
  {},
1096
1096
  {
1097
1097
  shopid: global.info.queryInfo?.shopId,
1098
1098
  },
1099
1099
  jsonParam,
1100
1100
  );
1101
1101
  const miniLogParams = {
1102
1102
  eid: eventId,
1103
1103
  elevel: eventLevel,
1104
1104
  eparam: JSON.stringify(getJsonParam),
1105
1105
  pageId: this.logPageId,
1106
1106
  pname: this.logPname,
1107
1107
  pparam: JSON.stringify(this.routerInfo.params),
1108
1108
  target: this.routerInfo.path,
1109
1109
  event: this.nativeEvent,
1110
1110
  ...otherParams,
1111
1111
  };
1112
1112
  if (clickKey === 'addToCart' && skuId) {
1113
1113
  miniLogParams['shoppingList'] = {
1114
1114
  [skuId]: 1,
1115
1115
  };
1116
1116
  }
1117
1117
  global.miniAppLogInstance && global.miniAppLogInstance[clickKey](miniLogParams);
1118
1118
  } else {
1119
1119
  console.log('暂无埋点参数eventId和eventParam');
1120
1120
  }
1121
1121
  }
1122
1122
 
1123
1123
  exposureEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}) {
1124
1124
  return this.clickEventLog(opts, 'exposure');
1125
1125
  }