@conecli/cone-render 0.9.1-shop2.4 → 0.9.1-shop2.40

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 (117) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/assets/icon_blue_info.svg +1 -0
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/environmentType.ts +1 -0
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.ts +1 -0
  10. package/dist/common/pageType.ts +1 -1
  11. package/dist/common/sgmCustomCode.ts +1 -0
  12. package/dist/common/token/token.jd.ts +1 -1
  13. package/dist/common/token/token.ts +1 -1
  14. package/dist/common/wxappApi.jd.ts +1 -0
  15. package/dist/components/ErrorBoundary.tsx +1 -1
  16. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  17. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  18. package/dist/components/base/CountDown/index.module.scss +49 -44
  19. package/dist/components/base/CountDown/index.tsx +1 -1
  20. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  21. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  22. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  23. package/dist/components/base/CustomVideo/common.ts +1 -0
  24. package/dist/components/base/CustomVideo/index.tsx +1 -1
  25. package/dist/components/base/Dialog/index.module.scss +16 -0
  26. package/dist/components/base/Dialog/index.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  28. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  30. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  31. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  32. package/dist/components/base/InViewRender/index.tsx +1 -1
  33. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  34. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  35. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  36. package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
  37. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  38. package/dist/components/base/MobileCommonHeader/index.module.scss +8 -0
  39. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  40. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  41. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  42. package/dist/components/base/Price/Base/index.tsx +1 -1
  43. package/dist/components/base/Price/Double/index.module.scss +8 -0
  44. package/dist/components/base/Price/Double/index.tsx +1 -1
  45. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  46. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  48. package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
  49. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  50. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  51. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  52. package/dist/components/floorItem.jd.tsx +1 -1
  53. package/dist/components/floorItem.tsx +1 -1
  54. package/dist/components/floorItem.weapp.tsx +1 -1
  55. package/dist/components/isv/Floor/index.tsx +1 -1
  56. package/dist/components/remoteFloorItem.tsx +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/interface/utils.ts +1 -1
  62. package/dist/jumpEventReport/base.ts +1 -1
  63. package/dist/jumpEventReport/const.ts +1 -1
  64. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  65. package/dist/jumpEventReport/index.h5.ts +1 -1
  66. package/dist/jumpEventReport/index.jd.ts +1 -1
  67. package/dist/jumpEventReport/index.weapp.ts +1 -1
  68. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  69. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  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 -0
  77. package/dist/jumpEventReport/web.pc.ts +1 -1
  78. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  79. package/dist/jumpEventReport/web.tjm.ts +1 -0
  80. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  81. package/dist/modules/ContainerFloorList/index.h5.module.scss +30 -1
  82. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  83. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  84. package/dist/open/api/device.ts +1 -1
  85. package/dist/open/api/environment.ts +1 -1
  86. package/dist/open/api/index.ts +1 -1
  87. package/dist/open/api/jump copy.ts +1 -1
  88. package/dist/open/api/request.ts +1 -1
  89. package/dist/open/api/shopMember.ts +1 -1
  90. package/dist/open/api/track.ts +1 -1
  91. package/dist/open/api/util.ts +1 -1
  92. package/dist/open/components/index.ts +1 -1
  93. package/dist/sass/app.h5.scss +274 -212
  94. package/dist/sass/base.scss +195 -137
  95. package/dist/service/fetchGateway.ts +1 -1
  96. package/dist/service/http/colorSign.ts +1 -1
  97. package/dist/service/http/const.ts +1 -1
  98. package/dist/service/http/h5Http.ts +1 -0
  99. package/dist/service/http/index.h5.ts +1 -0
  100. package/dist/service/requestServer.h5.ts +1 -0
  101. package/dist/service/requestServer.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.ts +1 -1
  103. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  104. package/dist/utils/draExceptionAndProfile.ts +1 -1
  105. package/dist/utils/h5Utils.ts +1 -1
  106. package/dist/utils/index.h5.ts +1 -1
  107. package/dist/utils/index.ts +1 -1
  108. package/dist/utils/index.weapp.ts +1 -1
  109. package/dist/utils/jm-common.js +1 -1
  110. package/dist/utils/jumpExtMapUtil.js +1 -0
  111. package/dist/utils/sColor.js +1 -0
  112. package/dist/utils/sgmCodeUtils.ts +1 -0
  113. package/dist/utils/taroRenderUtil.ts +1 -1
  114. package/dist/utils/utils.ts +1 -1
  115. package/package.json +26 -3
  116. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
  117. package/dist/utils/memberFormatUtils.js +0 -1
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
1
+ import Taro from '@tarojs/taro'
2
2
  SECTION_HOME_TAB_TYPE,
