@puresnake/snake-ui 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/LICENSE +21 -0
  2. package/changelog.md +83 -0
  3. package/components/snake-activity-list/snake-activity-list.vue +365 -0
  4. package/components/snake-activity-list/types.ts +29 -0
  5. package/components/snake-auxiliary-segmentation/snake-auxiliary-segmentation.vue +44 -0
  6. package/components/snake-auxiliary-segmentation/types.ts +5 -0
  7. package/components/snake-button/snake-button.vue +357 -0
  8. package/components/snake-button/types.ts +103 -0
  9. package/components/snake-button-sort/snake-button-sort.vue +72 -0
  10. package/components/snake-button-sort/types.ts +22 -0
  11. package/components/snake-calendar/snake-calendar.vue +998 -0
  12. package/components/snake-calendar/types.ts +189 -0
  13. package/components/snake-cell-group/snake-cell-group.vue +55 -0
  14. package/components/snake-cell-group/types.ts +19 -0
  15. package/components/snake-cell-item/snake-cell-item.vue +159 -0
  16. package/components/snake-cell-item/types.ts +66 -0
  17. package/components/snake-checkbox/snake-checkbox.vue +264 -0
  18. package/components/snake-checkbox/types.ts +70 -0
  19. package/components/snake-checkbox-group/snake-checkbox-group.vue +154 -0
  20. package/components/snake-checkbox-group/types.ts +52 -0
  21. package/components/snake-cms/blocks/v2/cms-v2-carousel.vue +87 -0
  22. package/components/snake-cms/blocks/v2/cms-v2-coupon.vue +25 -0
  23. package/components/snake-cms/blocks/v2/cms-v2-custom.vue +12 -0
  24. package/components/snake-cms/blocks/v2/cms-v2-divider.vue +33 -0
  25. package/components/snake-cms/blocks/v2/cms-v2-floatbutton.vue +28 -0
  26. package/components/snake-cms/blocks/v2/cms-v2-goods-list.vue +150 -0
  27. package/components/snake-cms/blocks/v2/cms-v2-hotzone.vue +41 -0
  28. package/components/snake-cms/blocks/v2/cms-v2-images.vue +41 -0
  29. package/components/snake-cms/blocks/v2/cms-v2-magiccube.vue +93 -0
  30. package/components/snake-cms/blocks/v2/cms-v2-notice.vue +80 -0
  31. package/components/snake-cms/blocks/v2/cms-v2-popup.vue +46 -0
  32. package/components/snake-cms/blocks/v2/cms-v2-richtext.vue +18 -0
  33. package/components/snake-cms/blocks/v2/cms-v2-search.vue +115 -0
  34. package/components/snake-cms/blocks/v2/cms-v2-video.vue +25 -0
  35. package/components/snake-cms/blocks/v2/shared.ts +84 -0
  36. package/components/snake-cms/snake-cms.vue +409 -0
  37. package/components/snake-cms/types.ts +50 -0
  38. package/components/snake-commodity-search/snake-commodity-search.vue +234 -0
  39. package/components/snake-commodity-search/types.ts +11 -0
  40. package/components/snake-config-provider/snake-config-provider.vue +61 -0
  41. package/components/snake-config-provider/types.ts +22 -0
  42. package/components/snake-count-down/snake-count-down.vue +231 -0
  43. package/components/snake-count-down/types.ts +103 -0
  44. package/components/snake-coupon/snake-coupon.vue +209 -0
  45. package/components/snake-coupon/types.ts +21 -0
  46. package/components/snake-custom-module/snake-custom-module.vue +25 -0
  47. package/components/snake-custom-module/types.ts +11 -0
  48. package/components/snake-drop-menu/snake-drop-menu.vue +123 -0
  49. package/components/snake-drop-menu/types.ts +95 -0
  50. package/components/snake-drop-menu-item/snake-drop-menu-item.vue +181 -0
  51. package/components/snake-drop-menu-item/types.ts +48 -0
  52. package/components/snake-empty/snake-empty.vue +100 -0
  53. package/components/snake-empty/types.ts +48 -0
  54. package/components/snake-filter-sorts/filter-page.vue +695 -0
  55. package/components/snake-filter-sorts/snake-filter-sorts.vue +185 -0
  56. package/components/snake-filter-sorts/types.ts +57 -0
  57. package/components/snake-floating-bubble/snake-floating-bubble.vue +157 -0
  58. package/components/snake-floating-bubble/types.ts +43 -0
  59. package/components/snake-follow/snake-follow.vue +18 -0
  60. package/components/snake-follow/types.ts +2 -0
  61. package/components/snake-form/snake-form.vue +124 -0
  62. package/components/snake-form/types.ts +96 -0
  63. package/components/snake-form-item/snake-form-item.vue +331 -0
  64. package/components/snake-form-item/types.ts +70 -0
  65. package/components/snake-goods-list/snake-goods-list.vue +792 -0
  66. package/components/snake-goods-list/types.ts +55 -0
  67. package/components/snake-graphic-navigation/snake-graphic-navigation.vue +198 -0
  68. package/components/snake-graphic-navigation/types.ts +43 -0
  69. package/components/snake-icon/icon-names.ts +222 -0
  70. package/components/snake-icon/snake-icon.vue +220 -0
  71. package/components/snake-icon/types.ts +45 -0
  72. package/components/snake-image/snake-image.vue +230 -0
  73. package/components/snake-image/types.ts +70 -0
  74. package/components/snake-images/snake-images.vue +80 -0
  75. package/components/snake-images/types.ts +5 -0
  76. package/components/snake-index-anchor/snake-index-anchor.vue +83 -0
  77. package/components/snake-index-anchor/types.ts +14 -0
  78. package/components/snake-index-list/anchor-registry.ts +80 -0
  79. package/components/snake-index-list/snake-index-list.vue +259 -0
  80. package/components/snake-index-list/types.ts +115 -0
  81. package/components/snake-index-list-panel/snake-index-list-panel.vue +277 -0
  82. package/components/snake-index-list-panel/types.ts +10 -0
  83. package/components/snake-input/snake-input.vue +225 -0
  84. package/components/snake-input/types.ts +99 -0
  85. package/components/snake-jump-applet/snake-jump-applet.vue +99 -0
  86. package/components/snake-jump-applet/types.ts +17 -0
  87. package/components/snake-line/snake-line.vue +42 -0
  88. package/components/snake-line/types.ts +30 -0
  89. package/components/snake-line-progress/snake-line-progress.vue +105 -0
  90. package/components/snake-line-progress/types.ts +26 -0
  91. package/components/snake-link/snake-link.vue +74 -0
  92. package/components/snake-link/types.ts +30 -0
  93. package/components/snake-list-switching/components/tree-select/index.vue +156 -0
  94. package/components/snake-list-switching/snake-list-switching.vue +1285 -0
  95. package/components/snake-list-switching/types.ts +11 -0
  96. package/components/snake-loading/snake-loading.vue +241 -0
  97. package/components/snake-loading/types.ts +34 -0
  98. package/components/snake-loadmore/snake-loadmore.vue +103 -0
  99. package/components/snake-loadmore/types.ts +56 -0
  100. package/components/snake-magic-cube/snake-magic-cube.vue +622 -0
  101. package/components/snake-magic-cube/types.ts +5 -0
  102. package/components/snake-modal/snake-modal.vue +434 -0
  103. package/components/snake-modal/types.ts +71 -0
  104. package/components/snake-navbar/snake-navbar.vue +194 -0
  105. package/components/snake-navbar/types.ts +54 -0
  106. package/components/snake-no-network/snake-no-network.vue +125 -0
  107. package/components/snake-no-network/types.ts +27 -0
  108. package/components/snake-notice/snake-notice.vue +44 -0
  109. package/components/snake-notice/types.ts +5 -0
  110. package/components/snake-notice-bar/snake-notice-bar.vue +336 -0
  111. package/components/snake-notice-bar/types.ts +82 -0
  112. package/components/snake-overlay/snake-overlay.vue +73 -0
  113. package/components/snake-overlay/types.ts +35 -0
  114. package/components/snake-page-popup/snake-page-popup.vue +146 -0
  115. package/components/snake-page-popup/types.ts +28 -0
  116. package/components/snake-parse/audio/audio.vue +286 -0
  117. package/components/snake-parse/audio/context.js +11 -0
  118. package/components/snake-parse/audio/index.js +34 -0
  119. package/components/snake-parse/node/node.vue +830 -0
  120. package/components/snake-parse/parser.js +1480 -0
  121. package/components/snake-parse/snake-parse.vue +548 -0
  122. package/components/snake-parse/static/app-plus/snake-parse/js/handler.js +109 -0
  123. package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.js +0 -0
  124. package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.min.js +1 -0
  125. package/components/snake-parse/static/app-plus/snake-parse/local.html +3 -0
  126. package/components/snake-parse/style/index.js +132 -0
  127. package/components/snake-parse/style/parser.js +175 -0
  128. package/components/snake-parse/types.ts +49 -0
  129. package/components/snake-picture-ads/snake-picture-ads.vue +292 -0
  130. package/components/snake-picture-ads/types.ts +5 -0
  131. package/components/snake-popup/snake-popup.vue +348 -0
  132. package/components/snake-popup/types.ts +88 -0
  133. package/components/snake-qr-code/qrcode.ts +1214 -0
  134. package/components/snake-qr-code/snake-qr-code.vue +408 -0
  135. package/components/snake-qr-code/types.ts +78 -0
  136. package/components/snake-radio/snake-radio.vue +271 -0
  137. package/components/snake-radio/types.ts +64 -0
  138. package/components/snake-radio-group/snake-radio-group.vue +98 -0
  139. package/components/snake-radio-group/types.ts +48 -0
  140. package/components/snake-read-more/snake-read-more.vue +140 -0
  141. package/components/snake-read-more/types.ts +53 -0
  142. package/components/snake-rich-text/snake-rich-text.vue +24 -0
  143. package/components/snake-rich-text/types.ts +5 -0
  144. package/components/snake-root-portal/snake-root-portal.vue +92 -0
  145. package/components/snake-root-portal/types.ts +9 -0
  146. package/components/snake-search/snake-search.vue +202 -0
  147. package/components/snake-search/types.ts +84 -0
  148. package/components/snake-select/snake-select.vue +371 -0
  149. package/components/snake-select/types.ts +75 -0
  150. package/components/snake-skeleton/snake-skeleton.vue +104 -0
  151. package/components/snake-skeleton/types.ts +32 -0
  152. package/components/snake-skeleton-item/snake-skeleton-item.vue +90 -0
  153. package/components/snake-skeleton-item/types.ts +30 -0
  154. package/components/snake-slider/snake-slider.vue +249 -0
  155. package/components/snake-slider/types.ts +59 -0
  156. package/components/snake-sticky/snake-sticky.vue +178 -0
  157. package/components/snake-sticky/types.ts +48 -0
  158. package/components/snake-subsection/snake-subsection.vue +188 -0
  159. package/components/snake-subsection/types.ts +54 -0
  160. package/components/snake-swiper/snake-swiper.vue +229 -0
  161. package/components/snake-swiper/types.ts +79 -0
  162. package/components/snake-switch/snake-switch.vue +100 -0
  163. package/components/snake-switch/types.ts +41 -0
  164. package/components/snake-tabbar/snake-tabbar.vue +306 -0
  165. package/components/snake-tabbar/types.ts +93 -0
  166. package/components/snake-tabs/snake-tabs.vue +305 -0
  167. package/components/snake-tabs/types.ts +79 -0
  168. package/components/snake-text/snake-text.vue +292 -0
  169. package/components/snake-text/types.ts +100 -0
  170. package/components/snake-textarea/snake-textarea.vue +171 -0
  171. package/components/snake-textarea/types.ts +79 -0
  172. package/components/snake-toast/snake-toast.vue +330 -0
  173. package/components/snake-toast/types.ts +55 -0
  174. package/components/snake-tooltip/position.ts +33 -0
  175. package/components/snake-tooltip/snake-tooltip.vue +339 -0
  176. package/components/snake-tooltip/types.ts +80 -0
  177. package/components/snake-transition/snake-transition.vue +315 -0
  178. package/components/snake-transition/types.ts +65 -0
  179. package/components/snake-upload/snake-upload.vue +1801 -0
  180. package/components/snake-upload/types.ts +256 -0
  181. package/components/snake-videos/snake-videos.vue +122 -0
  182. package/components/snake-videos/types.ts +7 -0
  183. package/iconfont.css +881 -0
  184. package/index.d.ts +7 -0
  185. package/index.scss +26 -0
  186. package/index.ts +94 -0
  187. package/libs/cms/blocks.ts +103 -0
  188. package/libs/cms/config.ts +25 -0
  189. package/libs/cms/index.ts +7 -0
  190. package/libs/cms/normalize.ts +135 -0
  191. package/libs/cms/resolve.ts +12 -0
  192. package/libs/cms/types.ts +164 -0
  193. package/libs/cms/use-commerce.ts +385 -0
  194. package/libs/cms/v2.ts +193 -0
  195. package/libs/config/index.ts +4 -0
  196. package/libs/config/modal.ts +93 -0
  197. package/libs/config/state.ts +33 -0
  198. package/libs/config/theme.ts +351 -0
  199. package/libs/config/toast.ts +71 -0
  200. package/libs/config/types.ts +135 -0
  201. package/libs/config/zIndex.ts +44 -0
  202. package/libs/css/color.scss +105 -0
  203. package/libs/css/common.scss +171 -0
  204. package/libs/css/style.h5.scss +7 -0
  205. package/libs/css/style.mp.scss +7 -0
  206. package/libs/css/style.theme.scss +70 -0
  207. package/libs/css/style.vue.scss +140 -0
  208. package/libs/form/async-validator.min.d.ts +75 -0
  209. package/libs/form/async-validator.min.js +3 -0
  210. package/libs/form/index.ts +3 -0
  211. package/libs/form/path.ts +40 -0
  212. package/libs/form/types.ts +51 -0
  213. package/libs/form/validate.ts +149 -0
  214. package/libs/foundation.ts +96 -0
  215. package/libs/function/$parent.ts +33 -0
  216. package/libs/function/clipboard.ts +13 -0
  217. package/libs/function/color.ts +55 -0
  218. package/libs/function/debounce.ts +34 -0
  219. package/libs/function/deepClone.ts +30 -0
  220. package/libs/function/deepMerge.ts +25 -0
  221. package/libs/function/emitter.ts +30 -0
  222. package/libs/function/format.ts +27 -0
  223. package/libs/function/getParent.ts +53 -0
  224. package/libs/function/getRect.ts +29 -0
  225. package/libs/function/guid.ts +11 -0
  226. package/libs/function/index.ts +31 -0
  227. package/libs/function/queryParams.ts +73 -0
  228. package/libs/function/random.ts +6 -0
  229. package/libs/function/randomArray.ts +14 -0
  230. package/libs/function/route.ts +155 -0
  231. package/libs/function/sleep.ts +7 -0
  232. package/libs/function/style.ts +58 -0
  233. package/libs/function/styleUtils.ts +83 -0
  234. package/libs/function/system.ts +14 -0
  235. package/libs/function/test.ts +202 -0
  236. package/libs/function/throttle.ts +36 -0
  237. package/libs/function/timeFormat.ts +27 -0
  238. package/libs/function/timeFrom.ts +27 -0
  239. package/libs/function/toast.ts +10 -0
  240. package/libs/function/trim.ts +11 -0
  241. package/libs/function/type2icon.ts +11 -0
  242. package/libs/function/unit.ts +45 -0
  243. package/libs/hooks/index.ts +11 -0
  244. package/libs/hooks/useChildren.ts +125 -0
  245. package/libs/hooks/useColor.ts +5 -0
  246. package/libs/hooks/useDebounce.ts +5 -0
  247. package/libs/hooks/useLocale.ts +13 -0
  248. package/libs/hooks/useModal.ts +131 -0
  249. package/libs/hooks/useParent.ts +62 -0
  250. package/libs/hooks/useRect.ts +44 -0
  251. package/libs/hooks/useRouter.ts +5 -0
  252. package/libs/hooks/useTheme.ts +31 -0
  253. package/libs/hooks/useThrottle.ts +5 -0
  254. package/libs/hooks/useToast.ts +116 -0
  255. package/libs/index.ts +18 -0
  256. package/libs/request/auto-http.ts +1 -0
  257. package/libs/request/index.ts +343 -0
  258. package/libs/runtime/accessors.ts +55 -0
  259. package/libs/runtime/context.ts +40 -0
  260. package/libs/runtime/index.ts +18 -0
  261. package/libs/runtime/types.ts +49 -0
  262. package/libs/util/calendar.ts +6 -0
  263. package/locale/index.ts +130 -0
  264. package/locale/lang/en-US.ts +67 -0
  265. package/locale/lang/zh-CN.ts +67 -0
  266. package/package.json +134 -5
  267. package/plugins/index.ts +1 -0
  268. package/plugins/root/README.md +86 -0
  269. package/plugins/root/index.ts +123 -0
  270. package/plugins/root/page.ts +77 -0
  271. package/plugins/root/root.ts +53 -0
  272. package/plugins/root/utils.ts +137 -0
  273. package/readme.md +79 -0
  274. package/theme.scss +118 -0
  275. package/types/components.d.ts +236 -0
  276. package/types/global.d.ts +21 -0
  277. package/types/index.d.ts +6 -0
  278. package/types/uni-app.d.ts +16 -0
  279. 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,83 @@
