@conecli/cone-render 0.8.20 → 0.8.21-shop-beta.3

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/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/index.ts +1 -1
  6. package/dist/common/index.weapp.ts +1 -1
  7. package/dist/common/isvStorage/index.h5.ts +1 -0
  8. package/dist/common/isvStorage/index.ts +1 -0
  9. package/dist/common/token/const.ts +1 -0
  10. package/dist/common/token/index.h5.ts +1 -0
  11. package/dist/common/token/index.ts +1 -0
  12. package/dist/common/token/token.jd.ts +1 -0
  13. package/dist/common/token/token.ts +1 -0
  14. package/dist/common/token/token.wxapp.ts +1 -0
  15. package/dist/components/ErrorBoundary.tsx +1 -1
  16. package/dist/components/base/CommonFloorHead/index.module.scss +1 -1
  17. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  18. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  19. package/dist/components/base/CustomVideo/const.ts +1 -0
  20. package/dist/components/base/CustomVideo/index.module.scss +40 -64
  21. package/dist/components/base/CustomVideo/index.tsx +1 -1
  22. package/dist/components/base/Dialog/index.module.scss +6 -2
  23. package/dist/components/base/Dialog/index.tsx +1 -1
  24. package/dist/components/base/ExposureSmart/const.ts +1 -0
  25. package/dist/components/base/ExposureSmart/index.h5.module.scss +18 -4
  26. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.module.scss +20 -9
  28. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  30. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  31. package/dist/components/base/InViewRender/index.tsx +1 -1
  32. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  33. package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
  34. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
  35. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  36. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  37. package/dist/components/base/NetworkDataError/const.ts +1 -1
  38. package/dist/components/base/NetworkDataError/index.module.scss +7 -1
  39. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  40. package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
  41. package/dist/components/base/Price/Base/index.module.scss +136 -0
  42. package/dist/components/base/Price/Base/index.tsx +1 -0
  43. package/dist/components/base/Price/Double/index.module.scss +158 -0
  44. package/dist/components/base/Price/Double/index.tsx +1 -0
  45. package/dist/components/base/Price/index.tsx +1 -1
  46. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  47. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  48. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  49. package/dist/components/floorItem.jd.tsx +1 -0
  50. package/dist/components/floorItem.tsx +1 -1
  51. package/dist/components/isv/Floor/index.tsx +1 -1
  52. package/dist/components/remoteFloorItem.tsx +1 -0
  53. package/dist/interface/common.ts +1 -1
  54. package/dist/interface/component.ts +1 -1
  55. package/dist/interface/jumpEventReport.ts +1 -1
  56. package/dist/interface/service.ts +1 -1
  57. package/dist/jumpEventReport/base.ts +1 -1
  58. package/dist/jumpEventReport/const.ts +1 -1
  59. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  60. package/dist/jumpEventReport/index.h5.ts +1 -1
  61. package/dist/jumpEventReport/index.ts +1 -1
  62. package/dist/jumpEventReport/index.weapp.ts +1 -1
  63. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  64. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  65. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  66. package/dist/jumpEventReport/web/report.ts +1 -1
  67. package/dist/jumpEventReport/web.base.ts +1 -1
  68. package/dist/jumpEventReport/web.jd.ts +1 -1
  69. package/dist/jumpEventReport/web.jdb.ts +1 -0
  70. package/dist/jumpEventReport/web.jdjch.ts +1 -0
  71. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  72. package/dist/libs/taroAppReport.js +2 -2
  73. package/dist/modules/ContainerFloorList/index.h5.module.scss +10 -1
  74. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  75. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  76. package/dist/open/api/device.ts +1 -1
  77. package/dist/open/api/index.ts +1 -1
  78. package/dist/open/api/jump/business.ts +1 -0
  79. package/dist/open/api/jump/index.ts +1 -0
  80. package/dist/open/api/jump/minPath.ts +1 -0
  81. package/dist/open/api/jump/side.ts +1 -0
  82. package/dist/open/api/jump/webUrl.ts +1 -0
  83. package/dist/open/api/jump copy.ts +1 -0
  84. package/dist/open/api/moduleUtil.ts +1 -1
  85. package/dist/open/api/request.ts +1 -0
  86. package/dist/open/api/shopMember.ts +1 -0
  87. package/dist/open/api/track.ts +1 -1
  88. package/dist/open/api/userToken.ts +1 -0
  89. package/dist/open/api/util.ts +1 -1
  90. package/dist/open/components/index.ts +1 -1
  91. package/dist/service/bMallConst.ts +1 -0
  92. package/dist/service/bMallConst.weapp.ts +1 -0
  93. package/dist/service/fetchGateway.ts +1 -0
  94. package/dist/service/fetchJsonp.ts +1 -0
  95. package/dist/service/http/colorSign.ts +1 -0
  96. package/dist/service/http/colorSign.weapp.ts +1 -0
  97. package/dist/service/http/const.ts +1 -0
  98. package/dist/service/http/http.ts +1 -0
  99. package/dist/service/http/httpInterceptors.jd.ts +1 -0
  100. package/dist/service/http/httpInterceptors.ts +1 -0
  101. package/dist/service/http/index.ts +1 -0
  102. package/dist/service/requestServer.ts +1 -0
  103. package/dist/utils/connectNativeJsBridge.ts +1 -1
  104. package/dist/utils/connectNativeJsBridge.weapp.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/intersectionObserver.ts +1 -1
  110. package/dist/utils/jm-common.js +1 -1
  111. package/dist/utils/memberFormatUtils.js +1 -0
  112. package/dist/utils/priceUtils.js +1 -0
  113. package/dist/utils/ready.ts +1 -0
  114. package/dist/utils/utils.ts +1 -1
  115. package/package.json +9 -5
  116. package/dist/components/base/Price/index.module.scss +0 -136
  117. package/dist/open/api/jump.ts +0 -1