3
3
  SECTION_HOME_TAB_NAME_TYPE,
4
4
  SHOP_MENU_ID_NAME,
5
5
  SHOP_MENU_ID_TYPE,
6
6
 
7
7
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
8
8
  console.log('[降级H5] jdJumpToShopHome index.weapp')
9
9
  const getInfo = Object.assign(
10
10
  {},
11
11
  {
12
12
  shopId: global.info.queryInfo.shopId,
13
13
  venderId: global.info.queryInfo.venderId,
14
14
  },
15
15
  shopInfo,
16
16
  )
17
17
  this.jdJumpToShopBase(getInfo)
18
18
  }
19
19
 
20
20
  jdJumpToShopCategory(shopId, venderId, logEventInfo = {}) {
21
21
  console.log('[降级H5] jdJumpToShopCategory index.weapp')
22
22
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
23
23
  shopId,
24
24
  venderId,
25
25
  tabActive: SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY],
26
26
  logEventInfo,
27
27
  })
28
28
  }
29
29
 
30
30
  jdJumpToShopBase(shopInfo) {
31
31
  console.log('[降级H5] jdJumpToShopBase index.weapp')
32
32
  this.jdNavigateToNative(
33
33
  `${this.jumpMiniPath.shopx}?${objectToUrlEncode(
34
34
  this.getShopIdOrVenderIdParams(shopInfo),
35
35
  )}`,
36
36
  {
37
37
  ...shopInfo,
38
38
  },
39
39
  )
40
40
  }
41
41
 
42
42
  jdJumpToShopLight(shopInfo) {
43
43
  this.jdNavigateToNative(
44
44
  `${this.jumpMiniPath.shopLight}?${objectToUrlEncode(
45
45
  this.getShopIdOrVenderIdParams(shopInfo),
46
46
  )}`,
47
47
  {
48
48
  ...shopInfo,
49
49
  },
50
50
  )
51
51
  }
52
52
 
53
53
  jdJumpToProduct(skuIds, logEventInfo) {
54
54
  skuIds = skuIds.toString().trim()
55
55
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
56
56
  console.log('京购商详页跳转2:', this.jumpMiniPath.detail)
57
57
  this.jdNavigateToNative(
58
58
  `${this.jumpMiniPath.detail}?sku=${getSkuId}`,
59
59
  logEventInfo,
60
60
  )
61
61
  }
62
62
 
63
63
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
64
64
  const getSkuId = skuInfo?.skuId;
65
65
  console.log('松果小程序跳转商详页:', this.jumpMiniPath.detail)
66
66
  getSkuId && this.jdNavigateToNative(
67
67
  `${this.jumpMiniPath.detail}?sku=${getSkuId}`,
68
68
  logEventInfo,
69
69
  )
70
70
  }
71
71
 
