2022-05-15 20:30:55 +08:00
|
|
|
<script setup lang="ts">
|
2023-08-04 17:50:25 +08:00
|
|
|
import { useUserStore } from "@/store/modules/user";
|
|
|
|
|
import { useTransition, TransitionPresets } from "@vueuse/core";
|
|
|
|
|
|
2023-06-03 11:12:17 +08:00
|
|
|
defineOptions({
|
|
|
|
|
// eslint-disable-next-line vue/no-reserved-component-names
|
|
|
|
|
name: "Dashboard",
|
|
|
|
|
inheritAttrs: false,
|
|
|
|
|
});
|
|
|
|
|
|
2023-01-23 01:19:17 +08:00
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
|
|
|
|
const date: Date = new Date();
|
|
|
|
|
|
|
|
|
|
const greetings = computed(() => {
|
2023-01-24 08:00:32 +08:00
|
|
|
if (date.getHours() >= 6 && date.getHours() < 8) {
|
2023-04-15 23:51:27 +08:00
|
|
|
return "晨起披衣出草堂,轩窗已自喜微凉🌅!";
|
2023-01-25 18:53:14 +08:00
|
|
|
} else if (date.getHours() >= 8 && date.getHours() < 12) {
|
2023-04-15 23:51:27 +08:00
|
|
|
return "上午好🌞!";
|
2023-01-23 01:19:17 +08:00
|
|
|
} else if (date.getHours() >= 12 && date.getHours() < 18) {
|
2023-04-15 23:51:27 +08:00
|
|
|
return "下午好☕!";
|
2023-01-23 01:19:17 +08:00
|
|
|
} else if (date.getHours() >= 18 && date.getHours() < 24) {
|
2023-04-15 23:51:27 +08:00
|
|
|
return "晚上好🌃!";
|
2023-01-23 01:19:17 +08:00
|
|
|
} else if (date.getHours() >= 0 && date.getHours() < 6) {
|
2023-04-15 23:51:27 +08:00
|
|
|
return "偷偷向银河要了一把碎星,只等你闭上眼睛撒入你的梦中,晚安🌛!";
|
2023-01-23 01:19:17 +08:00
|
|
|
}
|
|
|
|
|
});
|
2023-03-01 21:58:11 +08:00
|
|
|
|
|
|
|
|
const duration = 5000;
|
|
|
|
|
|
|
|
|
|
// 收入金额
|
|
|
|
|
const amount = ref(0);
|
|
|
|
|
const amountOutput = useTransition(amount, {
|
|
|
|
|
duration: duration,
|
2023-04-15 23:51:27 +08:00
|
|
|
transition: TransitionPresets.easeOutExpo,
|
2023-03-01 21:58:11 +08:00
|
|
|
});
|
|
|
|
|
amount.value = 2000;
|
|
|
|
|
|
|
|
|
|
// 访问数
|
|
|
|
|
const visitCount = ref(0);
|
|
|
|
|
const visitCountOutput = useTransition(visitCount, {
|
|
|
|
|
duration: duration,
|
2023-04-15 23:51:27 +08:00
|
|
|
transition: TransitionPresets.easeOutExpo,
|
2023-03-01 21:58:11 +08:00
|
|
|
});
|
|
|
|
|
visitCount.value = 2000;
|
|
|
|
|
|
|
|
|
|
//消息数
|
|
|
|
|
const messageCount = ref(0);
|
|
|
|
|
const messageCountOutput = useTransition(messageCount, {
|
|
|
|
|
duration: duration,
|
2023-04-15 23:51:27 +08:00
|
|
|
transition: TransitionPresets.easeOutExpo,
|
2023-03-01 21:58:11 +08:00
|
|
|
});
|
|
|
|
|
messageCount.value = 2000;
|
|
|
|
|
|
|
|
|
|
// 订单数
|
|
|
|
|
const orderCount = ref(0);
|
|
|
|
|
const orderCountOutput = useTransition(orderCount, {
|
|
|
|
|
duration: duration,
|
2023-04-15 23:51:27 +08:00
|
|
|
transition: TransitionPresets.easeOutExpo,
|
2023-03-01 21:58:11 +08:00
|
|
|
});
|
|
|
|
|
orderCount.value = 2000;
|
2022-05-15 20:30:55 +08:00
|
|
|
</script>
|
|
|
|
|
|
2021-11-16 23:47:47 +08:00
|
|
|
<template>
|
2022-05-08 13:06:12 +08:00
|
|
|
<div class="dashboard-container">
|
2023-01-23 01:19:17 +08:00
|
|
|
<!-- github角标 -->
|
2022-05-08 13:06:12 +08:00
|
|
|
<github-corner class="github-corner" />
|
2022-01-12 00:25:20 +08:00
|
|
|
|
2023-01-23 01:19:17 +08:00
|
|
|
<!-- 用户信息 -->
|
2023-02-06 01:08:40 +08:00
|
|
|
<el-row class="mb-8">
|
2023-01-23 01:19:17 +08:00
|
|
|
<el-card class="w-full">
|
|
|
|
|
<div class="flex justify-between flex-wrap">
|
2023-03-01 01:08:03 +08:00
|
|
|
<div class="flex items-center">
|
2023-01-23 01:19:17 +08:00
|
|
|
<img
|
|
|
|
|
class="user-avatar"
|
|
|
|
|
:src="userStore.avatar + '?imageView2/1/w/80/h/80'"
|
|
|
|
|
/>
|
2023-03-01 01:08:03 +08:00
|
|
|
<span class="ml-[10px] text-[16px]">
|
2023-01-23 01:19:17 +08:00
|
|
|
{{ userStore.nickname }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="leading-[40px]">
|
|
|
|
|
{{ greetings }}
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-06-17 09:53:35 +08:00
|
|
|
<div class="space-x-2 flex items-center justify-end">
|
2023-01-23 01:19:17 +08:00
|
|
|
<el-link
|
|
|
|
|
target="_blank"
|
|
|
|
|
type="danger"
|
2023-05-20 15:42:32 +08:00
|
|
|
href="https://blog.csdn.net/u013737132/article/details/130191394"
|
2023-06-17 09:53:35 +08:00
|
|
|
>💥官方从零到一文档</el-link
|
2023-01-23 01:19:17 +08:00
|
|
|
>
|
|
|
|
|
<el-divider direction="vertical" />
|
|
|
|
|
<el-link
|
|
|
|
|
target="_blank"
|
|
|
|
|
type="success"
|
2023-06-17 09:53:35 +08:00
|
|
|
href="https://gitee.com/youlaiorg"
|
|
|
|
|
>Gitee</el-link
|
2023-01-23 01:19:17 +08:00
|
|
|
>
|
|
|
|
|
<el-divider direction="vertical" />
|
|
|
|
|
<el-link
|
|
|
|
|
target="_blank"
|
|
|
|
|
type="primary"
|
2023-06-17 09:53:35 +08:00
|
|
|
href="https://github.com/youlaitech"
|
|
|
|
|
>GitHub
|
2023-01-23 01:19:17 +08:00
|
|
|
</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<!-- 数据卡片 -->
|
2023-03-17 22:31:26 +08:00
|
|
|
<el-row :gutter="40" class="mb-4">
|
|
|
|
|
<el-col :xs="24" :sm="12" :lg="6" class="mb-4">
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="data-box">
|
|
|
|
|
<div
|
|
|
|
|
class="text-[#40c9c6] hover:!text-white hover:bg-[#40c9c6] p-3 rounded"
|
|
|
|
|
>
|
|
|
|
|
<svg-icon icon-class="uv" size="3em" />
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
|
|
<div class="text-[var(--el-text-color-secondary)]">访问数</div>
|
2023-07-11 07:26:12 +08:00
|
|
|
<div class="text-lg text-right">
|
2023-03-01 21:58:11 +08:00
|
|
|
{{ Math.round(visitCountOutput) }}
|
2023-01-21 16:50:25 +08:00
|
|
|
</div>
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
2023-01-21 16:50:25 +08:00
|
|
|
<!--消息数-->
|
2023-03-17 22:31:26 +08:00
|
|
|
<el-col :xs="24" :sm="12" :lg="6" class="mb-4">
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="data-box">
|
|
|
|
|
<div
|
|
|
|
|
class="text-[#36a3f7] hover:!text-white hover:bg-[#36a3f7] p-3 rounded"
|
|
|
|
|
>
|
|
|
|
|
<svg-icon icon-class="message" size="3em" />
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
|
|
<div class="text-[var(--el-text-color-secondary)]">消息数</div>
|
2023-07-11 07:26:12 +08:00
|
|
|
<div class="text-lg text-right">
|
2023-03-01 21:58:11 +08:00
|
|
|
{{ Math.round(messageCountOutput) }}
|
2023-01-21 16:50:25 +08:00
|
|
|
</div>
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
2023-03-17 22:31:26 +08:00
|
|
|
<el-col :xs="24" :sm="12" :lg="6" class="mb-4">
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="data-box">
|
|
|
|
|
<div
|
|
|
|
|
class="text-[#f4516c] hover:!text-white hover:bg-[#f4516c] p-3 rounded"
|
|
|
|
|
>
|
|
|
|
|
<svg-icon icon-class="money" size="3em" />
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
|
|
<div class="text-[var(--el-text-color-secondary)]">收入金额</div>
|
2023-06-17 09:53:35 +08:00
|
|
|
<div class="text-lg text-right">
|
2023-03-01 21:58:11 +08:00
|
|
|
{{ Math.round(amountOutput) }}
|
2023-01-21 16:50:25 +08:00
|
|
|
</div>
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
2023-03-17 22:31:26 +08:00
|
|
|
<el-col :xs="24" :sm="12" :lg="6" class="mb-2">
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="data-box">
|
|
|
|
|
<div
|
|
|
|
|
class="text-[#34bfa3] hover:!text-white hover:bg-[#34bfa3] p-3 rounded"
|
|
|
|
|
>
|
|
|
|
|
<svg-icon icon-class="shopping" size="3em" />
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
2023-01-21 16:50:25 +08:00
|
|
|
<div class="flex flex-col space-y-3">
|
|
|
|
|
<div class="text-[var(--el-text-color-secondary)]">订单数</div>
|
2023-07-11 07:26:12 +08:00
|
|
|
<div class="text-lg text-right">
|
2023-03-01 21:58:11 +08:00
|
|
|
{{ Math.round(orderCountOutput) }}
|
2023-01-21 16:50:25 +08:00
|
|
|
</div>
|
2022-05-08 13:06:12 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<!-- Echarts 图表 -->
|
2023-01-23 01:19:17 +08:00
|
|
|
<el-row :gutter="40">
|
2023-02-06 01:08:40 +08:00
|
|
|
<el-col :sm="24" :lg="8" class="mb-4">
|
2022-05-08 13:06:12 +08:00
|
|
|
<BarChart
|
|
|
|
|
id="barChart"
|
|
|
|
|
height="400px"
|
|
|
|
|
width="100%"
|
2023-01-21 16:50:25 +08:00
|
|
|
class="bg-[var(--el-bg-color-overlay)]"
|
2022-05-08 13:06:12 +08:00
|
|
|
/>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
2023-02-06 01:08:40 +08:00
|
|
|
<el-col :xs="24" :sm="12" :lg="8" class="mb-4">
|
2022-05-08 13:06:12 +08:00
|
|
|
<PieChart
|
|
|
|
|
id="pieChart"
|
|
|
|
|
height="400px"
|
|
|
|
|
width="100%"
|
2023-01-21 16:50:25 +08:00
|
|
|
class="bg-[var(--el-bg-color-overlay)]"
|
2022-05-08 13:06:12 +08:00
|
|
|
/>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
2023-02-06 01:08:40 +08:00
|
|
|
<el-col :xs="24" :sm="12" :lg="8" class="mb-4">
|
2022-05-08 13:06:12 +08:00
|
|
|
<RadarChart
|
|
|
|
|
id="radarChart"
|
|
|
|
|
height="400px"
|
|
|
|
|
width="100%"
|
2023-01-21 16:50:25 +08:00
|
|
|
class="bg-[var(--el-bg-color-overlay)]"
|
2022-05-08 13:06:12 +08:00
|
|
|
/>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</div>
|
2021-11-16 23:47:47 +08:00
|
|
|
</template>
|
|
|
|
|
|
2022-01-12 00:25:20 +08:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.dashboard-container {
|
2022-05-08 13:06:12 +08:00
|
|
|
position: relative;
|
2023-04-15 23:51:27 +08:00
|
|
|
padding: 24px;
|
|
|
|
|
|
2023-01-23 01:19:17 +08:00
|
|
|
.user-avatar {
|
2023-03-01 01:08:03 +08:00
|
|
|
width: 40px;
|
2023-04-15 23:51:27 +08:00
|
|
|
height: 40px;
|
2023-01-23 01:19:17 +08:00
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
2022-05-08 13:06:12 +08:00
|
|
|
|
|
|
|
|
.github-corner {
|
|
|
|
|
position: absolute;
|
2023-04-15 23:51:27 +08:00
|
|
|
top: 0;
|
2022-05-08 13:06:12 +08:00
|
|
|
right: 0;
|
|
|
|
|
z-index: 99;
|
2023-04-15 23:51:27 +08:00
|
|
|
border: 0;
|
2022-05-08 13:06:12 +08:00
|
|
|
}
|
|
|
|
|
|
2023-01-21 16:50:25 +08:00
|
|
|
.data-box {
|
2023-04-15 23:51:27 +08:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
2023-01-21 16:50:25 +08:00
|
|
|
padding: 20px;
|
2023-04-15 23:51:27 +08:00
|
|
|
font-weight: bold;
|
2023-01-17 23:20:29 +08:00
|
|
|
color: var(--el-text-color-regular);
|
|
|
|
|
background: var(--el-bg-color-overlay);
|
2023-01-18 14:07:21 +08:00
|
|
|
border-color: var(--el-border-color);
|
2023-04-15 23:51:27 +08:00
|
|
|
box-shadow: var(--el-box-shadow-dark);
|
2022-05-08 13:06:12 +08:00
|
|
|
}
|
2023-04-15 23:51:27 +08:00
|
|
|
|
2023-01-25 18:53:14 +08:00
|
|
|
.svg-icon {
|
2023-04-15 23:51:27 +08:00
|
|
|
fill: currentcolor !important;
|
2023-01-25 18:53:14 +08:00
|
|
|
}
|
2022-01-12 00:25:20 +08:00
|
|
|
}
|
|
|
|
|
</style>
|