@conecli/cone-render 0.10.1-shop3.13 → 0.10.1-shop3.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
  TaroEventType,
3
2
  JUMP_MEMBER_CHANNEL,
4
3
  CENTERDISPATCH_JUMPPAGE_VALUE,
5
4
 
6
5
  CARD_BANNER = 'shopMemberCardVenderCardBanner',
7
6
 
8
7
  CARD_NAME = 'shopMemberCardVenderCardName',
9
8
 
10
9
  MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
11
10
 
12
11
  MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
13
12
 
14
13
  MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
15
14
  return new Promise((resolve) => {
16
15
  requestServer
17
16
  .getCustomerCenterDispatch(params)
18
17
  .then((response) => {
19
18
  if (response.result && response.code === '0') {
20
19
  resolve(response.result);
21
20
  } else {
22
21
  resolve({
23
22
  jumpPage:
24
23
  response.code === '1'
25
24
  ? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
26
25
  : CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
27
26
  });
28
27
  }
29
28
  })
30
29
  .catch((err) => {
31
30
  resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
32
31
  console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
33
32
  });
34
33
  });
35
34
  const currentVenderId = global.info.queryInfo.venderId;
36
35
  const currentShopId = global.info.queryInfo.shopId;
37
36
  const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
38
37
  const toastOpt = {
39
38
  duration: 3000,
40
39
  image:
41
40
  'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
42
41
  };
43
42
  if (isAppHomeForMarketPage) {
44
43
  JumpEventReport.jdJumpToBottomTabBrandMember({
45
44
  shopId: currentShopId,
46
45
  venderId: currentVenderId,
47
46
  });
48
47
  return;
49
48
  }
50
49
  const params = {
51
50
  venderId: currentVenderId,
52
51
  channel,
53
52
  queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
54
53
  };
55
54
  const centerDispatchResult = await getCenterDispatchResult(params);
56
55
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
57
56
  const { jumpPage } = centerDispatchResult;
58
57
  if (typeof jumpPage !== 'number') {
59
58
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
60
59
  showFailToast({
61
60
  title: '网络繁忙,稍后再试吧~',
62
61
  ...toastOpt,
63
62
  });
64
63
  return;
65
64
  }
66
65
  const centerDispatchJumpPageValue = Number(jumpPage);
67
66
  if (
68
67
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
69
68
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
70
69
  ) {
71
70
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
72
71
  showFailToast({
73
72
  title: '网络繁忙,稍后再试吧~',
74
73
  ...toastOpt,
75
74
  });
76
75
  return;
77
76
  }
78
77
  if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
79
78
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
80
79
  global
81
80
  .doLogin()
82
81
  .then((res) => {
83
82
  console.log('登录成功', res);
84
83
  })
85
84
  .catch((err) => {
86
85
  console.log('登录失败', err);
87
86
  });
88
87
  return;
89
88
  }
90
89
  const memberRoleJumpPageValueArr = [
91
90
  CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
92
91
  CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
93
92
  CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
94
93
  ];
95
94
  const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
96
95
  if (isMemberRole) {
97
96
  showFailToast({
98
97
  title: '您已是本店会员,无需再次入会',
99
98
  ...toastOpt,
100
99
  });
101
100
  return;
102
101
  }
103
102
  if (!isH5AndJdShopView) {
104
103
  JumpEventReport.jdJumpToNewH5MemberCard();
105
104
  return;
106
105
  }
107
106
  const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
108
107
  console.log('一键入会,是否已降级', isDegrade);
109
108
  console.log('一键入会,是否低版本', isLowVersion);
110
109
  if (isDegrade) {
111
110
  console.log('一键入会,已降级');
112
111
  showFailToast({
113
112
  title: '网络繁忙,稍后再试吧~',
114
113
  ...toastOpt,
115
114
  });
116
115
  return;
117
116
  }
118
117
  if (isLowVersion) {
119
118
  console.log('一键入会,低版本');
120
119
  JumpEventReport.jdJumpToMemberTab();
121
120
  return;
122
121
  }
