@conecli/cone-render 0.10.1-shop-beta.21 → 0.10.1-shop-beta.22

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 global from '../common';
2
1
  objectToUrlEncode,
3
2
  isH5AndJingGouMini,
4
3
  public jingGouMiniState: boolean;
5
4
  private isH5OpenToWxapp: boolean;
6
5
  constructor(opt) {
7
6
  super(opt);
8
7
  this.jingGouMiniState = false;
9
8
  this.getConfig(opt);
10
9
  console.log('window.shopGlobalSwitch:', JSON.stringify(window.shopGlobalSwitch));
11
10
  this.isH5OpenToWxapp = window.shopGlobalSwitch?.openMobileShopToWxApp == 'true';
12
11
  this.init();
13
12
  }
14
13
  getConfig(opt) {
15
14
  return Object.assign(this, {}, defaultConfig, super.getConfig(opt), opt);
16
15
  }
17
16
 
18
17
 
19
18
  async init() {
20
19
  if (window.isJingGouMiniViewState) {
21
20
  this.jingGouMiniState = true;
22
21
  } else {
23
22
  console.log('初始化进行小程序环境检查, 当前是否是京购小程序里的H5', isH5AndJingGouMini);
24
23
  if (isH5AndJingGouMini && this.isH5OpenToWxapp) {
25
24
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的if');
26
25
  this.jingGouMiniState = true;
27
26
  window.isJingGouMiniViewState = true;
28
27
  console.log('进入了 iwx?.miniProgram then 但是没有继续跳转的逻辑 ');
29
28
  global.info.isJingGouMiniViewState = true;
30
29
  } else {
31
30
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的esle');
32
31
  }
33
32
  }
34
33
  }
35
34
 
36
35
  jdJumpToMiniPage(pageUrl, logEventInfo, type = 'navigateTo') {
37
36
  this.jdNavigateToNative(
38
37
  pageUrl,
39
38
  logEventInfo,
40
39
  () => {
41
40
  console.log('JD.wxappext.goto');
42
41
  wx?.miniProgram[type] &&
43
42
  wx?.miniProgram[type]({
44
43
  url: pageUrl,
45
44
  });
46
45
  },
47
46
  () => {
48
47
  console.log('JD.wxappext.goto2');
49
48
  wx?.miniProgram[type] &&
50
49
  wx?.miniProgram[type]({
51
50
  url: pageUrl,
52
51
  });
53
52
  },
54
53
  );
55
54
  }
56
55
 
57
56
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
58
57
  console.log('web.wxapp.ts - jdJumpToTabAllProduct');
59
58
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
60
59
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
61
60
  if (this.jingGouMiniState) {
62
61
  const param = {
63
62
  shopId,
64
63
  venderId,
65
64
  tabActive: SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT],
66
65
  };
67
66
  const url = `${this.jumpMiniPath.shopx}?${objectToUrlEncode(param)}`;
68
67
  this.jdJumpToMiniPage(url, logEventInfo);
69
68
  } else {
70
69
  super.jdJumpToTabAllProduct(shopId, venderId, logEventInfo);
71
70
  }
72
71
  }
73
72
 
74
73
  jdJumpToTopTabBase(type, shopInfo = {}) {
75
74
  const getInfo = Object.assign(
76
75
  {},
77
76
  {
78
77
  shopId: global.info.queryInfo.shopId,
79
78
  venderId: global.info.queryInfo.venderId,
80
79
  },
81
80
  shopInfo,
82
81
  );
83
82
  if (this.jingGouMiniState) {
84
83
  const { shopId, venderId, ...otherInfo } = getInfo;
85
84
  const param = {
86
85
  shopId,
87
86
  venderId,
88
87
  tabActive: type,
89
88
  };
90
89
  const url = `${this.jumpMiniPath.shopx}?${objectToUrlEncode(param)}`;
91
90
  this.jdJumpToMiniPage(url, otherInfo);
92
91
  } else {
93
92
  super.jdJumpToTopTabBase(type, shopInfo);
94
93
  }
95
94
  }
96
95
 
97
96
  jdJumpToWeb(url, logEventInfo) {
98
97
  console.log('web.wxapp.ts - jdJumpToWeb', url);
99
98
  console.log('jingGouMiniState', this.jingGouMiniState);
100
99
  if (this.jingGouMiniState) {
101
100
  const encodeUrl = `${this.jumpMiniPath.h5}?encode_url=${encodeURIComponent(url)}`;
102
101
  this.jdJumpToMiniPage(encodeUrl, logEventInfo);
103
102
  } else {
104
103
  super.jdJumpToWeb(url, logEventInfo);
105
104
  }
106
105
  }
