@conecli/cone-render 0.8.19 → 0.8.20-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.jd.ts +1 -1
  5. package/dist/common/isvStorage/index.h5.ts +1 -0
  6. package/dist/common/isvStorage/index.ts +1 -0
  7. package/dist/common/token/const.ts +1 -0
  8. package/dist/common/token/index.h5.ts +1 -0
  9. package/dist/common/token/index.ts +1 -0
  10. package/dist/common/token/token.jd.ts +1 -0
  11. package/dist/common/token/token.ts +1 -0
  12. package/dist/common/token/token.wxapp.ts +1 -0
  13. package/dist/components/base/CommonFloorHead/index.module.scss +1 -1
  14. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  15. package/dist/components/base/CustomVideo/const.ts +1 -0
  16. package/dist/components/base/CustomVideo/index.module.scss +40 -64
  17. package/dist/components/base/CustomVideo/index.tsx +1 -1
  18. package/dist/components/base/Dialog/index.module.scss +6 -2
  19. package/dist/components/base/Dialog/index.tsx +1 -1
  20. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  21. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  22. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  23. package/dist/components/base/NetworkDataError/const.ts +1 -1
  24. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  25. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  26. package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
  27. package/dist/components/base/Price/Base/index.module.scss +136 -0
  28. package/dist/components/base/Price/Base/index.tsx +1 -0
  29. package/dist/components/base/Price/Double/index.module.scss +158 -0
  30. package/dist/components/base/Price/Double/index.tsx +1 -0
  31. package/dist/components/base/Price/index.tsx +1 -1
  32. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  33. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  34. package/dist/components/floorItem.jd.tsx +1 -0
  35. package/dist/components/floorItem.tsx +1 -1
  36. package/dist/components/isv/Floor/index.tsx +1 -1
  37. package/dist/interface/component.ts +1 -1
  38. package/dist/interface/jumpEventReport.ts +1 -1
  39. package/dist/interface/service.ts +1 -1
  40. package/dist/jumpEventReport/base.ts +1 -1
  41. package/dist/jumpEventReport/const.ts +1 -1
  42. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  43. package/dist/jumpEventReport/index.h5.ts +1 -1
  44. package/dist/jumpEventReport/index.weapp.ts +1 -1
  45. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  46. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  47. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  48. package/dist/jumpEventReport/web/report.ts +1 -1
  49. package/dist/jumpEventReport/web.base.ts +1 -1
  50. package/dist/jumpEventReport/web.jd.ts +1 -1
  51. package/dist/jumpEventReport/web.jdb.ts +1 -0
  52. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  53. package/dist/libs/taroAppReport.js +2 -2
  54. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  55. package/dist/open/api/index.ts +1 -1
  56. package/dist/open/api/jump/business.ts +1 -0
  57. package/dist/open/api/jump/index.ts +1 -0
  58. package/dist/open/api/jump/minPath.ts +1 -0
  59. package/dist/open/api/jump/side.ts +1 -0
  60. package/dist/open/api/jump/webUrl.ts +1 -0
  61. package/dist/open/api/jump copy.ts +1 -0
  62. package/dist/open/api/moduleUtil.ts +1 -1
  63. package/dist/open/api/request.ts +1 -0
  64. package/dist/open/api/shopMember.ts +1 -0
  65. package/dist/open/api/userToken.ts +1 -0
  66. package/dist/service/bMallConst.ts +1 -0
  67. package/dist/service/bMallConst.wxapp.ts +1 -0
  68. package/dist/service/fetchGateway.ts +1 -0
  69. package/dist/service/fetchJsonp.ts +1 -0
  70. package/dist/service/http/colorSign.ts +1 -0
  71. package/dist/service/http/colorSign.wxapp.ts +1 -0
  72. package/dist/service/http/const.ts +1 -0
  73. package/dist/service/http/http.ts +1 -0
  74. package/dist/service/http/httpInterceptors.jd.ts +1 -0
  75. package/dist/service/http/httpInterceptors.ts +1 -0
  76. package/dist/service/http/index.ts +1 -0
  77. package/dist/service/requestServer.ts +1 -0
  78. package/dist/utils/connectNativeJsBridge.ts +1 -1
  79. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  80. package/dist/utils/h5Utils.ts +1 -1
  81. package/dist/utils/index.h5.ts +1 -1
  82. package/dist/utils/index.ts +1 -1
  83. package/dist/utils/index.weapp.ts +1 -1
  84. package/dist/utils/jm-common.js +1 -1
  85. package/dist/utils/memberFormatUtils.js +1 -0
  86. package/dist/utils/priceUtils.js +1 -0
  87. package/dist/utils/ready.ts +1 -0
  88. package/dist/utils/utils.ts +1 -1
  89. package/package.json +5 -4
  90. package/dist/components/base/Price/index.module.scss +0 -136
  91. package/dist/open/api/jump.ts +0 -1
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
1
+ import { JdJumpJdApp } from './jdJumpJdApp'
2
2
  reportClick,