72
72
  jdJumpToCoupon(
73
73
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
74
74
  logInfo,
75
75
  ) {
76
76
  if (
77
77
  nowUrlParams.batchId &&
78
78
  (nowUrlParams.bindType === 1 || nowUrlParams.bindType === 3)
79
79
  ) {
80
80
  const couponUrlParams = {
81
81
  batch: nowUrlParams.batchId,
82
82
  kind: nowUrlParams.bindType,
83
83
  startTime: nowUrlParams.startTime,
84
84
  endTime: nowUrlParams.endTime,
85
85
  quangoufrom: 6,
86
86
  }
87
87
  this.jdNavigateToNative(
88
88
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(
89
89
  couponUrlParams,
90
90
  )}`,
91
91
  {
92
92
  ...logInfo,
93
93
  },
94
94
  )
95
95
  } else if (
96
96
  nowUrlParams.batchId &&
97
97
  nowUrlParams.bindType !== 1 &&
98
98
  nowUrlParams.bindType !== 3
99
99
  ) {
100
100
  const couponUrlParams = {
101
101
  ...this.getShopIdOrVenderIdParams(global.info.queryInfo),
102
102
  sceneId: 1002,
103
103
  }
104
104
  this.jdNavigateToNative(
105
105
  `${this.jumpMiniPath.shop}?${objectToUrlEncode(couponUrlParams)}`,
106
106
  {
107
107
  ...logInfo,
108
108
  },
109
109
  )
110
110
  }
111
111
  }
112
112
 
113
113
  jdJumpToJTCoupon(
114
114
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
115
115
  logInfo,
116
116
  ) {
117
117
  const couponUrlParams = {
118
118
  batch: nowUrlParams.batchId,
119
119
  kind: nowUrlParams.bindType,
120
120
  startTime: nowUrlParams.startTime,
121
121
  endTime: nowUrlParams.endTime,
122
122
  quangoufrom: 6,
123
123
  }
124
124
  this.jdNavigateToNative(
125
125
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(couponUrlParams)}`,
126
126
  {
127
127
  ...logInfo,
128
128
  },
129
129
  )
130
130
  }
131
131
 
132
132
  jdJumpToRankList(contentId: string | number, rankType = 10, logEventInfo) {
133
133
  const rankUrl = `${this.jumpWebUrl.rank}?contentId=${contentId}&sku=&rankType=${rankType}&fromName=dcpws&hideAd=1`
134
134
  this.jdJumpToWeb(rankUrl, {
135
135
  contentId,
136
136
  ...logEventInfo,
137
137
  })
138
138
  }
139
139
 
140
140
  jdJumpToWeb(spUrl, logEventInfo) {
141
141
  this.jdNavigateToNative(
142
142
  `${this.jumpMiniPath.h5}?encode_url=${encodeURIComponent(spUrl)}`,
143
143
  {
144
144
  ...logEventInfo,
145
145
  },
146
146
  )
147
147
  }
148
148
 
149
149
  weappRedirectToWeb(
150
150
  url: string,
151
151
  logEventInfo: JumpEventReportInterFace.OptEventLogParams = {},
152
152
  ) {
153
153
  const encodeUrl = `/pages/h5/index?encode_url=${encodeURIComponent(url)}`
154
154
  try {
155
155
  this.clickEventLog(logEventInfo)
156
156
  } catch (e) {
157
157
  console.log(e)
158
158
  }
159
159
  setTimeout(() => {
160
160
  Taro.redirectTo({ url: encodeUrl })
161
161
  .then((res) => {
162
162
  console.log('weappRedirectToWeb.success', res)
163
163
  })
164
164
  .catch((err) => {
165
165
  console.log('weappRedirectToWeb.fail', err)
166
166
  })
167
167
  }, 200)
168
168
  }
169
169
 
170
170
  jdJumpToLive(liveInfo, logEventInfo = {}) {
171
171
  if (liveInfo?.liveId) {
172
172
  this.jdJumpToWeb(
173
173
  `${this.jumpWebUrl.mLive}/${liveInfo?.liveId}?origin=0&appid=jdgw`,
174
174
  logEventInfo,
175
175
  )
176
176
  }
177
177
  }
178
178
 
179
179
  jdJumpToActivityPlace(spUrl, logEventInfo) {
180
180
  this.jdJumpToWeb(spUrl, logEventInfo)
181
181
  }
182
182
 
183
183
  jdJumpToShopFans(fansParams, logEventInfo) {
184
184
  this.jdNavigateToNative(
185
185
  `${this.jumpMiniPath.shopFans}?${objectToUrlEncode(fansParams)}`,
186
186
  {
187
187
  ...logEventInfo,
188
188
  },
189
189
  )
190
190
  }
