From e424322ec7cec462940830518398e8a2765b0ea5 Mon Sep 17 00:00:00 2001 From: ywyonui Date: Tue, 1 Jul 2025 17:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=88=90=E7=BB=A9=E7=9A=84?= =?UTF-8?q?=E7=BB=98=E5=88=B6=EF=BC=8C=E6=A0=B9=E6=8D=AE=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E6=98=BE=E7=A4=BA=E5=88=86?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E5=A2=9E=E5=8A=A0charts=E7=9A=84=E7=BA=B5?= =?UTF-8?q?=E5=9D=90=E6=A0=87=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/base/server.ts | 2 +- src/components/charts/u-charts.js | 13 ++-- src/pages/base/course-selection/pay-wait.vue | 4 ++ src/pages/base/grades/detail.vue | 65 ++++++++------------ 4 files changed, 39 insertions(+), 45 deletions(-) diff --git a/src/api/base/server.ts b/src/api/base/server.ts index 7e0931b..587d58a 100644 --- a/src/api/base/server.ts +++ b/src/api/base/server.ts @@ -35,7 +35,7 @@ export const xkqddeleteApi = async (params: any) => { }; // 获取配置:家长端是否显示分钟数 -export const getJzdShowFs = async (params: any) => { +export const getJzdShowFs = async () => { return await get("/api/comConfig/getJzdShowFs"); }; diff --git a/src/components/charts/u-charts.js b/src/components/charts/u-charts.js index f78bde5..4b2d65d 100644 --- a/src/components/charts/u-charts.js +++ b/src/components/charts/u-charts.js @@ -4692,6 +4692,7 @@ function drawYAxisGrid(categories, opts, config, context) { } function drawYAxis(series, opts, config, context) { + console.log('画Y轴'); if (opts.yAxis.disabled === true) { return; } @@ -4735,6 +4736,7 @@ function drawYAxis(series, opts, config, context) { let textAlign = yData.textAlign || "right"; //画Y轴刻度及文案 rangesFormat.forEach(function(item, index) { + var label = opts.yAxis.format(item); var pos = points[index]; context.beginPath(); context.setFontSize(yAxisFontSize); @@ -4764,7 +4766,7 @@ function drawYAxis(series, opts, config, context) { context.setTextAlign('center'); tmpstrat = tStartLeft - yAxisWidth.width / 2 } - context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + context.fillText(String(label), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); } else if (yAxisWidth.position == 'right') { //画刻度线 @@ -4786,7 +4788,7 @@ function drawYAxis(series, opts, config, context) { context.setTextAlign('center'); tmpstrat = tStartRight + yAxisWidth.width / 2 } - context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + context.fillText(String(label), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); } else if (yAxisWidth.position == 'center') { //画刻度线 if (yData.calibration == true) { @@ -4808,7 +4810,7 @@ function drawYAxis(series, opts, config, context) { context.setTextAlign('center'); tmpstrat = tStartCenter - yAxisWidth.width / 2 } - context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + context.fillText(String(label), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); } context.closePath(); context.stroke(); @@ -7016,7 +7018,10 @@ var uCharts = function uCharts(opts) { dashLength: 4 * opts.pix, gridColor: '#cccccc', padding: 10, - fontColor: '#666666' + fontColor: '#666666', + format: function format(val) { + return val; + } }, opts.yAxis); opts.xAxis = assign({}, { rotateLabel: false, diff --git a/src/pages/base/course-selection/pay-wait.vue b/src/pages/base/course-selection/pay-wait.vue index bac6517..e121453 100644 --- a/src/pages/base/course-selection/pay-wait.vue +++ b/src/pages/base/course-selection/pay-wait.vue @@ -37,6 +37,10 @@ onLoad((options: any) => { }, 1000) } }); + +onUnmounted(() => { + ws.closeConnect(); +}); diff --git a/src/pages/base/grades/detail.vue b/src/pages/base/grades/detail.vue index 03c2afd..bc02ce6 100644 --- a/src/pages/base/grades/detail.vue +++ b/src/pages/base/grades/detail.vue @@ -61,7 +61,7 @@ > {{ kscj.kmmc }} - (分数{{ kscj.ksfs }}) + (分数{{ kscj.ksfs }}) {{ kscj.ksdj.dfbs }} @@ -158,7 +158,7 @@ import { ref, onMounted, watch, nextTick } from "vue"; import uCharts from "@/components/charts/u-charts.js"; import dayjs from "dayjs"; -import { xsKscjApi } from "@/api/base/server"; +import { xsKscjApi, getJzdShowFs } from "@/api/base/server"; import { useUserStore } from "@/store/modules/user"; import { useDataStore } from "@/store/modules/data"; import { format } from "path"; @@ -181,25 +181,16 @@ const curKm = ref({}) const curKmIndex = ref(0) const xqKmmcList = ref([]) +const showFsFlag = ref(false); + // 当前选中的选项卡 const activeTab = ref("scores"); // 切换选项卡 -function switchTab(tab: string) { +const switchTab = (tab: string) => { activeTab.value = tab; } -// 科目数据 -const subjects = ref([ - { id: "1", kmmc: "语文", fullScore: 98, grade: "B" }, - { id: "2", kmmc: "数学", fullScore: 96, grade: "A" }, - { id: "3", kmmc: "英语", fullScore: 98, grade: "A" }, - { id: "4", kmmc: "科学", fullScore: 94, grade: "A" }, - // { id: "5", kmmc: "音乐", fullScore: 93, grade: "A" }, - // { id: "6", kmmc: "美术", fullScore: 93, grade: "A" }, - { id: "7", kmmc: "体育", fullScore: 93, grade: "A" }, -]); - type ColorMapType = { [key: string]: string; }; @@ -343,7 +334,7 @@ const drawTrendChart = () => { animation: true, background: "#FFFFFF", padding: [15, 15, 0, 15], - dataLabel: false, + dataLabel: showFsFlag.value, // 是否显示分数 dataPointShape: true, enableScroll: false, legend: { @@ -363,12 +354,9 @@ const drawTrendChart = () => { max: 100, }, ], - min: 0, // 纵坐标最小值设为0 - max: 100, // 纵坐标最大值设为100 - axisLabel: { // 标签配置 - show: function(value: any) { - return value === 0 || value === 100; // 只显示0和100 - } + format: (val : number) => { + console.log(val); + return val == 0 || val == 100 ? val : ''; }, }, extra: { @@ -488,30 +476,27 @@ const rebuildData = () => { buildXqKmKscjList(); } -onMounted(() => { +onMounted(async () => { curXs.value = getCurXs; kscc.value = getData; - xsKscjApi({ + const res = await xsKscjApi({ xsId: getCurXs.id, ksccId: getData.id, njmcId: getData.njmcId - }).then(res => { - if (res.resultCode == 1) { - srcKmList.value = res.result.kmList; - srcKsdjList.value = res.result.ksdjList; - srcKsccKscjList.value = res.result.ksccKscjList; - srcXqKscjList.value = res.result.xqKscjList; - // 初始化考试等级 - initKsdj(); - // 重构显示数据 - rebuildData(); - activeTab.value = "trend"; - } - }) - .catch((error) => { - // 接口调用失败 - console.error("调用查询成绩接口失败:", error); - }); + }); + if (res.resultCode == 1) { + srcKmList.value = res.result.kmList; + srcKsdjList.value = res.result.ksdjList; + srcKsccKscjList.value = res.result.ksccKscjList; + srcXqKscjList.value = res.result.xqKscjList; + showFsFlag.value = res.result.showFs; + // 初始化考试等级 + initKsdj(); + // 重构显示数据 + rebuildData(); + } else { + showFsFlag.value = false; + } // 默认绘制学科成绩视图 // 延迟执行确保DOM已经渲染 setTimeout(() => {