@conecli/cone-render 0.8.15-beta.0 → 0.8.15-beta.2

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 { isPublishToWxapp } from '../config/env'
1
+ import { isPublishToWxapp } from '../config/env'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -0,0 +1,42 @@
1
+ /*
2
+ * @Author: lichang68
3
+ * @Date: 2022-10-31 20:27:51
4
+ * @LastEditTime: 2022-11-01 10:54:17
5
+ * @LastEditors: lichang68
6
+ * @Description: 错误边界,是一个React组件,只能是class组件,可以捕获发生在子组件树任何位置的js错误,并打印这些错误,同时展示降级UI,并不会渲染发生崩溃的子组件树。
7
+ * 包裹ContainerFloorList,捕获isv h5楼层渲染时的错误异常,并做屏蔽处理
8
+ * @FilePath: /shop-react/Users/cdlichang1/Documents/work/workSpace/cone-render/src/components/ErrorBoundary.jsx
9
+ */
10
+ import React from 'react'
11
+ import { Text } from '@tarojs/components'
12
+ export default class ErrorBoundary extends React.Component {
13
+ constructor(props) {
14
+ super(props);
15
+ this.state = {
16
+ hasError: false,
17
+ }
18
+ }
19
+
20
+ static getDerivedStateFromError(error) {
21
+ // 更新 state 使下一次渲染能够显示出错降级后的 UI
22
+ return {
23
+ hasError: true
24
+ }
25
+ }
26
+
27
+ componentDidCatch(error, errorInfo) {
28
+ // 打印错误信息,error错误信息,errorInfo错误堆栈
29
+ console.log('isv模块渲染异常ErrorBoundary==========error: ', error.toString())
30
+ console.log('isv模块渲染异常ErrorBoundary==========errorInfo: ', errorInfo.componentStack)
31
+ }
32
+
33
+ render() {
34
+ if (this.state.hasError) {
35
+ // 可以在这里自定义出错降级后的 UI 并渲染
36
+ // 对于isv模块,出错后隐藏楼层
37
+ return null
38
+ }
39
+
40
+ return this.props.children
41
+ }
42
+ }
@@ -138,7 +138,7 @@
138
138
  display: block;
139
139
  // height: auto;
140
140
  height: 96px;
141
- background: no-repeat center/cover;
141
+ background: no-repeat top/100% auto;
142
142
  }
143
143
 