@@ -0,0 +1 @@
1
+ export const HttpStatus = {
2
  SUCCESS: 200,
1
3
  CREATED: 201,
2
4
  ACCEPTED: 202,
3
5
  CLIENT_ERROR: 400,
4
6
  AUTHENTICATE: 401,
5
7
  FORBIDDEN: 403,
6
8
  NOT_FOUND: 404,
7
9
  SERVER_ERROR: 500,
8
10
  BAD_GATEWAY: 502,
9
11
  SERVICE_UNAVAILABLE: 503,
10
12
  GATEWAY_TIMEOUT: 504,
11
13
  [HttpStatus.NOT_FOUND]: '请求资源不存在',
12
14
  [HttpStatus.BAD_GATEWAY]: '服务端异常,请稍后重试',
13
15
  [HttpStatus.FORBIDDEN]: '没有权限访问',
14
16
  [HttpStatus.AUTHENTICATE]: '需要鉴权',
15
17
  [HttpStatus.SUCCESS]: '成功',
16
18
  'whx_getShopHomeFloorInfo',
17
19
  'whx_searchWare',
18
20
  'shopGuessYouLike',
19
21
  'whx_getMShopCategory',
20
22
  'whx_newWareList',
21
23
  'getShopHomePromotionWebPage',
22
24
  'whx_getShopCampaignPage',
23
25
  'whx_getPromotionWares',
24
26
  'whx_buyerShowPage',
25
27
  'whx_getShopGwredPage',
26
28
  'whx_getShopSpeciSecKillPage',
27
29
  'whx_getSignInfo',
28
30
  'whx_getSignPrize',
29
31
  'getShopHomeFloorInfo',
30
32
  'shopGuessYouLike',
31
33
  'getShopHomePromotionWebPage',
32
34
  'getVipDetail',
33
35
  'getShopCategory',
34
36
  'getShopNavigationCategory',
35
37
  'getPagePreview',
36
38
  'bmall_cart',
37
39
  'bmall_getOmittedProduct',
38
40
  'bmall_cartAdd',
39
41
  'bmall_cartChange',
40
42
  'bmall_cartRemove',
41
43
  "whx_getShopHomeFloorInfo",
42
44
  "whx_searchWare",
43
45
  "shopGuessYouLike",
44
46
  "whx_getMShopCategory",
45
47
  "whx_newWareList",
46
48
  "getShopHomePromotionWebPage",
47
49
  "whx_getShopCampaignPage",
48
50
  "whx_getPromotionWares",
49
51
  "whx_buyerShowPage"
50
52
  'getShopHomeFloorInfo',
51
53
  'getShopCategory',
52
54
  'getShopNavigationCategory',
53
55
  'receiveShopCoupon',
54
56
  'getShopHomePromotionWebPage',
55
57
  'shopGuessYouLike',
56
58
  'addRemind',
57
59
  'cancelRemind',
58
60
  'getVipDetail',
59
61
  'shopDetail',
60
62
  'address_queryAddress',
61
63
  'shopMemberSprintJoinActivity',
62
64
  'shopMemberSprintReceivePrize',
63
65
  'customerCenterDispatch'
64
66
  'bmall_cart',
65
67
  'bmall_getOmittedProduct',
66
68
  'bmall_cartAdd',
67
69
  'bmall_cartChange',
68
70
  'bmall_cartRemove',
69
71
  SHOP_COLOR_APPID: 'shop_m_jd_com',
70
72
  JSHOPX_COLOR_APPID: 'jshopx_jd_com',
71
73
  PAGES_COLOR_APPID: 'pages_jd_com',
72
74
  B2B_COLOR_APPID: 'b2b',
73
75
  SHOP_MEMBER_COLOR_APPID: 'shopmember_m_jd_com'
@@ -0,0 +1 @@
1
+ import Taro, { RequestTask } from '@tarojs/taro'
2
  jsonHeader = 'application/json;charset=utf-8',
1
3
  formDataHeader = 'application/x-www-form-urlencoded',
2
4
  public fmInfo: {
3
5
  eid?: string
4
6
  fp?: string
5
7
  jsToken?: string
6
8
  sdkToken?: string
7
9
  }
8
10
  public api: ServiceInterFace.HttpApi
9
11
  constructor() {
10
12
  this._init()
11
13
  this.api = api
12
14
  }
13
15
  _init(): void {
14
16
  httpInterceptors.forEach((item) => {
15
17
  Taro.addInterceptor((chain) => item(chain))
16
18
  })
17
19
  }
18
20
 
19
21
  get(
20
22
  url: string,
21
23
  data: any = null,
22
24
  otherOptions = {},
23
25
  ): Promise<Taro.request.SuccessCallbackResult<any>> {
24
26
  return this.request({ url, data, method: 'GET', ...otherOptions })
25
27
  }
26
28
 
27
29
  post(
28
30
  url: string,
29
31
  data: any = null,
30
32
  otherOptions = {},
31
33
  ): Promise<Taro.request.SuccessCallbackResult<any>> {
32
34
  return this.request({ url, data, method: 'POST', ...otherOptions })
33
35
  }
34
36
 
35
37
  async request({
36
38
  url,
37
39
  method = 'POST',
38
40
  timeout = 7000,
39
41
  isColorVerify = false,
40
42
  ...otherOptions
41
43
  }): Promise<Taro.request.SuccessCallbackResult<any>> {
42
44
  const { header: otherHeader, ...otherOpts } = otherOptions
43
45
  const header = {
44
46
  'content-type':
45
47
  method === 'POST'
46
48
  ? RequestHeaderContentType.formDataHeader
47
49
  : RequestHeaderContentType.jsonHeader,
48
50
  ...otherHeader,
49
51
  }
50
52
  const getReqData = otherOptions.data
51
53
  if (url === this.api.apiFunc && typeof getReqData === 'object') {
52
54
  const { functionId } = getReqData
53
55
  console.log('获取当前是否需要color加固', isColorVerify, functionId)
54
56
  if (isColorVerify) {
55
57
  const { h5st } = await colorSign.paramsSign(getReqData)
56
58
  h5st && (getReqData.h5st = encodeURI(h5st))
57
59
  console.log(`${functionId}的apiReq_h5st===>:${h5st}`)
58
60
  }
59
61
  const { jsToken } = await colorSign.getFmInfo()
60
62
  jsToken && (getReqData['x-api-eid-token'] = jsToken)
61
63
  }
62
64
  const param: any = {
63
65
  url,
64
66
  method,
65
67
  timeout,
66
68
  header,
67
69
  credentials: 'include',
68
70
  ...otherOpts,
69
71
  }
70
72
  const requestTask = Taro.request(param)
71
73
  const requestTimeoutPromise =
72
74
  new Promise<ServiceInterFace.RequestPromiseRes>((resolve) => {
73
75
  setTimeout(() => {
74
76
  resolve({
75
77
  statusCode: 500,
76
78
  resTimeoutState: true,
77
79
  errMsg: 'request timeout',
78
80
  })
79
81
  }, timeout)
80
82
  })
81
83
  return Promise.race([requestTask, requestTimeoutPromise]).then(
82
84
  (res: any) => {
83
85
  if (res && res.statusCode === 500 && res.resTimeoutState) {
84
86
  console.warn('request 请求超时 url:' + url)
85
87
  requestTask.abort && requestTask.abort()
86
88
  }
87
89
  return res
88
90
  },
89
91
  )
90
92
  }
@@ -0,0 +1 @@
1
+ import Taro from '@tarojs/taro'
2
  const requestParams = chain.requestParams
1
3
  const { header } = requestParams
2
4
  const userInfo = global?.info?.userInfo
3
5
  console.log('获取用户信息', userInfo)
4
6
  if (userInfo) {
5
7
  header[
6
8
  'Cookie'
7
9
  ] = `pin=${userInfo.encodePin};ticket=${userInfo.ptkey};pt_pin=${userInfo.encodePin};pt_key=${userInfo.ptkey};${global.info.cookiesStr}`
8
10
  }
9
11
  return chain.proceed(requestParams).then((res) => {
10
12
  if (res.statusCode === HttpStatus.SUCCESS) {
11
13
  return res
12
14
  } else {
13
15
  return {
14
16
  statusCode: res.statusCode,
15
17
  msg: httpStatusMsg[res.statusCode] || defaultHttpStatusMsg,
16
18
  }
17
19
  }
18
20
  })
@@ -0,0 +1 @@
1
+ import Taro from '@tarojs/taro'
2
  const requestParams = chain.requestParams
1
3
  return chain.proceed(requestParams).then((res) => {
2
4
  if (res.statusCode === HttpStatus.SUCCESS) {
3
5
  return res
4
6
  } else {
5
7
  return {
6
8
  statusCode: res.statusCode,
7
9
  msg: httpStatusMsg[res.statusCode] || defaultHttpStatusMsg,
8
10
  }
9
11
  }
10
12
  })
@@ -0,0 +1 @@
1
+ import Http from './http'
@@ -0,0 +1 @@
1
+ import Taro from '@tarojs/taro'
2
  APPID,
1
3
  JshopxColorFunctionIdList,
2
4
  PagesColorFunctionIdList,
3
5
  PAGES_DOMAIN,
4
6
  B2BColorFunctionIdList,
5
7
  MobileVerifyColorList,
6
8
  AppVerifyColorList,
7
9
  JshopxVerifyColorList,
8
10
  BMallVerifyColorList,
9
11
  shopMemberColorFunctionIdList
10
12
  cookiesStr: '',
11
13
  requestHeaderContentType: {
12
14
  jsonHeader: {
13
15
  'content-type': 'application/json;charset=utf-8',
14
16
  },
15
17
  formDataHeader: {
16
18
  'content-type': 'application/x-www-form-urlencoded',
17
19
  },
18
20
  },
19
21
  requestBaseParam: {
20
22
  data: null,
21
23
  header: {
22
24
  'content-type': 'application/json;charset=utf-8',
23
25
  },
24
26
  },
25
27
  timeOut: 7000,
26
28
  apiClientParams: {
27
29
  clientVersion:
28
30
  isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '11.0.0',
29
31
  client: isH5AndJdShopView ? (isIosDevice ? 'apple' : 'android') : 'wh5',
30
32
  area: '1_72_2799_0',
31
33
  uuid: UUID,
32
34
  },
33
35
  public addressFetchInfo: {
34
36
  reqState: boolean
35
37
  promiseInstance: null | Promise<any>
36
38
  }
37
39
  public getPromotionConfig: {
38
40
  projectId: null | string | number
39
41
  pageId: null | string | number
40
42
  }
41
43
  public resInfo: ServiceInterFace.HttpRequestInfo
42
44
  public api: ServiceInterFace.HttpApi
43
45
  public isPageDomain: boolean
44
46
  public verifyColorList: string[]
45
47
  constructor(opt) {
46
48
  this._init()
47
49
  this.addressFetchInfo = {
48
50
  reqState: false,
49
51
  promiseInstance: null,
50
52
  }
51
53
  this.getPromotionConfig = {
52
54
  projectId: null,
53
55
  pageId: null,
54
56
  }
55
57
  this._userAreaUpdateListen()
56
58
  this.resInfo = this._getResConfig(opt)
57
59
  this.api = api
58
60
  this.isPageDomain = isH5 ? window?.location?.hostname === PAGES_DOMAIN : false
59
61
  this.verifyColorList = [
60
62
  ...MobileVerifyColorList,
61
63
  ...AppVerifyColorList,
62
64
  ...JshopxVerifyColorList,
63
65
  ...BMallVerifyColorList,
64
66
  ]
65
67
  }
66
68
  _init(): void {
67
69
  httpInterceptors.forEach((item) => {
68
70
  Taro.addInterceptor((chain) => item(chain))
69
71
  })
70
72
  }
71
73
  _getResConfig(opt = {}): ServiceInterFace.HttpRequestInfo {
72
74
  return Object.assign({}, DefaultConfig, opt)
73
75
  }
74
76
 
75
77
  _userAreaUpdateListen() {
76
78
  Taro.eventCenter.on(TaroEventType.USER_AREA_UPDATE, (area) => {
77
79
  this.updateApiClientParamsResInfo({
78
80
  area,
79
81
  })
80
82
  })
81
83
  }
82
84
  updateApiClientParamsResInfo(opt = {}) {
83
85
  this.resInfo.apiClientParams = {
84
86
  ...this.resInfo.apiClientParams,
85
87
  ...opt,
86
88
  }
87
89
  }
88
90
 
89
91
  checkFunctionIdToReturnAppId(functionId) {
90
92
  if (JshopxColorFunctionIdList.includes(functionId)) {
91
93
  return APPID.JSHOPX_COLOR_APPID
92
94
  } else if (
93
95
  this.isPageDomain &&
94
96
  PagesColorFunctionIdList.includes(functionId)
95
97
  ) {
96
98
  return APPID.PAGES_COLOR_APPID
97
99
  } else if (shopMemberColorFunctionIdList.includes(functionId)) {
98
100
  return APPID.SHOP_MEMBER_COLOR_APPID
99
101
  }else if (B2BColorFunctionIdList.includes(functionId)) {
100
102
  return APPID.B2B_COLOR_APPID
101
103
  } else {
102
104
  return APPID.SHOP_COLOR_APPID
103
105
  }
104
106
  }
105
107
 
106
108
  gatewayReq(
107
109
  functionId: string,
108
110
  bodyParams = {},
109
111
  clientParams = {},
110
112
  ): Promise<any> {
111
113
  if (
112
114
  functionId === 'receiveShopCoupon' &&
113
115
  ((isH5 && window?.isJingGouMiniViewState) || isWxMinAndWxapp)
114
116
  ) {
115
117
  clientParams = Object.assign(
116
118
  {},
117
119
  {
118
120
  loginType: '1',
119
121
  loginWQBiz: WXAPP_BIZ_KEY,
120
122
  },
121
123
  clientParams,
122
124
  )
123
125
  }
124
126
  const apiClientParams = Object.assign(
125
127
  {},
126
128
  this.resInfo.apiClientParams,
127
129
  clientParams,
128
130
  )
129
131
  typeof apiClientParams.appid === 'undefined' && (apiClientParams.appid = this.checkFunctionIdToReturnAppId(functionId))
130
132
  const isColorVerify = this.verifyColorList.includes(functionId)
131
133
  const getReqData = {
132
134
  functionId: functionId,
133
135
  body: JSON.stringify(bodyParams),
134
136
  t: Date.now(),
135
137
  ...apiClientParams,
136
138
  }
137
139
  return http
138
140
  .request({
139
141
  url: this.api.apiFunc,
140
142
  data: getReqData,
141
143
  isColorVerify,
142
144
  })
143
145
  .then((res: ServiceInterFace.RequestPromiseRes) => {
144
146
  const { statusCode, data } = res
145
147
  let changeRes: ServiceInterFace.RequestResponseFormatRes = {
146
148
  ok: true,
147
149
  }
148
150
  if (statusCode === 200 && data) {
149
151
  const resCode = Object.prototype.hasOwnProperty.call(res.data, 'code')
150
152
  ? Number(res.data.code)
151
153
  : -1
152
154
  const subCode = Object.prototype.hasOwnProperty.call(
153
155
  res.data,
154
156
  'subCode',
155
157
  )
156
158
  ? Number(res.data.subCode)
157
159
  : -1
158
160
  if (
159
161
  data.success === true ||
160
162
  data.isSuccess ||
161
163
  resCode === 0 ||
162
164
  resCode === 200 ||
163
165
  subCode === 0
164
166
  ) {
165
167
  changeRes = {
166
168
  result: Object.prototype.hasOwnProperty.call(data, 'result')
167
169
  ? data.result
168
170
  : Object.prototype.hasOwnProperty.call(data, 'data')
169
171
  ? data.data
170
172
  : data,
171
173
  code: data.code || 200,
172
174
  ok: true,
173
175
  source: data,
174
176
  }
175
177
  return changeRes
176
178
  } else {
177
179
  changeRes = {
178
180
  ...data,
179
181
  ok: false,
180
182
  statusCode: res.statusCode,
181
183
  }
182
184
  return changeRes
183
185
  }
184
186
  } else {
185
187
  changeRes = {
186
188
  ...data,
187
189
  ok: false,
188
190
  statusCode: res.statusCode,
189
191
  }
190
192
  return changeRes
191
193
  }
192
194
  })
193
195
  .catch((res) => {
194
196
  return {
195
197
  ...res,
196
198
  ok: false,
197
199
  } as ServiceInterFace.RequestResponseFormatRes
198
200
  })
199
201
  }
200
202
 
201
203
  async receiveCoupon(param = {}, clientParams) {
202
204
  return await this.gatewayReq(
203
205
  'receiveShopCoupon',
204
206
  {
205
207
  operation: '3',
206
208
  ...param,
207
209
  },
208
210
  clientParams,
209
211
  )
210
212
  }
211
213
 
212
214
  getCustomerCenterDispatch(params = {}) {
213
215
  return this.gatewayReq('customerCenterDispatch', params, {
214
216
  clientVersion: '9.2.0',
215
217
  client: 'H5',
216
218
  uuid: 88888,
217
219
  appid: 'shopmember_m_jd_com',
218
220
  })
219
221
  }
220
222
  bMallGetUserInfo = () => {
221
223
  return getBMallUserInfo()
222
224
  }
223
225
  async bMallAddCart(params = {}) {
224
226
  return await this.gatewayReq('bmall_cartAdd', params, {
225
227
  client: 'H5',
226
228
  clientVersion: '5.5.0'
227
229
  })
228
230
  }
229
231
  async bMallChangeCart(params = {}) {
230
232
  return await this.gatewayReq('bmall_cartChange', params, {
231
233
  client: 'H5',
232
234
  clientVersion: '5.5.0'
233
235
  })
234
236
  }
235
237
  async bMallRemoveCart(params = {}) {
236
238
  return await this.gatewayReq(
237
239
  'bmall_cartRemove',
238
240
  params,
239
241
  {
240
242
  client: 'H5',
241
243
  clientVersion: '5.5.0'
242
244
  },
243
245
  )
244
246
  }
245
247
  async bMallGetOmittedProduct(params = {}) {
246
248
  return await this.gatewayReq('bmall_getOmittedProduct', params, {
247
249
  client: 'H5',
248
250
  clientVersion: '5.5.0'
249
251
  })
250
252
  }
251
253
  async bMallAddCartService({ skuId, bMallTag, num, data = {} }) {
252
254
  const params = await getParams({ ...data, skuId, bMallTag, num })
253
255
  return await this.bMallAddCart(params)
254
256
  }
255
257
  async bMallGetSkuNumService(bMallTag = 1) {
256
258
  const params = await getParams({ bMallTag })
257
259
  delete params.operations
258
260
  return await this.bMallGetOmittedProduct(params)
259
261
  }
260
262
  async bMallRemoveCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
261
263
  let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid })
262
264
  return await this.bMallRemoveCart(params)
263
265
  }
264
266
  async bMallChangeCartService({ skuId, bMallTag, num, skuUuid, data = {} }) {
265
267
  let params = await getParams({ ...data, skuId, bMallTag, num, skuUuid })
266
268
  return await this.bMallChangeCart(params)
267
269
  }
268
270
 
269
271
  async bMallGetSkuNumApi(needRequest = false, bMallTag = 1) {
270
272
  if (!needRequest && isH5 && window?.bMallCartData) {
271
273
  return window?.bMallCartData
272
274
  }
273
275
  const cartData = await this.bMallGetSkuNumService(bMallTag)
274
276
  let items
275
277
  if (cartData.ok && cartData.result) {
276
278
  items = cartData?.result?.items || {}
277
279
  }
278
280
  if (isH5) {
279
281
  window.bMallCartData = items
280
282
  }
281
283
  return items
282
284
  }
283
285
 
284
286
  async bMallCartHandle(goodItem, num) {
285
287
  try {
286
288
  const {
287
289
  skuUuid,
288
290
  limitUpper,
289
291
  limitLower,
290
292
  } = goodItem
291
293
  let cartNum = Number(num)
292
294
  if (limitLower && cartNum && cartNum < limitLower) {
293
295
  cartNum = limitLower
294
296
  } else if (limitUpper && cartNum && cartNum > limitUpper) {
295
297
  cartNum = limitUpper
296
298
  }
297
299
  if (skuUuid && cartNum > 0) {
298
300
  return this.bMallChangeCartService({
299
301
  ...goodItem,
300
302
  skuUuid,
301
303
  num: cartNum,
302
304
  })
303
305
  } else if (!skuUuid && cartNum > 0) {
304
306
  return this.bMallAddCartService({ ...goodItem, num: cartNum })
305
307
  } else if (skuUuid && !cartNum) {
306
308
  return this.bMallRemoveCartService({
307
309
  ...goodItem,
308
310
  skuUuid,
309
311
  num: cartNum,
310
312
  })
311
313
  } else {
312
314
  console.error('参数不全')
313
315
  return false
314
316
  }
315
317
  } catch (e) {
316
318
  console.error(e)
317
319
  }
318
320
  }
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
3
2
  displayHeight: 1920,
