From b38f54c9c44c74fd020493719a2725e6ca788888 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Sat, 3 Dec 2022 10:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B1=95=E7=A4=BA=E9=A1=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/auto_pt/status.html | 123 ++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 44 deletions(-) diff --git a/templates/auto_pt/status.html b/templates/auto_pt/status.html index d27e275..d5f9807 100644 --- a/templates/auto_pt/status.html +++ b/templates/auto_pt/status.html @@ -42,12 +42,22 @@
站点数据 - 图表 + + + + 随机 - + 正序 + + 图表 + + 卡片 + +
@@ -136,23 +146,23 @@
-
- 矩形图 - - 柱状图 - - 饼图 - +
+ + + + 求药 + + + 图例 + + + Logo + + + + - - -
@@ -194,12 +204,12 @@ option: {}, showList: true, showChart: false, - chartShow: { - begInvite: false, - showLogo: false, - showLegend: false, - shuffle: false, - } + + begInvite: false, + showLogo: true, + showLegend: true, + shuffle: false, + } }, beforeMount() { @@ -220,6 +230,23 @@ } }, methods: { + begInviteMode() { + this.begInvite = !this.begInvite + if (this.begInvite) { + this.showLegend = false + this.showLogo = false + } + + this.setPie() + }, + showLogoMode() { + this.showLogo = !this.showLogo + this.setPie() + }, + showLegendMode() { + this.showLegend = !this.showLegend + this.setPie() + }, setChartOption(option) { this.option = option if (this.chart) { @@ -235,38 +262,46 @@ //}) }, shuffleList() { - if (this.shuffle) { - this.ptData.status_list.sort(() => { - return Math.random() > 0.5 ? -1 : 1 - }) - } else { - this.ptData.status_list.sort((a, b) => { - if (b.mail == a.mail) { - return b.uploaded - a.uploaded - } - return b.mail - a.mail - }) + this.shuffle = true + this.ptData.status_list.sort(() => { + return Math.random() > 0.5 ? -1 : 1 + }) + + this.showList ? this.setCard() : this.setPie() + }, + sortList() { + if (this.shuffle == false) { + return } + this.shuffle = false + this.ptData.status_list.sort((a, b) => { + if (b.mail == a.mail) { + return b.uploaded - a.uploaded + } + return b.mail - a.mail + }) + this.showList ? this.setCard() : this.setPie() }, setCard() { if (this.chart) { this.chart.clear() } //乱序 - this.shuffleList() + {#this.shuffleList()#} this.showList = true + }, setPie() { let uploadedList = [] let siteList = [] let ptData = this.ptData - let begInvite = !this.chartShow.begInvite + let begInvite = !this.begInvite let status_list = ptData.status_list this.showList = false - if (this.chartShow.shuffle) { - status_list.sort(shuffle) - } + //if (this.shuffle) { + // status_list.sort(shuffle) + //} status_list.forEach((site, index) => { uploadedList.push({ 'value': site.uploaded, @@ -280,7 +315,7 @@ //}) siteList.push({ name: site.name, - icon: begInvite ? `image://${site.icon}` : 'roundRect' + icon: this.showLogo ? `image://${site.icon}` : 'roundRect' }) }) let option = { @@ -317,7 +352,7 @@ '#d677f6', ], legend: { - show: this.chartShow.showLegend, + show: this.showLegend, {#type: 'scroll',#} {#top: 'bottom',#} right: '2%', @@ -379,7 +414,7 @@ }, setTree() { let ptData = this.ptData - let begInvite = !this.chartShow.begInvite + let begInvite = !this.begInvite let uploadedList = [] let downloadedList = [] ptData.status_list.forEach((site, index) => {