From 18ea3f5c580ec3328de7e1927c4a673bc3991048 Mon Sep 17 00:00:00 2001 From: Xwen <929716663@qq.com> Date: Wed, 13 Dec 2023 17:58:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=E9=A6=96=E9=A1=B5=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=9B=BE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/echars/VisitsLineChart.vue | 51 ------------ Yi.BBS.Vue3/src/router/index.js | 2 +- Yi.BBS.Vue3/src/views/{ => home}/Index.vue | 32 ++++++-- .../views/home/components/VisitsLineChart.vue | 30 +++++++ .../src/views/home/hooks/echartsConfig.js | 81 +++++++++++++++++++ 5 files changed, 139 insertions(+), 57 deletions(-) delete mode 100644 Yi.BBS.Vue3/src/components/echars/VisitsLineChart.vue rename Yi.BBS.Vue3/src/views/{ => home}/Index.vue (86%) create mode 100644 Yi.BBS.Vue3/src/views/home/components/VisitsLineChart.vue create mode 100644 Yi.BBS.Vue3/src/views/home/hooks/echartsConfig.js diff --git a/Yi.BBS.Vue3/src/components/echars/VisitsLineChart.vue b/Yi.BBS.Vue3/src/components/echars/VisitsLineChart.vue deleted file mode 100644 index c79192d4..00000000 --- a/Yi.BBS.Vue3/src/components/echars/VisitsLineChart.vue +++ /dev/null @@ -1,51 +0,0 @@ - - diff --git a/Yi.BBS.Vue3/src/router/index.js b/Yi.BBS.Vue3/src/router/index.js index efd0a79d..08366d10 100644 --- a/Yi.BBS.Vue3/src/router/index.js +++ b/Yi.BBS.Vue3/src/router/index.js @@ -41,7 +41,7 @@ const router = createRouter({ { name: "index", path: "/index", - component: () => import("../views/Index.vue"), + component: () => import("../views/home/Index.vue"), }, { name: "article", diff --git a/Yi.BBS.Vue3/src/views/Index.vue b/Yi.BBS.Vue3/src/views/home/Index.vue similarity index 86% rename from Yi.BBS.Vue3/src/views/Index.vue rename to Yi.BBS.Vue3/src/views/home/Index.vue index 17b073a3..3deb7c0c 100644 --- a/Yi.BBS.Vue3/src/views/Index.vue +++ b/Yi.BBS.Vue3/src/views/home/Index.vue @@ -54,7 +54,7 @@ @@ -99,22 +99,25 @@ diff --git a/Yi.BBS.Vue3/src/views/home/components/VisitsLineChart.vue b/Yi.BBS.Vue3/src/views/home/components/VisitsLineChart.vue new file mode 100644 index 00000000..8fcece6e --- /dev/null +++ b/Yi.BBS.Vue3/src/views/home/components/VisitsLineChart.vue @@ -0,0 +1,30 @@ + + + + diff --git a/Yi.BBS.Vue3/src/views/home/hooks/echartsConfig.js b/Yi.BBS.Vue3/src/views/home/hooks/echartsConfig.js new file mode 100644 index 00000000..e6d23ac4 --- /dev/null +++ b/Yi.BBS.Vue3/src/views/home/hooks/echartsConfig.js @@ -0,0 +1,81 @@ +export const statisticsEcharts = { + grid: { + top: "10%", + left: "4%", + right: "4%", + bottom: "5%", + containLabel: true, + }, + tooltip: { + trigger: "axis", + }, + xAxis: { + show: false, + type: "category", + data: [], + axisLine: { + lineStyle: { + color: "#999", + }, + }, + }, + yAxis: [ + { + type: "value", + splitNumber: 4, + splitLine: { + lineStyle: { + type: "dashed", + color: "#DDD", + }, + }, + axisLine: { + show: false, + lineStyle: { + color: "#333", + }, + }, + nameTextStyle: { + color: "#999", + }, + splitArea: { + show: false, + }, + }, + ], + series: { + name: "访问量", + type: "line", + data: [], + lineStyle: { + normal: { + width: 5, + color: { + type: "linear", + colorStops: [ + { + offset: 0, + color: "#a0cfff", // 浅蓝色,0% 处的颜色 + }, + { + offset: 1, + color: "#0047AB", // 深蓝色,100% 处的颜色 + }, + ], + globalCoord: false, // 缺省为 false + }, + shadowColor: "rgba(72,216,191, 0.3)", + shadowBlur: 10, + shadowOffsetY: 20, + }, + }, + itemStyle: { + normal: { + color: "#fff", + borderWidth: 10, + borderColor: "#A9F387", + }, + }, + smooth: true, + }, +};