home.uvue 10 KB

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