调整成绩的绘制,根据返回判断是否显示分数,增加charts的纵坐标格式化
This commit is contained in:
parent
5f59d3d8d4
commit
e424322ec7
@ -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");
|
||||
};
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -37,6 +37,10 @@ onLoad((options: any) => {
|
||||
}, 1000)
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
ws.closeConnect();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
>
|
||||
<view class="subject-header">
|
||||
<text class="subject-name">{{ kscj.kmmc }}</text>
|
||||
<text v-if="kscj.ksdj.id">(分数{{ kscj.ksfs }})</text>
|
||||
<text v-if="showFsFlag && kscj.ksdj.id">(分数{{ kscj.ksfs }})</text>
|
||||
</view>
|
||||
<view class="subject-body">
|
||||
<text class="subject-grade">{{ kscj.ksdj.dfbs }}</text>
|
||||
@ -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<any>({})
|
||||
const curKmIndex = ref<number>(0)
|
||||
const xqKmmcList = ref<string[]>([])
|
||||
|
||||
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;
|
||||
showFsFlag.value = res.result.showFs;
|
||||
// 初始化考试等级
|
||||
initKsdj();
|
||||
// 重构显示数据
|
||||
rebuildData();
|
||||
activeTab.value = "trend";
|
||||
} else {
|
||||
showFsFlag.value = false;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// 接口调用失败
|
||||
console.error("调用查询成绩接口失败:", error);
|
||||
});
|
||||
// 默认绘制学科成绩视图
|
||||
// 延迟执行确保DOM已经渲染
|
||||
setTimeout(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user