3
3
  reportPV,
4
4
  reportToCart,
5
5
  routerInfo: {
6
6
  params: {},
7
7
  },
8
8
  nativeEvent: null,
9
9
  jumpConfig: {
10
10
  venderId: null,
11
11
  shopId: null,
12
12
  sourceValue: '',
13
13
  sourceType: 'App-H5',
14
14
  activityType: 'shopx',
15
15
  moduleId: 'none',
16
16
  entrance: 'none',
17
17
  },
18
18
  logPageParamStr: '',
19
19
  public logPageId: string
20
20
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
21
21
  constructor(opt = {}) {
22
22
  super(opt)
23
23
  this.getConfig(opt)
24
24
  }
25
25
  getConfig(opt = {}) {
26
26
  return Object.assign(this, {}, defaultConfig, opt)
27
27
  }
28
28
  updateInfo(
29
29
  routerInfo,
30
30
  logPname = LogPnameInfo.HOME,
31
31
  pageId = LogPageIdInfo.APP,
32
32
  ) {
33
33
  this.logPageId = pageId
34
34
  this.routerInfo = routerInfo
35
35
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params)
36
36
  this.logPname = logPname
37
37
  }
38
38
  reportInfoPv(
39
39
  pageId = LogPageIdInfo.APP,
40
40
  opt: {
41
41
  pageParam?: any
42
42
  } = {},
43
43
  ) {
44
44
  const { pageParam } = opt
45
45
  this.logPageParamStr = pageParam
46
46
  ? pageParam
47
47
  : this.creatParamToLogStr(this.jumpConfig)
48
48
  .replace(/moduleId/, 'JumpmoduleID')
49
49
  .replace(/entrance/, 'Jumpentrance')
50
50
  reportPV({
51
51
  pageId,
52
52
  pageParam: this.logPageParamStr,
53
53
  ...opt,
54
54
  })
55
55
  }
56
56
 
57
57
  jdJumpToWeb(
58
58
  url,
59
59
  logEventInfo,
60
60
  successBack?: Function | undefined,
61
61
  failBack?: Function | undefined,
62
62
  ) {
63
63
  if (this.isOpenJdAppUrl(url)) {
64
64
  const getOpenAppParams = this.jdOpenAppParams(url)
65
65
  console.log(
66
66
  'jd web 获取自定义openApp链接解析后的参数结果',
67
67
  getOpenAppParams,
68
68
  )
69
69
  if (getOpenAppParams) {
70
70
  this.jdNavigateToNative(
71
71
  Object.assign({}, getOpenAppParams, {
72
72
  logEventInfo,
73
73
  }),
74
74
  )
75
75
  }
76
76
  } else {
77
77
  super.jdJumpToWeb(
78
78
  url,
79
79
  {
80
80
  ...logEventInfo,
81
81
  },
82
82
  successBack,
83
83
  failBack,
84
84
  )
85
85
  }
86
86
  }
87
87
 
88
88
  jdJumpToWebInner(url, logEventInfo) {
89
89
  this.jdJumpToWeb(url, logEventInfo)
90
90
  }
91
91
 
