@zamlia/mini-ui 0.0.1
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.
- package/es/components/common/BottomPopup/index.d.ts +78 -0
- package/es/components/common/BottomPopup/index.d.ts.map +1 -0
- package/es/components/common/Card/index.d.ts +33 -0
- package/es/components/common/Card/index.d.ts.map +1 -0
- package/es/components/common/CardItem/index.d.ts +60 -0
- package/es/components/common/CardItem/index.d.ts.map +1 -0
- package/es/components/common/DataSelect/index.d.ts +15 -0
- package/es/components/common/DataSelect/index.d.ts.map +1 -0
- package/es/components/common/Modal/index.d.ts +31 -0
- package/es/components/common/Modal/index.d.ts.map +1 -0
- package/es/components/common/NavBar/index.d.ts +38 -0
- package/es/components/common/NavBar/index.d.ts.map +1 -0
- package/es/components/common/Page/index.d.ts +16 -0
- package/es/components/common/Page/index.d.ts.map +1 -0
- package/es/components/common/PullToPushRefresh/index.d.ts +94 -0
- package/es/components/common/PullToPushRefresh/index.d.ts.map +1 -0
- package/es/components/common/Radio/index.d.ts +26 -0
- package/es/components/common/Radio/index.d.ts.map +1 -0
- package/es/components/common/TabPane/index.d.ts +9 -0
- package/es/components/common/TabPane/index.d.ts.map +1 -0
- package/es/components/common/Tabs/index.d.ts +27 -0
- package/es/components/common/Tabs/index.d.ts.map +1 -0
- package/es/components/common/UploadFile/index.d.ts +50 -0
- package/es/components/common/UploadFile/index.d.ts.map +1 -0
- package/es/components/common/UploadFile/upload.d.ts +11 -0
- package/es/components/common/UploadFile/upload.d.ts.map +1 -0
- package/es/components/common/UploadFile/utils.d.ts +20 -0
- package/es/components/common/UploadFile/utils.d.ts.map +1 -0
- package/es/components/common/VideoView/index.d.ts +14 -0
- package/es/components/common/VideoView/index.d.ts.map +1 -0
- package/es/components/common/index.d.ts +23 -0
- package/es/components/common/index.d.ts.map +1 -0
- package/es/components/industry/CitySelectButton/index.d.ts +17 -0
- package/es/components/industry/CitySelectButton/index.d.ts.map +1 -0
- package/es/components/industry/CitySelectModal/index.d.ts +13 -0
- package/es/components/industry/CitySelectModal/index.d.ts.map +1 -0
- package/es/components/industry/PaymentMethodSelect/index.d.ts +59 -0
- package/es/components/industry/PaymentMethodSelect/index.d.ts.map +1 -0
- package/es/components/industry/index.d.ts +5 -0
- package/es/components/industry/index.d.ts.map +1 -0
- package/es/config/classPrefix.d.ts +36 -0
- package/es/config/classPrefix.d.ts.map +1 -0
- package/es/index.d.ts +4 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +5334 -0
- package/es/index.js.map +1 -0
- package/es/styles/_base.scss +4 -0
- package/es/styles/index.scss +19 -0
- package/es/styles/mixins.scss +15 -0
- package/es/styles/variables.scss +2 -0
- package/es/utils/city.d.ts +4005 -0
- package/es/utils/city.d.ts.map +1 -0
- package/es/utils/index.d.ts +50 -0
- package/es/utils/index.d.ts.map +1 -0
- package/lib/components/common/BottomPopup/index.d.ts +78 -0
- package/lib/components/common/BottomPopup/index.d.ts.map +1 -0
- package/lib/components/common/Card/index.d.ts +33 -0
- package/lib/components/common/Card/index.d.ts.map +1 -0
- package/lib/components/common/CardItem/index.d.ts +60 -0
- package/lib/components/common/CardItem/index.d.ts.map +1 -0
- package/lib/components/common/DataSelect/index.d.ts +15 -0
- package/lib/components/common/DataSelect/index.d.ts.map +1 -0
- package/lib/components/common/Modal/index.d.ts +31 -0
- package/lib/components/common/Modal/index.d.ts.map +1 -0
- package/lib/components/common/NavBar/index.d.ts +38 -0
- package/lib/components/common/NavBar/index.d.ts.map +1 -0
- package/lib/components/common/Page/index.d.ts +16 -0
- package/lib/components/common/Page/index.d.ts.map +1 -0
- package/lib/components/common/PullToPushRefresh/index.d.ts +94 -0
- package/lib/components/common/PullToPushRefresh/index.d.ts.map +1 -0
- package/lib/components/common/Radio/index.d.ts +26 -0
- package/lib/components/common/Radio/index.d.ts.map +1 -0
- package/lib/components/common/TabPane/index.d.ts +9 -0
- package/lib/components/common/TabPane/index.d.ts.map +1 -0
- package/lib/components/common/Tabs/index.d.ts +27 -0
- package/lib/components/common/Tabs/index.d.ts.map +1 -0
- package/lib/components/common/UploadFile/index.d.ts +50 -0
- package/lib/components/common/UploadFile/index.d.ts.map +1 -0
- package/lib/components/common/UploadFile/upload.d.ts +11 -0
- package/lib/components/common/UploadFile/upload.d.ts.map +1 -0
- package/lib/components/common/UploadFile/utils.d.ts +20 -0
- package/lib/components/common/UploadFile/utils.d.ts.map +1 -0
- package/lib/components/common/VideoView/index.d.ts +14 -0
- package/lib/components/common/VideoView/index.d.ts.map +1 -0
- package/lib/components/common/index.d.ts +23 -0
- package/lib/components/common/index.d.ts.map +1 -0
- package/lib/components/industry/CitySelectButton/index.d.ts +17 -0
- package/lib/components/industry/CitySelectButton/index.d.ts.map +1 -0
- package/lib/components/industry/CitySelectModal/index.d.ts +13 -0
- package/lib/components/industry/CitySelectModal/index.d.ts.map +1 -0
- package/lib/components/industry/PaymentMethodSelect/index.d.ts +59 -0
- package/lib/components/industry/PaymentMethodSelect/index.d.ts.map +1 -0
- package/lib/components/industry/index.d.ts +5 -0
- package/lib/components/industry/index.d.ts.map +1 -0
- package/lib/config/classPrefix.d.ts +36 -0
- package/lib/config/classPrefix.d.ts.map +1 -0
- package/lib/index.d.ts +585 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5349 -0
- package/lib/index.js.map +1 -0
- package/lib/styles/_base.scss +4 -0
- package/lib/styles/index.scss +19 -0
- package/lib/styles/mixins.scss +15 -0
- package/lib/styles/variables.scss +2 -0
- package/lib/utils/city.d.ts +4005 -0
- package/lib/utils/city.d.ts.map +1 -0
- package/lib/utils/index.d.ts +50 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/package.json +81 -0
- package/src/components/common/BottomPopup/index.scss +34 -0
- package/src/components/common/BottomPopup/index.tsx +129 -0
- package/src/components/common/Card/index.scss +160 -0
- package/src/components/common/Card/index.tsx +72 -0
- package/src/components/common/CardItem/index.tsx +153 -0
- package/src/components/common/DataSelect/index.tsx +86 -0
- package/src/components/common/Modal/index.scss +49 -0
- package/src/components/common/Modal/index.tsx +105 -0
- package/src/components/common/NavBar/index.scss +26 -0
- package/src/components/common/NavBar/index.tsx +81 -0
- package/src/components/common/Page/index.scss +19 -0
- package/src/components/common/Page/index.tsx +56 -0
- package/src/components/common/PullToPushRefresh/index.scss +38 -0
- package/src/components/common/PullToPushRefresh/index.tsx +338 -0
- package/src/components/common/Radio/index.scss +15 -0
- package/src/components/common/Radio/index.tsx +56 -0
- package/src/components/common/TabPane/index.tsx +26 -0
- package/src/components/common/Tabs/index.scss +60 -0
- package/src/components/common/Tabs/index.tsx +107 -0
- package/src/components/common/UploadFile/index.scss +59 -0
- package/src/components/common/UploadFile/index.tsx +321 -0
- package/src/components/common/UploadFile/upload.ts +63 -0
- package/src/components/common/UploadFile/utils.ts +81 -0
- package/src/components/common/VideoView/index.tsx +50 -0
- package/src/components/common/index.ts +23 -0
- package/src/components/industry/CitySelectButton/index.tsx +76 -0
- package/src/components/industry/CitySelectModal/index.scss +122 -0
- package/src/components/industry/CitySelectModal/index.tsx +121 -0
- package/src/components/industry/PaymentMethodSelect/index.scss +146 -0
- package/src/components/industry/PaymentMethodSelect/index.tsx +316 -0
- package/src/components/industry/index.ts +5 -0
- package/src/config/classPrefix.ts +44 -0
- package/src/index.ts +9 -0
- package/src/styles/_base.scss +4 -0
- package/src/styles/index.scss +19 -0
- package/src/styles/mixins.scss +15 -0
- package/src/styles/variables.scss +2 -0
- package/src/utils/city.ts +4072 -0
- package/src/utils/index.ts +155 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Picker } from '@tarojs/components';
|
|
3
|
+
import { Utils } from '@utils';
|
|
4
|
+
|
|
5
|
+
export type DataSelectProps = {
|
|
6
|
+
dataSource: any[]
|
|
7
|
+
rangeKey: string
|
|
8
|
+
remoteValue?: any
|
|
9
|
+
onChange: (currentItem: any) => void
|
|
10
|
+
childRender?: (currentItem: any) => React.ReactElement
|
|
11
|
+
defaultSeletItem?: any
|
|
12
|
+
defaultValue?: string
|
|
13
|
+
isSelectFirstItem?: boolean
|
|
14
|
+
classNmaes?: string
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const DataSelect: React.FC<DataSelectProps> = (
|
|
18
|
+
{
|
|
19
|
+
dataSource,
|
|
20
|
+
rangeKey,
|
|
21
|
+
remoteValue,
|
|
22
|
+
onChange,
|
|
23
|
+
childRender,
|
|
24
|
+
defaultSeletItem = {},
|
|
25
|
+
defaultValue,
|
|
26
|
+
isSelectFirstItem = false,
|
|
27
|
+
classNmaes = 'DataSelect'
|
|
28
|
+
},
|
|
29
|
+
) => {
|
|
30
|
+
const [selectItem, setSelectItem] = useState<any>(defaultSeletItem as any)
|
|
31
|
+
const [selectIndex, setSelectIndex] = useState<number>(0)
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!Utils.isEmpty(defaultSeletItem)) {
|
|
35
|
+
setSelectItem(defaultSeletItem)
|
|
36
|
+
}
|
|
37
|
+
}, [defaultSeletItem])
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (isSelectFirstItem && dataSource?.length > 0) setSelectItem(dataSource[0])
|
|
41
|
+
}, [])
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
remoteValue && setSelectItem(remoteValue)
|
|
45
|
+
}, [remoteValue])
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View className={classNmaes}>
|
|
49
|
+
<Picker
|
|
50
|
+
mode='selector'
|
|
51
|
+
disabled={dataSource?.length === 0}
|
|
52
|
+
range={dataSource}
|
|
53
|
+
rangeKey={rangeKey}
|
|
54
|
+
value={selectIndex}
|
|
55
|
+
onChange={(e) => {
|
|
56
|
+
onChange(dataSource[e?.detail.value as any])
|
|
57
|
+
setSelectItem(dataSource[e?.detail.value as any])
|
|
58
|
+
setSelectIndex(e?.detail.value as number)
|
|
59
|
+
}}>
|
|
60
|
+
<View className='select-box'>
|
|
61
|
+
{
|
|
62
|
+
!childRender ? (
|
|
63
|
+
<>
|
|
64
|
+
<View className='text' style={{ fontWeight: "bold" }}>
|
|
65
|
+
{
|
|
66
|
+
!dataSource?.length ? '没有数据' : (
|
|
67
|
+
Utils.substr(selectItem[rangeKey], 20) ||
|
|
68
|
+
defaultValue ||
|
|
69
|
+
'选择内容'
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
</View>
|
|
74
|
+
<View className="icon" />
|
|
75
|
+
</>
|
|
76
|
+
) : (
|
|
77
|
+
childRender(selectItem)
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
</View>
|
|
81
|
+
</Picker>
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default DataSelect;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// 样式基础文件(变量和 mixin)已通过 Taro 配置自动注入,无需手动导入
|
|
2
|
+
.we-modal {
|
|
3
|
+
|
|
4
|
+
.nut-dialog {
|
|
5
|
+
position: relative;
|
|
6
|
+
min-width: 80vw;
|
|
7
|
+
|
|
8
|
+
&__content {
|
|
9
|
+
padding-inline: 24px;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&__footer {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__close {
|
|
17
|
+
position: fixed !important;
|
|
18
|
+
top: 36px;
|
|
19
|
+
right: 50px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__btn {
|
|
23
|
+
width: 48%;
|
|
24
|
+
min-width: 230px;
|
|
25
|
+
height: 78px;
|
|
26
|
+
border-radius: 20px;
|
|
27
|
+
font-size: 24px;
|
|
28
|
+
line-height: 78px;
|
|
29
|
+
text-align: center;
|
|
30
|
+
border: 1px solid $primary-color;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__btn-cancel {
|
|
34
|
+
margin-right: 20px;
|
|
35
|
+
background: #F0F0F0;
|
|
36
|
+
color: #666666;
|
|
37
|
+
border-color: transparent;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__btn-confirm {
|
|
41
|
+
background: $primary-color;
|
|
42
|
+
color: #ffffff;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__btn-confirm-large {
|
|
46
|
+
min-width: 330px;
|
|
47
|
+
border-radius: 40px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { View } from '@tarojs/components';
|
|
3
|
+
import { Dialog, DialogProps } from '@nutui/nutui-react-taro';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import './index.scss';
|
|
6
|
+
import { Close } from '@nutui/icons-react-taro';
|
|
7
|
+
|
|
8
|
+
export type ModalProps = {
|
|
9
|
+
/** 底部 */
|
|
10
|
+
content?: React.ReactElement | string
|
|
11
|
+
/**
|
|
12
|
+
* 是否显示右上角关闭按钮
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
showCloseIcon?: boolean
|
|
16
|
+
/**
|
|
17
|
+
* 是否显示取消按钮
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
showCancel?: boolean
|
|
21
|
+
/**
|
|
22
|
+
* 是否显示确认按钮
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
showConfirm?: boolean
|
|
26
|
+
/**
|
|
27
|
+
*自定义确定按钮文字
|
|
28
|
+
*/
|
|
29
|
+
confirmText?: React.ReactElement | string
|
|
30
|
+
className?: string
|
|
31
|
+
onCancel?: () => void
|
|
32
|
+
onConfirm?: () => void
|
|
33
|
+
} & Omit<DialogProps, 'content' | 'onCancel' | 'onConfirm' | 'confirmText'>;
|
|
34
|
+
|
|
35
|
+
const Modal: React.FC<PropsWithChildren<ModalProps>> = (props) => {
|
|
36
|
+
const {
|
|
37
|
+
className,
|
|
38
|
+
content,
|
|
39
|
+
children,
|
|
40
|
+
showCloseIcon = true,
|
|
41
|
+
showCancel = true,
|
|
42
|
+
showConfirm = true,
|
|
43
|
+
confirmText = "确定",
|
|
44
|
+
onCancel,
|
|
45
|
+
onConfirm,
|
|
46
|
+
...restProps
|
|
47
|
+
} = props
|
|
48
|
+
|
|
49
|
+
const confirmBtnRender = () => {
|
|
50
|
+
if (!showConfirm) {
|
|
51
|
+
return null
|
|
52
|
+
}
|
|
53
|
+
if (typeof confirmText === 'string') {
|
|
54
|
+
return (
|
|
55
|
+
<View className={classNames('we-modal__btn we-modal__btn-confirm', {
|
|
56
|
+
'we-modal__btn-confirm-large': !showCancel
|
|
57
|
+
})} onClick={onConfirm}>
|
|
58
|
+
{confirmText}
|
|
59
|
+
</View>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
return confirmText
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cancelBtnRender = () => {
|
|
66
|
+
if (!showCancel) {
|
|
67
|
+
return null
|
|
68
|
+
}
|
|
69
|
+
return (
|
|
70
|
+
<View className='we-modal__btn we-modal__btn-cancel' onClick={onCancel}>
|
|
71
|
+
取消
|
|
72
|
+
</View>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<View className={!!className ? `${className} we-modal` : 'we-modal'}>
|
|
78
|
+
<Dialog
|
|
79
|
+
{...restProps}
|
|
80
|
+
lockScroll={true}
|
|
81
|
+
onConfirm={onConfirm}
|
|
82
|
+
onCancel={onCancel}
|
|
83
|
+
footer={(
|
|
84
|
+
<>
|
|
85
|
+
{cancelBtnRender()}
|
|
86
|
+
{confirmBtnRender()}
|
|
87
|
+
</>
|
|
88
|
+
)}
|
|
89
|
+
>
|
|
90
|
+
{children || content}
|
|
91
|
+
{
|
|
92
|
+
showCloseIcon && (
|
|
93
|
+
<Close
|
|
94
|
+
size='22'
|
|
95
|
+
className='we-modal__close'
|
|
96
|
+
onClick={onCancel}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
</Dialog>
|
|
101
|
+
</View>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default Modal;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.transparent-nav {
|
|
2
|
+
width: 100vw;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
z-index: 1000;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.transparent-nav--center {
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
font-size: 36px;
|
|
14
|
+
color: #1D1B1B;
|
|
15
|
+
line-height: 50px;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.transparent-nav--fixed {
|
|
22
|
+
position: fixed;
|
|
23
|
+
top: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
z-index: 1000;
|
|
26
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Text, ITouchEvent } from '@tarojs/components';
|
|
2
|
+
import { NavBar as NutNavBar } from '@nutui/nutui-react-taro';
|
|
3
|
+
import { ArrowLeft, Share } from '@nutui/icons-react-taro';
|
|
4
|
+
import Taro from '@tarojs/taro';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import './index.scss';
|
|
7
|
+
|
|
8
|
+
export type NavBarProps = {
|
|
9
|
+
title?: string | React.ReactElement
|
|
10
|
+
/**
|
|
11
|
+
* 标题剧中
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
titleCenter?: boolean
|
|
15
|
+
/**
|
|
16
|
+
* 是否是头像
|
|
17
|
+
* @default false
|
|
18
|
+
* @description 如果该值是true titleCenter则为true
|
|
19
|
+
*/
|
|
20
|
+
isHeader?: boolean
|
|
21
|
+
/**
|
|
22
|
+
* 背景颜色
|
|
23
|
+
* @default transparent
|
|
24
|
+
* @description 只有isHeader才生效
|
|
25
|
+
*/
|
|
26
|
+
backageColor?: string
|
|
27
|
+
/**
|
|
28
|
+
* 是否穿透
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
fixed?: boolean
|
|
32
|
+
/**
|
|
33
|
+
* 返回按钮
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
back?: boolean
|
|
37
|
+
/**
|
|
38
|
+
* 返回事件
|
|
39
|
+
*/
|
|
40
|
+
onBack?: () => void
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const NavBar: React.FC<NavBarProps> = (props) => {
|
|
44
|
+
const {
|
|
45
|
+
title,
|
|
46
|
+
onBack
|
|
47
|
+
} = props;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 返回
|
|
51
|
+
*/
|
|
52
|
+
const handleBack = (e: ITouchEvent) => {
|
|
53
|
+
e?.stopPropagation()
|
|
54
|
+
if (onBack) {
|
|
55
|
+
onBack();
|
|
56
|
+
} else {
|
|
57
|
+
Taro.navigateBack({ delta: 1 })
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<NutNavBar
|
|
63
|
+
back={
|
|
64
|
+
<>
|
|
65
|
+
<ArrowLeft size={14} />
|
|
66
|
+
返回
|
|
67
|
+
</>
|
|
68
|
+
}
|
|
69
|
+
right={
|
|
70
|
+
<span className="flex-center">
|
|
71
|
+
<Share size={14} />
|
|
72
|
+
</span>
|
|
73
|
+
}
|
|
74
|
+
onBackClick={handleBack}
|
|
75
|
+
>
|
|
76
|
+
<Text>{title}</Text>
|
|
77
|
+
</NutNavBar>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default NavBar
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.we-page {
|
|
2
|
+
width: 100%;
|
|
3
|
+
|
|
4
|
+
&__loading {
|
|
5
|
+
padding: 50px 0;
|
|
6
|
+
text-align: center;
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&__empty {
|
|
12
|
+
width: 100%;
|
|
13
|
+
text-align: center;
|
|
14
|
+
height: 100px;
|
|
15
|
+
line-height: 100px;
|
|
16
|
+
font-size: 28px;
|
|
17
|
+
color: #666666;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { View } from '@tarojs/components';
|
|
3
|
+
import { Utils } from '@utils';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
|
|
6
|
+
export type PageProps = {
|
|
7
|
+
error: boolean
|
|
8
|
+
loading: boolean
|
|
9
|
+
loadingColor?: string
|
|
10
|
+
loadingText?: string
|
|
11
|
+
errorText?: string
|
|
12
|
+
emptyDataText?: string
|
|
13
|
+
emptyDataRender?: React.ReactElement
|
|
14
|
+
dataSource: Array<any> | any
|
|
15
|
+
onRequest?: () => void
|
|
16
|
+
renderLoading?: any
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Page: React.FC<PropsWithChildren<PageProps>> = (props) => {
|
|
20
|
+
const {
|
|
21
|
+
error = true,
|
|
22
|
+
loading = false,
|
|
23
|
+
// loadingColor = '#666666',
|
|
24
|
+
// loadingText = '加载中...',
|
|
25
|
+
errorText = '加载失败,请点击重试',
|
|
26
|
+
emptyDataText = '没有数据',
|
|
27
|
+
dataSource = [],
|
|
28
|
+
renderLoading,
|
|
29
|
+
emptyDataRender,
|
|
30
|
+
onRequest = () => { console.error('Page组件props没有传入onRequest') },
|
|
31
|
+
children
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View className='we-page'>
|
|
36
|
+
{
|
|
37
|
+
!loading && !error && !Utils.isEmpty(dataSource) && children
|
|
38
|
+
}
|
|
39
|
+
{loading ?
|
|
40
|
+
(
|
|
41
|
+
renderLoading || (
|
|
42
|
+
<View className='we-page__loading'>
|
|
43
|
+
{/* <Loading color={loadingColor} content={loadingText} /> */}
|
|
44
|
+
</View>
|
|
45
|
+
)
|
|
46
|
+
) : (
|
|
47
|
+
error ?
|
|
48
|
+
<View className='we-page__empty' onClick={onRequest}>{errorText}</View> :
|
|
49
|
+
Utils.isEmpty(dataSource) && <View className='we-page__empty-content'>{emptyDataRender ? emptyDataRender : emptyDataText}</View>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
</View>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default Page
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.we-list {
|
|
2
|
+
.scroll {
|
|
3
|
+
height: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
&__bottom {
|
|
7
|
+
margin: 0 auto;
|
|
8
|
+
text-align: center;
|
|
9
|
+
height: 200px;
|
|
10
|
+
line-height: 200px;
|
|
11
|
+
font-size: 24px;
|
|
12
|
+
color: #999999;
|
|
13
|
+
|
|
14
|
+
&-text {}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&__text {
|
|
18
|
+
font-size: 24px;
|
|
19
|
+
color: #999999;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__ptpr {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
height: 200px;
|
|
27
|
+
|
|
28
|
+
.nut-loading-icon {
|
|
29
|
+
width: 20px !important;
|
|
30
|
+
height: 20px !important;
|
|
31
|
+
font-size: 16px !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.nut-loading-text {
|
|
35
|
+
font-size: 12px !important;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|