@puresnake/snake-ui 0.0.0-stage → 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/LICENSE +21 -0
- package/changelog.md +1 -0
- package/components/snake-activity-list/snake-activity-list.vue +365 -0
- package/components/snake-activity-list/types.ts +29 -0
- package/components/snake-auxiliary-segmentation/snake-auxiliary-segmentation.vue +44 -0
- package/components/snake-auxiliary-segmentation/types.ts +5 -0
- package/components/snake-button/snake-button.vue +357 -0
- package/components/snake-button/types.ts +103 -0
- package/components/snake-button-sort/snake-button-sort.vue +72 -0
- package/components/snake-button-sort/types.ts +22 -0
- package/components/snake-calendar/snake-calendar.vue +998 -0
- package/components/snake-calendar/types.ts +189 -0
- package/components/snake-cell-group/snake-cell-group.vue +55 -0
- package/components/snake-cell-group/types.ts +19 -0
- package/components/snake-cell-item/snake-cell-item.vue +159 -0
- package/components/snake-cell-item/types.ts +66 -0
- package/components/snake-checkbox/snake-checkbox.vue +264 -0
- package/components/snake-checkbox/types.ts +70 -0
- package/components/snake-checkbox-group/snake-checkbox-group.vue +154 -0
- package/components/snake-checkbox-group/types.ts +52 -0
- package/components/snake-cms/blocks/v2/cms-v2-carousel.vue +87 -0
- package/components/snake-cms/blocks/v2/cms-v2-coupon.vue +25 -0
- package/components/snake-cms/blocks/v2/cms-v2-custom.vue +12 -0
- package/components/snake-cms/blocks/v2/cms-v2-divider.vue +33 -0
- package/components/snake-cms/blocks/v2/cms-v2-floatbutton.vue +28 -0
- package/components/snake-cms/blocks/v2/cms-v2-goods-list.vue +150 -0
- package/components/snake-cms/blocks/v2/cms-v2-hotzone.vue +41 -0
- package/components/snake-cms/blocks/v2/cms-v2-images.vue +41 -0
- package/components/snake-cms/blocks/v2/cms-v2-magiccube.vue +93 -0
- package/components/snake-cms/blocks/v2/cms-v2-notice.vue +80 -0
- package/components/snake-cms/blocks/v2/cms-v2-popup.vue +46 -0
- package/components/snake-cms/blocks/v2/cms-v2-richtext.vue +18 -0
- package/components/snake-cms/blocks/v2/cms-v2-search.vue +115 -0
- package/components/snake-cms/blocks/v2/cms-v2-video.vue +25 -0
- package/components/snake-cms/blocks/v2/shared.ts +84 -0
- package/components/snake-cms/snake-cms.vue +409 -0
- package/components/snake-cms/types.ts +50 -0
- package/components/snake-commodity-search/snake-commodity-search.vue +234 -0
- package/components/snake-commodity-search/types.ts +11 -0
- package/components/snake-config-provider/snake-config-provider.vue +61 -0
- package/components/snake-config-provider/types.ts +22 -0
- package/components/snake-count-down/snake-count-down.vue +231 -0
- package/components/snake-count-down/types.ts +103 -0
- package/components/snake-coupon/snake-coupon.vue +209 -0
- package/components/snake-coupon/types.ts +21 -0
- package/components/snake-custom-module/snake-custom-module.vue +25 -0
- package/components/snake-custom-module/types.ts +11 -0
- package/components/snake-drop-menu/snake-drop-menu.vue +123 -0
- package/components/snake-drop-menu/types.ts +95 -0
- package/components/snake-drop-menu-item/snake-drop-menu-item.vue +181 -0
- package/components/snake-drop-menu-item/types.ts +48 -0
- package/components/snake-empty/snake-empty.vue +100 -0
- package/components/snake-empty/types.ts +48 -0
- package/components/snake-filter-sorts/filter-page.vue +695 -0
- package/components/snake-filter-sorts/snake-filter-sorts.vue +185 -0
- package/components/snake-filter-sorts/types.ts +57 -0
- package/components/snake-floating-bubble/snake-floating-bubble.vue +157 -0
- package/components/snake-floating-bubble/types.ts +43 -0
- package/components/snake-follow/snake-follow.vue +18 -0
- package/components/snake-follow/types.ts +2 -0
- package/components/snake-form/snake-form.vue +124 -0
- package/components/snake-form/types.ts +96 -0
- package/components/snake-form-item/snake-form-item.vue +331 -0
- package/components/snake-form-item/types.ts +70 -0
- package/components/snake-goods-list/snake-goods-list.vue +792 -0
- package/components/snake-goods-list/types.ts +55 -0
- package/components/snake-graphic-navigation/snake-graphic-navigation.vue +198 -0
- package/components/snake-graphic-navigation/types.ts +43 -0
- package/components/snake-icon/icon-names.ts +222 -0
- package/components/snake-icon/snake-icon.vue +220 -0
- package/components/snake-icon/types.ts +45 -0
- package/components/snake-image/snake-image.vue +230 -0
- package/components/snake-image/types.ts +70 -0
- package/components/snake-images/snake-images.vue +80 -0
- package/components/snake-images/types.ts +5 -0
- package/components/snake-index-anchor/snake-index-anchor.vue +83 -0
- package/components/snake-index-anchor/types.ts +14 -0
- package/components/snake-index-list/anchor-registry.ts +80 -0
- package/components/snake-index-list/snake-index-list.vue +259 -0
- package/components/snake-index-list/types.ts +115 -0
- package/components/snake-index-list-panel/snake-index-list-panel.vue +277 -0
- package/components/snake-index-list-panel/types.ts +10 -0
- package/components/snake-input/snake-input.vue +225 -0
- package/components/snake-input/types.ts +99 -0
- package/components/snake-jump-applet/snake-jump-applet.vue +99 -0
- package/components/snake-jump-applet/types.ts +17 -0
- package/components/snake-line/snake-line.vue +42 -0
- package/components/snake-line/types.ts +30 -0
- package/components/snake-line-progress/snake-line-progress.vue +105 -0
- package/components/snake-line-progress/types.ts +26 -0
- package/components/snake-link/snake-link.vue +74 -0
- package/components/snake-link/types.ts +30 -0
- package/components/snake-list-switching/components/tree-select/index.vue +156 -0
- package/components/snake-list-switching/snake-list-switching.vue +1285 -0
- package/components/snake-list-switching/types.ts +11 -0
- package/components/snake-loading/snake-loading.vue +241 -0
- package/components/snake-loading/types.ts +34 -0
- package/components/snake-loadmore/snake-loadmore.vue +103 -0
- package/components/snake-loadmore/types.ts +56 -0
- package/components/snake-magic-cube/snake-magic-cube.vue +622 -0
- package/components/snake-magic-cube/types.ts +5 -0
- package/components/snake-modal/snake-modal.vue +434 -0
- package/components/snake-modal/types.ts +71 -0
- package/components/snake-navbar/snake-navbar.vue +194 -0
- package/components/snake-navbar/types.ts +54 -0
- package/components/snake-no-network/snake-no-network.vue +125 -0
- package/components/snake-no-network/types.ts +27 -0
- package/components/snake-notice/snake-notice.vue +44 -0
- package/components/snake-notice/types.ts +5 -0
- package/components/snake-notice-bar/snake-notice-bar.vue +336 -0
- package/components/snake-notice-bar/types.ts +82 -0
- package/components/snake-overlay/snake-overlay.vue +73 -0
- package/components/snake-overlay/types.ts +35 -0
- package/components/snake-page-popup/snake-page-popup.vue +146 -0
- package/components/snake-page-popup/types.ts +28 -0
- package/components/snake-parse/audio/audio.vue +286 -0
- package/components/snake-parse/audio/context.js +11 -0
- package/components/snake-parse/audio/index.js +34 -0
- package/components/snake-parse/node/node.vue +830 -0
- package/components/snake-parse/parser.js +1480 -0
- package/components/snake-parse/snake-parse.vue +548 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/handler.js +109 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.js +0 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.min.js +1 -0
- package/components/snake-parse/static/app-plus/snake-parse/local.html +3 -0
- package/components/snake-parse/style/index.js +132 -0
- package/components/snake-parse/style/parser.js +175 -0
- package/components/snake-parse/types.ts +49 -0
- package/components/snake-picture-ads/snake-picture-ads.vue +292 -0
- package/components/snake-picture-ads/types.ts +5 -0
- package/components/snake-popup/snake-popup.vue +348 -0
- package/components/snake-popup/types.ts +88 -0
- package/components/snake-qr-code/qrcode.ts +1214 -0
- package/components/snake-qr-code/snake-qr-code.vue +408 -0
- package/components/snake-qr-code/types.ts +78 -0
- package/components/snake-radio/snake-radio.vue +271 -0
- package/components/snake-radio/types.ts +64 -0
- package/components/snake-radio-group/snake-radio-group.vue +98 -0
- package/components/snake-radio-group/types.ts +48 -0
- package/components/snake-read-more/snake-read-more.vue +140 -0
- package/components/snake-read-more/types.ts +53 -0
- package/components/snake-rich-text/snake-rich-text.vue +24 -0
- package/components/snake-rich-text/types.ts +5 -0
- package/components/snake-root-portal/snake-root-portal.vue +92 -0
- package/components/snake-root-portal/types.ts +9 -0
- package/components/snake-search/snake-search.vue +202 -0
- package/components/snake-search/types.ts +84 -0
- package/components/snake-select/snake-select.vue +371 -0
- package/components/snake-select/types.ts +75 -0
- package/components/snake-skeleton/snake-skeleton.vue +104 -0
- package/components/snake-skeleton/types.ts +32 -0
- package/components/snake-skeleton-item/snake-skeleton-item.vue +90 -0
- package/components/snake-skeleton-item/types.ts +30 -0
- package/components/snake-slider/snake-slider.vue +249 -0
- package/components/snake-slider/types.ts +59 -0
- package/components/snake-sticky/snake-sticky.vue +178 -0
- package/components/snake-sticky/types.ts +48 -0
- package/components/snake-subsection/snake-subsection.vue +188 -0
- package/components/snake-subsection/types.ts +54 -0
- package/components/snake-swiper/snake-swiper.vue +229 -0
- package/components/snake-swiper/types.ts +79 -0
- package/components/snake-switch/snake-switch.vue +100 -0
- package/components/snake-switch/types.ts +41 -0
- package/components/snake-tabbar/snake-tabbar.vue +306 -0
- package/components/snake-tabbar/types.ts +93 -0
- package/components/snake-tabs/snake-tabs.vue +305 -0
- package/components/snake-tabs/types.ts +79 -0
- package/components/snake-text/snake-text.vue +292 -0
- package/components/snake-text/types.ts +100 -0
- package/components/snake-textarea/snake-textarea.vue +171 -0
- package/components/snake-textarea/types.ts +79 -0
- package/components/snake-toast/snake-toast.vue +330 -0
- package/components/snake-toast/types.ts +55 -0
- package/components/snake-tooltip/position.ts +33 -0
- package/components/snake-tooltip/snake-tooltip.vue +339 -0
- package/components/snake-tooltip/types.ts +80 -0
- package/components/snake-transition/snake-transition.vue +315 -0
- package/components/snake-transition/types.ts +65 -0
- package/components/snake-upload/snake-upload.vue +1801 -0
- package/components/snake-upload/types.ts +256 -0
- package/components/snake-videos/snake-videos.vue +122 -0
- package/components/snake-videos/types.ts +7 -0
- package/iconfont.css +881 -0
- package/index.d.ts +7 -0
- package/index.scss +26 -0
- package/index.ts +94 -0
- package/libs/cms/blocks.ts +103 -0
- package/libs/cms/config.ts +25 -0
- package/libs/cms/index.ts +7 -0
- package/libs/cms/normalize.ts +135 -0
- package/libs/cms/resolve.ts +12 -0
- package/libs/cms/types.ts +164 -0
- package/libs/cms/use-commerce.ts +385 -0
- package/libs/cms/v2.ts +193 -0
- package/libs/config/index.ts +4 -0
- package/libs/config/modal.ts +93 -0
- package/libs/config/state.ts +33 -0
- package/libs/config/theme.ts +351 -0
- package/libs/config/toast.ts +71 -0
- package/libs/config/types.ts +135 -0
- package/libs/config/zIndex.ts +44 -0
- package/libs/css/color.scss +105 -0
- package/libs/css/common.scss +171 -0
- package/libs/css/style.h5.scss +7 -0
- package/libs/css/style.mp.scss +7 -0
- package/libs/css/style.theme.scss +70 -0
- package/libs/css/style.vue.scss +140 -0
- package/libs/form/async-validator.min.d.ts +75 -0
- package/libs/form/async-validator.min.js +3 -0
- package/libs/form/index.ts +3 -0
- package/libs/form/path.ts +40 -0
- package/libs/form/types.ts +51 -0
- package/libs/form/validate.ts +149 -0
- package/libs/foundation.ts +96 -0
- package/libs/function/$parent.ts +33 -0
- package/libs/function/clipboard.ts +13 -0
- package/libs/function/color.ts +55 -0
- package/libs/function/debounce.ts +34 -0
- package/libs/function/deepClone.ts +30 -0
- package/libs/function/deepMerge.ts +25 -0
- package/libs/function/emitter.ts +30 -0
- package/libs/function/format.ts +27 -0
- package/libs/function/getParent.ts +53 -0
- package/libs/function/getRect.ts +29 -0
- package/libs/function/guid.ts +11 -0
- package/libs/function/index.ts +31 -0
- package/libs/function/queryParams.ts +73 -0
- package/libs/function/random.ts +6 -0
- package/libs/function/randomArray.ts +14 -0
- package/libs/function/route.ts +155 -0
- package/libs/function/sleep.ts +7 -0
- package/libs/function/style.ts +58 -0
- package/libs/function/styleUtils.ts +83 -0
- package/libs/function/system.ts +14 -0
- package/libs/function/test.ts +202 -0
- package/libs/function/throttle.ts +36 -0
- package/libs/function/timeFormat.ts +27 -0
- package/libs/function/timeFrom.ts +27 -0
- package/libs/function/toast.ts +10 -0
- package/libs/function/trim.ts +11 -0
- package/libs/function/type2icon.ts +11 -0
- package/libs/function/unit.ts +45 -0
- package/libs/hooks/index.ts +11 -0
- package/libs/hooks/useChildren.ts +125 -0
- package/libs/hooks/useColor.ts +5 -0
- package/libs/hooks/useDebounce.ts +5 -0
- package/libs/hooks/useLocale.ts +13 -0
- package/libs/hooks/useModal.ts +131 -0
- package/libs/hooks/useParent.ts +62 -0
- package/libs/hooks/useRect.ts +44 -0
- package/libs/hooks/useRouter.ts +5 -0
- package/libs/hooks/useTheme.ts +31 -0
- package/libs/hooks/useThrottle.ts +5 -0
- package/libs/hooks/useToast.ts +116 -0
- package/libs/index.ts +18 -0
- package/libs/request/auto-http.ts +1 -0
- package/libs/request/index.ts +343 -0
- package/libs/runtime/accessors.ts +55 -0
- package/libs/runtime/context.ts +40 -0
- package/libs/runtime/index.ts +18 -0
- package/libs/runtime/types.ts +49 -0
- package/libs/util/calendar.ts +6 -0
- package/locale/index.ts +130 -0
- package/locale/lang/en-US.ts +67 -0
- package/locale/lang/zh-CN.ts +67 -0
- package/package.json +130 -5
- package/plugins/index.ts +1 -0
- package/plugins/root/README.md +86 -0
- package/plugins/root/index.ts +123 -0
- package/plugins/root/page.ts +77 -0
- package/plugins/root/root.ts +53 -0
- package/plugins/root/utils.ts +137 -0
- package/readme.md +79 -0
- package/theme.scss +118 -0
- package/types/components.d.ts +236 -0
- package/types/global.d.ts +21 -0
- package/types/index.d.ts +6 -0
- package/types/uni-app.d.ts +16 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PURESNAKE
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/changelog.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Changelog
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view v-if="list.length" class="activity-list">
|
|
3
|
+
<scroll-view
|
|
4
|
+
class="scroll-view"
|
|
5
|
+
:scroll-x="list.length > 3"
|
|
6
|
+
:scroll-left="tabsScrollLeft"
|
|
7
|
+
:scroll-with-animation="true"
|
|
8
|
+
>
|
|
9
|
+
<view class="activity-list__nav" role="tablist" aria-label="活动场次">
|
|
10
|
+
<template v-for="(item, index) in list" :key="index">
|
|
11
|
+
<view
|
|
12
|
+
class="activity-list__item"
|
|
13
|
+
:class="{
|
|
14
|
+
'activity-list__item--active': current == item.id,
|
|
15
|
+
'activity-list__item--clicking': clickingIndex == index
|
|
16
|
+
}"
|
|
17
|
+
role="tab"
|
|
18
|
+
:aria-selected="current == item.id"
|
|
19
|
+
:tabindex="current == item.id ? 0 : -1"
|
|
20
|
+
@click="handelClick(item, index)"
|
|
21
|
+
@keydown.enter.prevent="handelClick(item, index)"
|
|
22
|
+
@keydown.space.prevent="handelClick(item, index)"
|
|
23
|
+
@keydown.left.prevent="selectAdjacent(index, -1)"
|
|
24
|
+
@keydown.right.prevent="selectAdjacent(index, 1)"
|
|
25
|
+
>
|
|
26
|
+
<!-- 图片 -->
|
|
27
|
+
<image
|
|
28
|
+
class="activity-list__image"
|
|
29
|
+
:src="item.squareImage || 'https://s.qiuxietang.com/images/202507/1390637519904706560.png'"
|
|
30
|
+
mode="aspectFill"
|
|
31
|
+
></image>
|
|
32
|
+
<!-- 倒计时 -->
|
|
33
|
+
<view class="activity-list__time" :style="timeStyle(item)">
|
|
34
|
+
<view
|
|
35
|
+
class="activity-list__time-box"
|
|
36
|
+
v-if="item.endTime"
|
|
37
|
+
:style="{
|
|
38
|
+
backgroundColor:
|
|
39
|
+
currentTime > item.startTime ? 'var(--snake-color-error, #ff525d)' : ''
|
|
40
|
+
}"
|
|
41
|
+
>
|
|
42
|
+
<text v-if="currentTime < item.startTime">拍卖预告</text>
|
|
43
|
+
<template v-else>
|
|
44
|
+
<view class="activity-list__time-icon">
|
|
45
|
+
<snake-icon
|
|
46
|
+
name="clock"
|
|
47
|
+
size="20rpx"
|
|
48
|
+
color="var(--snake-color-white, #ffffff)"
|
|
49
|
+
></snake-icon>
|
|
50
|
+
</view>
|
|
51
|
+
<text class="activity-list__countdown">
|
|
52
|
+
{{ uni.$snake.formatTime(item.endTime, 'mm-dd hh:MM') }}
|
|
53
|
+
</text>
|
|
54
|
+
</template>
|
|
55
|
+
</view>
|
|
56
|
+
</view>
|
|
57
|
+
<!-- 标题 -->
|
|
58
|
+
<view class="activity-list__title" v-if="index !== 0 || list.length === 1">
|
|
59
|
+
<text class="activity-list__title-main">{{ item.name }}</text>
|
|
60
|
+
<text class="activity-list__title-sub" v-if="currentTime > item.startTime">
|
|
61
|
+
{{ item.subtitle }}
|
|
62
|
+
</text>
|
|
63
|
+
<text class="activity-list__title-time activity-list__title-time--din" v-else>
|
|
64
|
+
{{ uni.$snake.formatTime(item.startTime, 'mm-dd') }}
|
|
65
|
+
<text class="activity-list__title-time--open">开场</text>
|
|
66
|
+
</text>
|
|
67
|
+
</view>
|
|
68
|
+
</view>
|
|
69
|
+
</template>
|
|
70
|
+
</view>
|
|
71
|
+
</scroll-view>
|
|
72
|
+
</view>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
/**
|
|
77
|
+
* @component ActivityList
|
|
78
|
+
* @description 横向展示拍卖活动入口、时间状态和当前选中项,并自动将当前项滚动到容器中部。
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
import Icon from '../snake-icon/snake-icon.vue';
|
|
82
|
+
|
|
83
|
+
export default {
|
|
84
|
+
name: 'activity-list',
|
|
85
|
+
options: { virtualHost: true, styleIsolation: 'shared' },
|
|
86
|
+
components: { SnakeIcon: Icon },
|
|
87
|
+
emits: ['change'],
|
|
88
|
+
props: {
|
|
89
|
+
list: {
|
|
90
|
+
type: Array,
|
|
91
|
+
default() {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
current: {
|
|
96
|
+
type: [String, Number],
|
|
97
|
+
default: '001'
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
data() {
|
|
101
|
+
return {
|
|
102
|
+
tabsScrollLeft: 0,
|
|
103
|
+
currentIndex: 0,
|
|
104
|
+
clickingIndex: -1,
|
|
105
|
+
clickTimer: undefined
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
computed: {
|
|
109
|
+
currentTime() {
|
|
110
|
+
return Date.now();
|
|
111
|
+
},
|
|
112
|
+
timeStyle() {
|
|
113
|
+
return item => {
|
|
114
|
+
const style = {};
|
|
115
|
+
if (this.current === item.id) {
|
|
116
|
+
style.top = '0rpx';
|
|
117
|
+
style.left = '0rpx';
|
|
118
|
+
}
|
|
119
|
+
return style;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
async mounted() {
|
|
124
|
+
await uni.$snake.sleep(30);
|
|
125
|
+
this.list.forEach((item, index) => {
|
|
126
|
+
if (this.current === item.id) {
|
|
127
|
+
this.currentIndex = index;
|
|
128
|
+
this.scrollIntoView();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
beforeUnmount() {
|
|
133
|
+
clearTimeout(this.clickTimer);
|
|
134
|
+
},
|
|
135
|
+
methods: {
|
|
136
|
+
handelClick(item, index) {
|
|
137
|
+
// 触发点击动画
|
|
138
|
+
this.clickingIndex = index;
|
|
139
|
+
|
|
140
|
+
// 150ms后结束点击动画
|
|
141
|
+
clearTimeout(this.clickTimer);
|
|
142
|
+
this.clickTimer = setTimeout(() => {
|
|
143
|
+
this.clickingIndex = -1;
|
|
144
|
+
}, 150);
|
|
145
|
+
|
|
146
|
+
this.currentIndex = index;
|
|
147
|
+
this.$emit('change', item, index);
|
|
148
|
+
this.scrollIntoView();
|
|
149
|
+
},
|
|
150
|
+
selectAdjacent(index, direction) {
|
|
151
|
+
if (!this.list.length) return;
|
|
152
|
+
const nextIndex = (index + direction + this.list.length) % this.list.length;
|
|
153
|
+
this.handelClick(this.list[nextIndex], nextIndex);
|
|
154
|
+
},
|
|
155
|
+
// 计算tab位置
|
|
156
|
+
scrollIntoView() {
|
|
157
|
+
// item滚动
|
|
158
|
+
this.getElementData('.activity-list__nav', data => {
|
|
159
|
+
const list = data[0];
|
|
160
|
+
this.getElementData('.activity-list__item', data2 => {
|
|
161
|
+
const el = data2[this.currentIndex];
|
|
162
|
+
this.tabsScrollLeft = el && el.width / 2 + -list.left + el.left - list.width / 2;
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
getElementData(el, callback) {
|
|
167
|
+
uni.createSelectorQuery()
|
|
168
|
+
.in(this)
|
|
169
|
+
.selectAll(el)
|
|
170
|
+
.boundingClientRect()
|
|
171
|
+
.exec(data => {
|
|
172
|
+
callback(data?.[0] || []);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
</script>
|
|
178
|
+
|
|
179
|
+
<style scoped lang="scss">
|
|
180
|
+
/* 隐藏滚动条样式 */
|
|
181
|
+
.scroll-view {
|
|
182
|
+
&::-webkit-scrollbar {
|
|
183
|
+
display: none;
|
|
184
|
+
width: 0;
|
|
185
|
+
height: 0;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.activity-list {
|
|
190
|
+
width: 100%;
|
|
191
|
+
|
|
192
|
+
/* 导航容器 */
|
|
193
|
+
&__nav {
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: flex-start;
|
|
196
|
+
width: 100%;
|
|
197
|
+
padding: 10rpx 20rpx;
|
|
198
|
+
// box-sizing: border-box;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* 活动项 */
|
|
202
|
+
&__item {
|
|
203
|
+
position: relative;
|
|
204
|
+
display: flex;
|
|
205
|
+
flex-direction: column;
|
|
206
|
+
align-items: center;
|
|
207
|
+
width: 180rpx;
|
|
208
|
+
min-width: 180rpx;
|
|
209
|
+
height: 180rpx;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
border-radius: 4rpx;
|
|
213
|
+
transform: translateZ(0); // 启用硬件加速
|
|
214
|
+
transition:
|
|
215
|
+
transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
216
|
+
border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
217
|
+
box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
218
|
+
will-change: transform, box-shadow, border-color; // 性能优化
|
|
219
|
+
|
|
220
|
+
/* 相邻项间距 */
|
|
221
|
+
+ .activity-list__item {
|
|
222
|
+
margin-left: 20rpx;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* 点击动画效果 */
|
|
226
|
+
&--clicking {
|
|
227
|
+
transform: scale(0.95);
|
|
228
|
+
// filter: brightness(0.92);
|
|
229
|
+
// box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.12);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* 激活状态样式 */
|
|
233
|
+
&--active {
|
|
234
|
+
width: 195rpx;
|
|
235
|
+
min-width: 195rpx;
|
|
236
|
+
height: 195rpx;
|
|
237
|
+
border: 4rpx solid #2d57e7;
|
|
238
|
+
border-radius: 4rpx;
|
|
239
|
+
// box-shadow: 0 6rpx 16rpx rgba(45, 87, 231, 0.3);
|
|
240
|
+
transform: translateY(-4rpx);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* 活动图片 */
|
|
245
|
+
&__image {
|
|
246
|
+
display: block;
|
|
247
|
+
width: 100%;
|
|
248
|
+
height: 100%;
|
|
249
|
+
transition:
|
|
250
|
+
transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
251
|
+
box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* 点击时图片效果 */
|
|
255
|
+
&__item--clicking &__image {
|
|
256
|
+
transform: scale(1.02);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* 激活时图片效果 */
|
|
260
|
+
&__item--active &__image {
|
|
261
|
+
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.3);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* 倒计时容器 */
|
|
265
|
+
&__time {
|
|
266
|
+
position: absolute;
|
|
267
|
+
top: 0;
|
|
268
|
+
left: 0;
|
|
269
|
+
transition:
|
|
270
|
+
top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
271
|
+
left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* 倒计时盒子 */
|
|
275
|
+
&__time-box {
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: center;
|
|
278
|
+
width: 100%;
|
|
279
|
+
height: 36rpx;
|
|
280
|
+
padding-right: 20rpx;
|
|
281
|
+
padding-left: 10rpx;
|
|
282
|
+
font-family: 'DIN-Schrift';
|
|
283
|
+
font-size: 20rpx;
|
|
284
|
+
line-height: 36rpx;
|
|
285
|
+
color: var(--snake-color-white, #ffffff);
|
|
286
|
+
background: var(--snake-color-text-secondary, #707184);
|
|
287
|
+
border-radius: 0rpx 0 4rpx 0;
|
|
288
|
+
transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* 倒计时文本 */
|
|
292
|
+
&__countdown {
|
|
293
|
+
min-width: 100%;
|
|
294
|
+
height: 36rpx;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* 倒计时图标 */
|
|
298
|
+
&__time-icon {
|
|
299
|
+
margin-right: 4rpx;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* 标题容器 */
|
|
303
|
+
&__title {
|
|
304
|
+
position: absolute;
|
|
305
|
+
top: 44rpx;
|
|
306
|
+
left: 12rpx;
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-direction: column;
|
|
309
|
+
font-family: PingFangSC-Semibold;
|
|
310
|
+
font-size: 26rpx;
|
|
311
|
+
color: var(--snake-color-text, #333);
|
|
312
|
+
transition:
|
|
313
|
+
transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
314
|
+
color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
315
|
+
opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* 主标题 */
|
|
319
|
+
&__title-main {
|
|
320
|
+
font-family: PingFangSC-Semibold;
|
|
321
|
+
font-size: 26rpx;
|
|
322
|
+
font-weight: 600;
|
|
323
|
+
color: var(--snake-color-text, #333333);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/* 副标题 */
|
|
327
|
+
&__title-sub {
|
|
328
|
+
margin-top: 4rpx;
|
|
329
|
+
font-family: PingFangSC-Light;
|
|
330
|
+
font-size: 20rpx;
|
|
331
|
+
font-weight: 300;
|
|
332
|
+
color: var(--snake-color-text-secondary, #666666);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/* 激活状态标题样式 */
|
|
336
|
+
&__item--active &__title {
|
|
337
|
+
top: 48rpx;
|
|
338
|
+
left: 16rpx;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&__title-time {
|
|
342
|
+
margin-top: 4rpx;
|
|
343
|
+
font-size: 20rpx;
|
|
344
|
+
color: var(--snake-color-text-muted, #888891);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
&__title-time--din {
|
|
348
|
+
font-family: 'DIN-Schrift';
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
&__title-time--open {
|
|
352
|
+
font-weight: 500;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
@media (prefers-reduced-motion: reduce) {
|
|
357
|
+
.activity-list__item,
|
|
358
|
+
.activity-list__image,
|
|
359
|
+
.activity-list__time,
|
|
360
|
+
.activity-list__time-box,
|
|
361
|
+
.activity-list__title {
|
|
362
|
+
transition: none;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** ActivityList 数据项。 */
|
|
2
|
+
export interface ActivityListItem extends Record<string, any> {
|
|
3
|
+
/** 数据唯一标识。 */
|
|
4
|
+
id: string | number;
|
|
5
|
+
/** 数据项名称或唯一标识。 */
|
|
6
|
+
name?: string;
|
|
7
|
+
/** subtitle 配置。 */
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
/** square image 配置。 */
|
|
10
|
+
squareImage?: string;
|
|
11
|
+
/** start time 配置。 */
|
|
12
|
+
startTime?: number;
|
|
13
|
+
/** end time 配置。 */
|
|
14
|
+
endTime?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** ActivityList 组件的公开属性。 */
|
|
18
|
+
export interface ActivityListProps {
|
|
19
|
+
/** 用于渲染的数据列表。 */
|
|
20
|
+
list?: ActivityListItem[];
|
|
21
|
+
/** 当前激活项索引。 */
|
|
22
|
+
current?: string | number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** ActivityList 组件的事件契约。 */
|
|
26
|
+
export type ActivityListEmits = {
|
|
27
|
+
/** change 事件携带的参数。 */
|
|
28
|
+
change: [item: ActivityListItem, index: number];
|
|
29
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="auxiliarysegmentation">
|
|
3
|
+
<view
|
|
4
|
+
class="contan"
|
|
5
|
+
:style="{
|
|
6
|
+
height: addUnit(datas.blankHeight, 'px'),
|
|
7
|
+
padding: datas.paddType === 0 ? '0px' : '0px 15px',
|
|
8
|
+
backgroundColor: datas.bgColor
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<view
|
|
12
|
+
v-show="datas.segmentationtype === 1"
|
|
13
|
+
style="width: 100%; height: 1px; border-top-width: 1px"
|
|
14
|
+
:style="{
|
|
15
|
+
'border-top-style': datas.bordertp,
|
|
16
|
+
'border-top-color': datas.auxliarColor
|
|
17
|
+
}"
|
|
18
|
+
/>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
/**
|
|
25
|
+
* @component AuxiliarySegmentation
|
|
26
|
+
* @description 在装修页面中插入留白,或在留白区域中央绘制一条可配置分割线。
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { addUnit } from '../../libs/function/unit';
|
|
30
|
+
import type { AuxiliarySegmentationProps } from './types';
|
|
31
|
+
|
|
32
|
+
defineOptions({ name: 'AuxiliarySegmentation', options: { virtualHost: true, styleIsolation: 'shared' } });
|
|
33
|
+
withDefaults(defineProps<AuxiliarySegmentationProps>(), { datas: () => ({}) });
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style scoped lang="scss">
|
|
37
|
+
.auxiliarysegmentation {
|
|
38
|
+
.contan {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</style>
|