92
92
  jdJumpConfigUrl(detail, logEventInfo = {}) {
93
93
  const { configDataType, configDataValue } = detail
94
94
  switch (configDataType) {
95
95
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
96
96
  this.jdJumpToShopCategory({
97
97
  ...configDataValue,
98
98
  logEventInfo,
99
99
  })
100
100
  break
101
101
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
102
102
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
103
103
  break
104
104
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
105
105
  this.jdJumpToWeb(
106
106
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
107
107
  {},
108
108
  )
109
109
  break
110
110
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
111
111
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
112
112
  const getShopSearchParams = this.jdOpenAppParams(
113
113
  configDataValue.clickUrl,
114
114
  )
115
115
  console.log(
116
116
  'jd web 获取店铺分类链接解析后的参数结果',
117
117
  getShopSearchParams,
118
118
  )
119
119
  getShopSearchParams &&
120
120
  this.jdJumpToShopSearch(
121
121
  Object.assign({}, getShopSearchParams, {
122
122
  logEventInfo,
123
123
  }),
124
124
  )
125
125
  } else {
126
126
  this.jdJumpToShopSearch(
127
127
  configDataValue['cid']
128
128
  ? Object.assign(
129
129
  {},
130
130
  {
131
131
  shopId: global.info.queryInfo.shopId,
132
132
  categoryId: configDataValue.cid,
133
133
  searchType: '5',
134
134
  logEventInfo,
135
135
  },
136
136
  )
137
137
  : {
138
138
  shopId: global.info.queryInfo.shopId,
139
139
  logEventInfo,
140
140
  },
141
141
  )
142
142
  }
143
143
  break
144
144
  case LinkConfigType.CONFIG_TYPE_MEMBER:
145
145
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
146
146
  const getShopMemberParams = this.jdOpenAppParams(
147
147
  configDataValue.clickUrl,
148
148
  )
149
149
  getShopMemberParams &&
150
150
  this.jdJumpToShopMember(
151
151
  Object.assign({}, getShopMemberParams, {
152
152
  logEventInfo,
153
153
  }),
154
154
  )
155
155
  } else {
156
156
  this.jdJumpToShopMember({
157
157
  shopId: global.info.queryInfo.shopId,
158
158
  venderId: configDataValue.shopDetail,
159
159
  logEventInfo,
160
160
  })
161
161
  }
162
162
  break
163
163
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
164
164
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
165
165
  const getShopActivityParams = this.jdOpenAppParams(
166
166
  configDataValue.clickUrl,
167
167
  )
168
168
  getShopActivityParams &&
169
169
  this.jdJumpToShopActivity(
170
170
  Object.assign({}, getShopActivityParams, {
171
171
  logEventInfo,
172
172
  }),
173
173
  )
174
174
  } else if (configDataValue['projectId']) {
175
175
  this.jdJumpToShopActivity({
176
176
  projectId: configDataValue['projectId'],
177
177
  configDataValue,
178
178
  logEventInfo,
179
179
  })
180
180
  }
181
181
  break
182
182
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
183
183
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
184
184
  const _url = configDataValue.linkUrl
185
185
  if (
186
186
  _url.indexOf('to=') === -1 &&
187
187
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
188
188
  ) {
189
189
  const _shopId = _url.match(/\d+/g)[0]
190
190
  this.jdJumpToShopHome({
191
191
  shopId: `${_shopId}`,
192
192
  logEventInfo,
193
193
  })
194
194
  } else if (this.isOpenJdAppUrl(_url)) {
195
195
  const getOpenAppParams = this.jdOpenAppParams(_url)
196
196
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
197
197
  if (getOpenAppParams) {
198
198
  this.jdNavigateToNative(
199
199
  Object.assign({}, getOpenAppParams, {
200
200
  logEventInfo,
201
201
  }),
202
202
  )
203
203
  }
204
204
  } else {
205
205
  this.jdJumpToWeb(_url, logEventInfo)
206
206
  }
207
207
  break
208
208
  }
209
209
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
210
210
  this.jdJumpToShopDetail({
211
211
  venderId: global.info.queryInfo.venderId,
212
212
  shopId: global.info.queryInfo.shopId,
213
213
  logEventInfo,
214
214
  })
215
215
  break
216
216
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
217
217
  this.jdJumpToShopHome({
218
218
  ...configDataValue,
219
219
  logEventInfo,
220
220
  })
221
221
  break
222
222
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
223
223
  break
224
224
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
225
225
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
226
226
  const getShoppingGuideParams = this.jdOpenAppParams(
227
227
  configDataValue.clickUrl,
228
228
  )
229
229
  getShoppingGuideParams &&
230
230
  this.jdJumpToShopActivity(
231
231
  Object.assign({}, getShoppingGuideParams, {
232
232
  logEventInfo,
233
233
  }),
234
234
  )