107
106
 
108
107
  jdJumpToWebInner(url, logEventInfo) {
109
108
  super.jdJumpToWeb(url, logEventInfo);
110
109
  }
111
110
 
112
111
  jdJumpToProduct(skuIds, logEventInfo) {
113
112
  if (this.jingGouMiniState) {
114
113
  const detailUrl = `${this.jumpMiniPath.detail}?sku=${skuIds}`;
115
114
  this.jdJumpToMiniPage(detailUrl, logEventInfo);
116
115
  } else {
117
116
  super.jdJumpToProduct(skuIds, logEventInfo);
118
117
  }
119
118
  }
120
119
 
121
120
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
122
121
  const getSkuId = skuInfo?.skuId;
123
122
  this.jdJumpToProduct(getSkuId, logEventInfo);
124
123
  }
125
124
 
126
125
  jdJumpToShopHome(params) {
127
126
  console.log('[降级H5] jdJumpToShopHome web.wxapp', params);
128
127
  console.log(
129
128
  'global.info.queryInfo.shopId',
130
129
  global.info.queryInfo.shopId,
131
130
  global.info.queryInfo.venderId,
132
131
  );
133
132
  const getInfo = Object.assign(
134
133
  {},
135
134
  {
136
135
  shopId: global.info.queryInfo.shopId,
137
136
  venderId: global.info.queryInfo.venderId,
138
137
  },
139
138
  params,
140
139
  );
141
140
  const { type = 'navigateTo', ...otherShopInfo } = getInfo;
142
141
  if (this.jingGouMiniState) {
143
142
  let shopUrl = `${this.jumpMiniPath.shopx}${window.location.search}`;
144
143
  if (
145
144
  /(\/shop\/(samCenter|samCard))|(\/sale\/home)|(\/favorite)/.test(window.location.pathname)
146
145
  ) {
147
146
  shopUrl = `${this.jumpMiniPath.shopx}?${objectToUrlEncode(
148
147
  this.getShopIdsInfo(otherShopInfo),
149
148
  )}`;
150
149
  }
151
150
  this.jdJumpToMiniPage(shopUrl, otherShopInfo, type);
152
151
  } else {
153
152
  super.jdJumpToShopHome(otherShopInfo);
154
153
  }
155
154
  }
156
155
 
157
156
  jdJumpToShopCategory(params) {
158
157
  console.log('[降级H5] jdJumpToShopCategory web.wxapp');
159
158
  const { type = 'navigateTo', ...otherShopInfo } = params;
160
159
  console.log('获取分类跳转参数', params);
161
160
  if (this.jingGouMiniState) {
162
161
  this.jdJumpToTopTabBase('classify', otherShopInfo);
163
162
  } else {
164
163
  super.jdJumpToShopCategory(otherShopInfo);
165
164
  }
166
165
  }
167
166
 
168
167
  jdJumpToLive(liveInfo, logEventInfo = {}) {
169
168
  if (liveInfo?.liveId) {
170
169
  if (this.jingGouMiniState && liveInfo?.openWxappToLiveRoom) {
171
170
  this.jdJumpToMiniPage(`${this.jumpMiniPath.jdLive}?liveId=${liveInfo.liveId}&origin=473`, {
172
171
  logEventInfo,
173
172
  });
174
173
  } else {
175
174
  this.jdJumpToWeb(
176
175
  `${this.jumpWebUrl.mLive}/${liveInfo.liveId}?${
177
176
  this.jingGouMiniState ? 'origin=0&appid=jdgw' : 'origin=30'
178
177
  }`,
179
178
  logEventInfo,
180
179
  );
181
180
  }
182
181
  }
183
182
  }
184
183
 
185
184
  jdJumpToShopLight(shopInfo) {
186
185
  if (this.jingGouMiniState) {
187
186
  this.jdJumpToMiniPage(
188
187
  `${this.jumpMiniPath.shopLight}?${objectToUrlEncode(
189
188
  this.getShopIdOrVenderIdParams(shopInfo),
190
189
  )}`,
191
190
  {
192
191
  ...shopInfo,
193
192
  },
194
193
  );
195
194
  } else {
196
195
  this.jdNavigateToNative(
197
196
  `${this.jumpWebUrl.shopLight}?${objectToUrlEncode(
198
197
  this.getShopIdOrVenderIdParams(shopInfo),
199
198
  )}`,
200
199
  {
201
200
  ...shopInfo,
202
201
  },
203
202
  );
204
203
  }
205
204
  }