191
191
 
192
192
  jdJumpToShopDetail(shopInfo) {
193
193
  const getInfo = Object.assign(
194
194
  {},
195
195
  {
196
196
  shopId: global.info.queryInfo.shopId,
197
197
  venderId: global.info.queryInfo.venderId,
198
198
  },
199
199
  shopInfo,
200
200
  )
201
201
  const getShopInfo = this.getShopIdOrVenderIdParams(getInfo)
202
202
  this.jdJumpToWeb(
203
203
  `${this.jumpWebUrl.shopIntroduce}?${objectToUrlEncode(getShopInfo)}`,
204
204
  getInfo,
205
205
  )
206
206
  }
207
207
 
208
208
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
209
209
  this.jdNavigateToNative(
210
210
  `${this.jumpMiniPath.couponSearch}?batch=${couponId}`,
211
211
  logEventInfo,
212
212
  )
213
213
  }
214
214
 
215
215
  jdJumpToShopActivity(shopInfo) {
216
216
  const { configDataValue, logEventInfo, projectId } = shopInfo
217
217
  if (projectId && configDataValue) {
218
218
  this.jdJumpToWeb(
219
219
  `${this.jumpWebUrl.shopSecondActivity}/${configDataValue.data}.html`,
220
220
  logEventInfo,
221
221
  )
222
222
  }
223
223
  }
224
224
 
225
225
  _checkUrlIsProductAndGetSkuInfo(url) {
226
226
  let skuId = null
227
227
  if (/\/\/item\.jd\.com\/(\d+)\.html/.test(url)) {
228
228
  const getSkuRes = url.match(/\/\/item\.jd\.com\/(\d+)\.html/)
229
229
  if (getSkuRes && getSkuRes[1]) {
230
230
  skuId = getSkuRes[1]
231
231
  }
232
232
  } else if (/\/\/item\.m\.jd.com\/product\/(\d+)\.html/.test(url)) {
233
233
  const getSkuRes2 = url.match(/\/\/item\.m\.jd\.com\/product\/(\d+)\.html/)
234
234
  if (getSkuRes2 && getSkuRes2[1]) {
235
235
  skuId = getSkuRes2[1]
236
236
  }
237
237
  }
238
238
  return skuId
239
239
  }
240
240
 
241
241
  jdJumpConfigUrl(detail, logEventInfo = {}) {
242
242
  const { configDataType, configDataValue } = detail
243
243
  switch (configDataType) {
244
244
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
245
245
  if(logEventInfo?.jsonParam?.logBaseInfo?.mInfo){
246
246
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds
247
247
  }
248
248
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
249
249
  break
250
250
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
251
251
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
252
252
  const getShopSearchParams = this.jdOpenAppParams(
253
253
  configDataValue.clickUrl,
254
254
  )
255
255
  getShopSearchParams &&
256
256
  this.jdJumpToShopSearch(
257
257
  Object.assign({}, getShopSearchParams, {
258
258
  logEventInfo,
259
259
  }),
260
260
  )
261
261
  } else {
262
262
  this.jdJumpToShopSearch(
263
263
  configDataValue['cid']
264
264
  ? Object.assign(
265
265
  {},
266
266
  {
267
267
  shopId: global.info.queryInfo.shopId,
268
268
  categoryId: configDataValue.cid,
269
269
  ...configDataValue,
270
270
  logEventInfo,
271
271
  },
272
272
  )
273
273
  : {
274
274
  shopId: global.info.queryInfo.shopId,
275
275
  logEventInfo,
276
276
  },
277
277
  )
278
278
  }
279
279
  break
280
280
  case LinkConfigType.CONFIG_TYPE_MEMBER:
281
281
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
282
282
  const getShopMemberParams = this.jdOpenAppParams(
283
283
  configDataValue.clickUrl,
284
284
  )
285
285
  getShopMemberParams &&
286
286
  this.jdJumpToShopMember(
287
287
  Object.assign({}, getShopMemberParams, {
288
288
  logEventInfo,
289
289
  }),
290
290
  )
291
291
  } else {
292
292
  this.jdJumpToShopMember({
293
293
  shopId: global.info.queryInfo.shopId,
294
294
  venderId: configDataValue.shopDetail,
295
295
  logEventInfo,
296
296
  })
297
297
  }