4
3
  offSetY: 0
5
4
  }
6
5
  console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
7
6
  if(options){
8
7
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
9
8
  }
10
9
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
11
10
  const { displayHeight, offSetY } = res
12
11
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
13
12
 
14
13
  if (isIosDevice) return res
15
14
 
16
15
  if (isAndroidDevice) {
17
16
  const deviceRatio = window.devicePixelRatio
18
17
  const cssDisplayHeight = Math.ceil(displayHeight / deviceRatio)
19
18
  const cssOffsetY = Math.ceil(offSetY / deviceRatio)
20
19
  return {
21
20
  displayHeight: cssDisplayHeight,
22
21
  offSetY: cssOffsetY
23
22
  }
24
23
  }
24
+ import Taro from '@tarojs/taro'
25
25
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
26
26
  displayHeight: 1920,
27
27
  offSetY: 0
28
28
  }
29
29
  console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
30
30
  if(options){
31
31
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
32
32
  }
33
33
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
34
34
  const { shopHomeExtendInfo } = options
35
35
  if(shopHomeExtendInfo) {
36
36
  Taro.eventCenter.trigger(TaroEventType.UPDATE_SHOP_HOME_EXTEND_DATA,shopHomeExtendInfo)
37
37
  }
38
38
  }
39
39
  window && window.scrollTo(0, 0);