206
205
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
207
206
  if (this.jingGouMiniState) {
208
207
  const detailUrl = `${this.jumpMiniPath.searchCoupon}?batch=${couponId}`;
209
208
  this.jdJumpToMiniPage(detailUrl, logEventInfo);
210
209
  } else {
211
210
  super.jdJumpToCouponSearchProductList(couponId, logEventInfo);
212
211
  }
213
212
  }
213
+ import global from '../common';
214
214
  objectToUrlEncode,
215
215
  isH5AndJingGouMini,
216
216
  public jingGouMiniState: boolean;
217
217
  private isH5OpenToWxapp: boolean;
218
218
  constructor(opt) {
219
219
  super(opt);
220
220
  this.jingGouMiniState = false;
221
221
  this.getConfig(opt);
222
222
  console.log('window.shopGlobalSwitch:', JSON.stringify(window.shopGlobalSwitch));
223
223
  this.isH5OpenToWxapp = window.shopGlobalSwitch?.openMobileShopToWxApp == 'true';
224
224
  this.init();
225
225
  }
226
226
  getConfig(opt) {
227
227
  return Object.assign(this, {}, defaultConfig, super.getConfig(opt), opt);
228
228
  }
229
229
 
230
230
 
231
231
  async init() {
232
232
  if (window.isJingGouMiniViewState) {
233
233
  this.jingGouMiniState = true;
234
234
  } else {
235
235
  console.log('初始化进行小程序环境检查, 当前是否是京购小程序里的H5', isH5AndJingGouMini);
236
236
  if (isH5AndJingGouMini && this.isH5OpenToWxapp) {
237
237
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的if');
238
238
  this.jingGouMiniState = true;
239
239
  window.isJingGouMiniViewState = true;
240
240
  console.log('进入了 iwx?.miniProgram then 但是没有继续跳转的逻辑 ');
241
241
  global.info.isJingGouMiniViewState = true;
242
242
  } else {
243
243
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的esle');
244
244
  }
245
245
  }
246
246
  }
247
247
 
248
248
  jdJumpToMiniPage(pageUrl, logEventInfo, type = 'navigateTo') {
249
249
  this.jdNavigateToNative(
250
250
  pageUrl,
251
251
  logEventInfo,
252
252
  () => {
253
253
  console.log('JD.wxappext.goto');
254
254
  wx?.miniProgram[type] &&
255
255
  wx?.miniProgram[type]({
256
256
  url: pageUrl,
257
257
  });
258
258
  },
259
259
  () => {
260
260
  console.log('JD.wxappext.goto2');
261
261
  wx?.miniProgram[type] &&
262
262
  wx?.miniProgram[type]({
263
263
  url: pageUrl,
264
264
  });
265
265
  },
266
266
  );
267
267
  }
268
268
 
269
269
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
270
270
  console.log('web.wxapp.ts - jdJumpToTabAllProduct');
271
271
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
272
272
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
273
273
  if (this.jingGouMiniState) {
274
274
  const param = {
275
275
  shopId,
276
276
  venderId,
277
277
  tabActive: SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT],
278
278
  };
279
279
  const url = `${this.jumpMiniPath.shopx}?${objectToUrlEncode(param)}`;
280
280
  this.jdJumpToMiniPage(url, logEventInfo);
281
281
  } else {
282
282
  super.jdJumpToTabAllProduct(shopId, venderId, logEventInfo);
283
283
  }
284
284
  }
285
285
 
286
286
  jdJumpToTopTabBase(type, shopInfo = {}) {
287
287
  const getInfo = Object.assign(
288
288
  {},
289
289
  {
290
290
  shopId: global.info.queryInfo.shopId,
291
291
  venderId: global.info.queryInfo.venderId,
292
292
  },
293
293
  shopInfo,
294
294
  );
295
295
  if (this.jingGouMiniState) {
296
296
  const { shopId, venderId, ...otherInfo } = getInfo;
297
297
  const param = {
298
298
  shopId,
299
299
  venderId,
300
300
  tabActive: type,
301
301
  };
302
302
  const url = `${this.jumpMiniPath.shopx}?${objectToUrlEncode(param)}`;
303
303
  this.jdJumpToMiniPage(url, otherInfo);
304
304
  } else {
305
305
  super.jdJumpToTopTabBase(type, shopInfo);
306
306
  }
307
307
  }
