@conecli/cone-render 0.10.1-shop-beta.13 → 0.10.1-shop-beta.15

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.
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
 
3
2
  jdJumpToCoupon(
4
3
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
5
4
  logInfo,
6
5
  ) {
7
6
  if (
8
7
  nowUrlParams.batchId &&
9
8
  (nowUrlParams.bindType === 1 || nowUrlParams.bindType === 3)
10
9
  ) {
11
10
  const couponUrlParams = {
12
11
  batch: nowUrlParams.batchId,
13
12
  kind: nowUrlParams.bindType,
14
13
  startTime: nowUrlParams.startTime,
15
14
  endTime: nowUrlParams.endTime,
16
15
  quangoufrom: 6,
17
16
  }
18
17
  this.jdNavigateToNative(
19
18
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(
20
19
  couponUrlParams,
21
20
  )}`,
22
21
  {
23
22
  ...logInfo,
24
23
  },
25
24
  )
26
25
  } else if (
27
26
  nowUrlParams.batchId &&
28
27
  nowUrlParams.bindType !== 1 &&
29
28
  nowUrlParams.bindType !== 3
30
29
  ) {
31
30
  const couponUrlParams = {
32
31
  ...this.getShopIdOrVenderIdParams(global.info.queryInfo),
33
32
  sceneId: 1002,
34
33
  }
35
34
  this.jdNavigateToNative(
36
35
  `${this.jumpMiniPath.shop}?${objectToUrlEncode(couponUrlParams)}`,
37
36
  {
38
37
  ...logInfo,
39
38
  },
40
39
  )
41
40
  }
42
41
  }
43
42
 
44
43
  jdJumpToJTCoupon(
45
44
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
46
45
  logInfo,
47
46
  ) {
48
47
  const couponUrlParams = {
49
48
  batch: nowUrlParams.batchId,
50
49
  kind: nowUrlParams.bindType,
51
50
  startTime: nowUrlParams.startTime,
52
51
  endTime: nowUrlParams.endTime,
53
52
  quangoufrom: 6,
54
53
  }
55
54
  this.jdNavigateToNative(
56
55
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(couponUrlParams)}`,
57
56
  {
58
57
  ...logInfo,
59
58
  },
60
59
  )
61
60
  }
62
61
 
63
62
  jdJumpToRankList(contentId: string | number, rankType = 10, logEventInfo) {
64
63
  const rankUrl = `${this.jumpWebUrl.rank}?contentId=${contentId}&sku=&rankType=${rankType}&fromName=dcpws&hideAd=1`
65
64
  console.log(`rankUrl${rankUrl}`)
66
65
  this.jdJumpToWeb(rankUrl, {
67
66
  contentId,
68
67
  ...logEventInfo,
69
68
  })
70
69
  }
71
70
 
72
71
  jdJumpToShopDetall() {
73
72
  }
74
73
 
75
74
  jdJumpToActivityPlace(spUrl, logEventInfo) {
76
75
  this.jdJumpToWeb(spUrl, logEventInfo)
77
76
  }
78
77
 
79
78
  jdJumpToShopFans(fansParams, logEventInfo) {
80
79
  this.jdNavigateToNative(
81
80
  `${this.jumpMiniPath.shopFans}?${objectToUrlEncode(fansParams)}`,
82
81
  {
83
82
  ...logEventInfo,
84
83
  },
85
84
  )
86
85
  }
87
86
 
88
87
  jdJumpToShopActivity(shopInfo) {
89
88
  const getParams = Object.assign(
90
89
  {},
91
90
  {
92
91
  category: 'jump',
93
92
  des: 'jshopActivity',
94
93
  shopId: global.info.queryInfo.shopId,
95
94
  venderId: global.info.queryInfo.venderId,
96
95
  },
97
96
  shopInfo,
98
97
  )
99
98
  getParams['projectId'] &&
100
99
  (getParams['projectId'] = `${getParams['projectId']}`)
101
100
  }
102
101
 
103
102
  jdJumpToThreePlatform(spUrl, logEventInfo) {
104
103
  this.jdJumpToWeb(spUrl, logEventInfo)
105
104
  }
106
105
 
107
106
  jdJumpToMiniProgram({
108
107
  appId,
109
108
  path,
110
109
  param = {},
111
110
  }: JumpEventReportInterFace.LinkMiniParams) {
112
111
  const pageName = param['pageType'] || 'home'
113
112
  path = `pages/${pageName}/index`
114
113
  if (appId === global.info.pageInfo?.appId) {
115
114
  Taro.navigateTo({
116
115
  url: `/${path}?${objectToUrlEncode(param)}`,
117
116
  }).catch((err) => {
118
117
  console.warn('跳转小程序页面错误:', err)
119
118
  })
120
119
  } else {
121
120
  console.log('一个小程序跳转到另一个小程序暂无此业务')
122
121
  }
123
122
  }