235
235
  }
236
236
  break
237
237
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
238
238
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
239
239
  const search = linkUrl.match(/\?.+/)
240
240
  if (search) {
241
241
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
242
242
  parseQueryUrlString(linkUrl)
243
243
  try {
244
244
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
245
245
  } catch (e) {
246
246
  console.warn('解析小程序 param 错误:', miniQueryData.param)
247
247
  }
248
248
  this.jdJumpToMiniProgram(miniQueryData)
249
249
  } else {
250
250
  console.warn('小程序地址错误:', linkUrl)
251
251
  }
252
252
  break
253
253
  }
254
254
  default:
255
255
  }
256
256
  }
257
257
 
258
258
  jdNavigateToNative(
259
259
  params: {},
260
260
  url = 'openapp.jdmobile://virtual',
261
261
  successBack?: Function | null,
262
262
  failBack?: Function | null,
263
263
  ) {
264
264
  console.log('[降级H5] jdNavigateToNative web.jd:', params)
265
265
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
266
266
  Object.assign(
267
267
  {},
268
268
  {
269
269
  sourceValue: 'sourceValue_jshopModuleWeb',
270
270
  sourceType: 'sourceType_jshopModuleWeb',
271
271
  param: {},
272
272
  },
273
273
  params,
274
274
  )
275
275
  const { logEventInfo, ...otherParams } = getResParams
276
276
  console.log(
277
277
  'jd web 获取open协议参数 jdNavigateToNative params: ',
278
278
  getResParams,
279
279
  )
280
280
  console.log('logEventInfo params: ', logEventInfo)
281
281
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
282
282
  this.clickEventLog(logEventInfo || getResParams)
283
283
  .then(() => {
284
284
  if (typeof successBack == 'function') {
285
285
  successBack(getResParams)
286
286
  } else {
287
287
  try {
288
288
  const paramsStr = JSON.stringify(otherParams)
289
289
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`)
290
290
  window.location.href = `${url}?params=${paramsStr}`
291
291
  } catch (e) {
292
292
  console.log('跳转异常', e)
293
293
  }
294
294
  }
295
295
  })
296
296
  .catch(() => {
297
297
  typeof failBack == 'function' && failBack(getResParams)
298
298
  })
299
299
  }
300
300
 
301
301
  clickEventLog(
302
302
  opts: JumpEventReportInterFace.OptEventLogParams = {},
303
303
  reportKey = 'click',
304
304
  ) {
305
305
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
306
306
  if (eventId && jsonParam) {
307
307
  const { etModelInfo, logBaseInfo } = jsonParam
308
308
  const webLogParams = {
309
309
  eid: eventId,
310
310
  elevel: eventLevel,
311
311
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
312
312
  etModel: JSON.stringify(etModelInfo || {}),
313
313
  pageId: this.logPageId,
314
314
  pageParam: this.logPageParamStr,
315
315
  ...otherParams,
316
316
  }
317
317
  return /click|exposure/.test(reportKey)
318
318
  ? reportClick(webLogParams)
319
319
  : reportToCart(opts)
320
320
  } else {
321
321
  console.log('暂无埋点参数eventId和eventParam')
322
322
  return Promise.resolve(false)
323
323
  }
324
324
  }
325
325
 
326
326
  exposureEventLog(opts) {
327
327
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
328
328
  ? this.clickEventLog(
329
329
  {
330
330
  ...opts,
331
331
  exposureState: true,
332
332
  },
333
333
  'exposure',
334
334
  )
335
335
  : Promise.resolve(false)
336
336
  }
@@ -0,0 +1 @@
1
+ import { JdJumpJdApp } from './jdJumpJdApp'
2
  routerInfo: {
1
3
  params: {},
2
4
  },
3
5
  nativeEvent: null,
4
6
  jumpConfig: {
5
7
  venderId: null,
6
8
  shopId: null,
7
9
  sourceValue: '',
8
10
  sourceType: 'App-H5',
9
11
  activityType: 'shopx',
10
12
  moduleId: 'none',
11
13
  entrance: 'none',
12
14
  },
13
15
  logPageParamStr: '',
14
16
  public logPageId: string
15
17
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
16
18
  constructor(opt = {}) {
17
19
  console.log('jdb加载==========')
18
20
  super(opt)
19
21
  this.getConfig(opt)
20
22
  }
21
23
  jdbOpenAppParams(openAppUrl): Object | boolean {
22
24
  let getParams: boolean | Object = false
23
25
  if (this.isOpenJdbAppUrl(openAppUrl)) {
24
26
  try {
25
27
  getParams = openAppUrl.replace(
26
28
  /openApp\.jdbmall:\/\/virtual\?params=/i,
27
29
  '',
28
30
  )
29
31
  getParams = JSON.parse(String(getParams))
30
32
  } catch (e) {
31
33
  console.log(e)
32
34
  }
33
35
  }
34
36
  return getParams
35
37
  }
36
38
  isOpenJdbAppUrl(openAppUrl) {
37
39
  return /openApp\.jdbmall:\/\/virtual\?params=/i.test(openAppUrl)
38
40
  }
39
41
 
40
42
  async jdJumpConfigUrl(detail, logEventInfo = {}) {
41
43
  const { configDataType, configDataValue } = detail
42
44
  switch (configDataType) {
43
45
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
44
46
  this.jdJumpToProduct(
45
47
  {
46
48
  ...configDataValue,
47
49
  skuId: configDataValue.skuIds,
48
50
  skuUniformBizInfo: { buId: configDataValue.buId },
49
51
  },
50
52
  logEventInfo,
51
53
  )
52
54
  break
53
55
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK: {
54
56
  const _url = configDataValue.linkUrl
55
57
  if (this.isOpenJdbAppUrl(_url)) {
56
58
  const getOpenAppParams = this.jdbOpenAppParams(_url)
57
59
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
58
60
  if (getOpenAppParams) {
59
61
  this.jdNavigateToNative(
60
62
  Object.assign({}, getOpenAppParams, {
61
63
  logEventInfo,
62
64
  }),
63
65
  )
64
66
  }
65
67
  }
66
68
  break
67
69
  }
68
70
  default:
69
71
  }
70
72
  }
71
73
 
72
74
  jdJumpToProduct(skuParams, logEventInfo) {
73
75
  if (typeof skuParams !== 'object') {
74
76
  console.error('万商app跳转商品详情参数需要对象,详情请查看文档')
75
77
  return
76
78
  }
77
79
 
78
80
  let { skuId, bMallTag = '1', skuUniformBizInfo } = skuParams
79
81
  skuId = skuId.toString().trim()
80
82
  this.jdNavigateToNative({
81
83
  category: 'jump',
82
84
  des: 'skudetail',
83
85
  param: {
84
86
  skuId: skuId,
85
87
  bMallTag: bMallTag,
86
88
  skuUniformBizInfo,
87
89
  },
88
90
  logEventInfo,
89
91
  })
90
92
  }
91
93
 
92
94
  jdNavigateToNative(
93
95
  params: {},
94
96
  url = OpenAppHost,
95
97
  successBack?: Function | null,
96
98
  failBack?: Function | null,
97
99
  ) {
98
100
  console.log('jdb web', params)
99
101
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
100
102
  Object.assign(
101
103
  {},
102
104
  {
103
105
  param: {},
104
106
  },
105
107
  params,
106
108
  )
107
109
  const { logEventInfo, ...otherParams } = getResParams
108
110
  console.log(
109
111
  'jdb web 获取open协议参数 jdNavigateToNative params: ',
110
112
  otherParams,
111
113
  )
112
114
  console.log('logEventInfo params: ', logEventInfo)
113
115
  console.log('otherParams', otherParams)
114
116
  const paramsStr = JSON.stringify(otherParams)
115
117
  console.log('跳转web jdb open协议', `${url}?params=${paramsStr}`)
116
118
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
117
119
  this.clickEventLog(logEventInfo || getResParams)
118
120
  .then(() => {
119
121
  if (typeof successBack == 'function') {
120
122
  successBack(getResParams)
121
123
  } else {
122
124
  try {
123
125
  const paramsStr = JSON.stringify(otherParams)
124
126
  console.log(
125
127
  'success: 跳转web jdb open协议',
126
128
  `${url}?params=${paramsStr}`,
127
129
  )
128
130
  window.location.href = `${url}?params=${paramsStr}`
129
131
  } catch (e) {
130
132
  console.log('跳转异常', e)
131
133
  }
132
134
  }
133
135
  })
134
136
  .catch((e) => {
135
137
  console.log('catch', e)
136
138
  typeof failBack == 'function' && failBack(getResParams)
137
139
  })
138
140
  }
139
141
 
140
142
  clickEventLog(
141
143
  opts: JumpEventReportInterFace.OptEventLogParams = {},
142
144
  reportKey = 'click',
143
145
  ) {
144
146
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
145
147
  if (eventId && jsonParam) {
146
148
  const { etModelInfo, logBaseInfo } = jsonParam
147
149
  const webLogParams = {
148
150
  eid: eventId,
149
151
  elevel: eventLevel,
150
152
  eparam:JSON.stringify(logBaseInfo || jsonParam),
151
153
  jsonParam: JSON.stringify(logBaseInfo || jsonParam),
152
154
  etModel: JSON.stringify(etModelInfo || {}),
153
155
  pageId: this.logPageId,
154
156
  pageParam: this.logPageParamStr,
155
157
  ...otherParams,
156
158
  }
157
159
  return /click|exposure/.test(reportKey)
158
160
  ? reportClick(webLogParams)
159
161
  : reportToCart(opts)
160
162
  } else {
161
163
  console.log('暂无埋点参数eventId和eventParam')
162
164
  return Promise.resolve(false)
163
165
  }
164
166
  }
165
167
  getConfig(opt = {}) {
166
168
  return Object.assign(this, {}, defaultConfig, opt)
167
169
  }
@@ -1 +1 @@
1
- import global from '../common'
2
1
  console.log('window.shopGlobalSwitch:', JSON.stringify(window.shopGlobalSwitch))
3
2
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的if')
4
3
  this.jingGouMiniState = true
5
4
  window.isJingGouMiniViewState = true
6
5
  console.log('进入了 iwx?.miniProgram then 但是没有继续跳转的逻辑 ')
7
6
  global.info.isJingGouMiniViewState = true
8
7
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的esle')
9
8
  }
9
+ import global from '../common'
10
10
  objectToUrlEncode,
11
11
  parseQueryUrlString,
12
12
  isH5AndJingGouMini,
13
13
  public jingGouMiniState: boolean
14
14
  private isH5OpenToWxapp: boolean
15
15
  constructor(opt) {
16
16
  super(opt)
17
17
  this.jingGouMiniState = false
18
18
  this.getConfig(opt)
19
19
  console.log(
20
20
  'window.shopGlobalSwitch:',
21
21
  JSON.stringify(window.shopGlobalSwitch),
22
22
  )
23
23
  this.isH5OpenToWxapp =
24
24
  window.shopGlobalSwitch?.openMobileShopToWxApp == 'true'
25
25
  this.init()
26
26
  }
27
27
  getConfig(opt) {
28
28
  return Object.assign(this, {}, defaultConfig, super.getConfig(opt), opt)
29
29
  }
30
30
 
31
31
 
32
32
  async init() {
33
33
  if (window.isJingGouMiniViewState) {
34
34
  this.jingGouMiniState = true
35
35
  } else {
36
36
  console.log(
37
37
  '初始化进行小程序环境检查, 当前是否是京购小程序里的H5',
38
38
  isH5AndJingGouMini,
39
39
  )
40
40
  if (isH5AndJingGouMini && this.isH5OpenToWxapp) {
41
41
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的if')
42
42
  this.jingGouMiniState = true
43
43
  window.isJingGouMiniViewState = true
44
44
  console.log('进入了 iwx?.miniProgram then 但是没有继续跳转的逻辑 ')
45
45
  global.info.isJingGouMiniViewState = true
46
46
  } else {
47
47
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的esle')
48
48
  }
49
49
  }
50
50
  }
51
51
 
52
52
  jdJumpToMiniPage(pageUrl, logEventInfo, type = 'navigateTo') {
53
53
  this.jdNavigateToNative(
54
54
  pageUrl,
55
55
  logEventInfo,
56
56
  () => {
57
57
  wx?.miniProgram[type] &&
58
58
  wx?.miniProgram[type]({
59
59
  url: pageUrl,
60
60
  })
61
61
  },
62
62
  () => {
63
63
  wx?.miniProgram[type] &&
64
64
  wx?.miniProgram[type]({
65
65
  url: pageUrl,
66
66
  })
67
67
  },
68
68
  )
69
69
  }
70
70
 
71
71
  jdJumpToWeb(url, logEventInfo) {
72
72
  if (this.jingGouMiniState) {
73
73
  const encodeUrl = `${
74
74
  this.jumpMiniPath.h5
75
75
  }?encode_url=${encodeURIComponent(url)}`
76
76
  this.jdJumpToMiniPage(encodeUrl, logEventInfo)
77
77
  } else {
78
78
  super.jdJumpToWeb(url, logEventInfo)
79
79
  }
80
80
  }
81
81
 
82
82
  jdJumpToWebInner(url, logEventInfo) {
83
83
  super.jdJumpToWeb(url, logEventInfo)
84
84
  }
85
85
 
86
86
  jdJumpToProduct(skuIds, logEventInfo) {
87
87
  if (this.jingGouMiniState) {
88
88
  const detailUrl = `${this.jumpMiniPath.detail}?sku=${skuIds}`
89
89
  this.jdJumpToMiniPage(detailUrl, logEventInfo)
90
90
  } else {
91
91
  super.jdJumpToProduct(skuIds, logEventInfo)
92
92
  }
93
93
  }
94
94
 
95
95
  jdJumpToShopHome(params) {
96
96
  console.log('[降级H5] jdJumpToShopHome web.wxapp')
97
97
  const { type = 'navigateTo', ...otherShopInfo } = params
98
98
  if (this.jingGouMiniState) {
99
99
  let shopUrl = `${this.jumpMiniPath.shopx}${window.location.search}`
100
100
  if (/\/shop\/(samCenter|samCard)/.test(window.location.pathname)) {
101
101
  shopUrl = `${this.jumpMiniPath.shopx}?${objectToUrlEncode(
102
102
  this.getShopIdsInfo(otherShopInfo),
103
103
  )}`
104
104
  }
105
105
  this.jdJumpToMiniPage(shopUrl, otherShopInfo, type)
106
106
  } else {
107
107
  super.jdJumpToShopHome(otherShopInfo)
108
108
  }
109
109
  }
110
110
 
111
111
  jdJumpToShopCategory(params) {
112
112
  console.log('[降级H5] jdJumpToShopCategory web.wxapp')
113
113
  const { type = 'navigateTo', ...otherShopInfo } = params
114
114
  if (this.jingGouMiniState) {
115
115
  let shopUrl = `${this.jumpMiniPath.shopx}${window.location.search}`
116
116
  this.jdJumpToMiniPage(shopUrl, otherShopInfo, type)
117
117
  } else {
118
118
  super.jdJumpToShopCategory(otherShopInfo)
119
119
  }
120
120
  }
121
121
 
122
122
  jdJumpToLive(liveInfo, logEventInfo = {}) {
123
123
  if (liveInfo?.liveId) {
124
124
  this.jdJumpToWeb(
125
125
  `${this.jumpWebUrl.mLive}/${liveInfo?.liveId}?${
126
126
  this.jingGouMiniState ? 'origin=0&appid=jdgw' : 'origin=30'
127
127
  }`,
128
128
  logEventInfo,
129
129
  )
130
130
  }
131
131
  }
132
132
 
133
133
  jdJumpToShopLight(shopInfo) {
134
134
  if (this.jingGouMiniState) {
135
135
  this.jdJumpToMiniPage(
136
136
  `${this.jumpMiniPath.shopLight}?${objectToUrlEncode(
137
137
  this.getShopIdOrVenderIdParams(shopInfo),
138
138
  )}`,
139
139
  {
140
140
  ...shopInfo,
141
141
  },
142
142
  )
143
143
  } else {
144
144
  this.jdNavigateToNative(
145
145
  `${this.jumpWebUrl.shopLight}?${objectToUrlEncode(
146
146
  this.getShopIdOrVenderIdParams(shopInfo),
147
147
  )}`,
148
148
  {
149
149
  ...shopInfo,
150
150
  },
151
151
  )
152
152
  }
153
153
  }
154
154
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
155
155
  if (this.jingGouMiniState) {
156
156
  const detailUrl = `${this.jumpMiniPath.searchCoupon}?batch=${couponId}`
157
157
  this.jdJumpToMiniPage(detailUrl, logEventInfo)
158
158
  } else {
159
159
  super.jdJumpToCouponSearchProductList(couponId, logEventInfo)
160
160
  }
161
161
  }