@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,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="show">
|
|
3
|
+
<slot name="default" :open="open">
|
|
4
|
+
<text @tap.stop="open"> {{ prefix }}{{ env.name }}{{ suffix }} </text>
|
|
5
|
+
</slot>
|
|
6
|
+
<!-- #ifndef MP -->
|
|
7
|
+
<uv-action-sheet v-if="switchable" ref="actionSheet" :actions="list" title="切换环境" @select="select" />
|
|
8
|
+
<!-- #endif -->
|
|
9
|
+
</template>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import color from '../../configs/color';
|
|
14
|
+
import ver from '../../configs/ver';
|
|
15
|
+
import update from '../../utils/update';
|
|
16
|
+
import { requestDelay } from '../../utils';
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
props: {
|
|
20
|
+
env: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: () => ({}),
|
|
23
|
+
},
|
|
24
|
+
data: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: () => [
|
|
27
|
+
{
|
|
28
|
+
name: '开发环境',
|
|
29
|
+
key: 'dev',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: '测试环境',
|
|
33
|
+
key: 'sit',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: '演示环境',
|
|
37
|
+
key: 'uat',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: '预生产环境',
|
|
41
|
+
key: 'pre',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
prefix: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
suffix: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
switchable: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
computed: {
|
|
59
|
+
show() {
|
|
60
|
+
return this.env.name !== 'prod';
|
|
61
|
+
},
|
|
62
|
+
list() {
|
|
63
|
+
return this.data.map((item) => ({
|
|
64
|
+
...item,
|
|
65
|
+
disabled: item.disabled || (item.key === this.env.name ? true : false),
|
|
66
|
+
}));
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
open() {
|
|
71
|
+
if (this.switchable) {
|
|
72
|
+
// #ifdef MP-WEIXIN
|
|
73
|
+
uni.showModal({
|
|
74
|
+
title: '提示',
|
|
75
|
+
content: '请在"小程序助手"中切换环境',
|
|
76
|
+
showCancel: false,
|
|
77
|
+
confirmColor: color.primary,
|
|
78
|
+
});
|
|
79
|
+
// #endif
|
|
80
|
+
// #ifdef H5
|
|
81
|
+
if (!window.electron) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// #endif
|
|
85
|
+
// #ifndef MP
|
|
86
|
+
this.$refs.actionSheet.open();
|
|
87
|
+
// #endif
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
// #ifndef MP
|
|
91
|
+
select(e) {
|
|
92
|
+
this.$refs.actionSheet.close();
|
|
93
|
+
if (this.current !== e.key) {
|
|
94
|
+
uni.showModal({
|
|
95
|
+
title: '提示',
|
|
96
|
+
content: `是否切换到${e.name}并重启应用?`,
|
|
97
|
+
confirmColor: color.primary,
|
|
98
|
+
success: async (res) => {
|
|
99
|
+
if (res.confirm) {
|
|
100
|
+
this.env.set(e.key);
|
|
101
|
+
ver.code = -1;
|
|
102
|
+
try {
|
|
103
|
+
uni.showLoading({ title: '切换中...' });
|
|
104
|
+
await requestDelay(() => Promise.resolve());
|
|
105
|
+
uni.hideLoading();
|
|
106
|
+
await update.check(true);
|
|
107
|
+
} catch (e) {
|
|
108
|
+
// #ifdef APP
|
|
109
|
+
plus.runtime.restart();
|
|
110
|
+
// #endif
|
|
111
|
+
// #ifdef H5
|
|
112
|
+
window.location.reload();
|
|
113
|
+
// #endif
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
// #endif
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="float" :style="[style]" @tap.stop="click">
|
|
3
|
+
<slot>
|
|
4
|
+
<g-icon :name="iconName" :font="iconFont" :size="iconSize" :color="iconColor" class="flex" />
|
|
5
|
+
</slot>
|
|
6
|
+
</view>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import color from '../../configs/color';
|
|
11
|
+
import navigate from '../../utils/navigate';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
props: {
|
|
15
|
+
size: {
|
|
16
|
+
type: [String, Number],
|
|
17
|
+
default: 40,
|
|
18
|
+
},
|
|
19
|
+
show: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: 8,
|
|
22
|
+
},
|
|
23
|
+
offset: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default: () => [10],
|
|
26
|
+
},
|
|
27
|
+
hasTabbar: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
scrollTop: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 0,
|
|
34
|
+
},
|
|
35
|
+
iconName: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: '',
|
|
38
|
+
},
|
|
39
|
+
iconFont: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: '',
|
|
42
|
+
},
|
|
43
|
+
iconSize: {
|
|
44
|
+
type: [String, Number],
|
|
45
|
+
default: 20,
|
|
46
|
+
},
|
|
47
|
+
customStyle: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: () => ({}),
|
|
50
|
+
},
|
|
51
|
+
iconColor: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: () => color.mainColor,
|
|
54
|
+
},
|
|
55
|
+
bgColor: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: '#fff',
|
|
58
|
+
},
|
|
59
|
+
url: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: '',
|
|
62
|
+
},
|
|
63
|
+
delay: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 1000,
|
|
66
|
+
},
|
|
67
|
+
opacity: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: 0.5,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
isScroll: false,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
computed: {
|
|
78
|
+
style({ offset, hasTabbar, isScroll, size, bgColor, show, opacity }) {
|
|
79
|
+
let [bottom = 20, right] = offset;
|
|
80
|
+
if (right == null) {
|
|
81
|
+
right = bottom;
|
|
82
|
+
}
|
|
83
|
+
size = uni.$uv.addUnit(size);
|
|
84
|
+
const style = {
|
|
85
|
+
width: size,
|
|
86
|
+
height: size,
|
|
87
|
+
right: uni.$uv.addUnit(right),
|
|
88
|
+
bottom: `calc(${uni.$uv.addUnit(bottom)} + ${hasTabbar ? 'var(--window-bottom)' : '0px'})`,
|
|
89
|
+
opacity: isScroll ? opacity : 1,
|
|
90
|
+
transform: `translateX(${isScroll ? `calc(${size} - ${uni.$uv.addUnit(show)})` : '0'})`,
|
|
91
|
+
backgroundColor: bgColor,
|
|
92
|
+
};
|
|
93
|
+
return Object.assign(style, this.customStyle);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
watch: {
|
|
97
|
+
scrollTop() {
|
|
98
|
+
this.scrolling();
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
methods: {
|
|
102
|
+
scrolling() {
|
|
103
|
+
this.isScroll = true;
|
|
104
|
+
uni.$uv.debounce(() => {
|
|
105
|
+
this.isScroll = false;
|
|
106
|
+
}, this.delay);
|
|
107
|
+
},
|
|
108
|
+
click() {
|
|
109
|
+
if (this.url) {
|
|
110
|
+
navigate({ url: this.url });
|
|
111
|
+
} else {
|
|
112
|
+
this.$emit('goto');
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style lang="scss" scoped>
|
|
120
|
+
.float {
|
|
121
|
+
position: fixed;
|
|
122
|
+
z-index: 11;
|
|
123
|
+
border-radius: 50%;
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
align-items: center;
|
|
127
|
+
box-shadow: 0rpx 8rpx 30rpx rgba(0, 0, 0, 0.08);
|
|
128
|
+
background-color: #fff;
|
|
129
|
+
transition: all 0.3s;
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="grid" :style="[_style]">
|
|
3
|
+
<view v-for="(item, index) in list" :key="index" :style="[_imageStyle]" class="overflow-hidden" @tap.stop="click(item)">
|
|
4
|
+
<image :src="item.image" style="width: 100%; height: 100%" :mode="mode" class="flex" />
|
|
5
|
+
</view>
|
|
6
|
+
</view>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
props: {
|
|
12
|
+
list: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: () => [],
|
|
15
|
+
},
|
|
16
|
+
margin: {
|
|
17
|
+
type: [Array, Number, String],
|
|
18
|
+
default: () => 15,
|
|
19
|
+
},
|
|
20
|
+
height: {
|
|
21
|
+
type: [String, Number],
|
|
22
|
+
default: 64,
|
|
23
|
+
},
|
|
24
|
+
customStyle: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => ({}),
|
|
27
|
+
},
|
|
28
|
+
imageStyle: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: () => ({}),
|
|
31
|
+
},
|
|
32
|
+
borderRadius: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: 16,
|
|
35
|
+
},
|
|
36
|
+
col: {
|
|
37
|
+
type: [String, Number],
|
|
38
|
+
default: 2,
|
|
39
|
+
},
|
|
40
|
+
mode: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'widthFix',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
computed: {
|
|
46
|
+
gutter() {
|
|
47
|
+
return [].concat(this.margin);
|
|
48
|
+
},
|
|
49
|
+
_style() {
|
|
50
|
+
const [row, col] = this.gutter;
|
|
51
|
+
return Object.assign(
|
|
52
|
+
{
|
|
53
|
+
'grid-gap': `${uni.$uv.addUnit(row)} ${uni.$uv.addUnit(col || row)}`,
|
|
54
|
+
'grid-template-columns': new Array(Number(this.col))
|
|
55
|
+
.fill(undefined)
|
|
56
|
+
.map(() => '1fr')
|
|
57
|
+
.join(' '),
|
|
58
|
+
},
|
|
59
|
+
this.customStyle,
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
_imageStyle() {
|
|
63
|
+
return Object.assign(
|
|
64
|
+
{
|
|
65
|
+
height: uni.$uv.addUnit(this.height),
|
|
66
|
+
borderRadius: uni.$uv.addUnit(this.borderRadius),
|
|
67
|
+
},
|
|
68
|
+
this.imageStyle,
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
click(e) {
|
|
74
|
+
this.$emit('click', e);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<style lang="scss" scoped>
|
|
81
|
+
.grid {
|
|
82
|
+
display: grid;
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="relative" v-if="dataList && dataList.length" :style="[customStyle]">
|
|
3
|
+
<swiper class="swiper" :current="cur" :style="[swiperStyle]" @change="change">
|
|
4
|
+
<swiper-item v-for="(list, index) in dataList" :key="index">
|
|
5
|
+
<uv-grid :col="col" :border="false" align="left">
|
|
6
|
+
<uv-grid-item v-for="(ele, i) in list" :key="i" bgColor="transparent" :customStyle="_colStyle">
|
|
7
|
+
<view class="flex justify-center flex-col" :style="[_itemStyle(ele)]" @tap.stop="click(index, i)">
|
|
8
|
+
<uv-image
|
|
9
|
+
v-if="ele[iconKey]"
|
|
10
|
+
:src="ele[iconKey]"
|
|
11
|
+
:width="iconStyle.width || iconStyle.height"
|
|
12
|
+
:height="iconStyle.height || iconStyle.width"
|
|
13
|
+
mode="heightFix"
|
|
14
|
+
errorIcon="photo"
|
|
15
|
+
:compress="false"
|
|
16
|
+
/>
|
|
17
|
+
<text v-if="ele[titleKey]" class="text-24rpx text-main mt-12rpx" :style="[titleStyle]">
|
|
18
|
+
{{ ele[titleKey] }}
|
|
19
|
+
</text>
|
|
20
|
+
<text v-if="ele[descKey]" class="text-tips text-20rpx mt-4rpx" :style="[descStyle]">
|
|
21
|
+
{{ ele[descKey] }}
|
|
22
|
+
</text>
|
|
23
|
+
</view>
|
|
24
|
+
</uv-grid-item>
|
|
25
|
+
</uv-grid>
|
|
26
|
+
</swiper-item>
|
|
27
|
+
</swiper>
|
|
28
|
+
<slot name="indicator" :data="{ current: cur }">
|
|
29
|
+
<view v-if="dataList.length > 1" class="indicator" :style="[_indicatorStyle]">
|
|
30
|
+
<view v-for="(ele, i) in dataList" :key="i" class="indicator-dot" :class="{ current: cur === i }"></view>
|
|
31
|
+
</view>
|
|
32
|
+
</slot>
|
|
33
|
+
</view>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
export default {
|
|
38
|
+
props: {
|
|
39
|
+
list: {
|
|
40
|
+
type: Array,
|
|
41
|
+
default: () => [],
|
|
42
|
+
},
|
|
43
|
+
params: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => ({}),
|
|
46
|
+
},
|
|
47
|
+
customStyle: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: () => ({}),
|
|
50
|
+
},
|
|
51
|
+
itemStyle: {
|
|
52
|
+
type: [Object, Function],
|
|
53
|
+
default: () => ({}),
|
|
54
|
+
},
|
|
55
|
+
linkKey: {
|
|
56
|
+
type: [Boolean, String],
|
|
57
|
+
default: 'link',
|
|
58
|
+
},
|
|
59
|
+
titleKey: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: 'title',
|
|
62
|
+
},
|
|
63
|
+
descKey: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'desc',
|
|
66
|
+
},
|
|
67
|
+
iconKey: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'icon',
|
|
70
|
+
},
|
|
71
|
+
indicator: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: 'number',
|
|
74
|
+
},
|
|
75
|
+
indicatorPos: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: 'bottomCenter',
|
|
78
|
+
},
|
|
79
|
+
indicatorStyle: {
|
|
80
|
+
type: Object,
|
|
81
|
+
default: () => ({}),
|
|
82
|
+
},
|
|
83
|
+
bgColor: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: 'transparent',
|
|
86
|
+
},
|
|
87
|
+
rowHeight: {
|
|
88
|
+
type: [Number, String],
|
|
89
|
+
default: 114,
|
|
90
|
+
},
|
|
91
|
+
col: {
|
|
92
|
+
type: [Number, String],
|
|
93
|
+
default: 4,
|
|
94
|
+
},
|
|
95
|
+
row: {
|
|
96
|
+
type: [Number, String],
|
|
97
|
+
default: 3,
|
|
98
|
+
},
|
|
99
|
+
current: {
|
|
100
|
+
type: [Number, String],
|
|
101
|
+
default: 0,
|
|
102
|
+
},
|
|
103
|
+
iconStyle: {
|
|
104
|
+
type: Object,
|
|
105
|
+
default: () => ({
|
|
106
|
+
width: '72rpx',
|
|
107
|
+
height: '72rpx',
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
titleStyle: {
|
|
111
|
+
type: Object,
|
|
112
|
+
default: () => ({}),
|
|
113
|
+
},
|
|
114
|
+
descStyle: {
|
|
115
|
+
type: Object,
|
|
116
|
+
default: () => ({}),
|
|
117
|
+
},
|
|
118
|
+
colStyle: {
|
|
119
|
+
type: [Object, Function],
|
|
120
|
+
default: () => ({}),
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
data() {
|
|
124
|
+
return {
|
|
125
|
+
cur: parseInt(this.current),
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
computed: {
|
|
129
|
+
dataList({ col, row, list }) {
|
|
130
|
+
const data = [];
|
|
131
|
+
const size = col * row;
|
|
132
|
+
list.forEach((e, i) => {
|
|
133
|
+
const j = Math.floor(i / size);
|
|
134
|
+
if (!data[j]) {
|
|
135
|
+
data[j] = [];
|
|
136
|
+
}
|
|
137
|
+
data[j].push(e);
|
|
138
|
+
});
|
|
139
|
+
return data;
|
|
140
|
+
},
|
|
141
|
+
swiperStyle({ cur, col, dataList, rowHeight }) {
|
|
142
|
+
const data = dataList[cur];
|
|
143
|
+
if (!data) {
|
|
144
|
+
return {};
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
height: `${Math.ceil(data.length / col) * rowHeight}rpx`,
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
_indicatorStyle({ indicatorStyle, indicatorPos }) {
|
|
151
|
+
return Object.assign(
|
|
152
|
+
(() => {
|
|
153
|
+
switch (indicatorPos) {
|
|
154
|
+
case 'bottomCenter':
|
|
155
|
+
return {
|
|
156
|
+
bottom: '10rpx',
|
|
157
|
+
left: '50%',
|
|
158
|
+
transform: 'translateX(-50%)',
|
|
159
|
+
};
|
|
160
|
+
default:
|
|
161
|
+
return {};
|
|
162
|
+
}
|
|
163
|
+
})(),
|
|
164
|
+
indicatorStyle,
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
_itemStyle({ itemStyle }) {
|
|
168
|
+
return (e) => {
|
|
169
|
+
return typeof itemStyle === 'function' ? itemStyle(e) : itemStyle;
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
_colStyle({ colStyle }) {
|
|
173
|
+
return Object.assign({ padding: 0 }, colStyle);
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
watch: {
|
|
177
|
+
current() {
|
|
178
|
+
this.cur = parseInt(this.current);
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
methods: {
|
|
182
|
+
change(e) {
|
|
183
|
+
const { current } = e.detail;
|
|
184
|
+
this.cur = current;
|
|
185
|
+
},
|
|
186
|
+
click(i, j) {
|
|
187
|
+
let data = this.dataList[i];
|
|
188
|
+
if (j != null) {
|
|
189
|
+
data = data[j];
|
|
190
|
+
}
|
|
191
|
+
if (this.linkKey) {
|
|
192
|
+
const link = data[this.linkKey];
|
|
193
|
+
if (link) {
|
|
194
|
+
uni.navigateTo({
|
|
195
|
+
url: link,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
this.$emit('click', data);
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
</script>
|
|
204
|
+
|
|
205
|
+
<style lang="scss" scoped>
|
|
206
|
+
.swiper {
|
|
207
|
+
transition: all 0.3s;
|
|
208
|
+
}
|
|
209
|
+
.indicator {
|
|
210
|
+
position: absolute;
|
|
211
|
+
height: 8rpx;
|
|
212
|
+
border-radius: 100rpx;
|
|
213
|
+
background-color: #d8d8d8;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
display: flex;
|
|
216
|
+
&-dot {
|
|
217
|
+
width: 16rpx;
|
|
218
|
+
height: 100%;
|
|
219
|
+
&.current {
|
|
220
|
+
background-color: $uv-primary;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<text :class="[classname, `${classname}-${name}`]" :style="[style]" @click="click" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
props: {
|
|
8
|
+
type: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: 'icon',
|
|
11
|
+
},
|
|
12
|
+
font: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: '',
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: '',
|
|
19
|
+
},
|
|
20
|
+
zoom: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false,
|
|
23
|
+
},
|
|
24
|
+
bold: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
type: [Number, String],
|
|
30
|
+
default: 12,
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
computed: {
|
|
38
|
+
classname({ font, type }) {
|
|
39
|
+
if (font) {
|
|
40
|
+
if (font.startsWith(`${type}-`)) {
|
|
41
|
+
return font;
|
|
42
|
+
}
|
|
43
|
+
return `${type}-${font}`;
|
|
44
|
+
}
|
|
45
|
+
return type;
|
|
46
|
+
},
|
|
47
|
+
style({ size, zoom, bold, color }) {
|
|
48
|
+
const style = {
|
|
49
|
+
fontSize: uni.$uv.addUnit(size),
|
|
50
|
+
};
|
|
51
|
+
if (bold) {
|
|
52
|
+
style.fontWeight = 'bold';
|
|
53
|
+
}
|
|
54
|
+
if (color) {
|
|
55
|
+
style.color = color;
|
|
56
|
+
}
|
|
57
|
+
if (zoom) {
|
|
58
|
+
const z = Number.parseFloat(size) / 24;
|
|
59
|
+
if (z < 1) {
|
|
60
|
+
style.zoom = z;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return style;
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
click(e) {
|
|
68
|
+
this.$emit('click', e);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
</script>
|