124
123
 
125
124
  jdJumpToAppMiniProgram(
126
125
  path: string,
127
126
  param = {},
128
127
  successBack?: Function,
129
128
  failBack?: Function,
130
129
  ) {
131
130
  this.jdNavigateToNative(path, param, successBack, failBack)
132
131
  }
133
132
 
134
133
  jdNavigateToNative(
135
134
  url: string,
136
135
  params: {
137
136
  logEventInfo?: object
138
137
  } = {},
139
138
  successBack?: Function,
140
139
  failBack?: Function,
141
140
  ) {
142
141
  const { logEventInfo, ...otherParams } = params
143
142
  const getEparam = logEventInfo || params
144
143
  console.log('[降级H5] index jdNavigateToNative params: ', params)
145
144
  console.log('logEventInfo params: ', logEventInfo)
146
145
  try {
147
146
  this.clickEventLog(getEparam)
148
147
  } catch (e) {
149
148
  console.log(e)
150
149
  }
151
150
  setTimeout(() => {
152
151
  Taro.navigateTo({
153
152
  url: `${url}${otherParams ? '?' + objectToUrlEncode(otherParams) : ''}`,
154
153
  })
155
154
  .then((res) => {
156
155
  typeof successBack === 'function' && successBack(res)
157
156
  console.log('navigateToWxapp.success', res)
158
157
  })
159
158
  .catch((err) => {
160
159
  typeof failBack === 'function' && failBack(err)
161
160
  console.log('navigateToWxapp.fail', err)
162
161
  })
163
162
  }, 200)
164
163
  }
165
164
 
166
165
  clickEventLog(
167
166
  opts: JumpEventReportInterFace.OptEventLogParams = {},
168
167
  clickKey = 'click',
169
168
  ) {
170
169
  const { eventId, jsonParam, eventLevel = 3, skuId, ...otherParams } = opts
171
170
  if (eventId && jsonParam) {
172
171
  const { etModelInfo, logBaseInfo } = jsonParam
173
172
  const miniLogParams = {
174
173
  eid: eventId,
175
174
  elevel: eventLevel,
176
175
  eparam: JSON.stringify(logBaseInfo || jsonParam),
177
176
  ext: {
178
177
  et_model: JSON.stringify(etModelInfo || {}),
179
178
  },
180
179
  pageId: this.logPageId,
181
180
  pname: this.logPname,
182
181
  pparam: JSON.stringify(this.routerInfo.params),
183
182
  target: this.routerInfo.path,
184
183
  event: this.nativeEvent,
185
184
  ...otherParams,
186
185
  }
187
186
  if (clickKey === 'addToCart' && skuId) {
188
187
  miniLogParams['shoppingList'] = {
189
188
  [skuId]: 1,
190
189
  }
191
190
  }
192
191
  console.log('点击埋点参数对象', miniLogParams, clickKey)
193
192
  global.miniAppLogInstance &&
194
193
  global.miniAppLogInstance[clickKey](miniLogParams)
195
194
  } else {
196
195
  console.log('暂无埋点参数eventId和eventParam')
197
196
  }
198
197
  }
199
198
 
200
199
  exposureEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}) {
201
200
  return this.clickEventLog(opts, 'exposure')
202
201
  }
203
202
 
204
203
  jdJumpToSearch(shopId, suggestWord) {
205
204
  console.log(
206
205
  '� ~ file: index.ts ~ line 304 ~ JumpEventReportCenter ~ shopId, suggestWord',
207
206
  shopId,
208
207
  suggestWord,
209
208
  )
210
209
  }
211
210
 
212
211
  jdJumpToMyMessageBox() {}
213
212
 
214
213
  jdJumpToAppHome(params = {}) {
215
214
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.jingGouHome, params)
216
215
  }
217
216
 
218
217
  jdJumpToShopHomeDetail({ shopId, venderId }) {
219
218
  console.log(
220
219
  '� ~ file: index.ts ~ line 327 ~ JumpEventReportCenter ~ shopId, verderId',
221
220
  shopId,
222
221
  venderId,
223
222
  )
224
223
  }
224
+ import Taro from '@tarojs/taro'
225
225
 