308
308
 
309
309
  jdJumpToWeb(url, logEventInfo) {
310
310
  console.log('web.wxapp.ts - jdJumpToWeb', url);
311
311
  console.log('jingGouMiniState', this.jingGouMiniState);
312
312
  if (this.jingGouMiniState) {
313
313
  const encodeUrl = `${this.jumpMiniPath.h5}?encode_url=${encodeURIComponent(url)}`;
314
314
  this.jdJumpToMiniPage(encodeUrl, logEventInfo);
315
315
  } else {
316
316
  super.jdJumpToWeb(url, logEventInfo);
317
317
  }
318
318
  }
319
319
 
320
320
  jdJumpToWebInner(url, logEventInfo) {
321
321
  super.jdJumpToWeb(url, logEventInfo);
322
322
  }
323
323
 
324
324
  jdJumpToProduct(skuIds, logEventInfo) {
325
325
  if (this.jingGouMiniState) {
326
326
  const detailUrl = `${this.jumpMiniPath.detail}?sku=${skuIds}`;
327
327
  this.jdJumpToMiniPage(detailUrl, logEventInfo);
328
328
  } else {
329
329
  super.jdJumpToProduct(skuIds, logEventInfo);
330
330
  }
331
331
  }
332
332
 
333
333
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
334
334
  const getSkuId = skuInfo?.skuId;
335
335
  this.jdJumpToProduct(getSkuId, logEventInfo);
336
336
  }
337
337
 
338
338
  jdJumpToShopHome(shopInfo) {
339
339
  console.log('[降级H5] jdJumpToShopHome web.wxapp', shopInfo);
340
340
  console.log(
341
341
  'global.info.queryInfo.shopId',
342
342
  global.info.queryInfo.shopId,
343
343
  global.info.queryInfo.venderId,
344
344
  );
345
345
  const currentShopInfo = {
346
346
  shopId: global.info.queryInfo.shopId,
347
347
  venderId: global.info.queryInfo.venderId,
348
348
  };
349
349
  const restParams =
350
350
  (shopInfo?.shopId && shopInfo.shopId !== currentShopInfo.shopId) ||
351
351
  (shopInfo?.venderId && shopInfo.venderId !== currentShopInfo.venderId)
352
352
  ? {}
353
353
  : currentShopInfo;
354
354
  const getInfo = Object.assign({}, restParams, shopInfo);
355
355
  const { type = 'navigateTo', ...otherShopInfo } = getInfo;
356
356
  if (this.jingGouMiniState) {
357
357
  let shopUrl = `${this.jumpMiniPath.shopx}${window.location.search}`;
358
358
  if (
359
359
  /(\/shop\/(samCenter|samCard))|(\/sale\/home)|(\/favorite)/.test(window.location.pathname)
360
360
  ) {
361
361
  shopUrl = `${this.jumpMiniPath.shopx}?${objectToUrlEncode(
362
362
  this.getShopIdsInfo(otherShopInfo),
363
363
  )}`;
364
364
  }
365
365
  this.jdJumpToMiniPage(shopUrl, otherShopInfo, type);
366
366
  } else {
367
367
  super.jdJumpToShopHome(otherShopInfo);
368
368
  }
369
369
  }
370
370
 
371
371
  jdJumpToShopCategory(params) {
372
372
  console.log('[降级H5] jdJumpToShopCategory web.wxapp');
373
373
  const { type = 'navigateTo', ...otherShopInfo } = params;
374
374
  console.log('获取分类跳转参数', params);
375
375
  if (this.jingGouMiniState) {
376
376
  this.jdJumpToTopTabBase('classify', otherShopInfo);
377
377
  } else {
378
378
  super.jdJumpToShopCategory(otherShopInfo);
379
379
  }
380
380
  }
381
381
 
