From 2e2927a189229a5c7aab2dca90c397a0a44f5703 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Tue, 16 Apr 2024 20:13:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8D=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E8=B6=8B=E5=8A=BF=E5=9B=BE=E8=A1=A8=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/common/home.ts | 9 + src/apis/common/index.ts | 1 + src/apis/common/type.ts | 7 + src/styles/global.scss | 49 ++++ src/views/home/components/AccessTrend.vue | 206 ---------------- src/views/home/components/AccessTrendCard.vue | 219 ++++++++++++++++++ src/views/home/index.vue | 4 +- 7 files changed, 287 insertions(+), 208 deletions(-) create mode 100644 src/apis/common/home.ts delete mode 100644 src/views/home/components/AccessTrend.vue create mode 100644 src/views/home/components/AccessTrendCard.vue diff --git a/src/apis/common/home.ts b/src/apis/common/home.ts new file mode 100644 index 0000000..efbae9d --- /dev/null +++ b/src/apis/common/home.ts @@ -0,0 +1,9 @@ +import http from '@/utils/http' +import type * as Common from './type' + +const BASE_URL = '/dashboard' + +/** @desc 查询访问趋势 */ +export function listAccessTrend(days: number) { + return http.get(`${BASE_URL}/access/trend/${days}`) +} diff --git a/src/apis/common/index.ts b/src/apis/common/index.ts index 7d4814a..dca11d3 100644 --- a/src/apis/common/index.ts +++ b/src/apis/common/index.ts @@ -1,2 +1,3 @@ export * from './common' export * from './captcha' +export * from './home' diff --git a/src/apis/common/type.ts b/src/apis/common/type.ts index 81842f8..35b1516 100644 --- a/src/apis/common/type.ts +++ b/src/apis/common/type.ts @@ -3,3 +3,10 @@ export interface ImageCaptchaResp { uuid: string img: string } + +/** 仪表盘访问趋势 */ +export interface DashboardAccessTrendResp { + date: string + pvCount: number + ipCount: number +} diff --git a/src/styles/global.scss b/src/styles/global.scss index 8546e67..0550deb 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -198,6 +198,55 @@ } } +// echarts 提示 +.echarts-tooltip-diy { + background: linear-gradient( + 304.17deg, + rgba(253, 254, 255, 0.6) -6.04%, + rgba(244, 247, 252, 0.6) 85.2% + ) !important; + border: none !important; + backdrop-filter: blur(10px) !important; + /* Note: backdrop-filter has minimal browser support */ + + border-radius: 6px !important; + .content-panel { + display: flex; + justify-content: space-between; + padding: 0 9px; + background: rgba(255, 255, 255, 0.8); + width: 164px; + height: 32px; + line-height: 32px; + box-shadow: 6px 0 20px rgba(34, 87, 188, 0.1); + border-radius: 4px; + margin-bottom: 4px; + } + .tooltip-title { + margin: 0 0 10px 0; + } + p { + margin: 0; + } + .tooltip-title, + .tooltip-value { + font-size: 13px; + line-height: 15px; + display: flex; + align-items: center; + text-align: right; + color: #1d2129; + font-weight: bold; + } + .tooltip-item-icon { + display: inline-block; + margin-right: 8px; + width: 10px; + height: 10px; + border-radius: 50%; + } +} + // 通用卡片 .general-card { height: 100%; diff --git a/src/views/home/components/AccessTrend.vue b/src/views/home/components/AccessTrend.vue deleted file mode 100644 index 25eb94a..0000000 --- a/src/views/home/components/AccessTrend.vue +++ /dev/null @@ -1,206 +0,0 @@ - - - diff --git a/src/views/home/components/AccessTrendCard.vue b/src/views/home/components/AccessTrendCard.vue new file mode 100644 index 0000000..836fdc9 --- /dev/null +++ b/src/views/home/components/AccessTrendCard.vue @@ -0,0 +1,219 @@ + + + diff --git a/src/views/home/index.vue b/src/views/home/index.vue index fa7ed0a..3306c77 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -5,7 +5,7 @@
-
+
@@ -23,7 +23,7 @@