home.uvue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <cl-page>
  3. <cl-topbar
  4. fixed
  5. :show-back="false"
  6. safe-area-top
  7. :height="isMp() ? null : 50"
  8. :pt="{
  9. className: '!z-50'
  10. }"
  11. background-color="transparent"
  12. >
  13. <view
  14. class="flex flex-row items-center p-3 flex-1 w-full"
  15. :class="{
  16. 'pt-0': isMp()
  17. }"
  18. >
  19. <view
  20. class="bg-white rounded-lg h-[32px] w-[32px] flex flex-row items-center justify-center"
  21. >
  22. <cl-image
  23. src="/static/logo.png"
  24. :width="18"
  25. :height="18"
  26. :show-loading="false"
  27. ></cl-image>
  28. </view>
  29. <cl-text
  30. :size="16"
  31. :pt="{
  32. className: 'mr-auto ml-2 flex-1 font-bold'
  33. }"
  34. >
  35. {{ config.name }}
  36. </cl-text>
  37. <view
  38. class="bg-surface-500 h-[32px] w-[32px] rounded-full flex flex-row items-center justify-center mr-3"
  39. @tap="setSize"
  40. >
  41. <cl-icon name="font-size" color="white" :size="16"></cl-icon>
  42. </view>
  43. <view
  44. class="bg-primary-500 h-[32px] w-[32px] rounded-full flex flex-row items-center justify-center"
  45. :class="{
  46. 'mr-24': isMp()
  47. }"
  48. @tap="setLocale"
  49. >
  50. <cl-icon name="translate" color="white" :size="16"></cl-icon>
  51. </view>
  52. </view>
  53. </cl-topbar>
  54. <view class="p-3">
  55. <view class="group" v-for="item in data" :key="item.label">
  56. <cl-text :size="12" :pt="{ className: '!text-surface-400 mb-2 ml-2' }"
  57. >{{ item.label }}({{ item.children?.length ?? 0 }})</cl-text
  58. >
  59. <view class="list">
  60. <cl-row :gutter="10">
  61. <template v-for="child in item.children" :key="child.label">
  62. <cl-col :span="6" v-if="child.hidden != true">
  63. <view
  64. class="item dark:!bg-surface-800"
  65. hover-class="opacity-80"
  66. :hover-stay-time="250"
  67. @tap="toPath(child)"
  68. >
  69. <cl-icon :name="child.icon" :size="18"></cl-icon>
  70. <cl-text
  71. :size="12"
  72. :pt="{
  73. className: 'mt-2 text-center'
  74. }"
  75. >{{ child.label }}</cl-text
  76. >
  77. </view>
  78. </cl-col>
  79. </template>
  80. </cl-row>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 自定义底部导航栏 -->
  85. <custom-tabbar></custom-tabbar>
  86. <!-- 主题设置 -->
  87. <locale-set :ref="refs.set('localeSet')"></locale-set>
  88. <!-- 字体大小设置 -->
  89. <size-set :ref="refs.set('sizeSet')"></size-set>
  90. </cl-page>
  91. </template>
  92. <script lang="ts" setup>
  93. import { isApp, isMp, router, useRefs, t } from "@/.cool";
  94. import { computed } from "vue";
  95. import { useUi } from "@/uni_modules/cool-ui";
  96. import { config } from "@/config";
  97. import LocaleSet from "@/components/locale-set.uvue";
  98. import SizeSet from "@/components/size-set.uvue";
  99. import CustomTabbar from "./components/tabbar.uvue";
  100. const ui = useUi();
  101. const refs = useRefs();
  102. type Item = {
  103. label: string;
  104. icon?: string;
  105. path?: string;
  106. disabled?: boolean;
  107. hidden?: boolean;
  108. children?: Item[];
  109. };
  110. const data = computed<Item[]>(() => {
  111. return [
  112. {
  113. label: t("基础组件"),
  114. children: [
  115. {
  116. label: t("文本"),
  117. icon: "text",
  118. path: "/pages/demo/basic/text"
  119. },
  120. {
  121. label: t("按钮"),
  122. icon: "mouse-line",
  123. path: "/pages/demo/basic/button"
  124. },
  125. {
  126. label: t("图片"),
  127. icon: "image-line",
  128. path: "/pages/demo/basic/image"
  129. },
  130. {
  131. label: t("图标"),
  132. icon: "puzzle-2-line",
  133. path: "/pages/demo/basic/icon"
  134. },
  135. {
  136. label: t("标签"),
  137. icon: "price-tag-3-line",
  138. path: "/pages/demo/basic/tag"
  139. }
  140. ]
  141. },
  142. {
  143. label: t("表单组件"),
  144. children: [
  145. {
  146. label: t("表单验证"),
  147. icon: "draft-line",
  148. path: "/pages/demo/form/form"
  149. },
  150. {
  151. label: t("输入框"),
  152. icon: "input-field",
  153. path: "/pages/demo/form/input"
  154. },
  155. {
  156. label: t("文本域"),
  157. icon: "text-block",
  158. path: "/pages/demo/form/textarea"
  159. },
  160. {
  161. label: t("计数器"),
  162. icon: "increase-decrease-line",
  163. path: "/pages/demo/form/input-number"
  164. },
  165. {
  166. label: t("口令输入"),
  167. icon: "input-method-line",
  168. path: "/pages/demo/form/input-otp"
  169. },
  170. {
  171. label: t("键盘"),
  172. icon: "keyboard-box-line",
  173. path: "/pages/demo/form/keyboard"
  174. },
  175. {
  176. label: t("单选框"),
  177. icon: "radio-button-line",
  178. path: "/pages/demo/form/radio"
  179. },
  180. {
  181. label: t("多选框"),
  182. icon: "checkbox-line",
  183. path: "/pages/demo/form/checkbox"
  184. },
  185. {
  186. label: t("开关"),
  187. icon: "toggle-line",
  188. path: "/pages/demo/form/switch"
  189. },
  190. {
  191. label: t("评分"),
  192. icon: "star-line",
  193. path: "/pages/demo/form/rate"
  194. },
  195. {
  196. label: t("滑块"),
  197. icon: "equalizer-2-line",
  198. path: "/pages/demo/form/slider"
  199. },
  200. {
  201. label: t("选择器"),
  202. icon: "dropdown-list",
  203. path: "/pages/demo/form/select"
  204. },
  205. {
  206. label: t("日期选择器"),
  207. icon: "calendar-line",
  208. path: "/pages/demo/form/select-date"
  209. },
  210. {
  211. label: t("时间选择器"),
  212. icon: "time-line",
  213. path: "/pages/demo/form/select-time"
  214. },
  215. {
  216. label: t("级联选择器"),
  217. icon: "stacked-view",
  218. path: "/pages/demo/form/cascader"
  219. },
  220. {
  221. label: t("文件上传"),
  222. icon: "file-upload-line",
  223. path: "/pages/demo/form/upload"
  224. },
  225. {
  226. label: t("日历"),
  227. icon: "calendar-line",
  228. path: "/pages/demo/form/calendar"
  229. }
  230. ]
  231. },
  232. {
  233. label: t("布局组件"),
  234. children: [
  235. {
  236. label: t("弹性布局"),
  237. icon: "layout-2-line",
  238. path: "/pages/demo/layout/flex"
  239. },
  240. {
  241. label: t("标签页"),
  242. icon: "function-add-line",
  243. path: "/pages/demo/layout/tabs"
  244. },
  245. {
  246. label: t("折叠面板"),
  247. icon: "collapse-vertical-line",
  248. path: "/pages/demo/layout/collapse"
  249. },
  250. {
  251. label: t("吸顶"),
  252. icon: "align-top",
  253. path: "/pages/demo/layout/sticky"
  254. },
  255. {
  256. label: t("导航栏"),
  257. icon: "layout-top-line",
  258. path: "/pages/demo/layout/topbar"
  259. },
  260. {
  261. label: t("底部视图"),
  262. icon: "layout-bottom-line",
  263. path: "/pages/demo/layout/footer"
  264. },
  265. {
  266. label: t("悬浮视图"),
  267. icon: "picture-in-picture-line",
  268. path: "/pages/demo/layout/float-view"
  269. },
  270. {
  271. label: t("底部导航栏"),
  272. icon: "layout-bottom-2-line",
  273. path: "/pages/demo/layout/tabbar"
  274. }
  275. ]
  276. },
  277. {
  278. label: t("数据展示"),
  279. children: [
  280. {
  281. label: t("头像"),
  282. icon: "account-circle-line",
  283. path: "/pages/demo/data/avatar"
  284. },
  285. {
  286. label: t("查看更多"),
  287. icon: "menu-add-line",
  288. path: "/pages/demo/data/read-more"
  289. },
  290. {
  291. label: t("列表"),
  292. icon: "list-check",
  293. path: "/pages/demo/data/list"
  294. },
  295. {
  296. label: t("列表视图"),
  297. icon: "list-view",
  298. path: "/pages/demo/data/list-view"
  299. },
  300. {
  301. label: t("列表刷新"),
  302. icon: "refresh-line",
  303. path: "/pages/demo/data/list-view-refresh",
  304. disabled: false
  305. },
  306. {
  307. label: t("瀑布流"),
  308. icon: "layout-column-line",
  309. path: "/pages/demo/data/waterfall"
  310. },
  311. {
  312. label: t("轮播图"),
  313. icon: "carousel-view",
  314. path: "/pages/demo/data/banner"
  315. },
  316. {
  317. label: t("跑马灯"),
  318. icon: "film-line",
  319. path: "/pages/demo/data/marquee"
  320. },
  321. {
  322. label: t("分页"),
  323. icon: "page-separator",
  324. path: "/pages/demo/data/pagination"
  325. },
  326. {
  327. label: t("时间轴"),
  328. icon: "timeline-view",
  329. path: "/pages/demo/data/timeline"
  330. },
  331. {
  332. label: t("拖拽"),
  333. icon: "drag-move-line",
  334. path: "/pages/demo/data/draggable"
  335. },
  336. {
  337. label: t("筛选栏"),
  338. icon: "filter-line",
  339. path: "/pages/demo/data/filter-bar"
  340. },
  341. {
  342. label: t("树形结构"),
  343. icon: "node-tree",
  344. path: "/pages/demo/data/tree"
  345. }
  346. ]
  347. },
  348. {
  349. label: t("状态组件"),
  350. children: [
  351. {
  352. label: t("角标"),
  353. icon: "notification-badge-line",
  354. path: "/pages/demo/status/badge"
  355. },
  356. {
  357. label: t("通知栏"),
  358. icon: "error-warning-line",
  359. path: "/pages/demo/status/noticebar"
  360. },
  361. {
  362. label: t("倒计时"),
  363. icon: "timer-line",
  364. path: "/pages/demo/status/countdown"
  365. },
  366. {
  367. label: t("数字滚动"),
  368. icon: "arrow-up-box-line",
  369. path: "/pages/demo/status/rolling-number"
  370. },
  371. {
  372. label: t("进度条"),
  373. icon: "subtract-line",
  374. path: "/pages/demo/status/progress"
  375. },
  376. {
  377. label: t("圆形进度条"),
  378. icon: "circle-line",
  379. path: "/pages/demo/status/progress-circle"
  380. },
  381. {
  382. label: t("骨架图"),
  383. icon: "shadow-line",
  384. path: "/pages/demo/status/skeleton"
  385. },
  386. {
  387. label: t("加载更多"),
  388. icon: "loader-4-line",
  389. path: "/pages/demo/status/loadmore"
  390. }
  391. ]
  392. },
  393. {
  394. label: t("反馈组件"),
  395. children: [
  396. {
  397. label: t("操作菜单"),
  398. icon: "menu-line",
  399. path: "/pages/demo/feedback/action-sheet"
  400. },
  401. {
  402. label: t("弹窗"),
  403. icon: "chat-4-line",
  404. path: "/pages/demo/feedback/popup"
  405. },
  406. {
  407. label: t("确认框"),
  408. icon: "chat-check-line",
  409. path: "/pages/demo/feedback/confirm"
  410. },
  411. {
  412. label: t("提示框"),
  413. icon: "message-2-line",
  414. path: "/pages/demo/feedback/toast"
  415. }
  416. ]
  417. },
  418. {
  419. label: "其他",
  420. children: [
  421. {
  422. label: "QRCode",
  423. icon: "qr-code-line",
  424. path: "/pages/demo/other/qrcode"
  425. },
  426. {
  427. label: t("签名"),
  428. icon: "sketching",
  429. path: "/pages/demo/other/sign"
  430. },
  431. {
  432. label: t("水印"),
  433. icon: "copyright-line",
  434. path: "/pages/demo/other/watermark"
  435. },
  436. {
  437. label: t("图片裁剪"),
  438. icon: "crop-line",
  439. path: "/pages/demo/other/cropper"
  440. },
  441. {
  442. label: t("Canvas"),
  443. icon: "markup-line",
  444. path: "/pages/demo/other/canvas"
  445. },
  446. {
  447. label: t("富文本"),
  448. icon: "text-snippet",
  449. path: "/pages/demo/other/rict-text",
  450. disabled: true
  451. },
  452. {
  453. label: "DayUts",
  454. icon: "timer-2-line",
  455. path: "/pages/demo/other/day-uts"
  456. },
  457. {
  458. label: "Vibrate",
  459. icon: "volume-vibrate-line",
  460. path: "/pages/demo/other/vibrate"
  461. },
  462. {
  463. label: "SVG",
  464. icon: "bubble-chart-line",
  465. path: "/pages/demo/other/svg"
  466. },
  467. {
  468. label: "SlideVerify",
  469. icon: "contract-right-fill",
  470. path: "/pages/demo/other/slide-verify"
  471. },
  472. {
  473. label: "Animation",
  474. icon: "instance-line",
  475. path: "/pages/demo/other/animation"
  476. },
  477. {
  478. label: "Router",
  479. icon: "compass-discover-line",
  480. path: "/pages/demo/other/router/index"
  481. },
  482. {
  483. label: "Share",
  484. icon: "share-line",
  485. path: "/pages/demo/other/share",
  486. hidden: !isApp()
  487. },
  488. {
  489. label: t("选座"),
  490. icon: "armchair-line",
  491. path: "/pages/demo/other/select-seat"
  492. }
  493. ]
  494. }
  495. ];
  496. });
  497. function toPath(item: Item) {
  498. if (item.disabled == true) {
  499. return ui.showToast({
  500. message: t("该功能正在开发中")
  501. });
  502. }
  503. router.to(item.path!);
  504. }
  505. function setLocale() {
  506. refs.open("localeSet");
  507. }
  508. function setSize() {
  509. refs.open("sizeSet");
  510. }
  511. </script>
  512. <style lang="scss" scoped>
  513. .group {
  514. @apply mb-10;
  515. .list {
  516. .item {
  517. @apply flex flex-col items-center;
  518. @apply rounded-xl bg-white px-2;
  519. height: 70px;
  520. margin-bottom: 5px;
  521. padding-top: 18px;
  522. }
  523. }
  524. }
  525. </style>