226
226
  jdJumpToCoupon(
227
227
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
228
228
  logInfo,
229
229
  ) {
230
230
  if (
231
231
  nowUrlParams.batchId &&
232
232
  (nowUrlParams.bindType === 1 || nowUrlParams.bindType === 3)
233
233
  ) {
234
234
  const couponUrlParams = {
235
235
  batch: nowUrlParams.batchId,
236
236
  kind: nowUrlParams.bindType,
237
237
  startTime: nowUrlParams.startTime,
238
238
  endTime: nowUrlParams.endTime,
239
239
  quangoufrom: 6,
240
240
  }
241
241
  this.jdNavigateToNative(
242
242
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(
243
243
  couponUrlParams,
244
244
  )}`,
245
245
  {
246
246
  ...logInfo,
247
247
  },
248
248
  )
249
249
  } else if (
250
250
  nowUrlParams.batchId &&
251
251
  nowUrlParams.bindType !== 1 &&
252
252
  nowUrlParams.bindType !== 3
253
253
  ) {
254
254
  const couponUrlParams = {
255
255
  ...this.getShopIdOrVenderIdParams(global.info.queryInfo),
256
256
  sceneId: 1002,
257
257
  }
258
258
  this.jdNavigateToNative(
259
259
  `${this.jumpMiniPath.shop}?${objectToUrlEncode(couponUrlParams)}`,
260
260
  {
261
261
  ...logInfo,
262
262
  },
263
263
  )
264
264
  }
265
265
  }
266
266
 
267
267
  jdJumpToJTCoupon(
268
268
  nowUrlParams: JumpEventReportInterFace.CouponUrlParams,
269
269
  logInfo,
270
270
  ) {
271
271
  const couponUrlParams = {
272
272
  batch: nowUrlParams.batchId,
273
273
  kind: nowUrlParams.bindType,
274
274
  startTime: nowUrlParams.startTime,
275
275
  endTime: nowUrlParams.endTime,
276
276
  quangoufrom: 6,
277
277
  }
278
278
  this.jdNavigateToNative(
279
279
  `${this.jumpMiniPath.searchCoupon}?${objectToUrlEncode(couponUrlParams)}`,
280
280
  {
281
281
  ...logInfo,
282
282
  },
283
283
  )
284
284
  }
285
285
 
286
286
  jdJumpToRankList(contentId: string | number, rankType = 10, logEventInfo) {
287
287
  const rankUrl = `${this.jumpWebUrl.rank}?contentId=${contentId}&sku=&rankType=${rankType}&fromName=dcpws&hideAd=1`
288
288
  console.log(`rankUrl${rankUrl}`)
289
289
  this.jdJumpToWeb(rankUrl, {
290
290
  contentId,
291
291
  ...logEventInfo,
292
292
  })
293
293
  }
294
294
 
295
295
  jdJumpToShopDetall() {
296
296
  }
297
297
 
298
298
  jdJumpToActivityPlace(spUrl, logEventInfo) {
299
299
  this.jdJumpToWeb(spUrl, logEventInfo)
300
300
  }
301
301
 
302
302
  jdJumpToShopFans(fansParams, logEventInfo) {
303
303
  this.jdNavigateToNative(
304
304
  `${this.jumpMiniPath.shopFans}?${objectToUrlEncode(fansParams)}`,
305
305
  {
306
306
  ...logEventInfo,
307
307
  },
308
308
  )
309
309
  }
310
310
 
311
311
  jdJumpToShopActivity(shopInfo) {
312
312
  const getParams = Object.assign(
313
313
  {},
314
314
  {
315
315
  category: 'jump',
316
316
  des: 'jshopActivity',
317
317
  shopId: global.info.queryInfo.shopId,
318
318
  venderId: global.info.queryInfo.venderId,
319
319
  },
320
320
  shopInfo,
321
321
  )
322
322
  getParams['projectId'] &&
323
323
  (getParams['projectId'] = `${getParams['projectId']}`)
324
324
  }
325
325
 
326
326
  jdJumpToThreePlatform(spUrl, logEventInfo) {
327
327
  this.jdJumpToWeb(spUrl, logEventInfo)
328
328
  }
329
329
 
330
330
  jdJumpToMiniProgram({
331
331
  appId,
332
332
  path,
333
333
  param = {},
334
334
  }: JumpEventReportInterFace.LinkMiniParams) {
335
335
  const pageName = param['pageType'] || 'home'
336
336
  path = `pages/${pageName}/index`
337
337
  if (appId === global.info.pageInfo?.appId) {
338
338
  Taro.navigateTo({
339
339
  url: `/${path}?${objectToUrlEncode(param)}`,
340
340
  }).catch((err) => {
341
341
  console.warn('跳转小程序页面错误:', err)
342
342
  })
343
343
  } else {
344
344
  console.log('一个小程序跳转到另一个小程序暂无此业务')
345
345
  }
346
346
  }
347
347
 
348
348
  jdJumpToAppMiniProgram(
349
349
  path: string,
350
350
  param = {},
351
351
  successBack?: Function,
352
352
  failBack?: Function,
353
353
  ) {
354
354
  this.jdNavigateToNative(path, param, successBack, failBack)
355
355
  }
356
356
 
357
357
  jdNavigateToNative(
358
358
  url: string,
359
359
  params: {
360
360
  logEventInfo?: object
361
361
  } = {},
362
362
  successBack?: Function,
363
363
  failBack?: Function,
364
364
  ) {
365
365
  const { logEventInfo, ...otherParams } = params
366
366
  const getEparam = logEventInfo || params
367
367
  console.log('[降级H5] index jdNavigateToNative params: ', params)
368
368
  console.log('logEventInfo params: ', logEventInfo)
369
369
  try {
370
370
  this.clickEventLog(getEparam)
371
371
  } catch (e) {
372
372
  console.log(e)
373
373
  }
374
374
  setTimeout(() => {
375
375
  Taro.navigateTo({
376
376
  url: `${url}${otherParams ? '?' + objectToUrlEncode(otherParams) : ''}`,
377
377
  })
378
378
  .then((res) => {
379
379
  typeof successBack === 'function' && successBack(res)
380
380
  console.log('navigateToWxapp.success', res)
381
381
  })
382
382
  .catch((err) => {
383
383
  typeof failBack === 'function' && failBack(err)
384
384
  console.log('navigateToWxapp.fail', err)
385
385
  })
386
386
  }, 200)
387
387
  }
388
388
 
389
389
  clickEventLog(
390
390
  opts: JumpEventReportInterFace.OptEventLogParams = {},
391
391
  clickKey = 'click',
392
392
  ) {
393
393
  const { eventId, jsonParam, eventLevel = 3, skuId, ...otherParams } = opts
394
394
  if (eventId && jsonParam) {
395
395
  const { etModelInfo, logBaseInfo } = jsonParam
396
396
  const miniLogParams = {
397
397
  eid: eventId,
398
398
  elevel: eventLevel,
399
399
  eparam: JSON.stringify(logBaseInfo || jsonParam),
400
400
  ext: {
401
401
  et_model: JSON.stringify(etModelInfo || {}),
402
402
  },
403
403
  pageId: this.logPageId,
404
404
  pname: this.logPname,
405
405
  pparam: JSON.stringify(this.routerInfo.params),
406
406
  target: this.routerInfo.path,
407
407
  event: this.nativeEvent,
408
408
  ...otherParams,
409
409
  }
410
410
  if (clickKey === 'addToCart' && skuId) {
411
411
  miniLogParams['shoppingList'] = {
412
412
  [skuId]: 1,
413
413
  }
414
414
  }
415
415
  console.log('点击埋点参数对象', miniLogParams, clickKey)
416
416
  global.miniAppLogInstance &&
417
417
  global.miniAppLogInstance[clickKey](miniLogParams)
418
418
  } else {
419
419
  console.log('暂无埋点参数eventId和eventParam')
420
420
  }
421
421
  }
422
422
 
423
423
  exposureEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}) {
424
424
  return this.clickEventLog(opts, 'exposure')
425
425
  }
426
426
 
427
427
  jdJumpToSearch(shopId, suggestWord) {
428
428
  console.log(
429
429
  '� ~ file: index.ts ~ line 304 ~ JumpEventReportCenter ~ shopId, suggestWord',
430
430
  shopId,
431
431
  suggestWord,
432
432
  )
433
433
  }
434
434
 
435
435
  jdJumpToMyMessageBox() {}
436
436
 
437
437
  jdJumpToAppHome(params = {}) {
438
438
  this.jdJumpToAppMiniProgram(this.jumpMiniPath.jingGouHome, params)
439
439
  }
440
440
 
441
441
  jdJumpToShopHomeDetail({ shopId, venderId }) {
442
442
  console.log(
443
443
  '� ~ file: index.ts ~ line 327 ~ JumpEventReportCenter ~ shopId, verderId',
444
444
  shopId,
445
445
  venderId,
446
446
  )
447
447
  }
448
448
 
449
449
  jdJumpToMyCart(){
450
450
  console.log("暂未实现")
451
451
  }