From fdea1e556487e22381eeef37e09de705968ba017 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Sun, 4 Dec 2022 19:51:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=A1=E7=89=87=E6=B7=BB=E5=8A=A0=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/auto_pt/status.html | 179 ++++++++++++++++++---------------- 1 file changed, 97 insertions(+), 82 deletions(-) diff --git a/templates/auto_pt/status.html b/templates/auto_pt/status.html index 6bdb570..38c0950 100644 --- a/templates/auto_pt/status.html +++ b/templates/auto_pt/status.html @@ -109,7 +109,13 @@
- 历史数据 + 签到 + + 更新 + + 编辑 + + 历史 c

@@ -231,26 +237,26 @@ } const vm = new Vue({ - el: '#status', - data() { - return { - chart: null, - ptData: {}, - option: {}, - showList: false, - showSiteChart: false, - begInvite: false, - showLogo: true, - showLegend: true, - shuffle: false, + el: '#status', + data() { + return { + chart: null, + ptData: {}, + option: {}, + showList: false, + showSiteChart: false, + begInvite: false, + showLogo: true, + showLegend: true, + shuffle: false, - } - }, - beforeMount() { + } + }, + beforeMount() { - }, - mounted() { - {#this.chart = this.$refs.charts.chart#} + }, + mounted() { + {#this.chart = this.$refs.charts.chart#} this.getData() }, watch: { @@ -263,34 +269,43 @@ deep: true, } }, - methods: { - showHistoryList(id) { - axios.get( - "{% url 'site_data_api' %}" + '?id=' + id - ).then(res => { - console.log('获取数据列表成功', res.data) - let data = res.data - if ((typeof res.data) == "string") { - data = JSON.parse(data) - } - {#console.log(typeof res.data.data)#} - if (res.data.code === 0) { - {#this.ptData = res.data.data#} - {#this.ptData = res.data.data#} - {#this.setPie()#} - {#this.setCard()#} + methods: { + signIn(id) { + alert(id) + }, + updateSite(id) { + alert(id) + }, + editSite(id) { + alert(id) + }, + showHistoryList(id) { + axios.get( + "{% url 'site_data_api' %}" + '?id=' + id + ).then(res => { + console.log('获取数据列表成功', res.data) + let data = res.data + if ((typeof res.data) == "string") { + data = JSON.parse(data) + } + {#console.log(typeof res.data.data)#} + if (res.data.code === 0) { + {#this.ptData = res.data.data#} + {#this.ptData = res.data.data#} + {#this.setPie()#} + {#this.setCard()#} - this.setLine(data.data) - } else { - this.loading = false - this.$message({ - type: 'warning', - message: '获取数据列表失败!' - }); - } - }) - //.catch(res => { - //console.log('获取数据列表失败', res) + this.setLine(data.data) + } else { + this.loading = false + this.$message({ + type: 'warning', + message: '获取数据列表失败!' + }); + } + }) + //.catch(res => { + //console.log('获取数据列表失败', res) // this.$message({ // type: 'warning', // message: '获取数据列表失败!' + res @@ -311,28 +326,28 @@ this.showLogo = !this.showLogo this.setPie() } - , - showLegendMode() { - this.showLegend = !this.showLegend - this.setPie() - } - , - setChartOption(option) { - {#this.option = option#} - if (this.chart) { - this.chart.clear() + , + showLegendMode() { + this.showLegend = !this.showLegend + this.setPie() } - this.chart.setOption(option) - window.addEventListener("resize", () => { - this.chart.resize() - }) - //this.$nextTick(() => {//自适应宽度 - // this.chart.resize(); - //}) - } - , - shuffleList() { - this.shuffle = true + , + setChartOption(option) { + {#this.option = option#} + if (this.chart) { + this.chart.clear() + } + this.chart.setOption(option) + window.addEventListener("resize", () => { + this.chart.resize() + }) + //this.$nextTick(() => {//自适应宽度 + // this.chart.resize(); + //}) + } + , + shuffleList() { + this.shuffle = true this.ptData.status_list.sort(() => { return Math.random() > 0.5 ? -1 : 1 }) @@ -494,15 +509,15 @@ this.setChartOption(option) }, 50) }, - setTree() { - let ptData = this.ptData - let begInvite = !this.begInvite - let uploadedList = [] - let downloadedList = [] - ptData.status_list.forEach((site, index) => { - uploadedList.push({ - 'value': site.uploaded, - 'path': 'uploaded/' + site.name, + setTree() { + let ptData = this.ptData + let begInvite = !this.begInvite + let uploadedList = [] + let downloadedList = [] + ptData.status_list.forEach((site, index) => { + uploadedList.push({ + 'value': site.uploaded, + 'path': 'uploaded/' + site.name, 'name': `${site.name}\t${renderSize(site.uploaded)}` }) downloadedList.push({ @@ -779,9 +794,9 @@ }, - getData() { - axios.get( - "{% url "site_status_api" %}" + getData() { + axios.get( + "{% url "site_status_api" %}" ).then(res => { console.log('获取数据列表成功', res.data) if (res.data.code === 0) { @@ -797,9 +812,9 @@ message: '获取数据列表失败!' }); } - }).catch(res => { - console.log('获取数据列表失败', res) - this.$message({ + }).catch(res => { + console.log('获取数据列表失败', res) + this.$message({ type: 'warning', message: '获取数据列表失败!' + res });