40
40
  }
41
41
  PAGE_PV_PARAM: 'pagePvParam',
42
42
  NATIVE_SCORLL_VIEW: 'nativeScrollControl',
43
43
  NATIVE_PUSH_NATIVE_PAGE: 'pushNativePage',
44
44
  UPDATE_NATIVE_DATA: 'updateNativeData',
45
45
  H5_TO_SCROLL_TOP: 'h5ToScrollTop',
46
46
  OPEN: 'open',
47
47
  newHomePage: true,
48
48
  case Message_Type.UPDATE_NATIVE_DATA:
49
49
  console.log('接收到原生通知 UPDATE_NATIVE_DATA',messageData)
50
50
  console.log('接收到原生通知 UPDATE_NATIVE_DATA getSendJsonData',getSendJsonData)
51
51
  taroEventUpdateNativeData(getSendJsonData)
52
52
  break;
53
53
  case Message_Type.H5_TO_SCROLL_TOP:
54
54
  taroEventH5ToScrollTop()
55
55
  nativePageRegisterMessage(Message_Type.NATIVE_PUSH_NATIVE_PAGE, {
56
56
  data: params,
57
57
  })
58
58
  const { displayHeight, offSetY } = res
59
59
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
60
60
  if (isIosDevice) return res
61
61
  if (isAndroidDevice) {
62
62
  const deviceRatio = window.devicePixelRatio
63
63
  const cssDisplayHeight = Math.ceil(displayHeight / deviceRatio)
64
64
  const cssOffsetY = Math.ceil(offSetY / deviceRatio)
65
65
  return {
66
66
  displayHeight: cssDisplayHeight,
67
67
  offSetY: cssOffsetY
68
68
  }
69
69
  }