382
382
  jdJumpToLive(liveInfo, logEventInfo = {}) {
383
383
  if (liveInfo?.liveId) {
384
384
  if (this.jingGouMiniState && liveInfo?.openWxappToLiveRoom) {
385
385
  this.jdJumpToMiniPage(`${this.jumpMiniPath.jdLive}?liveId=${liveInfo.liveId}&origin=473`, {
386
386
  logEventInfo,
387
387
  });
388
388
  } else {
389
389
  this.jdJumpToWeb(
390
390
  `${this.jumpWebUrl.mLive}/${liveInfo.liveId}?${
391
391
  this.jingGouMiniState ? 'origin=0&appid=jdgw' : 'origin=30'
392
392
  }`,
393
393
  logEventInfo,
394
394
  );
395
395
  }
396
396
  }
397
397
  }
398
398
 
399
399
  jdJumpToShopLight(shopInfo) {
400
400
  if (this.jingGouMiniState) {
401
401
  this.jdJumpToMiniPage(
402
402
  `${this.jumpMiniPath.shopLight}?${objectToUrlEncode(
403
403
  this.getShopIdOrVenderIdParams(shopInfo),
404
404
  )}`,
405
405
  {
406
406
  ...shopInfo,
407
407
  },
408
408
  );
409
409
  } else {
410
410
  this.jdNavigateToNative(
411
411
  `${this.jumpWebUrl.shopLight}?${objectToUrlEncode(
412
412
  this.getShopIdOrVenderIdParams(shopInfo),
413
413
  )}`,
414
414
  {
415
415
  ...shopInfo,
416
416
  },
417
417
  );
418
418
  }
419
419
  }
420
420
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
421
421
  if (this.jingGouMiniState) {
422
422
  const detailUrl = `${this.jumpMiniPath.searchCoupon}?batch=${couponId}`;
423
423
  this.jdJumpToMiniPage(detailUrl, logEventInfo);
424
424
  } else {
425
425
  super.jdJumpToCouponSearchProductList(couponId, logEventInfo);
426
426
  }
427
427
  }
@@ -52,6 +52,7 @@
52
52
  "sendCodeFail": "Send failed, please try again later.",
53
53
  "successMsg": "Success",
54
54
  "noProduct": "No products~",
55
+ "shopYearDescText": "Achieve annual 5-Star honors, with ratings exceeding 99% of stores",
55
56
  "newWareCalendar": "上新日历",
56
57
  "joinYouToMember": "Invite you to join brand member",
57
58
  "recommendOrder": "Recommended",
@@ -166,6 +167,7 @@
166
167
  "joinMemberRightNow": "立即加入品牌会员",
167
168
  "follow": "Follow",
168
169
  "followed": "Following",
170
+ "shopPopularity": "Popularity",
169
171
  "joinMemberSuccess": "Join successfully",
170
172
  "mobileNumberErrorFill": "Wrong phone number",
171
173
  "joinNow": "Join now",
@@ -52,6 +52,7 @@
52
52
  "sendCodeFail": "发送失败, 请稍后再试",
53
53
  "successMsg": "成功",
54
54
  "noProduct": "哎呀,店铺内没有商品呢~",
55
+ "shopYearDescText": "获得年度五星荣誉, 评级超过99%的店铺",
55
56
  "newWareCalendar": "上新日历",
56
57
  "joinYouToMember": "授权加入店铺会员",
57
58
  "recommendOrder": "推荐排序",
@@ -166,6 +167,7 @@
166
167
  "joinMemberRightNow": "立即加入品牌会员",
167
168
  "follow": "关注",
168
169
  "followed": "已关注",
170
+ "shopPopularity": "店铺人气",
169
171
  "joinMemberSuccess": "入会成功",
170
172
  "mobileNumberErrorFill": "未填写正确的手机号",
171
173
  "joinNow": "入会立享",
@@ -52,6 +52,7 @@
52
52
  "sendCodeFail": "發送失敗, 請稍後再試",
53
53
  "successMsg": "成功",
54
54
  "noProduct": "哎呀,店鋪內沒有商品呢~",
55
+ "shopYearDescText": "獲得年度五星榮譽, 評級超過99%的店鋪",
55
56
  "newWareCalendar": "上新日曆",
56
57
  "joinYouToMember": "授權加入店鋪會員",
57
58
  "recommendOrder": "推薦排序",
@@ -166,6 +167,7 @@
166
167
  "joinMemberRightNow": "立即加入品牌會員",
167
168
  "follow": "關注",
168
169
  "followed": "已關注",
170
+ "shopPopularity": "店鋪人氣",
169
171
  "joinMemberSuccess": "入會成功",
170
172
  "mobileNumberErrorFill": "未填寫正確的手機號",
171
173
  "joinNow": "入會立享",