123
122
  return new Promise((resolve) => {
124
123
  const getOpenCardUrlParams = {
125
124
  venderId: currentVenderId,
126
125
  shopId: currentShopId,
127
126
  channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
128
127
  device: isJdTabletDevice ? 'tablet' : 'all',
129
128
  };
130
129
  const memberCardurl =
131
130
  window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
132
131
  ? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
133
132
  : `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
134
133
  const sourceUrl = encodeURIComponent(window.location.href || '');
135
134
  const url =
136
135
  sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
137
136
  console.log('openPopWebview url', url);
138
137
  nativeOpenPopWebView({
139
138
  url,
140
139
  });
141
140
  Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
142
141
  Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
143
142
  console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
144
143
  const { shopId, venderId } = res;
145
144
  if (shopId === currentShopId && venderId === currentVenderId) {
146
145
  resolve(true);
147
146
  } else {
148
147
  console.log(
149
148
  'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
150
149
  currentShopId,
151
150
  currentVenderId,
152
151
  );
153
152
  resolve(false);
154
153
  }
155
154
  });
156
155
  });
156
+ import Taro from '@tarojs/taro';
157
157
  TaroEventType,
158
158
  JUMP_MEMBER_CHANNEL,
159
159
  CENTERDISPATCH_JUMPPAGE_VALUE,
160
160
 
161
161
  CARD_BANNER = 'shopMemberCardVenderCardBanner',
162
162
 
163
163
  CARD_NAME = 'shopMemberCardVenderCardName',
164
164
 
165
165
  MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
166
166
 
167
167
  MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
168
168
 
169
169
  MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
170
170
  return new Promise((resolve) => {
171
171
  requestServer
172
172
  .getCustomerCenterDispatch(params)
173
173
  .then((response) => {
174
174
  if (response.result && response.code === '0') {
175
175
  resolve(response.result);
176
176
  } else {
177
177
  resolve({
178
178
  jumpPage:
179
179
  response.code === '1'
180
180
  ? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
181
181
  : CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
182
182
  });
183
183
  }
184
184
  })
185
185
  .catch((err) => {
186
186
  resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
187
187
  console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
188
188
  });
189
189
  });
190
190
  const currentVenderId = global.info.queryInfo.venderId;
191
191
  const currentShopId = global.info.queryInfo.shopId;
192
192
  const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
193
193
  const toastOpt = {
194
194
  duration: 3000,
195
195
  image:
196
196
  'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
197
197
  };
198
198
  if (isAppHomeForMarketPage) {
199
199
  JumpEventReport.jdJumpToBottomTabBrandMember({
200
200
  shopId: currentShopId,
201
201
  venderId: currentVenderId,
202
202
  });
203
203
  return;
204
204
  }
205
205
  const params = {
206
206
  venderId: currentVenderId,
207
207
  channel,
208
208
  queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
209
209
  };
210
210
  const centerDispatchResult = await getCenterDispatchResult(params);
211
211
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
212
212
  const { jumpPage } = centerDispatchResult;
213
213
  if (typeof jumpPage !== 'number') {
214
214
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
215
215
  showFailToast({
216
216
  title: '网络繁忙,稍后再试吧~',
217
217
  ...toastOpt,
218
218
  });
219
219
  return;
220
220
  }
221
221
  const centerDispatchJumpPageValue = Number(jumpPage);
222
222
  if (
223
223
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
224
224
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
225
225
  ) {
226
226
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
227
227
  showFailToast({
228
228
  title: '网络繁忙,稍后再试吧~',
229
229
  ...toastOpt,
230
230
  });
231
231
  return;
232
232
  }
233
233
  if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
234
234
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
235
235
  global
236
236
  .doLogin()
237
237
  .then((res) => {
238
238
  console.log('登录成功', res);
239
239
  })
240
240
  .catch((err) => {
241
241
  console.log('登录失败', err);
242
242
  });
243
243
  return;
244
244
  }
245
245
  const memberRoleJumpPageValueArr = [
246
246
  CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
247
247
  CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
248
248
  CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
249
249
  ];
250
250
  const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
251
251
  if (isMemberRole) {
252
252
  showFailToast({
253
253
  title: '您已是本店会员,无需再次入会',
254
254
  ...toastOpt,
255
255
  });
256
256
  return;
257
257
  }
258
258
  if (!isH5AndJdShopView) {
259
259
  JumpEventReport.jdJumpToNewH5MemberCard();
260
260
  return;
261
261
  }
262
262
  const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
263
263
  console.log('一键入会,是否已降级', isDegrade);
264
264
  console.log('一键入会,是否低版本', isLowVersion);
265
265
  if (isDegrade) {
266
266
  console.log('一键入会,已降级');
267
267
  showFailToast({
268
268
  title: '网络繁忙,稍后再试吧~',
269
269
  ...toastOpt,
270
270
  });
271
271
  return;
272
272
  }
273
273
  if (isLowVersion) {
274
274
  console.log('一键入会,低版本');
275
275
  JumpEventReport.jdJumpToMemberTab();
276
276
  return;
277
277
  }
278
278
  return new Promise((resolve) => {
279
279
  const getOpenCardUrlParams = {
280
280
  venderId: currentVenderId,
281
281
  shopId: currentShopId,
282
282
  channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
283
283
  device: global.info.sysInfo?.isJdTabletDevice ? 'tablet' : 'all',
284
284
  };
285
285
  const memberCardurl =
286
286
  window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
287
287
  ? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
288
288
  : `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
289
289
  const sourceUrl = encodeURIComponent(window.location.href || '');
290
290
  const url =
291
291
  sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
292
292
  console.log('openPopWebview url', url);
293
293
  nativeOpenPopWebView({
294
294
  url,
295
295
  });
296
296
  Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
297
297
  Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
298
298
  console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
299
299
  const { shopId, venderId } = res;
300
300
  if (shopId === currentShopId && venderId === currentVenderId) {
301
301
  resolve(true);
302
302
  } else {
303
303
  console.log(
304
304
  'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
305
305
  currentShopId,
306
306
  currentVenderId,
307
307
  );
308
308
  resolve(false);
309
309
  }
310
310
  });