@@ -1 +1 @@
1
- import Taro from "@tarojs/taro";
1
+ import Taro from "@tarojs/taro";
@@ -1 +1 @@
1
- import {
2
1
  isApp,
3
2
  isIOS,
4
3
  getAppVersion,
5
4
  version,
6
5
  getUUID,
7
6
  getUrlQuery,
8
7
  assign,
9
8
  isString,
10
9
  isObject,
11
10
  serialize,
12
11
  isAndroid,
13
12
  CHANNEL_TYPE,
14
13
  JDShopViewBusinessPathType,
15
14
  JDShopViewBusinessPathList,
16
15
  SECTION_HOME_TAB_NAME_TYPE,
17
16
  parseQueryUrlString(window?.location?.href ?? ''),
18
17
  try {
19
18
  return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
20
19
  } catch (e) {
21
20
  return {}
22
21
  }
23
22
  isWxMiniH5View && urlCookie['wxapp_type'] == '1'
24
23
  if (isJdApp) {
25
24
  isIosDevice
26
25
  ? e && e.stopPropagation()
27
26
  : androidDeviceStopNativeScrollEvent(state)
28
27
  }
29
28
  isJdApp &&
30
29
  isAndroidDevice &&
31
30
  window?.JdAndroid &&
32
31
  window?.JdAndroid.requestEvent(state)
33
32
  if (isH5AndJdShopView) {
34
33
  return (
35
34
  CHANNEL_TYPE[currentChannel] ||
36
35
  CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
37
36
  )
38
37
  }
39
38
  return null
40
39
  isH5 && ['/app/home', '/app/classify'].includes(urlPathname)
40
+ import {
41
41
  isApp,
42
42
  isIOS,
43
43
  getAppVersion,
44
44
  version,
45
45
  getUUID,
46
46
  getUrlQuery,
47
47
  assign,
48
48
  isString,
49
49
  isObject,
50
50
  serialize,
51
51
  isAndroid, versionCompare,
52
52
  CHANNEL_TYPE,
53
53
  JDShopViewBusinessPathType,
54
54
  JDShopViewBusinessPathList,
55
55
  SECTION_HOME_TAB_NAME_TYPE,
56
56
  parseQueryUrlString(window?.location?.href ?? ''),
57
57
  try {
58
58
  return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
59
59
  } catch (e) {
60
60
  return {}
61
61
  }
62
62
  isWxMiniH5View && urlCookie['wxapp_type'] == '1'
63
63
  if (isJdApp) {
64
64
  isIosDevice
65
65
  ? e && e.stopPropagation()
66
66
  : androidDeviceStopNativeScrollEvent(state)
67
67
  }
68
68
  isJdApp &&
69
69
  isAndroidDevice &&
70
70
  window?.JdAndroid &&
71
71
  window?.JdAndroid.requestEvent(state)
72
72
  if (isH5AndJdShopView) {
73
73
  return (
74
74
  CHANNEL_TYPE[currentChannel] ||
75
75
  CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
76
76
  )
77
77
  }
78
78
  return null
79
79
  isH5 && ['/app/home', '/app/classify', '/member/shopcard'].includes(urlPathname)
80
80
  const getCustomObj = {
81
81
  type: 1,
82
82
  code: 'all',
83
83
  cost1: 1,
84
84
  ...customObj
85
85
  }
86
86
  try {
87
87
  window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
88
88
  } catch (e) {}