298
298
  break
299
299
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
300
300
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
301
301
  const getShopActivityParams = this.jdOpenAppParams(
302
302
  configDataValue.clickUrl,
303
303
  )
304
304
  if (
305
305
  getShopActivityParams &&
306
306
  getShopActivityParams['des'] == 'jshopActivity'
307
307
  ) {
308
308
  this.jdJumpToShopActivity({
309
309
  projectId: configDataValue['projectId'],
310
310
  configDataValue,
311
311
  logEventInfo,
312
312
  })
313
313
  }
314
314
  } else if (configDataValue['projectId']) {
315
315
  this.jdJumpToShopActivity({
316
316
  projectId: configDataValue['projectId'],
317
317
  configDataValue,
318
318
  logEventInfo,
319
319
  })
320
320
  }
321
321
  break
322
322
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
323
323
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
324
324
  const _url = configDataValue.linkUrl
325
325
  if (
326
326
  _url.indexOf('to=') === -1 &&
327
327
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
328
328
  ) {
329
329
  const _shopId = _url.match(/\d+/g)[0]
330
330
  this.jdJumpToShopHome({
331
331
  shopId: `${_shopId}`,
332
332
  logEventInfo,
333
333
  })
334
334
  } else if (this.isOpenJdAppUrl(_url)) {
335
335
  const getOpenAppParams: any = this.jdOpenAppParams(_url)
336
336
  if (getOpenAppParams) {
337
337
  if (getOpenAppParams.jumpTab == 'allProduct') {
338
338
  this.jdJumpToTabAllProduct(
339
339
  global.info.queryInfo.shopId,
340
340
  global.info.queryInfo.venderId,
341
341
  )
342
342
  } else if (
343
343
  getOpenAppParams.des == 'productList' &&
344
344
  getOpenAppParams.from == 'couponBatch'
345
345
  ) {
346
346
  console.log('优惠券跳转至京购优惠券可用商品列表')
347
347
  this.jdJumpToCouponSearchProductList(getOpenAppParams?.couponId)
348
348
  } else if (getOpenAppParams.des == 'vapp') {
349
349
  this.jdJumpToWeb(
350
350
  `https://conecli.com/apps/mpshare/index.html?category=${
351
351
  getOpenAppParams.category
352
352
  }&des=${getOpenAppParams.des}&vapptype=${
353
353
  getOpenAppParams.vapptype
354
354
  }&appId=${getOpenAppParams.appId}&path=${
355
355
  getOpenAppParams.path
356
356
  }&param=${encodeURI(JSON.stringify(getOpenAppParams.param))}`,
357
357
  logEventInfo,
358
358
  )
359
359
  } else {
360
360
  this.jdNavigateToNative(
361
361
  '',
362
362
  Object.assign({}, getOpenAppParams, {
363
363
  logEventInfo,
364
364
  }),
365
365
  )
366
366
  }
367
367
  }
368
368
  } else {
369
369
  const getSkuId = this._checkUrlIsProductAndGetSkuInfo(_url)
370
370
  getSkuId
371
371
  ? this.jdJumpToProduct(getSkuId, logEventInfo)
372
372
  : this.jdJumpToWeb(_url, logEventInfo)
373
373
  }
374
374
  break
375
375
  }
376
376
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
377
377
  this.jdJumpToShopDetail({
378
378
  venderId: global.info.queryInfo.venderId,
379
379
  shopId: global.info.queryInfo.shopId,
380
380
  logEventInfo,
381
381
  })
382
382
  break
383
383
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
384
384
  this.jdJumpToShopHome({
385
385
  ...configDataValue,
386
386
  logEventInfo,
387
387
  })
388
388
  break