144
144
  .d-place-holder {
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import React, {useRef, useEffect} from 'react'
1
+ import React, {useRef, useEffect} from 'react'
@@ -1 +1 @@
1
- export const NetWorkTypeQuality = {
1
+ export const NetWorkTypeQuality = {
@@ -1 +1 @@
1
- import React, {useCallback, useState} from 'react'
2
1
  const {
3
2
  src,
4
3
  lazyLoad,
5
4
  width,
6
5
  height,
7
6
  className,
8
7
  isSkuImage,
9
8
  hideErrorImage,
10
9
  style,
11
10
  backgroundColor,
12
11
  errorSrc,
13
12
  onLoad,
14
13
  onError,
15
14
  ...otherOption
16
15
  } = props
17
16
  getNetWorkType === NetWorkTypeQuality.default &&
18
17
  (getNetWorkType = taroJdBaseInfo.info.sysInfo.netWorkType)
19
18
  const [loadSuccess, setLoadSuccess] = useState(false)
20
19
  const [imageErrState, setImageErrState] = useState(false)
21
20
  const [imgSrc, setImgSrc] = useState(src)
22
21
  const imageError = useCallback(
23
22
  (e) => {
24
23
  console.log('图片加载错误', e)
25
24
  errorSrc && setImgSrc(errorSrc)
26
25
  hideErrorImage && setImageErrState(true)
27
26
  typeof onError === 'function' && onError(e, src, props)
28
27
  },
29
28
  [src],
30
29
  )
31
30
 
32
31
  const imageLoad = useCallback(
32
+ import React, {useCallback, useState} from 'react'
@@ -1 +1 @@
1
- import React, {useCallback, useState} from 'react'
2
1
  const {
3
2
  src,
4
3
  lazyLoad,
5
4
  width,
6
5
  height,
7
6
  className,
8
7
  isSkuImage,
9
8
  hideErrorImage,
10
9
  style,
11
10
  backgroundColor,
12
11
  errorSrc,
13
12
  onLoad,
14
13
  onError,
15
14
  ...otherOption
16
15
  } = props
17
16
  getNetWorkType === NetWorkTypeQuality.default &&
18
17
  (getNetWorkType = taroJdBaseInfo.info.sysInfo.netWorkType)
19
18
  const [loadSuccess, setLoadSuccess] = useState(false)
20
19
  const [imgSrc, setImgSrc] = useState(src)
21
20
  const [imageErrState, setImageErrState] = useState(false)
22
21
  const imageError = useCallback(
23
22
  (e) => {
24
23
  console.log('图片加载错误', e)
25
24
  errorSrc && setImgSrc(errorSrc)
26
25
  hideErrorImage && setImageErrState(true)
27
26
  typeof onError === 'function' && onError(e, src, props)
28
27
  },
29
28
  [src],
30
29
  )
31
30
 
32
31
  const imageLoad = useCallback(
33
32
  (event) => {
34
33
  setLoadSuccess(true)
35
34
  typeof onLoad === 'function' && onLoad(event, src, props)
36
35
  },
37
36
  [src],
38
37
  )
39
38
 
40
39
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
41
40
  const changeStyle = {}
42
41
  width && (changeStyle['width'] = width)
43
42
  height && (changeStyle['height'] = height)
44
43
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
45
44
  return changeStyle
46
45
  }
47
46
  return (
48
47
  <Image
49
48
  style={{
50
49
  ...style,
51
50
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
52
51
  }}
53
52
  className={classNames(
54
53
  imageStyle['d-lazy-image'],
55
54
  {
56
55
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
57
56
  },
58
57
  {
59
58
  [imageStyle['d-hide-image-error']]: imageErrState,
60
59
  },
61
60
  {
62
61
  },
63
62
  'd-imag-rendering-crisp-edges',
64
63
  className,
65
64
  )}
66
65
  src={getQualityImage(imgSrc, NetWorkTypeQuality[getNetWorkType])}
67
66
  lazyLoad={lazyLoad}
68
67
  onError={imageError}
69
68
  onLoad={imageLoad}
70
69
  {...otherOption}
71
70
  />
72
71
  )
73
72
  lazyLoad: true,
74
73
  isSkuImage: false,
75
74
  hideErrorImage: false,
76
75
  src: null,
77
76
  style: null,
78
77
  width: null,
79
78
  height: null,
80
79
  backgroundColor: null,
81
80
  className: null,
82
81
  errorSrc: null,
83
82
  onLoad: null,
84
83
  onError: null,
84
+ import React, {useCallback, useState} from 'react'
@@ -1 +1 @@
1
- import React, { Suspense, lazy } from 'react'
1
+ import React, { Suspense, lazy } from 'react'
@@ -1 +1 @@
1
- import { ComponentInterFace } from '../../../interface/component'
1
+ import { ComponentInterFace } from '../../../interface/component'
@@ -1 +1 @@
1
- import React, { useRef } from 'react'
1
+ import React, { useRef } from 'react'
@@ -1 +1 @@
1
- import React, { useCallback, useEffect, useRef } from 'react'
1
+ import React, { useCallback, useEffect, useRef } from 'react'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import React from 'react'
1
+ import React from 'react'
@@ -1 +1 @@
1
- export declare namespace JumpEventReportInterFace {
1
+ export declare namespace JumpEventReportInterFace {
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- export enum LinkConfigType {
1
+ import { isH5 } from '../utils'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
1
+ import { JdJumpJdApp } from './jdJumpJdApp'
@@ -1 +1 @@
1
- import taroJdBaseInfo from '../common'
1
+ import taroJdBaseInfo from '../common'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  <span class="d-shop-loading-icon"></span>
3
2
  <p class="d-shop-text">${text}</p>
4
3
  </div>`
4
+ import Taro from '@tarojs/taro'
5
5
  <span class="d-shop-loading-icon"></span>
6
6
  <p class="d-shop-text">${text}</p>
7
7
  </div>`
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conecli/cone-render",
3
- "version": "0.8.15-beta.0",
3
+ "version": "0.8.15-beta.2",
4
4
  "private": false,
5
5
  "main": "dist/open/index.ts",
6
6
  "files": [
@@ -75,6 +75,8 @@
75
75
  "@babel/core": "^7.8.0",
76
76
  "@babel/runtime": "^7.17.9",
77
77
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
78
+ "@swc/core": "^1.2.242",
79
+ "@swc/register": "^0.1.10",
78
80
  "@types/react": "^18.0.17",
79
81
  "@types/webpack-env": "^1.13.6",
80
82
  "@typescript-eslint/eslint-plugin": "^5.20.0",
@@ -92,9 +94,12 @@
92
94
  "estraverse": "^5.3.0",
93
95
  "gulp": "^4.0.2",
94
96
  "gulp-util": "^3.0.8",
97
+ "html-webpack-plugin": "^5.5.0",
98
+ "mini-css-extract-plugin": "^2.6.1",
95
99
  "sass": "^1.53.0",
96
100
  "shelljs": "^0.8.5",
97
101
  "stylelint": "^14.4.0",
102
+ "terser-webpack-plugin": "^5.3.6",
98
103
  "typescript": "^4.1.0",
99
104
  "webpack": "5.69.0"
100
105
  }