@zfqh/uniapp 0.1.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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/docs/api/apis/core.md +189 -0
- package/docs/api/apis/index.md +82 -0
- package/docs/api/apis/request.md +369 -0
- package/docs/api/configs/api.md +32 -0
- package/docs/api/configs/app.md +43 -0
- package/docs/api/configs/brand.md +43 -0
- package/docs/api/configs/cdn.md +35 -0
- package/docs/api/configs/color.md +144 -0
- package/docs/api/configs/env.md +120 -0
- package/docs/api/configs/index.md +394 -0
- package/docs/api/configs/link.md +33 -0
- package/docs/api/configs/log.md +27 -0
- package/docs/api/configs/mp.md +34 -0
- package/docs/api/configs/navigate.md +27 -0
- package/docs/api/configs/page.md +32 -0
- package/docs/api/configs/path.md +27 -0
- package/docs/api/configs/storage.md +24 -0
- package/docs/api/configs/tabbar.md +29 -0
- package/docs/api/configs/toast.md +35 -0
- package/docs/api/configs/update.md +25 -0
- package/docs/api/configs/upload.md +45 -0
- package/docs/api/configs/ver.md +32 -0
- package/docs/api/configs/web.md +28 -0
- package/docs/api/hooks/index.md +182 -0
- package/docs/api/hooks/useI18n.md +27 -0
- package/docs/api/hooks/useOverlay.md +37 -0
- package/docs/api/hooks/usePopup.md +35 -0
- package/docs/api/hooks/useVersion.md +23 -0
- package/docs/api/index.md +269 -0
- package/docs/api/mixins/app.md +29 -0
- package/docs/api/mixins/badge.md +23 -0
- package/docs/api/mixins/debounce.md +32 -0
- package/docs/api/mixins/deep.md +29 -0
- package/docs/api/mixins/index.md +23 -0
- package/docs/api/mixins/login.md +22 -0
- package/docs/api/mixins/model.md +26 -0
- package/docs/api/mixins/redirect.md +26 -0
- package/docs/api/mixins/share.md +29 -0
- package/docs/api/mixins/show.md +27 -0
- package/docs/api/mixins/webview.md +27 -0
- package/docs/api/modules/app.md +30 -0
- package/docs/api/modules/dict.md +28 -0
- package/docs/api/modules/im.md +22 -0
- package/docs/api/modules/index.md +44 -0
- package/docs/api/modules/launch.md +26 -0
- package/docs/api/modules/location.md +25 -0
- package/docs/api/modules/login.md +35 -0
- package/docs/api/modules/network.md +26 -0
- package/docs/api/modules/system.md +29 -0
- package/docs/api/utils/audio.md +84 -0
- package/docs/api/utils/consts.md +201 -0
- package/docs/api/utils/cos.md +269 -0
- package/docs/api/utils/debounce.md +89 -0
- package/docs/api/utils/file.md +78 -0
- package/docs/api/utils/index.md +547 -0
- package/docs/api/utils/locale.md +32 -0
- package/docs/api/utils/message.md +81 -0
- package/docs/api/utils/navigate.md +267 -0
- package/docs/api/utils/pages.md +205 -0
- package/docs/api/utils/permission.md +28 -0
- package/docs/api/utils/permit.md +62 -0
- package/docs/api/utils/query.md +89 -0
- package/docs/api/utils/request.md +34 -0
- package/docs/api/utils/storage.md +145 -0
- package/docs/api/utils/subscribe.md +77 -0
- package/docs/api/utils/throttle.md +101 -0
- package/docs/api/utils/toast.md +164 -0
- package/docs/api/utils/uni.md +28 -0
- package/docs/api/utils/update.md +165 -0
- package/docs/components/g-back-button.md +76 -0
- package/docs/components/g-checkbox-list.md +101 -0
- package/docs/components/g-container.md +93 -0
- package/docs/components/g-data-list.md +106 -0
- package/docs/components/g-dot-text.md +79 -0
- package/docs/components/g-env.md +75 -0
- package/docs/components/g-float.md +83 -0
- package/docs/components/g-grid-image.md +91 -0
- package/docs/components/g-grid-swiper.md +99 -0
- package/docs/components/g-icon.md +106 -0
- package/docs/components/g-mask.md +82 -0
- package/docs/components/g-money.md +90 -0
- package/docs/components/g-more.md +78 -0
- package/docs/components/g-page-container.md +170 -0
- package/docs/components/g-permission-popup.md +117 -0
- package/docs/components/g-polyline-chat.md +102 -0
- package/docs/components/g-polyline-view.md +67 -0
- package/docs/components/g-popup.md +144 -0
- package/docs/components/g-refresh-view.md +118 -0
- package/docs/components/g-render-image.md +83 -0
- package/docs/components/g-search.md +120 -0
- package/docs/components/g-share-photo.md +77 -0
- package/docs/components/g-share-view.md +83 -0
- package/docs/components/g-share-weixin.md +81 -0
- package/docs/components/g-skeleton-view.md +71 -0
- package/docs/components/g-skeleton.md +64 -0
- package/docs/components/g-tag-editor.md +134 -0
- package/docs/components/g-timer.md +72 -0
- package/docs/components/g-trtc-room.md +116 -0
- package/docs/components/g-trtc-tui.md +84 -0
- package/docs/components/g-trtc.md +124 -0
- package/docs/components/g-upload.md +117 -0
- package/docs/components/g-waterfall.md +84 -0
- package/docs/components/index.md +109 -0
- package/docs/components/styles/base-styles.md +367 -0
- package/docs/components/styles/global-vars.md +150 -0
- package/docs/components/usage.md +112 -0
- package/docs/faq/index.md +78 -0
- package/docs/guide/getting-started.md +195 -0
- package/docs/guide/project-frame.md +297 -0
- package/docs/index.md +80 -0
- package/lib/apis/core.d.ts +12 -0
- package/lib/apis/core.js +13 -0
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.js +2 -0
- package/lib/apis/request.d.ts +4 -0
- package/lib/apis/request.js +27 -0
- package/lib/components/g-back-button/g-back-button.vue +141 -0
- package/lib/components/g-checkbox-list/g-checkbox-list.vue +156 -0
- package/lib/components/g-container/g-container.vue +159 -0
- package/lib/components/g-data-list/g-data-list.vue +192 -0
- package/lib/components/g-dot-text/g-dot-text.vue +114 -0
- package/lib/components/g-env/g-env.vue +123 -0
- package/lib/components/g-float/g-float.vue +131 -0
- package/lib/components/g-grid-image/g-grid-image.vue +84 -0
- package/lib/components/g-grid-swiper/g-grid-swiper.vue +224 -0
- package/lib/components/g-icon/g-icon.vue +72 -0
- package/lib/components/g-mask/g-mask.vue +126 -0
- package/lib/components/g-money/g-money.vue +174 -0
- package/lib/components/g-more/g-more.vue +68 -0
- package/lib/components/g-page-container/g-page-container.vue +470 -0
- package/lib/components/g-permission-popup/g-permission-popup.vue +80 -0
- package/lib/components/g-polyline-chat/g-polyline-chat.vue +255 -0
- package/lib/components/g-polyline-view/g-polyline-view.vue +104 -0
- package/lib/components/g-popup/g-popup.vue +449 -0
- package/lib/components/g-refresh-view/g-refresh-view.vue +213 -0
- package/lib/components/g-render-image/g-render-image.vue +222 -0
- package/lib/components/g-search/g-search.vue +274 -0
- package/lib/components/g-share-photo/g-share-photo.vue +75 -0
- package/lib/components/g-share-view/g-share-view.vue +157 -0
- package/lib/components/g-share-weixin/g-share-weixin.vue +106 -0
- package/lib/components/g-skeleton/g-skeleton.vue +55 -0
- package/lib/components/g-skeleton-view/g-skeleton-view.vue +78 -0
- package/lib/components/g-tag-editor/g-tag-editor.vue +482 -0
- package/lib/components/g-timer/g-timer.vue +61 -0
- package/lib/components/g-trtc/g-trtc.vue +347 -0
- package/lib/components/g-trtc-room/g-trtc-room.vue +524 -0
- package/lib/components/g-trtc-room/iconfont.scss +59 -0
- package/lib/components/g-trtc-tui/g-trtc-tui.vue +245 -0
- package/lib/components/g-upload/g-upload.vue +294 -0
- package/lib/components/g-waterfall/g-waterfall.vue +101 -0
- package/lib/configs/api.d.ts +7 -0
- package/lib/configs/api.js +6 -0
- package/lib/configs/app.d.ts +26 -0
- package/lib/configs/app.js +50 -0
- package/lib/configs/brand.d.ts +22 -0
- package/lib/configs/brand.js +26 -0
- package/lib/configs/cdn.d.ts +13 -0
- package/lib/configs/cdn.js +12 -0
- package/lib/configs/color.d.ts +62 -0
- package/lib/configs/color.js +66 -0
- package/lib/configs/env.d.ts +37 -0
- package/lib/configs/env.js +71 -0
- package/lib/configs/index.d.ts +170 -0
- package/lib/configs/index.js +82 -0
- package/lib/configs/link.d.ts +11 -0
- package/lib/configs/link.js +3 -0
- package/lib/configs/log.d.ts +9 -0
- package/lib/configs/log.js +8 -0
- package/lib/configs/mp.d.ts +15 -0
- package/lib/configs/mp.js +9 -0
- package/lib/configs/navigate.d.ts +17 -0
- package/lib/configs/navigate.js +5 -0
- package/lib/configs/page.d.ts +18 -0
- package/lib/configs/page.js +14 -0
- package/lib/configs/path.d.ts +11 -0
- package/lib/configs/path.js +10 -0
- package/lib/configs/storage.d.ts +7 -0
- package/lib/configs/storage.js +6 -0
- package/lib/configs/tabbar.d.ts +7 -0
- package/lib/configs/tabbar.js +6 -0
- package/lib/configs/toast.d.ts +18 -0
- package/lib/configs/toast.js +29 -0
- package/lib/configs/update.d.ts +45 -0
- package/lib/configs/update.js +6 -0
- package/lib/configs/upload.d.ts +30 -0
- package/lib/configs/upload.js +7 -0
- package/lib/configs/ver.d.ts +8 -0
- package/lib/configs/ver.js +28 -0
- package/lib/configs/web.d.ts +5 -0
- package/lib/configs/web.js +2 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.js +4 -0
- package/lib/hooks/useI18n.d.ts +2 -0
- package/lib/hooks/useI18n.js +19 -0
- package/lib/hooks/useOverlay.d.ts +1 -0
- package/lib/hooks/useOverlay.js +17 -0
- package/lib/hooks/usePopup.d.ts +1 -0
- package/lib/hooks/usePopup.js +14 -0
- package/lib/hooks/useVersion.d.ts +6 -0
- package/lib/hooks/useVersion.js +21 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +33 -0
- package/lib/mixins/app.d.ts +14 -0
- package/lib/mixins/app.js +105 -0
- package/lib/mixins/badge.d.ts +24 -0
- package/lib/mixins/badge.js +44 -0
- package/lib/mixins/debounce.d.ts +6 -0
- package/lib/mixins/debounce.js +11 -0
- package/lib/mixins/deep.d.ts +6 -0
- package/lib/mixins/deep.js +8 -0
- package/lib/mixins/index.d.ts +8 -0
- package/lib/mixins/index.js +8 -0
- package/lib/mixins/login.d.ts +4 -0
- package/lib/mixins/login.js +25 -0
- package/lib/mixins/model.d.ts +22 -0
- package/lib/mixins/model.js +29 -0
- package/lib/mixins/redirect.d.ts +8 -0
- package/lib/mixins/redirect.js +94 -0
- package/lib/mixins/share.d.ts +15 -0
- package/lib/mixins/share.js +55 -0
- package/lib/mixins/show.d.ts +9 -0
- package/lib/mixins/show.js +16 -0
- package/lib/mixins/webview.d.ts +26 -0
- package/lib/mixins/webview.js +225 -0
- package/lib/modules/app.d.ts +5 -0
- package/lib/modules/app.js +19 -0
- package/lib/modules/dict.d.ts +8 -0
- package/lib/modules/dict.js +43 -0
- package/lib/modules/im.d.ts +6 -0
- package/lib/modules/im.js +105 -0
- package/lib/modules/index.d.ts +8 -0
- package/lib/modules/index.js +8 -0
- package/lib/modules/launch.d.ts +5 -0
- package/lib/modules/launch.js +32 -0
- package/lib/modules/location.d.ts +5 -0
- package/lib/modules/location.js +57 -0
- package/lib/modules/login.d.ts +5 -0
- package/lib/modules/login.js +72 -0
- package/lib/modules/network.d.ts +5 -0
- package/lib/modules/network.js +39 -0
- package/lib/modules/system.d.ts +5 -0
- package/lib/modules/system.js +65 -0
- package/lib/styles/animate-vue.scss +3 -0
- package/lib/styles/animate.scss +27 -0
- package/lib/styles/bg-vue.scss +21 -0
- package/lib/styles/bg.scss +93 -0
- package/lib/styles/border.scss +218 -0
- package/lib/styles/flex-nvue.scss +64 -0
- package/lib/styles/flex-vue.scss +75 -0
- package/lib/styles/font.scss +59 -0
- package/lib/styles/index.scss +25 -0
- package/lib/styles/layout-nvue.scss +24 -0
- package/lib/styles/layout-vue.scss +30 -0
- package/lib/styles/layout.scss +76 -0
- package/lib/styles/opacity.scss +10 -0
- package/lib/styles/reset-vue.scss +46 -0
- package/lib/styles/shadow.scss +12 -0
- package/lib/styles/sizing-vue.scss +21 -0
- package/lib/styles/sizing.scss +21 -0
- package/lib/styles/spacing.scss +234 -0
- package/lib/styles/text-nvue.scss +21 -0
- package/lib/styles/text-vue.scss +70 -0
- package/lib/styles/text.scss +122 -0
- package/lib/styles/var.module.scss +29 -0
- package/lib/utils/audio.d.ts +14 -0
- package/lib/utils/audio.js +43 -0
- package/lib/utils/consts.d.ts +30 -0
- package/lib/utils/consts.js +52 -0
- package/lib/utils/cos.d.ts +15 -0
- package/lib/utils/cos.js +140 -0
- package/lib/utils/debounce.d.ts +2 -0
- package/lib/utils/debounce.js +30 -0
- package/lib/utils/file.d.ts +28 -0
- package/lib/utils/file.js +292 -0
- package/lib/utils/index.d.ts +166 -0
- package/lib/utils/index.js +485 -0
- package/lib/utils/locale.d.ts +6 -0
- package/lib/utils/locale.js +19 -0
- package/lib/utils/message.d.ts +9 -0
- package/lib/utils/message.js +63 -0
- package/lib/utils/navigate.d.ts +27 -0
- package/lib/utils/navigate.js +183 -0
- package/lib/utils/pages.d.ts +21 -0
- package/lib/utils/pages.js +79 -0
- package/lib/utils/permission.d.ts +16 -0
- package/lib/utils/permission.js +291 -0
- package/lib/utils/permit.d.ts +30 -0
- package/lib/utils/permit.js +181 -0
- package/lib/utils/query.d.ts +13 -0
- package/lib/utils/query.js +14 -0
- package/lib/utils/request.d.ts +8 -0
- package/lib/utils/request.js +126 -0
- package/lib/utils/storage.d.ts +53 -0
- package/lib/utils/storage.js +145 -0
- package/lib/utils/subscribe.d.ts +7 -0
- package/lib/utils/subscribe.js +94 -0
- package/lib/utils/throttle.d.ts +2 -0
- package/lib/utils/throttle.js +32 -0
- package/lib/utils/toast.d.ts +17 -0
- package/lib/utils/toast.js +66 -0
- package/lib/utils/uni.d.ts +1 -0
- package/lib/utils/uni.js +147 -0
- package/lib/utils/update.d.ts +9 -0
- package/lib/utils/update.js +376 -0
- package/package.json +49 -0
- package/types/index.d.ts +25 -0
- package/types/virtual.d.ts +1 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :style="[customStyle]">
|
|
3
|
+
<slot name="default" :data="dataList" :select="select" :checked="checked">
|
|
4
|
+
<view
|
|
5
|
+
v-for="(item, index) in dataList"
|
|
6
|
+
:key="item.key"
|
|
7
|
+
class="flex justify-between pr-20rpx"
|
|
8
|
+
:class="{ 'uv-border-top': border && index > 0 }"
|
|
9
|
+
:style="[style]"
|
|
10
|
+
@tap="select(item)"
|
|
11
|
+
>
|
|
12
|
+
<text class="flex-1 w-0 truncate text-main text-30rpx">{{ item[labelField] }}</text>
|
|
13
|
+
<uv-icon v-if="checked.includes(item[valueField])" :name="iconName" :size="icon.size" :color="iconColor" />
|
|
14
|
+
</view>
|
|
15
|
+
</slot>
|
|
16
|
+
</view>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import model from '../../mixins/model';
|
|
21
|
+
import color from '../../configs/color';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
mixins: [
|
|
25
|
+
model({
|
|
26
|
+
type: Array,
|
|
27
|
+
default: () => [],
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
props: {
|
|
31
|
+
list: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => [],
|
|
34
|
+
},
|
|
35
|
+
customStyle: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: () => ({}),
|
|
38
|
+
},
|
|
39
|
+
itemStyle: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: () => ({}),
|
|
42
|
+
},
|
|
43
|
+
itemHeight: {
|
|
44
|
+
type: [String, Number],
|
|
45
|
+
default: 32,
|
|
46
|
+
},
|
|
47
|
+
iconName: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'checkmark',
|
|
50
|
+
},
|
|
51
|
+
fontSize: {
|
|
52
|
+
type: [String, Number],
|
|
53
|
+
default: 14,
|
|
54
|
+
},
|
|
55
|
+
iconSize: {
|
|
56
|
+
type: [String, Number],
|
|
57
|
+
default: 14,
|
|
58
|
+
},
|
|
59
|
+
iconColor: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: () => color.primary,
|
|
62
|
+
},
|
|
63
|
+
border: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true,
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false,
|
|
70
|
+
},
|
|
71
|
+
multiple: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false,
|
|
74
|
+
},
|
|
75
|
+
toggle: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true,
|
|
78
|
+
},
|
|
79
|
+
labelField: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: 'label',
|
|
82
|
+
},
|
|
83
|
+
valueField: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: 'value',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
data() {
|
|
89
|
+
return {
|
|
90
|
+
checked: [],
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
watch: {
|
|
94
|
+
value: {
|
|
95
|
+
immediate: true,
|
|
96
|
+
handler(e) {
|
|
97
|
+
this.checked = e;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
checked(checked) {
|
|
101
|
+
this.updateModel(checked);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
computed: {
|
|
105
|
+
dataList({ list, labelField, valueField }) {
|
|
106
|
+
return list.map((e) => {
|
|
107
|
+
if (typeof e !== 'object') {
|
|
108
|
+
return {
|
|
109
|
+
[labelField]: e,
|
|
110
|
+
[valueField]: e,
|
|
111
|
+
key: e,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return { key: e[valueField], ...e };
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
icon({ iconSize }) {
|
|
118
|
+
return {
|
|
119
|
+
size: uni.$uv.addUnit(iconSize),
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
style({ itemStyle, fontSize, itemHeight }) {
|
|
123
|
+
return Object.assign({ fontSize: uni.$uv.addUnit(fontSize), height: uni.$uv.addUnit(itemHeight) }, itemStyle);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
methods: {
|
|
127
|
+
select(item) {
|
|
128
|
+
if (this.disabled) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const value = item[this.valueField];
|
|
132
|
+
if (this.multiple) {
|
|
133
|
+
if (this.checked.includes(value)) {
|
|
134
|
+
this.checked = this.checked.filter((val) => val !== value);
|
|
135
|
+
} else {
|
|
136
|
+
const checked = this.checked.concat(value);
|
|
137
|
+
this.checked = this.dataList
|
|
138
|
+
.filter((ele) => checked.includes(ele[this.valueField]))
|
|
139
|
+
.map((ele) => ele[this.valueField]);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
if (this.checked.includes(value)) {
|
|
143
|
+
if (this.toggle) {
|
|
144
|
+
this.checked = [];
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
this.checked = [value];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
this.$emit('change', value, this.checked);
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<style></style>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="container" :class="[customClass]" :style="[style]">
|
|
3
|
+
<view :style="[contentStyle]" :class="[contentClass]">
|
|
4
|
+
<slot name="default" />
|
|
5
|
+
</view>
|
|
6
|
+
<view v-if="showFooter" :style="[_footerStyle]" :class="[{ 'uv-border-top': footerBorder }, footerClass]">
|
|
7
|
+
<slot name="footer"></slot>
|
|
8
|
+
</view>
|
|
9
|
+
</view>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import color from '../../configs/color';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
props: {
|
|
17
|
+
loading: {
|
|
18
|
+
type: [String, Boolean],
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
// 背景色
|
|
22
|
+
bgColor: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: () => color.bgColor,
|
|
25
|
+
},
|
|
26
|
+
// 是否开启安全区域
|
|
27
|
+
footerSafeArea: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true,
|
|
30
|
+
},
|
|
31
|
+
// 是否显式footer
|
|
32
|
+
showFooter: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
// 是否有原生Tabbar
|
|
37
|
+
hasTabbar: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
// 是否显式footer边框
|
|
42
|
+
footerBorder: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true,
|
|
45
|
+
},
|
|
46
|
+
// 是否显示footer阴影
|
|
47
|
+
footerShadow: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
// 自定义class
|
|
52
|
+
customClass: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '',
|
|
55
|
+
},
|
|
56
|
+
// 自定义class
|
|
57
|
+
contentClass: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '',
|
|
60
|
+
},
|
|
61
|
+
// 自定义class
|
|
62
|
+
footerClass: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
// 自定义样式
|
|
67
|
+
customStyle: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default: () => ({}),
|
|
70
|
+
},
|
|
71
|
+
// 自定义样式
|
|
72
|
+
contentStyle: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => ({}),
|
|
75
|
+
},
|
|
76
|
+
// 自定义footer样式
|
|
77
|
+
footerStyle: {
|
|
78
|
+
type: Object,
|
|
79
|
+
default: () => ({}),
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
computed: {
|
|
83
|
+
systemInfo() {
|
|
84
|
+
return this.$store.state.system.info;
|
|
85
|
+
},
|
|
86
|
+
style() {
|
|
87
|
+
const style = Object.assign(
|
|
88
|
+
{
|
|
89
|
+
backgroundColor: this.bgColor,
|
|
90
|
+
},
|
|
91
|
+
this.customStyle,
|
|
92
|
+
);
|
|
93
|
+
if (this.hasTabbar) {
|
|
94
|
+
style.paddingBottom = 'var(--window-bottom) !important';
|
|
95
|
+
}
|
|
96
|
+
return style;
|
|
97
|
+
},
|
|
98
|
+
_footerStyle() {
|
|
99
|
+
const footerStyle = Object.assign(
|
|
100
|
+
{
|
|
101
|
+
padding: '16rpx 32rpx',
|
|
102
|
+
backgroundColor: '#fff',
|
|
103
|
+
position: 'sticky',
|
|
104
|
+
zIndex: 9,
|
|
105
|
+
bottom: 0,
|
|
106
|
+
},
|
|
107
|
+
this.footerStyle,
|
|
108
|
+
);
|
|
109
|
+
if (this.hasTabbar) {
|
|
110
|
+
footerStyle.bottom = 'var(--window-bottom)';
|
|
111
|
+
}
|
|
112
|
+
if (this.footerShadow) {
|
|
113
|
+
footerStyle.boxShadow = '0rpx -4rpx 10rpx 0rpx rgba(0,0,0,0.05)';
|
|
114
|
+
}
|
|
115
|
+
if (this.footerSafeArea && !this.hasTabbar && this.systemInfo.safeAreaInsets.bottom > 0) {
|
|
116
|
+
footerStyle.paddingBottom = `${this.systemInfo.safeAreaInsets.bottom}px !important`;
|
|
117
|
+
}
|
|
118
|
+
return footerStyle;
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
watch: {
|
|
122
|
+
loading(value) {
|
|
123
|
+
this.setLoading(value);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
methods: {
|
|
127
|
+
setLoading(loading) {
|
|
128
|
+
if (loading) {
|
|
129
|
+
uni.showLoading({
|
|
130
|
+
title: typeof loading === 'string' ? loading : '',
|
|
131
|
+
mask: true,
|
|
132
|
+
});
|
|
133
|
+
} else if (!loading) {
|
|
134
|
+
uni.hideLoading();
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
beforeMount() {
|
|
139
|
+
if (this.loading) {
|
|
140
|
+
this.setLoading(this.loading);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style lang="scss" scoped>
|
|
147
|
+
.container {
|
|
148
|
+
min-height: calc(100vh - var(--window-top) - var(--window-bottom));
|
|
149
|
+
box-sizing: border-box;
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
& > view {
|
|
153
|
+
box-sizing: border-box;
|
|
154
|
+
&:first-child {
|
|
155
|
+
flex: 1;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :style="[customStyle]">
|
|
3
|
+
<slot v-if="value != null" name="default"></slot>
|
|
4
|
+
<slot v-else-if="data != null" name="default" :data="data"></slot>
|
|
5
|
+
<slot v-if="data && !data.length" name="empty">
|
|
6
|
+
<uv-empty text="暂无数据" marginTop="24vh" textSize="28rpx" iconSize="160rpx" />
|
|
7
|
+
</slot>
|
|
8
|
+
<slot name="loadmore" :status="stat">
|
|
9
|
+
<uv-load-more
|
|
10
|
+
v-if="stat !== 'nomore' && data?.length"
|
|
11
|
+
:customStyle="loadingStyle"
|
|
12
|
+
:status="showLoading ? 'loading' : stat"
|
|
13
|
+
:marginTop="loadingTop"
|
|
14
|
+
:marginBottom="loadingBottom"
|
|
15
|
+
@loadmore="loadMore"
|
|
16
|
+
:line="loadingLine"
|
|
17
|
+
/>
|
|
18
|
+
</slot>
|
|
19
|
+
</view>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import model from '../../mixins/model';
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
mixins: [
|
|
27
|
+
model({
|
|
28
|
+
type: Array,
|
|
29
|
+
default: null,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
props: {
|
|
33
|
+
request: {
|
|
34
|
+
type: Function,
|
|
35
|
+
default: () => {},
|
|
36
|
+
},
|
|
37
|
+
initLoad: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
loading: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
loadingLine: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
},
|
|
49
|
+
loadingTop: {
|
|
50
|
+
type: [String, Number],
|
|
51
|
+
default: 10,
|
|
52
|
+
},
|
|
53
|
+
loadingBottom: {
|
|
54
|
+
type: [String, Number],
|
|
55
|
+
default: 0,
|
|
56
|
+
},
|
|
57
|
+
customStyle: {
|
|
58
|
+
type: Object,
|
|
59
|
+
default: () => ({}),
|
|
60
|
+
},
|
|
61
|
+
pageSize: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default: 12,
|
|
64
|
+
},
|
|
65
|
+
status: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'nomore',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
stat: this.status,
|
|
73
|
+
page: 1,
|
|
74
|
+
total: 0,
|
|
75
|
+
data: null,
|
|
76
|
+
rawData: null,
|
|
77
|
+
showLoading: true,
|
|
78
|
+
timer: null,
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
watch: {
|
|
82
|
+
data(data) {
|
|
83
|
+
this.updateModel(data);
|
|
84
|
+
},
|
|
85
|
+
value(e) {
|
|
86
|
+
this.data = e;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
computed: {
|
|
90
|
+
loadingStyle({ page }) {
|
|
91
|
+
return {
|
|
92
|
+
opacity: page > 1 ? 1 : 0,
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
getParent() {
|
|
98
|
+
let parent = this;
|
|
99
|
+
// #ifdef VUE2
|
|
100
|
+
let i = 0;
|
|
101
|
+
while (i < 3) {
|
|
102
|
+
parent = parent.$parent;
|
|
103
|
+
if (parent && typeof parent.request === 'function') {
|
|
104
|
+
break;
|
|
105
|
+
} else {
|
|
106
|
+
i++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// #endif
|
|
110
|
+
return parent;
|
|
111
|
+
},
|
|
112
|
+
async loadData(page = 0, pageSize = 0) {
|
|
113
|
+
try {
|
|
114
|
+
this.showLoading = true;
|
|
115
|
+
if (page > 1) {
|
|
116
|
+
this.stat = 'loading';
|
|
117
|
+
}
|
|
118
|
+
const params = {
|
|
119
|
+
pageSize: Math.max(pageSize, this.pageSize),
|
|
120
|
+
page: Math.max(page, 1),
|
|
121
|
+
};
|
|
122
|
+
this.page = params.page;
|
|
123
|
+
|
|
124
|
+
let { data, total, rawData } = await this.getParent().request(params);
|
|
125
|
+
|
|
126
|
+
if (!Array.isArray(data)) {
|
|
127
|
+
data = [];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (!Array.isArray(rawData)) {
|
|
131
|
+
rawData = data;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
this.total = total || 0;
|
|
135
|
+
if (params.page === 1) {
|
|
136
|
+
this.data = [].concat(data);
|
|
137
|
+
this.rawData = [].concat(rawData);
|
|
138
|
+
} else {
|
|
139
|
+
this.data = [].concat(this.data || [], data);
|
|
140
|
+
this.rawData = [].concat(this.rawData || [], rawData);
|
|
141
|
+
}
|
|
142
|
+
this.page = Math.ceil(this.rawData.length / this.pageSize);
|
|
143
|
+
} catch (e) {
|
|
144
|
+
if (!this.data) {
|
|
145
|
+
this.data = [];
|
|
146
|
+
}
|
|
147
|
+
} finally {
|
|
148
|
+
if (this.data.length < this.total) {
|
|
149
|
+
this.stat = 'loadmore';
|
|
150
|
+
} else {
|
|
151
|
+
this.stat = 'nomore';
|
|
152
|
+
}
|
|
153
|
+
// 解决文字闪烁问题
|
|
154
|
+
clearTimeout(this.timer);
|
|
155
|
+
this.timer = setTimeout(() => {
|
|
156
|
+
this.showLoading = false;
|
|
157
|
+
}, 1000);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
async loadMore() {
|
|
161
|
+
if (this.stat === 'loadmore') {
|
|
162
|
+
await this.loadData(this.page + 1);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
updateData() {
|
|
166
|
+
if (this.data && this.stat !== 'loading') {
|
|
167
|
+
this.loadData(0, this.data.length);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
async initData() {
|
|
171
|
+
try {
|
|
172
|
+
if (this.loading) {
|
|
173
|
+
uni.showLoading();
|
|
174
|
+
}
|
|
175
|
+
await this.loadData();
|
|
176
|
+
} catch (e) {
|
|
177
|
+
} finally {
|
|
178
|
+
if (this.loading) {
|
|
179
|
+
uni.hideLoading();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
mounted() {
|
|
185
|
+
if (this.initLoad) {
|
|
186
|
+
this.initData();
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<style></style>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="flex" :class="[{ 'items-start': align === 'top', 'items-end': align === 'bottom', 'items-center': align === 'center', 'items-stretch': align === 'stretch', 'items-baseline': align === 'baseline' }, customClass]" :style="[customStyle]">
|
|
3
|
+
<text v-if="show" :style="[_dotStyle]" />
|
|
4
|
+
<view class="flex-1 w-0" :style="[textStyle]" :class="textClass">
|
|
5
|
+
<slot name="default"></slot>
|
|
6
|
+
</view>
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import color from '../../configs/color';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
props: {
|
|
15
|
+
type: String,
|
|
16
|
+
space: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: 6,
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
type: [String, Number],
|
|
22
|
+
default: 6,
|
|
23
|
+
},
|
|
24
|
+
width: {
|
|
25
|
+
type: [String, Number],
|
|
26
|
+
default: 0,
|
|
27
|
+
},
|
|
28
|
+
height: {
|
|
29
|
+
type: [String, Number],
|
|
30
|
+
default: 0,
|
|
31
|
+
},
|
|
32
|
+
fontSize: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: 13,
|
|
35
|
+
},
|
|
36
|
+
color: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: '',
|
|
39
|
+
},
|
|
40
|
+
textColor: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: '',
|
|
43
|
+
},
|
|
44
|
+
borderRadius: {
|
|
45
|
+
type: [String, Number],
|
|
46
|
+
default: '50%',
|
|
47
|
+
},
|
|
48
|
+
top: {
|
|
49
|
+
type: [String, Number],
|
|
50
|
+
default: 0,
|
|
51
|
+
},
|
|
52
|
+
plain: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
show: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: true,
|
|
59
|
+
},
|
|
60
|
+
customClass: String,
|
|
61
|
+
textClass: String,
|
|
62
|
+
textStyle: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: () => ({}),
|
|
65
|
+
},
|
|
66
|
+
customStyle: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: () => ({}),
|
|
69
|
+
},
|
|
70
|
+
dotStyle: {
|
|
71
|
+
type: Object,
|
|
72
|
+
default: () => ({}),
|
|
73
|
+
},
|
|
74
|
+
align: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: 'center',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
computed: {
|
|
80
|
+
_color() {
|
|
81
|
+
const { color: c, type } = this;
|
|
82
|
+
if (c) {
|
|
83
|
+
return c;
|
|
84
|
+
} else if (type) {
|
|
85
|
+
return color[type];
|
|
86
|
+
}
|
|
87
|
+
return '';
|
|
88
|
+
},
|
|
89
|
+
_dotStyle() {
|
|
90
|
+
const { size, borderRadius, plain, width, height, top, space, _color } = this;
|
|
91
|
+
const style = {
|
|
92
|
+
width: uni.$uv.addUnit(width || size),
|
|
93
|
+
height: uni.$uv.addUnit(height || size),
|
|
94
|
+
border: `1rpx solid ${_color}`,
|
|
95
|
+
borderRadius: uni.$uv.addUnit(borderRadius),
|
|
96
|
+
backgroundColor: plain ? 'transparent' : _color,
|
|
97
|
+
marginTop: uni.$uv.addUnit(top),
|
|
98
|
+
marginRight: uni.$uv.addUnit(space),
|
|
99
|
+
};
|
|
100
|
+
return Object.assign(style, this.dotStyle);
|
|
101
|
+
},
|
|
102
|
+
txtStyle() {
|
|
103
|
+
const { textColor, fontSize, textStyle } = this;
|
|
104
|
+
const style = {
|
|
105
|
+
color: textColor,
|
|
106
|
+
fontSize: uni.$uv.addUnit(fontSize),
|
|
107
|
+
};
|
|
108
|
+
return Object.assign(style, textStyle);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style lang="scss" scoped></style>
|