1
+ # 更新日志
2
+
3
+ ## 0.0.2(2026-10-29)
4
+
5
+ - 补齐 package.json `exports` 子路径:`./libs/*`、`./plugins/*`、`./locale/*`、`./iconfont.css`,接入方可以直接通过 `@puresnake/snake-ui/libs/...` 等子路径 import
6
+ - 新增 `pnpm changelog:sync`:本文件单向同步到 `docs/components/changelog.md`,文档站更新日志随发版自动对齐
7
+
8
+ ## 0.0.1(2026-10-29)
9
+
10
+ - 首个 npm 公开发布版本(`@puresnake/snake-ui`,MIT)
11
+ - 基于 Vue 3 + TypeScript 的 uni-app 组件库,面向商城与 CMS 场景
12
+ - 14 个配置驱动的 CMS 页面区块,统一由 `snake-cms` 渲染
13
+ - 内置明暗主题(`theme.scss`)、`zh-CN` / `en-US` 多语言、基于 `uni.request` 的 HTTP 客户端与常用 hooks / 工具
14
+ - easycom 按需引入,精简打包体积
15
+ - 兼容 H5、微信小程序、App 等多端
16
+
17
+ ## 组件索引
18
+
19
+ 以下清单随组件目录更新,当前共 46 个通用组件入口。
20
+
21
+ 基础组件(12)
22
+
23
+ - Parse 富文本解析
24
+ - ConfigProvider 全局配置
25
+ - Button 按钮
26
+ - Icon 图标
27
+ - Image 图片
28
+ - QrCode 二维码
29
+ - Loading 加载
30
+ - Skeleton 骨架屏
31
+ - Transition 过渡动画
32
+ - RootPortal 根节点传送
33
+ - Text 文本
34
+ - Link 超链接
35
+
36
+ 表单组件(11)
37
+
38
+ - Form 表单
39
+ - Input 输入框
40
+ - Textarea 文本域
41
+ - Checkbox 复选框
42
+ - Radio 单选框
43
+ - Switch 开关
44
+ - Slider 滑动选择器
45
+ - Search 搜索框
46
+ - Select 列选择器
47
+ - Upload 文件上传
48
+ - Calendar 日历
49
+
50
+ 数据组件(5)
51
+
52
+ - Loadmore 加载更多
53
+ - LineProgress 线形进度条
54
+ - ReadMore 阅读更多
55
+ - Empty 空状态
56
+ - CountDown 倒计时
57
+
58
+ 反馈组件(5)
59
+
60
+ - NoticeBar 通知栏
61
+ - Overlay 遮罩层
62
+ - Tooltip 文字提示
63
+ - Popup 弹出层
64
+ - NoNetwork 无网络提示
65
+
66
+ 布局组件(4)
67
+
68
+ - Swiper 轮播图
69
+ - Sticky 吸顶
70
+ - Line 分隔线
71
+ - Cell 单元格
72
+
73
+ 导航组件(9)
74
+
75
+ - Navbar 导航栏
76
+ - Tabbar 底部导航栏
77
+ - Tabs 标签页
78
+ - Subsection 分段器
79
+ - ButtonSort 排序按钮
80
+ - DropMenu 下拉菜单
81
+ - IndexList 索引列表
82
+ - IndexListPanel 容器索引列表
83
+ - IndexAnchor 索引锚点
@@ -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>
@@ -0,0 +1,5 @@
1
+ /** AuxiliarySegmentation 组件的公开属性。 */
2
+ export interface AuxiliarySegmentationProps<Data extends Record<string, any> = Record<string, any>> {
3
+ /** CMS 装修组件配置数据。 */
4
+ datas?: Data;
5
+ }