From ada18d3c5fd3f5ae4903c44bf575d4d04a3fdcbe Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 3 Aug 2023 17:54:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BB=B4=E5=BA=A6=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=EF=BC=88=E5=A4=87=E4=BB=BD=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/achievement/info/course.vue | 5 ++- src/pages/achievement/info/project.vue | 43 +++++++++++++++++++++----- src/pages/achievement/list/course.vue | 2 +- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/pages/achievement/info/course.vue b/src/pages/achievement/info/course.vue index f91682e..1895747 100644 --- a/src/pages/achievement/info/course.vue +++ b/src/pages/achievement/info/course.vue @@ -282,6 +282,7 @@ export default { accountId: this.$route.query.accountId, id: +this.$route.query.id, cid: +this.$route.query.cid, + classId: +this.$route.query.classId, keyword: "", searchTimer: null, listDataAll: [], @@ -330,7 +331,8 @@ export default { keyWord: this.keyword, mallId: this.id, cid: this.cid, - permissions: per + permissions: per, + classId: this.classId }) this.listDataAll = per ? res.listOfAssessmentResults.records : res.userScoreList.records this.total = per ? res.listOfAssessmentResults.total : res.userScoreList.total @@ -388,6 +390,7 @@ export default { mallId: this.id, cid: this.cid, permissions: +this.curTab, + classId: this.classId }) list = practice ? res.userScoreList.records : res.listOfAssessmentResults.records } diff --git a/src/pages/achievement/info/project.vue b/src/pages/achievement/info/project.vue index 3a605d9..76324b8 100644 --- a/src/pages/achievement/info/project.vue +++ b/src/pages/achievement/info/project.vue @@ -502,29 +502,56 @@ export default { getChart () { // 初始化折线图 const xData = Array.from({ length: 101 }, (v, k) => k) const yData = Array.from({ length: 101 }, (v, k) => 0) + const data = {} const list = this.listDataAll list.map(n => { + if (!data[n.score]) { + data[n.score] = 1 + } else { + data[n.score]++ + } + yData[n.score]++ }) - console.log(333, xData, yData) + let max = Math.max(...Object.values(data)) + console.log("🚀 ~ file: project.vue:517 ~ getChart ~ max:", yData) + const x = Array.from({ length: max }, (v, k) => k) + + for (let i = 0; i <= max; i++) { + const item = yData.findIndex(e => e == i) + console.log("🚀 ~ file: project.vue:521 ~ getChart ~ item:", item) + + } + + xData.map(e => { + for (let i = 0; i <= max; i++) { + + } + }) + // console.log(333, xData, yData, data) let myChart = echarts.init(document.getElementById("chart")); myChart.setOption({ title: { text: "实验分数分布图" }, tooltip: {}, xAxis: { - name: "分数", - type: "category", + name: this.permissions ? "人数" : '成绩报告数量', + type: "value", boundaryGap: false, interval: 5, axisLabel: { - interval: 9, + interval: 5 }, - data: xData }, yAxis: { - name: this.permissions ? "人数" : '成绩报告数量', - type: "value", - interval: 5 + name: "分数", + type: "category", + min: 0, + max: 100, + interval: 5, + axisLabel: { + interval: 9 + }, + data: xData }, series: [{ data: yData, diff --git a/src/pages/achievement/list/course.vue b/src/pages/achievement/list/course.vue index 26c4d65..dc86753 100644 --- a/src/pages/achievement/list/course.vue +++ b/src/pages/achievement/list/course.vue @@ -248,7 +248,7 @@ export default { }, // 进入实验记录 entry (row) { - this.$router.push(`course?id=${row.mallId}&curriculumName=${row.curriculumName}&cid=${row.cid}`) + this.$router.push(`course?id=${row.mallId}&curriculumName=${row.curriculumName}&cid=${row.cid}&classId=${row.classId}`) }, handleCurrentChange (val) { // 切换页码 this.page = val