311
311
  });
@@ -1 +1 @@
1
- export const HttpStatus = {
2
1
  SUCCESS: 200,
3
2
  CREATED: 201,
4
3
  ACCEPTED: 202,
5
4
  CLIENT_ERROR: 400,
6
5
  AUTHENTICATE: 401,
7
6
  FORBIDDEN: 403,
8
7
  NOT_FOUND: 404,
9
8
  SERVER_ERROR: 500,
10
9
  BAD_GATEWAY: 502,
11
10
  SERVICE_UNAVAILABLE: 503,
12
11
  GATEWAY_TIMEOUT: 504,
13
12
  [HttpStatus.NOT_FOUND]: '请求资源不存在',
14
13
  [HttpStatus.BAD_GATEWAY]: '服务端异常,请稍后重试',
15
14
  [HttpStatus.FORBIDDEN]: '没有权限访问',
16
15
  [HttpStatus.AUTHENTICATE]: '需要鉴权',
17
16
  [HttpStatus.SUCCESS]: '成功',
18
17
  'whx_getShopHomeFloorInfo',
19
18
  'whx_searchWare',
20
19
  'shopGuessYouLike',
21
20
  'whx_getMShopCategory',
22
21
  'whx_newWareList',
23
22
  'getShopHomePromotionWebPage',
24
23
  'whx_getShopCampaignPage',
25
24
  'whx_getPromotionWares',
26
25
  'whx_buyerShowPage',
27
26
  'whx_getShopGwredPage',
28
27
  'whx_getShopSpeciSecKillPage',
29
28
  'whx_getSignInfo',
30
29
  'whx_getSignPrize',
31
30
  'getShopHomeFloorInfo',
32
31
  'shopGuessYouLike',
33
32
  'getShopHomePromotionWebPage',
34
33
  'getVipDetail',
35
34
  'getShopCategory',
36
35
  'getShopNavigationCategory',
37
36
  'getPagePreview',
38
37
  'bmall_cart',
39
38
  'bmall_getOmittedProduct',
40
39
  'bmall_cartAdd',
41
40
  'bmall_cartChange',
42
41
  'bmall_cartRemove',
43
42
  'whx_getShopHomeFloorInfo',
44
43
  'whx_searchWare',
45
44
  'shopGuessYouLike',
46
45
  'whx_getMShopCategory',
47
46
  'whx_newWareList',
48
47
  'getShopHomePromotionWebPage',
49
48
  'whx_getShopCampaignPage',
50
49
  'whx_getPromotionWares',
51
50
  'whx_buyerShowPage',
52
51
  'getShopHomeFloorInfo',
53
52
  'getShopCategory',
54
53
  'getShopNavigationCategory',
55
54
  'giftCardAddCart',
56
55
  'receiveShopCoupon',
57
56
  'getShopHomePromotionWebPage',
58
57
  'shopGuessYouLike',
59
58
  'addRemind',
60
59
  'cancelRemind',
61
60
  'getVipDetail',
62
61
  'shopDetail',
63
62
  'address_queryAddress',
64
63
  'shopMemberSprintJoinActivity',
65
64
  'shopMemberSprintReceivePrize',
66
65
  'bmall_cart',
67
66
  'bmall_getOmittedProduct',
68
67
  'bmall_cartAdd',
69
68
  'bmall_cartChange',
70
69
  'bmall_cartRemove',
71
70
  SHOP_COLOR_APPID: 'shop_m_jd_com',
72
71
  JSHOPX_COLOR_APPID: 'jshopx_jd_com',
73
72
  PAGES_COLOR_APPID: 'pages_jd_com',
74
73
  B2B_COLOR_APPID: 'b2b',
75
74
  SHOP_MEMBER_COLOR_APPID: 'shopmember_m_jd_com',
76
75
  MALL_COLOR_APPID: 'mall_jd_com',
77
76
  'getSeriesTabData',
78
77
  'searchWare',
79
78
  'getDrShopDiscoveryFeeds',
79
+ export const HttpStatus = {
80
80
  SUCCESS: 200,
81
81
  CREATED: 201,
82
82
  ACCEPTED: 202,
83
83
  CLIENT_ERROR: 400,
84
84
  AUTHENTICATE: 401,
85
85
  FORBIDDEN: 403,
86
86
  NOT_FOUND: 404,
87
87
  SERVER_ERROR: 500,
88
88
  BAD_GATEWAY: 502,
89
89
  SERVICE_UNAVAILABLE: 503,
90
90
  GATEWAY_TIMEOUT: 504,
91
91
  [HttpStatus.NOT_FOUND]: '请求资源不存在',
92
92
  [HttpStatus.BAD_GATEWAY]: '服务端异常,请稍后重试',
93
93
  [HttpStatus.FORBIDDEN]: '没有权限访问',
94
94
  [HttpStatus.AUTHENTICATE]: '需要鉴权',
95
95
  [HttpStatus.SUCCESS]: '成功',
96
96
  'whx_getShopHomeFloorInfo',
97
97
  'whx_searchWare',
98
98
  'shopGuessYouLike',
99
99
  'whx_getMShopCategory',
100
100
  'whx_newWareList',
101
101
  'getShopHomePromotionWebPage',
102
102
  'whx_getShopCampaignPage',
103
103
  'whx_getPromotionWares',
104
104
  'whx_buyerShowPage',
105
105
  'whx_getShopGwredPage',
106
106
  'whx_getShopSpeciSecKillPage',
107
107
  'whx_getSignInfo',
108
108
  'whx_getSignPrize',
109
109
  'getShopHomeFloorInfo',
110
110
  'shopGuessYouLike',
111
111
  'getShopHomePromotionWebPage',
112
112
  'getVipDetail',
113
113
  'getShopCategory',
114
114
  'getShopNavigationCategory',
115
115
  'colorApiPreview',
116
116
  'bmall_cart',
117
117
  'bmall_getOmittedProduct',
118
118
  'bmall_cartAdd',
119
119
  'bmall_cartChange',
120
120
  'bmall_cartRemove',
121
121
  'whx_getShopHomeFloorInfo',
122
122
  'whx_searchWare',
123
123
  'shopGuessYouLike',
124
124
  'whx_getMShopCategory',
125
125
  'whx_newWareList',
126
126
  'getShopHomePromotionWebPage',
127
127
  'whx_getShopCampaignPage',
128
128
  'whx_getPromotionWares',
129
129
  'whx_buyerShowPage',
130
130
  'getShopHomeFloorInfo',
131
131
  'getShopCategory',
132
132
  'getShopNavigationCategory',
133
133
  'giftCardAddCart',
134
134
  'receiveShopCoupon',
135
135
  'getShopHomePromotionWebPage',
136
136
  'shopGuessYouLike',
137
137
  'addRemind',
138
138
  'cancelRemind',
139
139
  'getVipDetail',
140
140
  'shopDetail',
141
141
  'address_queryAddress',
142
142
  'shopMemberSprintJoinActivity',
143
143
  'shopMemberSprintReceivePrize',
144
144
  'bmall_cart',
145
145
  'bmall_getOmittedProduct',
146
146
  'bmall_cartAdd',
147
147
  'bmall_cartChange',
148
148
  'bmall_cartRemove',
149
149
  SHOP_COLOR_APPID: 'shop_m_jd_com',
150
150
  JSHOPX_COLOR_APPID: 'jshopx_jd_com',
151
151
  PAGES_COLOR_APPID: 'pages_jd_com',
152
152
  B2B_COLOR_APPID: 'b2b',
153
153
  SHOP_MEMBER_COLOR_APPID: 'shopmember_m_jd_com',
154
154
  MALL_COLOR_APPID: 'mall_jd_com',
155
155
  'getSeriesTabData',
156
156
  'searchWare',
157
157
  'getDrShopDiscoveryFeeds',
@@ -1 +1 @@
1
- const colorDSM = 'https://api.m.jd.com/client.action?functionId=';
2
1
  [
3
2
  colorDSM + 'op_getGoodListByCatesIds',
4
3
  ['dsm.jshop.operations.api.inner.service.ProductJsfService.getGoodListByCatesIds', true],
5
4
  ,
6
5
  ],
7
6
  console.log('getSColorPara ~ url is:', url);
8
7
  url = colorDSM + url;
9
8
  if (isDowngradeSDM(url)) {
10
9
  return {};
11
10
  }
12
11
  return getDSMValue(url)
13
12
  ? {
14
13
  url: '/api?v=1.0&appId=IEAFE4HKEFPYCKVAUVBR&api=' + getDSMValue(url)[0],
15
14
  }
16
15
  : {};
17
16
  url = colorDSM + url;
18
17
  try {
19
18
  if (isDowngradeSDM(url)) {
20
19
  return false;
21
20
  }
22
21
  console.log('is DSM', !!getDSMValue(url));
23
22
  return !!getDSMValue(url);
24
23
  } catch (error) {
25
24
  console.log('🚀 ~ checkIsDSM ~ error:', error);
26
25
  return false;
27
26
  }
28
27
  url = colorDSM + url;
29
28
  if (isDowngradeSDM(url)) {
30
29
  return false;
31
30
  }
32
31
  console.log('is need deconstruction', getDSMValue(url) ? getDSMValue(url)[1] : false);
33
32
  return getDSMValue(url) ? getDSMValue(url)[1] : false;
34
33
  for (let [key, value] of DSM) {
35
34
  if (url.startsWith(key) && url.includes('?')) {
36
35
  return value;
37
36
  }
38
37
  if (key === url) {
39
38
  return value;
40
39
  }
41
40
  }
42
41
  return '';
43
42
  const { nodePageData } = window;
44
43
  const { DSMDowngradeList } = nodePageData;
45
44
  console.log('DSMDowngradeList:', DSMDowngradeList);
46
45
  if (
47
46
  !Array.isArray(DSMDowngradeList) ||
48
47
  (DSMDowngradeList.length > 0 &&
49
48
  DSMDowngradeList.some((prefix) => url.startsWith(prefix)) &&
50
49
  url.includes('?')) ||
51
50
  DSMDowngradeList.includes(url)
52
51
  ) {
53
52
  return true;
54
53
  }
55
54
  return false;
56
55
  getSColorPara: (url) => getSColorPara(url),
57
56
  checkIsNeedDeconstruction: (url) => checkIsNeedDeconstruction(url),
58
57
  checkIsDSM: (url) => checkIsDSM(url),
58
+ const colorDSM = 'https://api.m.jd.com/client.action?functionId=';
59
59
  [
60
60
  colorDSM + 'op_getGoodListByCatesIds',
61
61
  ['dsm.jshop.operations.api.inner.service.ProductJsfService.getGoodListByCatesIds', true],
62
62
  ,
63
63
  ],
64
64
  console.log('getSColorPara ~ url is:', url);
65
65
  url = colorDSM + url;
66
66
  if (isDowngradeSDM(url)) {
67
67
  return {};
68
68
  }
69
69
  return getDSMValue(url)
70
70
  ? {
71
71
  url: '/api?v=1.0&appId=IEAFE4HKEFPYCKVAUVBR&api=' + getDSMValue(url)[0],
72
72
  }
73
73
  : {};
74
74
  url = colorDSM + url;
75
75
  try {
76
76
  if (isDowngradeSDM(url)) {
77
77
  return false;
78
78
  }
79
79
  console.log('is DSM', !!getDSMValue(url));
80
80
  return !!getDSMValue(url);
81
81
  } catch (error) {
82
82
  console.log('🚀 ~ checkIsDSM ~ error:', error);
83
83
  return false;
84
84
  }
85
85
  url = colorDSM + url;
86
86
  if (isDowngradeSDM(url)) {
87
87
  return false;
88
88
  }
89
89
  console.log('is need deconstruction', getDSMValue(url) ? getDSMValue(url)[1] : false);
90
90
  return getDSMValue(url) ? getDSMValue(url)[1] : false;
91
91
  for (let [key, value] of DSM) {
92
92
  if (url.startsWith(key) && url.includes('?')) {
93
93
  return value;
94
94
  }
95
95
  if (key === url) {
96
96
  return value;
97
97
  }
98
98
  }
99
99
  return '';
100
100
  try {
101
101
  const { nodePageData } = window;
102
102
  const { DSMDowngradeList = null, routeBlackList = null } = nodePageData;
103
103
  if (
104
104
  nodePageData &&
105
105
  routeBlackList &&
106
106
  Array.isArray(routeBlackList) &&
107
107
  ((routeBlackList.length > 0 &&
108
108
  routeBlackList.some((prefix) => url.startsWith(prefix)) &&
109
109
  url.includes('?')) ||
110
110
  routeBlackList.includes(url))
111
111
  ) {
112
112
  return true;
113
113
  }
114
114
  if (DSMDowngradeList === null) return true;
115
115
  if (
116
116
  !Array.isArray(DSMDowngradeList) ||
117
117
  (DSMDowngradeList.length > 0 &&
118
118
  DSMDowngradeList.some((prefix) => url.startsWith(prefix)) &&
119
119
  url.includes('?')) ||
120
120
  DSMDowngradeList.includes(url)
121
121
  ) {
122
122
  return true;
123
123
  }
124
124
  return false;
125
125
  } catch (error) {
126
126
  console.log('🚀 ~ isDowngradeSDM ~ error:', error)
127
127
  return false;
128
128
  }
129
129
  getSColorPara: (url) => getSColorPara(url),
130
130
  checkIsNeedDeconstruction: (url) => checkIsNeedDeconstruction(url),
131
131
  checkIsDSM: (url) => checkIsDSM(url),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conecli/cone-render",
3
- "version": "0.10.1-shop3.13",
3
+ "version": "0.10.1-shop3.15",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist/"
@@ -62,6 +62,23 @@
62
62
  "ios >= 8"
63
63
  ]
64
64
  },
65
+ "husky": {
66
+ "hooks": {
67
+ "pre-commit": "lint-staged",
68
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
69
+ }
70
+ },
71
+ "lint-staged": {
72
+ "*.{js,ts}": [
73
+ "eslint",
74
+ "eslint --fix",
75
+ "git add"
76
+ ],
77
+ "*.{scss}": [
78
+ "prettier --write",
79
+ "git add"
80
+ ]
81
+ },
65
82
  "keywords": [
66
83
  "conecli",
67
84
  "render"
@@ -108,6 +125,7 @@
108
125
  "sass": "^1.75.0",
109
126
  "babel-preset-taro": "4.0.9",
110
127
  "eslint-config-taro": "4.0.9",
128
+ "eslint-config-prettier": "^8.3.0",
111
129
  "eslint": "^8.57.0",
112
130
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
113
131
  "react-refresh": "^0.14.0",