@kevairy/template 0.1.0
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/README.md +14 -0
- package/package.json +37 -0
- package/template/.env +22 -0
- package/template/.env.development +13 -0
- package/template/.env.production +10 -0
- package/template/.prettierignore +3 -0
- package/template/.prettierrc +20 -0
- package/template/.stylelintignore +9 -0
- package/template/.stylelintrc.cjs +84 -0
- package/template/LICENSE +21 -0
- package/template/README.md +22 -0
- package/template/_gitignore +19 -0
- package/template/eslint-auto-import.json +324 -0
- package/template/eslint.config.mjs +83 -0
- package/template/index.html +25 -0
- package/template/package.json +79 -0
- package/template/playwright.config.ts +25 -0
- package/template/public/favicon.ico +0 -0
- package/template/src/App.vue +39 -0
- package/template/src/adapters/auth/index.ts +9 -0
- package/template/src/adapters/auth/mock.ts +10 -0
- package/template/src/adapters/auth/types.ts +11 -0
- package/template/src/adapters/navigation/index.ts +13 -0
- package/template/src/adapters/navigation/types.ts +6 -0
- package/template/src/api/auth.ts +23 -0
- package/template/src/assets/images/avatar/avatar.webp +0 -0
- package/template/src/assets/images/avatar/avatar1.webp +0 -0
- package/template/src/assets/images/avatar/avatar10.webp +0 -0
- package/template/src/assets/images/avatar/avatar2.webp +0 -0
- package/template/src/assets/images/avatar/avatar3.webp +0 -0
- package/template/src/assets/images/avatar/avatar4.webp +0 -0
- package/template/src/assets/images/avatar/avatar5.webp +0 -0
- package/template/src/assets/images/avatar/avatar6.webp +0 -0
- package/template/src/assets/images/avatar/avatar7.webp +0 -0
- package/template/src/assets/images/avatar/avatar8.webp +0 -0
- package/template/src/assets/images/avatar/avatar9.webp +0 -0
- package/template/src/assets/images/ceremony/hb.png +0 -0
- package/template/src/assets/images/ceremony/sd.png +0 -0
- package/template/src/assets/images/ceremony/xc.png +0 -0
- package/template/src/assets/images/ceremony/yd.png +0 -0
- package/template/src/assets/images/common/logo.webp +0 -0
- package/template/src/assets/images/draw/draw1.png +0 -0
- package/template/src/assets/images/favicon.ico +0 -0
- package/template/src/assets/images/lock/bg_dark.webp +0 -0
- package/template/src/assets/images/lock/bg_light.webp +0 -0
- package/template/src/assets/images/login/kylin-hero-source.png +0 -0
- package/template/src/assets/images/login/lf_icon2.webp +0 -0
- package/template/src/assets/images/settings/menu_layouts/dual_column.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/horizontal.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/mixed.png +0 -0
- package/template/src/assets/images/settings/menu_layouts/vertical.png +0 -0
- package/template/src/assets/images/settings/menu_styles/dark.png +0 -0
- package/template/src/assets/images/settings/menu_styles/design.png +0 -0
- package/template/src/assets/images/settings/menu_styles/light.png +0 -0
- package/template/src/assets/images/settings/theme_styles/dark.png +0 -0
- package/template/src/assets/images/settings/theme_styles/light.png +0 -0
- package/template/src/assets/images/settings/theme_styles/system.png +0 -0
- package/template/src/assets/images/svg/403.svg +1 -0
- package/template/src/assets/images/svg/404.svg +1 -0
- package/template/src/assets/images/svg/500.svg +5 -0
- package/template/src/assets/images/svg/login_icon.svg +1 -0
- package/template/src/assets/images/user/avatar.webp +0 -0
- package/template/src/assets/images/user/bg.webp +0 -0
- package/template/src/assets/styles/core/app.scss +227 -0
- package/template/src/assets/styles/core/dark.scss +93 -0
- package/template/src/assets/styles/core/el-dark.scss +2 -0
- package/template/src/assets/styles/core/el-light.scss +34 -0
- package/template/src/assets/styles/core/el-ui.scss +519 -0
- package/template/src/assets/styles/core/md.scss +1036 -0
- package/template/src/assets/styles/core/mixin.scss +157 -0
- package/template/src/assets/styles/core/reset.scss +41 -0
- package/template/src/assets/styles/core/router-transition.scss +104 -0
- package/template/src/assets/styles/core/tailwind.css +219 -0
- package/template/src/assets/styles/core/theme-animation.scss +63 -0
- package/template/src/assets/styles/core/theme-change.scss +11 -0
- package/template/src/assets/styles/custom/one-dark-pro.scss +98 -0
- package/template/src/assets/styles/index.scss +23 -0
- package/template/src/assets/svg/loading.ts +32 -0
- package/template/src/bootstrap/initializeApp.ts +30 -0
- package/template/src/components/core/banners/art-basic-banner/index.vue +343 -0
- package/template/src/components/core/banners/art-card-banner/index.vue +114 -0
- package/template/src/components/core/base/art-back-to-top/index.vue +40 -0
- package/template/src/components/core/base/art-logo/index.vue +34 -0
- package/template/src/components/core/base/art-svg-icon/index.vue +24 -0
- package/template/src/components/core/cards/art-bar-chart-card/index.vue +103 -0
- package/template/src/components/core/cards/art-data-list-card/index.vue +74 -0
- package/template/src/components/core/cards/art-donut-chart-card/index.vue +124 -0
- package/template/src/components/core/cards/art-image-card/index.vue +89 -0
- package/template/src/components/core/cards/art-line-chart-card/index.vue +126 -0
- package/template/src/components/core/cards/art-progress-card/index.vue +86 -0
- package/template/src/components/core/cards/art-stats-card/index.vue +67 -0
- package/template/src/components/core/cards/art-timeline-list-card/index.vue +69 -0
- package/template/src/components/core/charts/art-bar-chart/index.vue +203 -0
- package/template/src/components/core/charts/art-dual-bar-compare-chart/index.vue +195 -0
- package/template/src/components/core/charts/art-h-bar-chart/index.vue +208 -0
- package/template/src/components/core/charts/art-k-line-chart/index.vue +152 -0
- package/template/src/components/core/charts/art-line-chart/index.vue +371 -0
- package/template/src/components/core/charts/art-radar-chart/index.vue +105 -0
- package/template/src/components/core/charts/art-ring-chart/index.vue +133 -0
- package/template/src/components/core/charts/art-scatter-chart/index.vue +115 -0
- package/template/src/components/core/feedback/art-page-loading/index.vue +281 -0
- package/template/src/components/core/forms/art-button-more/index.vue +71 -0
- package/template/src/components/core/forms/art-button-table/index.vue +59 -0
- package/template/src/components/core/forms/art-drag-verify/index.vue +430 -0
- package/template/src/components/core/forms/art-excel-export/index.vue +390 -0
- package/template/src/components/core/forms/art-excel-import/index.vue +62 -0
- package/template/src/components/core/forms/art-form/index.vue +507 -0
- package/template/src/components/core/forms/art-wang-editor/index.vue +261 -0
- package/template/src/components/core/forms/art-wang-editor/style.scss +273 -0
- package/template/src/components/core/layouts/art-breadcrumb/index.vue +142 -0
- package/template/src/components/core/layouts/art-chat-window/index.vue +262 -0
- package/template/src/components/core/layouts/art-fast-enter/index.vue +113 -0
- package/template/src/components/core/layouts/art-fireworks-effect/index.vue +633 -0
- package/template/src/components/core/layouts/art-global-component/index.vue +14 -0
- package/template/src/components/core/layouts/art-global-search/index.vue +431 -0
- package/template/src/components/core/layouts/art-header-bar/index.vue +485 -0
- package/template/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue +118 -0
- package/template/src/components/core/layouts/art-menus/art-horizontal-menu/index.vue +110 -0
- package/template/src/components/core/layouts/art-menus/art-horizontal-menu/widget/HorizontalSubmenu.vue +106 -0
- package/template/src/components/core/layouts/art-menus/art-mixed-menu/index.vue +279 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/index.vue +354 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/style.scss +251 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/theme.scss +258 -0
- package/template/src/components/core/layouts/art-menus/art-sidebar-menu/widget/SidebarSubmenu.vue +190 -0
- package/template/src/components/core/layouts/art-notification/index.vue +456 -0
- package/template/src/components/core/layouts/art-page-content/index.vue +137 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsConfig.ts +248 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsHandlers.ts +167 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsPanel.ts +233 -0
- package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsState.ts +37 -0
- package/template/src/components/core/layouts/art-settings-panel/index.vue +72 -0
- package/template/src/components/core/layouts/art-settings-panel/style.scss +92 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/BasicSettings.vue +77 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/BoxStyleSettings.vue +38 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ColorSettings.vue +35 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ContainerSettings.vue +33 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/MenuLayoutSettings.vue +31 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/MenuStyleSettings.vue +44 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SectionTitle.vue +17 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingActions.vue +236 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingDrawer.vue +51 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingHeader.vue +18 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingItem.vue +101 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/ThemeSettings.vue +28 -0
- package/template/src/components/core/layouts/art-work-tab/index.vue +584 -0
- package/template/src/components/core/media/art-cutter-img/index.vue +350 -0
- package/template/src/components/core/media/art-video-player/index.vue +111 -0
- package/template/src/components/core/others/art-menu-right/index.vue +415 -0
- package/template/src/components/core/others/art-watermark/index.vue +64 -0
- package/template/src/components/core/text-effect/art-count-to/index.vue +310 -0
- package/template/src/components/core/text-effect/art-festival-text-scroll/index.vue +32 -0
- package/template/src/components/core/text-effect/art-text-scroll/index.vue +285 -0
- package/template/src/components/core/theme/theme-svg/index.vue +100 -0
- package/template/src/components/core/views/exception/ArtException.vue +55 -0
- package/template/src/components/core/views/login/AuthTopBar.vue +149 -0
- package/template/src/components/core/views/login/LoginLeftView.vue +602 -0
- package/template/src/components/core/views/result/ArtResultPage.vue +43 -0
- package/template/src/components/core/widget/art-icon-button/index.vue +23 -0
- package/template/src/config/assets/images.ts +61 -0
- package/template/src/config/index.ts +170 -0
- package/template/src/config/modules/component.ts +98 -0
- package/template/src/config/modules/fastEnter.ts +16 -0
- package/template/src/config/modules/festival.ts +51 -0
- package/template/src/config/modules/headerBar.ts +64 -0
- package/template/src/config/setting.ts +109 -0
- package/template/src/directives/core/auth.ts +66 -0
- package/template/src/directives/core/highlight-loader.ts +37 -0
- package/template/src/directives/core/highlight.ts +253 -0
- package/template/src/directives/core/ripple.ts +116 -0
- package/template/src/directives/core/roles.ts +87 -0
- package/template/src/directives/index.ts +14 -0
- package/template/src/enums/appEnum.ts +81 -0
- package/template/src/enums/formEnum.ts +17 -0
- package/template/src/env.d.ts +32 -0
- package/template/src/hooks/core/useAppMode.ts +45 -0
- package/template/src/hooks/core/useAuth.ts +74 -0
- package/template/src/hooks/core/useCeremony.ts +184 -0
- package/template/src/hooks/core/useChart.ts +745 -0
- package/template/src/hooks/core/useCommon.ts +87 -0
- package/template/src/hooks/core/useFastEnter.ts +55 -0
- package/template/src/hooks/core/useHeaderBar.ts +201 -0
- package/template/src/hooks/core/useLayoutHeight.ts +148 -0
- package/template/src/hooks/core/useTableColumns.ts +313 -0
- package/template/src/hooks/core/useTheme.ts +174 -0
- package/template/src/hooks/index.ts +29 -0
- package/template/src/locales/index.ts +123 -0
- package/template/src/locales/langs/en.json +283 -0
- package/template/src/locales/langs/zh.json +283 -0
- package/template/src/main.ts +29 -0
- package/template/src/mock/auth.ts +46 -0
- package/template/src/plugins/echarts.ts +76 -0
- package/template/src/plugins/index.ts +6 -0
- package/template/src/router/core/ComponentLoader.ts +82 -0
- package/template/src/router/core/IframeRouteManager.ts +78 -0
- package/template/src/router/core/MenuProcessor.ts +280 -0
- package/template/src/router/core/RoutePermissionValidator.ts +161 -0
- package/template/src/router/core/RouteRegistry.ts +90 -0
- package/template/src/router/core/RouteTransformer.ts +132 -0
- package/template/src/router/core/RouteValidator.ts +187 -0
- package/template/src/router/core/index.ts +14 -0
- package/template/src/router/guards/afterEach.ts +34 -0
- package/template/src/router/guards/beforeEach.ts +442 -0
- package/template/src/router/index.ts +24 -0
- package/template/src/router/modules/dashboard.ts +23 -0
- package/template/src/router/modules/examples.ts +109 -0
- package/template/src/router/modules/exception.ts +46 -0
- package/template/src/router/modules/index.ts +12 -0
- package/template/src/router/modules/result.ts +32 -0
- package/template/src/router/routes/asyncRoutes.ts +9 -0
- package/template/src/router/routes/staticRoutes.ts +60 -0
- package/template/src/router/routesAlias.ts +8 -0
- package/template/src/services/auth.ts +15 -0
- package/template/src/store/index.ts +52 -0
- package/template/src/store/modules/menu.ts +109 -0
- package/template/src/store/modules/setting.ts +450 -0
- package/template/src/store/modules/user.ts +218 -0
- package/template/src/store/modules/worktab.ts +568 -0
- package/template/src/types/api/api.d.ts +86 -0
- package/template/src/types/common/index.ts +95 -0
- package/template/src/types/common/response.ts +32 -0
- package/template/src/types/component/chart.ts +324 -0
- package/template/src/types/component/index.ts +86 -0
- package/template/src/types/config/index.ts +253 -0
- package/template/src/types/directive/directive.d.ts +15 -0
- package/template/src/types/import/auto-imports.d.ts +319 -0
- package/template/src/types/import/components.d.ts +126 -0
- package/template/src/types/index.ts +22 -0
- package/template/src/types/router/index.ts +80 -0
- package/template/src/types/store/index.ts +157 -0
- package/template/src/utils/form/index.ts +9 -0
- package/template/src/utils/form/validator.ts +316 -0
- package/template/src/utils/http/contract.ts +39 -0
- package/template/src/utils/http/error.ts +182 -0
- package/template/src/utils/http/index.ts +226 -0
- package/template/src/utils/http/status.ts +18 -0
- package/template/src/utils/index.ts +31 -0
- package/template/src/utils/navigation/index.ts +10 -0
- package/template/src/utils/navigation/jump.ts +68 -0
- package/template/src/utils/navigation/route.ts +85 -0
- package/template/src/utils/navigation/worktab.ts +67 -0
- package/template/src/utils/router.ts +63 -0
- package/template/src/utils/socket/index.ts +423 -0
- package/template/src/utils/storage/index.ts +7 -0
- package/template/src/utils/storage/storage-config.ts +127 -0
- package/template/src/utils/storage/storage-key-manager.ts +97 -0
- package/template/src/utils/storage/storage.ts +250 -0
- package/template/src/utils/sys/console.ts +9 -0
- package/template/src/utils/sys/error-handle.ts +143 -0
- package/template/src/utils/sys/index.ts +2 -0
- package/template/src/utils/sys/mittBus.ts +61 -0
- package/template/src/utils/ui/animation.ts +80 -0
- package/template/src/utils/ui/colors.ts +273 -0
- package/template/src/utils/ui/emojo.ts +24 -0
- package/template/src/utils/ui/iconify-loader.ts +31 -0
- package/template/src/utils/ui/index.ts +11 -0
- package/template/src/utils/ui/loading.ts +158 -0
- package/template/src/utils/ui/tabs.ts +60 -0
- package/template/src/views/auth/forget-password/index.vue +62 -0
- package/template/src/views/auth/login/index.vue +166 -0
- package/template/src/views/auth/login/style.css +38 -0
- package/template/src/views/auth/register/index.vue +240 -0
- package/template/src/views/dashboard/console/index.vue +173 -0
- package/template/src/views/examples/analytics/index.vue +389 -0
- package/template/src/views/examples/complex-form/index.vue +395 -0
- package/template/src/views/examples/crud-workspace/index.vue +412 -0
- package/template/src/views/examples/navigation/detail/index.vue +151 -0
- package/template/src/views/examples/navigation/state/index.vue +226 -0
- package/template/src/views/examples/overview/index.vue +309 -0
- package/template/src/views/examples/permissions/index.vue +303 -0
- package/template/src/views/examples/search-table/index.vue +182 -0
- package/template/src/views/examples/search-table/search.config.ts +81 -0
- package/template/src/views/examples/search-table/service.ts +116 -0
- package/template/src/views/examples/search-table/table.config.ts +37 -0
- package/template/src/views/exception/403/index.vue +16 -0
- package/template/src/views/exception/404/index.vue +16 -0
- package/template/src/views/exception/500/index.vue +16 -0
- package/template/src/views/index/index.vue +29 -0
- package/template/src/views/index/style.scss +93 -0
- package/template/src/views/outside/Iframe.vue +42 -0
- package/template/src/views/result/fail/index.vue +28 -0
- package/template/src/views/result/success/index.vue +21 -0
- package/template/tests/e2e/auth.spec.ts +14 -0
- package/template/tests/e2e/search-table.spec.ts +154 -0
- package/template/tests/unit/adapters/auth.spec.ts +38 -0
- package/template/tests/unit/config/app-config.spec.ts +17 -0
- package/template/tests/unit/directives/highlight.spec.ts +20 -0
- package/template/tests/unit/http/contract.spec.ts +47 -0
- package/template/tests/unit/mock/search-table.spec.ts +62 -0
- package/template/tests/unit/router/examples.spec.ts +52 -0
- package/template/tsconfig.json +28 -0
- package/template/vite.config.ts +181 -0
- package/template/vitest.config.ts +27 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<!-- 柱状图卡片 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="art-card relative overflow-hidden" :style="{ height: `${height}rem` }">
|
|
4
|
+
<div class="mb-5 flex-b items-start px-5 pt-5">
|
|
5
|
+
<div>
|
|
6
|
+
<p class="m-0 text-2xl font-medium leading-tight text-g-900">
|
|
7
|
+
{{ value }}
|
|
8
|
+
</p>
|
|
9
|
+
<p class="mt-1 text-sm text-g-600">{{ label }}</p>
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
class="text-sm font-medium text-danger"
|
|
13
|
+
:class="[percentage > 0 ? 'text-success' : '', isMiniChart ? 'absolute bottom-5' : '']"
|
|
14
|
+
>
|
|
15
|
+
{{ percentage > 0 ? '+' : '' }}{{ percentage }}%
|
|
16
|
+
</div>
|
|
17
|
+
<div v-if="date" class="absolute bottom-5 right-5 text-xs text-g-600">
|
|
18
|
+
{{ date }}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div
|
|
22
|
+
ref="chartRef"
|
|
23
|
+
class="absolute bottom-0 left-0 right-0 mx-auto"
|
|
24
|
+
:class="isMiniChart ? '!absolute !top-5 !right-5 !bottom-auto !left-auto !h-15 !w-4/10' : ''"
|
|
25
|
+
:style="{ height: isMiniChart ? '60px' : `calc(${height}rem - 5rem)` }"
|
|
26
|
+
></div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { useChartOps, useChartComponent } from '@/hooks/core/useChart'
|
|
32
|
+
import { type EChartsOption } from '@/plugins/echarts'
|
|
33
|
+
|
|
34
|
+
defineOptions({ name: 'ArtBarChartCard' })
|
|
35
|
+
|
|
36
|
+
interface Props {
|
|
37
|
+
/** 数值 */
|
|
38
|
+
value: number
|
|
39
|
+
/** 标签 */
|
|
40
|
+
label: string
|
|
41
|
+
/** 百分比 +(绿色)-(红色) */
|
|
42
|
+
percentage: number
|
|
43
|
+
/** 日期 */
|
|
44
|
+
date?: string
|
|
45
|
+
/** 高度 */
|
|
46
|
+
height?: number
|
|
47
|
+
/** 颜色 */
|
|
48
|
+
color?: string
|
|
49
|
+
/** 图表数据 */
|
|
50
|
+
chartData: number[]
|
|
51
|
+
/** 柱状图宽度 */
|
|
52
|
+
barWidth?: string
|
|
53
|
+
/** 是否为迷你图表 */
|
|
54
|
+
isMiniChart?: boolean
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
58
|
+
height: 11,
|
|
59
|
+
barWidth: '26%'
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// 使用新的图表组件抽象
|
|
63
|
+
const { chartRef } = useChartComponent({
|
|
64
|
+
props: {
|
|
65
|
+
height: `${props.height}rem`,
|
|
66
|
+
loading: false,
|
|
67
|
+
isEmpty: !props.chartData?.length || props.chartData.every((val) => val === 0)
|
|
68
|
+
},
|
|
69
|
+
checkEmpty: () => !props.chartData?.length || props.chartData.every((val) => val === 0),
|
|
70
|
+
watchSources: [() => props.chartData, () => props.color, () => props.barWidth],
|
|
71
|
+
generateOptions: (): EChartsOption => {
|
|
72
|
+
const computedColor = props.color || useChartOps().themeColor
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
grid: {
|
|
76
|
+
top: 0,
|
|
77
|
+
right: 0,
|
|
78
|
+
bottom: 15,
|
|
79
|
+
left: 0
|
|
80
|
+
},
|
|
81
|
+
xAxis: {
|
|
82
|
+
type: 'category',
|
|
83
|
+
show: false
|
|
84
|
+
},
|
|
85
|
+
yAxis: {
|
|
86
|
+
type: 'value',
|
|
87
|
+
show: false
|
|
88
|
+
},
|
|
89
|
+
series: [
|
|
90
|
+
{
|
|
91
|
+
data: props.chartData,
|
|
92
|
+
type: 'bar',
|
|
93
|
+
barWidth: props.barWidth,
|
|
94
|
+
itemStyle: {
|
|
95
|
+
color: computedColor,
|
|
96
|
+
borderRadius: 2
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!-- 数据列表卡片 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="art-card p-5">
|
|
4
|
+
<div class="pb-3.5">
|
|
5
|
+
<p class="text-lg font-medium">{{ title }}</p>
|
|
6
|
+
<p class="text-sm text-g-600">{{ subtitle }}</p>
|
|
7
|
+
</div>
|
|
8
|
+
<ElScrollbar :style="{ height: maxHeight }">
|
|
9
|
+
<div v-for="(item, index) in list" :key="index" class="flex-c py-3">
|
|
10
|
+
<div v-if="item.icon" class="flex-cc mr-3 size-10 rounded-lg" :class="item.class">
|
|
11
|
+
<ArtSvgIcon :icon="item.icon" class="text-xl" />
|
|
12
|
+
</div>
|
|
13
|
+
<div class="flex-1">
|
|
14
|
+
<div class="mb-1 text-sm">{{ item.title }}</div>
|
|
15
|
+
<div class="text-xs text-g-500">{{ item.status }}</div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="ml-3 text-xs text-g-500">{{ item.time }}</div>
|
|
18
|
+
</div>
|
|
19
|
+
</ElScrollbar>
|
|
20
|
+
<ElButton
|
|
21
|
+
class="mt-[25px] w-full text-center"
|
|
22
|
+
v-if="showMoreButton"
|
|
23
|
+
v-ripple
|
|
24
|
+
@click="handleMore"
|
|
25
|
+
>查看更多</ElButton
|
|
26
|
+
>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
defineOptions({ name: 'ArtDataListCard' })
|
|
32
|
+
|
|
33
|
+
interface Props {
|
|
34
|
+
/** 数据列表 */
|
|
35
|
+
list: Activity[]
|
|
36
|
+
/** 标题 */
|
|
37
|
+
title: string
|
|
38
|
+
/** 副标题 */
|
|
39
|
+
subtitle?: string
|
|
40
|
+
/** 最大显示数量 */
|
|
41
|
+
maxCount?: number
|
|
42
|
+
/** 是否显示更多按钮 */
|
|
43
|
+
showMoreButton?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface Activity {
|
|
47
|
+
/** 标题 */
|
|
48
|
+
title: string
|
|
49
|
+
/** 状态 */
|
|
50
|
+
status: string
|
|
51
|
+
/** 时间 */
|
|
52
|
+
time: string
|
|
53
|
+
/** 样式类名 */
|
|
54
|
+
class: string
|
|
55
|
+
/** 图标 */
|
|
56
|
+
icon: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const ITEM_HEIGHT = 66
|
|
60
|
+
const DEFAULT_MAX_COUNT = 5
|
|
61
|
+
|
|
62
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
63
|
+
maxCount: DEFAULT_MAX_COUNT
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const maxHeight = computed(() => `${ITEM_HEIGHT * props.maxCount}px`)
|
|
67
|
+
|
|
68
|
+
const emit = defineEmits<{
|
|
69
|
+
/** 点击更多按钮事件 */
|
|
70
|
+
(e: 'more'): void
|
|
71
|
+
}>()
|
|
72
|
+
|
|
73
|
+
const handleMore = () => emit('more')
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<!-- 环型图卡片 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="art-card overflow-hidden" :style="{ height: `${height}rem` }">
|
|
4
|
+
<div class="flex box-border h-full p-5 pr-2">
|
|
5
|
+
<div class="flex w-full items-start gap-5">
|
|
6
|
+
<div class="flex-b h-full flex-1 flex-col">
|
|
7
|
+
<p class="m-0 text-xl font-medium leading-tight text-g-900">
|
|
8
|
+
{{ title }}
|
|
9
|
+
</p>
|
|
10
|
+
<div>
|
|
11
|
+
<p class="m-0 mt-2.5 text-xl font-medium leading-tight text-g-900">
|
|
12
|
+
{{ formatNumber(value) }}
|
|
13
|
+
</p>
|
|
14
|
+
<div
|
|
15
|
+
class="mt-1.5 text-xs font-medium"
|
|
16
|
+
:class="percentage > 0 ? 'text-success' : 'text-danger'"
|
|
17
|
+
>
|
|
18
|
+
{{ percentage > 0 ? '+' : '' }}{{ percentage }}%
|
|
19
|
+
<span v-if="percentageLabel">{{ percentageLabel }}</span>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="mt-2 flex gap-4 text-xs text-g-600">
|
|
23
|
+
<div v-if="currentValue" class="flex-cc">
|
|
24
|
+
<div class="size-2 bg-theme/100 rounded mr-2"></div>
|
|
25
|
+
{{ currentValue }}
|
|
26
|
+
</div>
|
|
27
|
+
<div v-if="previousValue" class="flex-cc">
|
|
28
|
+
<div class="size-2 bg-g-400 rounded mr-2"></div>
|
|
29
|
+
{{ previousValue }}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="flex-c h-full max-w-40 flex-1">
|
|
34
|
+
<div ref="chartRef" class="h-30 w-full"></div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { type EChartsOption } from '@/plugins/echarts'
|
|
43
|
+
import { useChartOps, useChartComponent } from '@/hooks/core/useChart'
|
|
44
|
+
|
|
45
|
+
defineOptions({ name: 'ArtDonutChartCard' })
|
|
46
|
+
|
|
47
|
+
interface Props {
|
|
48
|
+
/** 数值 */
|
|
49
|
+
value: number
|
|
50
|
+
/** 标题 */
|
|
51
|
+
title: string
|
|
52
|
+
/** 百分比 */
|
|
53
|
+
percentage: number
|
|
54
|
+
/** 百分比标签 */
|
|
55
|
+
percentageLabel?: string
|
|
56
|
+
/** 当前年份 */
|
|
57
|
+
currentValue?: string
|
|
58
|
+
/** 去年年份 */
|
|
59
|
+
previousValue?: string
|
|
60
|
+
/** 高度 */
|
|
61
|
+
height?: number
|
|
62
|
+
/** 颜色 */
|
|
63
|
+
color?: string
|
|
64
|
+
/** 半径 */
|
|
65
|
+
radius?: [string, string]
|
|
66
|
+
/** 数据 */
|
|
67
|
+
data: [number, number]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
71
|
+
height: 9,
|
|
72
|
+
radius: () => ['70%', '90%'],
|
|
73
|
+
data: () => [0, 0]
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const formatNumber = (num: number) => {
|
|
77
|
+
return num.toLocaleString()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 使用新的图表组件抽象
|
|
81
|
+
const { chartRef } = useChartComponent({
|
|
82
|
+
props: {
|
|
83
|
+
height: `${props.height}rem`,
|
|
84
|
+
loading: false,
|
|
85
|
+
isEmpty: props.data.every((val) => val === 0)
|
|
86
|
+
},
|
|
87
|
+
checkEmpty: () => props.data.every((val) => val === 0),
|
|
88
|
+
watchSources: [
|
|
89
|
+
() => props.data,
|
|
90
|
+
() => props.color,
|
|
91
|
+
() => props.radius,
|
|
92
|
+
() => props.currentValue,
|
|
93
|
+
() => props.previousValue
|
|
94
|
+
],
|
|
95
|
+
generateOptions: (): EChartsOption => {
|
|
96
|
+
const computedColor = props.color || useChartOps().themeColor
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
series: [
|
|
100
|
+
{
|
|
101
|
+
type: 'pie',
|
|
102
|
+
radius: props.radius,
|
|
103
|
+
avoidLabelOverlap: false,
|
|
104
|
+
label: {
|
|
105
|
+
show: false
|
|
106
|
+
},
|
|
107
|
+
data: [
|
|
108
|
+
{
|
|
109
|
+
value: props.data[0],
|
|
110
|
+
name: props.currentValue,
|
|
111
|
+
itemStyle: { color: computedColor }
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
value: props.data[1],
|
|
115
|
+
name: props.previousValue,
|
|
116
|
+
itemStyle: { color: '#e6e8f7' }
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
</script>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<!-- 图片卡片 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="w-full c-p" @click="handleClick">
|
|
4
|
+
<div class="art-card overflow-hidden">
|
|
5
|
+
<div class="relative w-full aspect-[16/10] overflow-hidden">
|
|
6
|
+
<ElImage
|
|
7
|
+
:src="props.imageUrl"
|
|
8
|
+
fit="cover"
|
|
9
|
+
loading="lazy"
|
|
10
|
+
class="w-full h-full transition-transform duration-300 ease-in-out hover:scale-105"
|
|
11
|
+
>
|
|
12
|
+
<template #placeholder>
|
|
13
|
+
<div class="flex-cc w-full h-full bg-[#f5f7fa]">
|
|
14
|
+
<ElIcon><Picture /></ElIcon>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
</ElImage>
|
|
18
|
+
<div
|
|
19
|
+
class="absolute right-3.5 bottom-3.5 py-1 px-2 text-xs bg-g-200 rounded"
|
|
20
|
+
v-if="props.readTime"
|
|
21
|
+
>
|
|
22
|
+
{{ props.readTime }} 阅读
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="p-4">
|
|
27
|
+
<div
|
|
28
|
+
class="inline-block py-0.5 px-2 mb-2 text-xs bg-g-300/70 rounded"
|
|
29
|
+
v-if="props.category"
|
|
30
|
+
>
|
|
31
|
+
{{ props.category }}
|
|
32
|
+
</div>
|
|
33
|
+
<p class="m-0 mb-3 text-base font-medium">{{ props.title }}</p>
|
|
34
|
+
<div class="flex-c gap-4 text-xs text-g-600">
|
|
35
|
+
<span class="flex-c gap-1" v-if="props.views">
|
|
36
|
+
<ElIcon class="text-base"><View /></ElIcon>
|
|
37
|
+
{{ props.views }}
|
|
38
|
+
</span>
|
|
39
|
+
<span class="flex-c gap-1" v-if="props.comments">
|
|
40
|
+
<ElIcon class="text-base"><ChatLineRound /></ElIcon>
|
|
41
|
+
{{ props.comments }}
|
|
42
|
+
</span>
|
|
43
|
+
<span>{{ props.date }}</span>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
import { Picture, View, ChatLineRound } from '@element-plus/icons-vue'
|
|
52
|
+
|
|
53
|
+
defineOptions({ name: 'ArtImageCard' })
|
|
54
|
+
|
|
55
|
+
interface Props {
|
|
56
|
+
/** 图片地址 */
|
|
57
|
+
imageUrl: string
|
|
58
|
+
/** 标题 */
|
|
59
|
+
title: string
|
|
60
|
+
/** 分类 */
|
|
61
|
+
category?: string
|
|
62
|
+
/** 阅读时间 */
|
|
63
|
+
readTime?: string
|
|
64
|
+
/** 浏览量 */
|
|
65
|
+
views?: number
|
|
66
|
+
/** 评论数 */
|
|
67
|
+
comments?: number
|
|
68
|
+
/** 日期 */
|
|
69
|
+
date?: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
73
|
+
imageUrl: '',
|
|
74
|
+
title: '',
|
|
75
|
+
category: '',
|
|
76
|
+
readTime: '',
|
|
77
|
+
views: 0,
|
|
78
|
+
comments: 0,
|
|
79
|
+
date: ''
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const emit = defineEmits<{
|
|
83
|
+
(e: 'click', card: Props): void
|
|
84
|
+
}>()
|
|
85
|
+
|
|
86
|
+
const handleClick = () => {
|
|
87
|
+
emit('click', props)
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<!-- 折线图卡片 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="art-card relative overflow-hidden" :style="{ height: `${height}rem` }">
|
|
4
|
+
<div class="mb-2.5 flex-b items-start p-5">
|
|
5
|
+
<div>
|
|
6
|
+
<p class="text-2xl font-medium leading-none">
|
|
7
|
+
{{ value }}
|
|
8
|
+
</p>
|
|
9
|
+
<p class="mt-1 text-sm text-g-500">{{ label }}</p>
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
class="text-sm font-medium"
|
|
13
|
+
:class="[
|
|
14
|
+
percentage > 0 ? 'text-success' : 'text-danger',
|
|
15
|
+
isMiniChart ? 'absolute bottom-5' : ''
|
|
16
|
+
]"
|
|
17
|
+
>
|
|
18
|
+
{{ percentage > 0 ? '+' : '' }}{{ percentage }}%
|
|
19
|
+
</div>
|
|
20
|
+
<div v-if="date" class="absolute bottom-5 right-5 text-xs text-g-500">
|
|
21
|
+
{{ date }}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
ref="chartRef"
|
|
26
|
+
class="absolute bottom-0 left-0 right-0 box-border w-full"
|
|
27
|
+
:class="isMiniChart ? '!absolute !top-5 !right-5 !bottom-auto !left-auto !h-15 !w-4/10' : ''"
|
|
28
|
+
:style="{ height: isMiniChart ? '60px' : `calc(${height}rem - 5rem)` }"
|
|
29
|
+
></div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import { graphic, type EChartsOption } from '@/plugins/echarts'
|
|
35
|
+
import { getCssVar, hexToRgba } from '@/utils/ui'
|
|
36
|
+
import { useChartOps, useChartComponent } from '@/hooks/core/useChart'
|
|
37
|
+
|
|
38
|
+
defineOptions({ name: 'ArtLineChartCard' })
|
|
39
|
+
|
|
40
|
+
interface Props {
|
|
41
|
+
/** 数值 */
|
|
42
|
+
value: number
|
|
43
|
+
/** 标签 */
|
|
44
|
+
label: string
|
|
45
|
+
/** 百分比 */
|
|
46
|
+
percentage: number
|
|
47
|
+
/** 日期 */
|
|
48
|
+
date?: string
|
|
49
|
+
/** 高度 */
|
|
50
|
+
height?: number
|
|
51
|
+
/** 颜色 */
|
|
52
|
+
color?: string
|
|
53
|
+
/** 是否显示区域颜色 */
|
|
54
|
+
showAreaColor?: boolean
|
|
55
|
+
/** 图表数据 */
|
|
56
|
+
chartData: number[]
|
|
57
|
+
/** 是否为迷你图表 */
|
|
58
|
+
isMiniChart?: boolean
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
62
|
+
height: 11
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// 使用新的图表组件抽象
|
|
66
|
+
const { chartRef } = useChartComponent({
|
|
67
|
+
props: {
|
|
68
|
+
height: `${props.height}rem`,
|
|
69
|
+
loading: false,
|
|
70
|
+
isEmpty: !props.chartData?.length || props.chartData.every((val) => val === 0)
|
|
71
|
+
},
|
|
72
|
+
checkEmpty: () => !props.chartData?.length || props.chartData.every((val) => val === 0),
|
|
73
|
+
watchSources: [() => props.chartData, () => props.color, () => props.showAreaColor],
|
|
74
|
+
generateOptions: (): EChartsOption => {
|
|
75
|
+
const computedColor = props.color || useChartOps().themeColor
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
grid: {
|
|
79
|
+
top: 0,
|
|
80
|
+
right: 0,
|
|
81
|
+
bottom: 0,
|
|
82
|
+
left: 0
|
|
83
|
+
},
|
|
84
|
+
xAxis: {
|
|
85
|
+
type: 'category',
|
|
86
|
+
show: false,
|
|
87
|
+
boundaryGap: false
|
|
88
|
+
},
|
|
89
|
+
yAxis: {
|
|
90
|
+
type: 'value',
|
|
91
|
+
show: false
|
|
92
|
+
},
|
|
93
|
+
series: [
|
|
94
|
+
{
|
|
95
|
+
data: props.chartData,
|
|
96
|
+
type: 'line',
|
|
97
|
+
smooth: true,
|
|
98
|
+
showSymbol: false,
|
|
99
|
+
lineStyle: {
|
|
100
|
+
width: 3,
|
|
101
|
+
color: computedColor
|
|
102
|
+
},
|
|
103
|
+
areaStyle: props.showAreaColor
|
|
104
|
+
? {
|
|
105
|
+
color: new graphic.LinearGradient(0, 0, 0, 1, [
|
|
106
|
+
{
|
|
107
|
+
offset: 0,
|
|
108
|
+
color: props.color
|
|
109
|
+
? hexToRgba(props.color, 0.2).rgba
|
|
110
|
+
: hexToRgba(getCssVar('--el-color-primary'), 0.2).rgba
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
offset: 1,
|
|
114
|
+
color: props.color
|
|
115
|
+
? hexToRgba(props.color, 0.01).rgba
|
|
116
|
+
: hexToRgba(getCssVar('--el-color-primary'), 0.01).rgba
|
|
117
|
+
}
|
|
118
|
+
])
|
|
119
|
+
}
|
|
120
|
+
: undefined
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!-- 进度条卡片 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="art-card h-32 flex flex-col justify-center px-5">
|
|
4
|
+
<div class="mb-3.5 flex-c" :style="{ justifyContent: icon ? 'space-between' : 'flex-start' }">
|
|
5
|
+
<div v-if="icon" class="size-11 flex-cc bg-g-300 text-xl rounded-lg" :class="iconStyle">
|
|
6
|
+
<ArtSvgIcon :icon="icon" class="text-2xl"></ArtSvgIcon>
|
|
7
|
+
</div>
|
|
8
|
+
<div>
|
|
9
|
+
<ArtCountTo
|
|
10
|
+
class="mb-1 block text-2xl font-semibold"
|
|
11
|
+
:target="percentage"
|
|
12
|
+
:duration="2000"
|
|
13
|
+
suffix="%"
|
|
14
|
+
:style="{ textAlign: icon ? 'right' : 'left' }"
|
|
15
|
+
/>
|
|
16
|
+
<p class="text-sm text-g-500">{{ title }}</p>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<ElProgress
|
|
20
|
+
:percentage="currentPercentage"
|
|
21
|
+
:stroke-width="strokeWidth"
|
|
22
|
+
:show-text="false"
|
|
23
|
+
:color="color"
|
|
24
|
+
class="[&_.el-progress-bar__outer]:bg-[rgb(240_240_240)]"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
defineOptions({ name: 'ArtProgressCard' })
|
|
31
|
+
|
|
32
|
+
interface Props {
|
|
33
|
+
/** 进度百分比 */
|
|
34
|
+
percentage: number
|
|
35
|
+
/** 标题 */
|
|
36
|
+
title: string
|
|
37
|
+
/** 颜色 */
|
|
38
|
+
color?: string
|
|
39
|
+
/** 图标 */
|
|
40
|
+
icon?: string
|
|
41
|
+
/** 图标样式 */
|
|
42
|
+
iconStyle?: string
|
|
43
|
+
/** 进度条宽度 */
|
|
44
|
+
strokeWidth?: number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
48
|
+
strokeWidth: 5,
|
|
49
|
+
color: '#67C23A'
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const animationDuration = 500
|
|
53
|
+
const currentPercentage = ref(0)
|
|
54
|
+
|
|
55
|
+
const animateProgress = () => {
|
|
56
|
+
const startTime = Date.now()
|
|
57
|
+
const startValue = currentPercentage.value
|
|
58
|
+
const endValue = props.percentage
|
|
59
|
+
|
|
60
|
+
const animate = () => {
|
|
61
|
+
const currentTime = Date.now()
|
|
62
|
+
const elapsed = currentTime - startTime
|
|
63
|
+
const progress = Math.min(elapsed / animationDuration, 1)
|
|
64
|
+
|
|
65
|
+
currentPercentage.value = startValue + (endValue - startValue) * progress
|
|
66
|
+
|
|
67
|
+
if (progress < 1) {
|
|
68
|
+
requestAnimationFrame(animate)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
requestAnimationFrame(animate)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onMounted(() => {
|
|
76
|
+
animateProgress()
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// 当 percentage 属性变化时重新执行动画
|
|
80
|
+
watch(
|
|
81
|
+
() => props.percentage,
|
|
82
|
+
() => {
|
|
83
|
+
animateProgress()
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!-- 统计卡片 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
class="art-card h-32 flex-c px-5 transition-transform duration-200 hover:-translate-y-0.5"
|
|
5
|
+
:class="boxStyle"
|
|
6
|
+
>
|
|
7
|
+
<div v-if="icon" class="mr-4 size-11 flex-cc rounded-lg text-xl text-white" :class="iconStyle">
|
|
8
|
+
<ArtSvgIcon :icon="icon"></ArtSvgIcon>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="flex-1">
|
|
11
|
+
<p class="m-0 text-lg font-medium" :style="{ color: textColor }" v-if="title">
|
|
12
|
+
{{ title }}
|
|
13
|
+
</p>
|
|
14
|
+
<ArtCountTo
|
|
15
|
+
class="m-0 text-2xl font-medium"
|
|
16
|
+
v-if="count !== undefined"
|
|
17
|
+
:target="count"
|
|
18
|
+
:duration="2000"
|
|
19
|
+
:decimals="decimals"
|
|
20
|
+
:separator="separator"
|
|
21
|
+
/>
|
|
22
|
+
<p
|
|
23
|
+
class="mt-1 text-sm text-g-500 opacity-90"
|
|
24
|
+
:style="{ color: textColor }"
|
|
25
|
+
v-if="description"
|
|
26
|
+
>{{ description }}</p
|
|
27
|
+
>
|
|
28
|
+
</div>
|
|
29
|
+
<div v-if="showArrow">
|
|
30
|
+
<ArtSvgIcon icon="ri:arrow-right-s-line" class="text-xl text-g-500" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
defineOptions({ name: 'ArtStatsCard' })
|
|
37
|
+
|
|
38
|
+
interface StatsCardProps {
|
|
39
|
+
/** 盒子样式 */
|
|
40
|
+
boxStyle?: string
|
|
41
|
+
/** 图标 */
|
|
42
|
+
icon?: string
|
|
43
|
+
/** 图标样式 */
|
|
44
|
+
iconStyle?: string
|
|
45
|
+
/** 标题 */
|
|
46
|
+
title?: string
|
|
47
|
+
/** 数值 */
|
|
48
|
+
count?: number
|
|
49
|
+
/** 小数位 */
|
|
50
|
+
decimals?: number
|
|
51
|
+
/** 分隔符 */
|
|
52
|
+
separator?: string
|
|
53
|
+
/** 描述 */
|
|
54
|
+
description: string
|
|
55
|
+
/** 文本颜色 */
|
|
56
|
+
textColor?: string
|
|
57
|
+
/** 是否显示箭头 */
|
|
58
|
+
showArrow?: boolean
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
withDefaults(defineProps<StatsCardProps>(), {
|
|
62
|
+
iconSize: 30,
|
|
63
|
+
iconBgRadius: 50,
|
|
64
|
+
decimals: 0,
|
|
65
|
+
separator: ','
|
|
66
|
+
})
|
|
67
|
+
</script>
|