389
389
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
390
390
  this.jdJumpToShopCategory(
391
391
  global.info.queryInfo.shopId,
392
392
  global.info.queryInfo.venderId,
393
393
  )
394
394
  break
395
395
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
396
396
  break
397
397
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
398
398
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
399
399
  const getShoppingGuideParams = this.jdOpenAppParams(
400
400
  configDataValue.clickUrl,
401
401
  )
402
402
  getShoppingGuideParams &&
403
403
  this.jdJumpToShopActivity(
404
404
  Object.assign({}, getShoppingGuideParams, {
405
405
  logEventInfo,
406
406
  }),
407
407
  )
408
408
  }
409
409
  break
410
410
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
411
411
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
412
412
  const search = linkUrl.match(/\?.+/)
413
413
  if (search) {
414
414
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
415
415
  parseQueryUrlString(linkUrl)
416
416
  try {
417
417
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
418
418
  } catch (e) {
419
419
  console.warn('解析小程序 param 错误:', miniQueryData.param)
420
420
  }
421
421
  this.jdJumpToMiniProgram(miniQueryData)
422
422
  } else {
423
423
  console.warn('小程序地址错误:', linkUrl)
424
424
  }
425
425
  break
426
426
  }
427
427
  default:
428
428
  }
429
429
  }
430
430
 
431
431
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
432
432
  console.log('index.weapp.ts - jdJumpToTabAllProduct')
433
433
  if(typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId
434
434
  if(typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId
435
435
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
436
436
  shopId,
437
437
  venderId,
438
438
  tabActive: SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT],
439
439
  logEventInfo,
440
440
  })
441
441
  }
442
442
 
443
443
  jdJumpToTopTabBase(type, shopInfo = {}) {
444
444
  const getInfo = Object.assign(
445
445
  {},
446
446
  {
447
447
  shopId: global.info.queryInfo.shopId,
448
448
  venderId: global.info.queryInfo.venderId,
449
449
  },
450
450
  shopInfo,
451
451
  )
452
452
  console.log('小程序原生跳转 jdJumpToTopTabBase')
453
453
  const { shopId, venderId, ...logEventInfo } = getInfo
454
454
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopx, {
455
455
  shopId,
456
456
  venderId,
457
457
  tabActive: type,
458
458
  ...logEventInfo,
459
459
  })
460
460
  }
461
461
 
462
462
  jdJumpToSearch(shopId, suggestWord) {
463
463
  if(typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId
464
464
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.shopSearch, {
465
465
  shopId,
466
466
  })
467
467
  }
468
468
 
469
469
  jdJumpToAppHome(params = {}) {
470
470
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.jingGouHome, params)
471
471
  }
472
472
 
473
473
  jdJumpToThreePlatform(spUrl, logEventInfo) {
474
474
  this.jdJumpToWeb(spUrl, logEventInfo)
475
475
  }
476
476
 
477
477
  jdJumpToMiniProgram({
478
478
  appId,
479
479
  path,
480
480
  param = {},
481
481
  }: JumpEventReportInterFace.LinkMiniParams) {
482
482
  const pageName = param['pageType'] || 'home'
483
483
  path = `pages/${pageName}/index`
484
484
  if (appId === global.info.pageInfo?.appId) {
485
485
  Taro.navigateTo({
486
486
  url: `/${path}?${objectToUrlEncode(param)}`,
487
487
  }).catch((err) => {
488
488
  console.warn('跳转小程序页面错误:', err)
489
489
  })
490
490
  } else {
491
491
  console.log('一个小程序跳转到另一个小程序暂无此业务')
492
492
  }
493
493
  }
494
494
 
495
495
  jdJumpToAppMiniProgram(
496
496
  path: string,
497
497
  param = {},
498
498
  successBack?: Function,
499
499
  failBack?: Function,
500
500
  ) {
501
501
  this.jdNavigateToNative(path, param, successBack, failBack)
502
502
  }
503
503
 
