fix: always show six training modules on student home

dev-QQq
chenyuan 4 weeks ago
parent cf8fa95f99
commit 6faa6b1dab

@ -29,7 +29,7 @@
</section> </section>
<section class="score-table-wrap" aria-label=""> <section class="score-table-wrap" aria-label="">
<el-table :data="participatingModules" stripe border class="score-table" empty-text=""> <el-table :data="displayModules" stripe border class="score-table" empty-text="">
<el-table-column type="index" label="序号" width="64" align="center" /> <el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column prop="moduleName" label="实训模块" min-width="210" /> <el-table-column prop="moduleName" label="实训模块" min-width="210" />
<el-table-column label="成绩占比" width="116" align="center"> <el-table-column label="成绩占比" width="116" align="center">
@ -69,7 +69,7 @@
</section> </section>
<section class="module-progress-list" aria-label=""> <section class="module-progress-list" aria-label="">
<article v-for="(module, index) in participatingModules" :key="module.moduleName" class="module-progress-item"> <article v-for="(module, index) in displayModules" :key="module.moduleName" class="module-progress-item">
<div class="module-progress-head"> <div class="module-progress-head">
<span class="module-color" :style="{ backgroundColor: moduleColor(index) }"></span> <span class="module-color" :style="{ backgroundColor: moduleColor(index) }"></span>
<strong>{{ module.moduleName }}</strong> <strong>{{ module.moduleName }}</strong>
@ -106,9 +106,7 @@ const MODULE_COLORS = ["#6958e7", "#3698ee", "#ffb83e", "#ff6f4a", "#45b982", "#
let scoreChart; let scoreChart;
let progressChart; let progressChart;
const participatingModules = computed(() => const displayModules = computed(() => report.value.modules || []);
(report.value.modules || []).filter((module) => module && module.participating !== false)
);
const totalStudyMinutes = computed(() => const totalStudyMinutes = computed(() =>
Object.values(studyTime.value || {}).reduce((total, value) => total + (Number(value) || 0), 0) Object.values(studyTime.value || {}).reduce((total, value) => total + (Number(value) || 0), 0)
@ -139,7 +137,7 @@ const renderScoreChart = () => {
center: ["34%", "50%"], center: ["34%", "50%"],
avoidLabelOverlap: true, avoidLabelOverlap: true,
label: { formatter: "{b}" }, label: { formatter: "{b}" },
data: participatingModules.value.map((module, index) => ({ data: displayModules.value.map((module, index) => ({
name: module.moduleName, name: module.moduleName,
value: Number(module.score) || 0, value: Number(module.score) || 0,
itemStyle: { color: moduleColor(index) } itemStyle: { color: moduleColor(index) }
@ -151,7 +149,7 @@ const renderScoreChart = () => {
const renderProgressChart = () => { const renderProgressChart = () => {
if (!progressChartRef.value) return; if (!progressChartRef.value) return;
progressChart = progressChart || echarts.init(progressChartRef.value); progressChart = progressChart || echarts.init(progressChartRef.value);
const modules = participatingModules.value; const modules = displayModules.value;
progressChart.setOption({ progressChart.setOption({
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } }, tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
legend: { top: 0, data: ["已完成", "待完成"] }, legend: { top: 0, data: ["已完成", "待完成"] },

@ -6,7 +6,11 @@ const root = path.resolve(__dirname, '..');
const page = fs.readFileSync(path.join(root, 'src/views/student/index.vue'), 'utf8'); const page = fs.readFileSync(path.join(root, 'src/views/student/index.vue'), 'utf8');
assert(/getCurrentExperimentReport/.test(page)); assert(/getCurrentExperimentReport/.test(page));
assert(/participatingModules/.test(page)); assert(/const displayModules = computed\(\(\) => report\.value\.modules \|\| \[\]\);/.test(page));
assert(/:data="displayModules"/.test(page));
assert(/v-for="\(module, index\) in displayModules"/.test(page));
assert((page.match(/displayModules\.value/g) || []).length >= 2);
assert(!/participatingModules/.test(page));
assert(/completedTaskCount/.test(page)); assert(/completedTaskCount/.test(page));
assert(/totalTaskCount/.test(page)); assert(/totalTaskCount/.test(page));
assert(/moduleName/.test(page)); assert(/moduleName/.test(page));

Loading…
Cancel
Save