504
504
  jdNavigateToNative(
505
505
  url: string,
506
506
  params: {
507
507
  logEventInfo?: object
508
508
  } = {},
509
509
  successBack?: Function,
510
510
  failBack?: Function,
511
511
  ) {
512
512
  const { logEventInfo, ...otherParams } = params
513
513
  const getEparam = logEventInfo || params
514
514
  console.log('[降级H5] index.weapp jdNavigateToNative params: ', params)
515
515
  console.log('wxmini logEventInfo params: ', logEventInfo)
516
516
  try {
517
517
  this.clickEventLog(getEparam)
518
518
  } catch (e) {
519
519
  console.log(e)
520
520
  }
521
521
  setTimeout(() => {
522
522
  console.log('进来了啊 first~')
523
523
  const goToPath = `${url}${
524
524
  otherParams ? (url.includes('?')? '&': '?') + objectToUrlEncode(otherParams) : ''
525
525
  }`
526
526
  console.log('打印跳转地址path', goToPath)
527
527
  const isDetail = url.substring(0, url.indexOf('?')) === this.jumpMiniPath.detail
528
528
  console.log('isDetail isDetail isDetail:', isDetail)
529
529
  if (url === this.jumpMiniPath.jingGouHome) {
530
530
  Taro.switchTab({
531
531
  url: goToPath,
532
532
  })
533
533
  .then((res) => {
534
534
  typeof successBack === 'function' && successBack(res)
535
535
  console.log('navigateToWxapp.success', res)
536
536
  })
537
537
  .catch((err) => {
538
538
  typeof failBack === 'function' && failBack(err)
539
539
  console.log('navigateToWxapp.fail', err)
540
540
  })
541
541
  } else {
542
542
  console.log('进来了啊 new new')
543
543
  try{
544
544
  global.wxAppNavigatorInstance.goto(goToPath)
545
545
  typeof successBack === 'function' && successBack()
546
546
  console.log('navigateToWxapp.success')
547
547
  }catch(err){
548
548
  typeof failBack === 'function' && failBack(err)
549
549
  console.log('navigateToWxapp.fail', err)
550
550
  }
551
551
  }
552
552
  }, 200)
553
553
  }
554
554
 
555
555
  clickEventLog(
556
556
  opts: JumpEventReportInterFace.OptEventLogParams = {},
557
557
  clickKey = 'click',
558
558
  ) {
559
559
  const { eventId, jsonParam, eventLevel = 3, skuId, ...otherParams } = opts
560
560
  if (eventId && jsonParam) {
561
561
  if (/TerminatorNew_/.test(eventId + '')) {
562
562
  console.log('mini eventId==========', eventId)
563
563
  }
564
564
  const { etModelInfo, logBaseInfo } = jsonParam
565
565
  const getJsonParam =
566
566
  etModelInfo && logBaseInfo
567
567
  ? logBaseInfo
568
568
  : Object.assign(
569
569
  {},
570
570
  {
571
571
  shopid: global.info.queryInfo?.shopId,
572
572
  },
573
573
  jsonParam,
574
574
  )
575
575
  const miniLogParams = {
576
576
  eid: eventId,
577
577
  elevel: eventLevel,
578
578
  eparam: JSON.stringify(getJsonParam),
579
579
  pageId: this.logPageId,
580
580
  pname: this.logPname,
581
581
  pparam: JSON.stringify(this.routerInfo.params),
582
582
  target: this.routerInfo.path,
583
583
  event: this.nativeEvent,
584
584
  ...otherParams,
585
585
  }
586
586
  if (clickKey === 'addToCart' && skuId) {
587
587
  miniLogParams['shoppingList'] = {
588
588
  [skuId]: 1,
589
589
  }
590
590
  }
591
591
  global.miniAppLogInstance &&
592
592
  global.miniAppLogInstance[clickKey](miniLogParams)
593
593
  } else {
594
594
  console.log('暂无埋点参数eventId和eventParam')
595
595
  }
596
596
  }
597
597
 
598
598
  exposureEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}) {
599
599
  return this.clickEventLog(opts, 'exposure')
600
600
  }