Commit 06869a45119d0717c12e67393b00d7e72c9fa9cc
1 parent
45b98e8e
fix:修改测验时长显示不对的逻辑
Showing
5 changed files
with
73 additions
and
37 deletions
.gitignore
src/utils/index.js
@@ -411,6 +411,26 @@ export function formatDate(date, fmt) { | @@ -411,6 +411,26 @@ export function formatDate(date, fmt) { | ||
411 | return time_str; | 411 | return time_str; |
412 | } | 412 | } |
413 | 413 | ||
414 | +export function formatTimeWithHours(seconds) { | ||
415 | + if (!seconds || seconds <= 0) return "0秒"; | ||
416 | + const hours = Math.floor(seconds / 3600); | ||
417 | + const minutes = Math.floor((seconds % 3600) / 60); | ||
418 | + const sec = seconds % 60; | ||
419 | + | ||
420 | + // 根据是否有小时动态调整格式 | ||
421 | + var ret = ''; | ||
422 | + if (hours > 0) { | ||
423 | + ret += hours + "小时"; | ||
424 | + } | ||
425 | + if (minutes > 0) { | ||
426 | + ret += minutes + "分钟"; | ||
427 | + } | ||
428 | + if (sec > 0) { | ||
429 | + ret += sec + "秒"; | ||
430 | + } | ||
431 | + return ret; | ||
432 | +} | ||
433 | + | ||
414 | // 获取日期时间戳 | 434 | // 获取日期时间戳 |
415 | export function getTime(dayNum) { | 435 | export function getTime(dayNum) { |
416 | var myDate = new Date(); | 436 | var myDate = new Date(); |
@@ -1266,12 +1286,12 @@ export function tablePrint(options) { | @@ -1266,12 +1286,12 @@ export function tablePrint(options) { | ||
1266 | } | 1286 | } |
1267 | 1287 | ||
1268 | let pagedoc = awin.document.createElement('div') | 1288 | let pagedoc = awin.document.createElement('div') |
1269 | - pagedoc.className = "page-number" | ||
1270 | - awin.document.body.append(pagedoc) | ||
1271 | - awin.document.body.append(aDom); | ||
1272 | - | ||
1273 | - let pagedom = awin.document.querySelectorAll('.page-number'); | ||
1274 | - | 1289 | + pagedoc.className = "page-number" |
1290 | + awin.document.body.append(pagedoc) | ||
1291 | + awin.document.body.append(aDom); | ||
1292 | + | ||
1293 | + let pagedom = awin.document.querySelectorAll('.page-number'); | ||
1294 | + | ||
1275 | awin.print(); | 1295 | awin.print(); |
1276 | 1296 | ||
1277 | awin.close() | 1297 | awin.close() |
src/views/basic/askTestQuestion/components/testBzrMulti.vue
@@ -21,7 +21,11 @@ | @@ -21,7 +21,11 @@ | ||
21 | {{ `${scoped.row.answeredNum}/${scoped.row.classPersonNum}` }} | 21 | {{ `${scoped.row.answeredNum}/${scoped.row.classPersonNum}` }} |
22 | </template> | 22 | </template> |
23 | </el-table-column> | 23 | </el-table-column> |
24 | - <el-table-column prop="examStartTime" label="测验时长"></el-table-column> | 24 | + <el-table-column label="测验时长"> |
25 | + <template slot-scope="scoped"> | ||
26 | + {{ _formatTimeWithHours(scoped.row.duration) }} | ||
27 | + </template> | ||
28 | + </el-table-column> | ||
25 | </el-table> | 29 | </el-table> |
26 | </el-row> | 30 | </el-row> |
27 | </div> | 31 | </div> |
@@ -29,8 +33,8 @@ | @@ -29,8 +33,8 @@ | ||
29 | <el-container style="height: 100%;width: 100%;"> | 33 | <el-container style="height: 100%;width: 100%;"> |
30 | <el-main id="print-content"> | 34 | <el-main id="print-content"> |
31 | <el-row class="row-type print-hidden"> | 35 | <el-row class="row-type print-hidden"> |
32 | - <div style="float: left;"> | ||
33 | - <el-button @click="_backa">返回</el-button> | 36 | + <div style="float: left;"> |
37 | + <el-button @click="_backa">返回</el-button> | ||
34 | </div> | 38 | </div> |
35 | <div style="float: right;"> | 39 | <div style="float: right;"> |
36 | <el-button type="primary" @click="_import" class="opration-btn" | 40 | <el-button type="primary" @click="_import" class="opration-btn" |
@@ -52,37 +56,37 @@ | @@ -52,37 +56,37 @@ | ||
52 | <el-table-column :prop="'examCount' + item" label="测练数" | 56 | <el-table-column :prop="'examCount' + item" label="测练数" |
53 | :class-name="index % 2 == 0 ? 'bg' : ''"> | 57 | :class-name="index % 2 == 0 ? 'bg' : ''"> |
54 | <template slot-scope="scoped">{{ | 58 | <template slot-scope="scoped">{{ |
55 | - scoped.row["examCount" + item] || | ||
56 | - Number(scoped.row["examCount" + item]) === 0 | ||
57 | - ? scoped.row["examCount" + item] | ||
58 | - : "-" | ||
59 | - }}</template> | 59 | + scoped.row["examCount" + item] || |
60 | + Number(scoped.row["examCount" + item]) === 0 | ||
61 | + ? scoped.row["examCount" + item] | ||
62 | + : "-" | ||
63 | + }}</template> | ||
60 | </el-table-column> | 64 | </el-table-column> |
61 | <el-table-column :prop="'participationCount' + item" label="参与数" | 65 | <el-table-column :prop="'participationCount' + item" label="参与数" |
62 | :class-name="index % 2 == 0 ? 'bg' : ''"> | 66 | :class-name="index % 2 == 0 ? 'bg' : ''"> |
63 | <template slot-scope="scoped">{{ | 67 | <template slot-scope="scoped">{{ |
64 | - scoped.row["participationCount" + item] || | ||
65 | - Number(scoped.row["participationCount" + item]) === 0 | ||
66 | - ? scoped.row["participationCount" + item] | ||
67 | - : "-" | ||
68 | - }}</template> | 68 | + scoped.row["participationCount" + item] || |
69 | + Number(scoped.row["participationCount" + item]) === 0 | ||
70 | + ? scoped.row["participationCount" + item] | ||
71 | + : "-" | ||
72 | + }}</template> | ||
69 | </el-table-column> | 73 | </el-table-column> |
70 | <el-table-column :prop="'score' + item" label="总分" | 74 | <el-table-column :prop="'score' + item" label="总分" |
71 | :class-name="index % 2 == 0 ? 'bg' : ''"> | 75 | :class-name="index % 2 == 0 ? 'bg' : ''"> |
72 | <template slot-scope="scoped">{{ | 76 | <template slot-scope="scoped">{{ |
73 | - scoped.row["score" + item] || | ||
74 | - Number(scoped.row["score" + item]) === 0 | ||
75 | - ? scoped.row["score" + item] | ||
76 | - : "-" | ||
77 | - }}</template> | 77 | + scoped.row["score" + item] || |
78 | + Number(scoped.row["score" + item]) === 0 | ||
79 | + ? scoped.row["score" + item] | ||
80 | + : "-" | ||
81 | + }}</template> | ||
78 | </el-table-column> | 82 | </el-table-column> |
79 | <el-table-column :prop="'classRank' + item" label="班名" | 83 | <el-table-column :prop="'classRank' + item" label="班名" |
80 | :class-name="index % 2 == 0 ? 'bg' : ''"> | 84 | :class-name="index % 2 == 0 ? 'bg' : ''"> |
81 | <template slot-scope="scoped">{{ | 85 | <template slot-scope="scoped">{{ |
82 | - scoped.row["classRank" + item] || | ||
83 | - Number(scoped.row["classRank" + item]) === 0 | ||
84 | - ? scoped.row["classRank" + item] | ||
85 | - : "-" | 86 | + scoped.row["classRank" + item] || |
87 | + Number(scoped.row["classRank" + item]) === 0 | ||
88 | + ? scoped.row["classRank" + item] | ||
89 | + : "-" | ||
86 | }}</template> | 90 | }}</template> |
87 | </el-table-column> | 91 | </el-table-column> |
88 | </el-table-column> | 92 | </el-table-column> |
@@ -93,7 +97,7 @@ | @@ -93,7 +97,7 @@ | ||
93 | </el-table-column> | 97 | </el-table-column> |
94 | </el-table> | 98 | </el-table> |
95 | </el-row> | 99 | </el-row> |
96 | - </el-main> | 100 | + </el-main> |
97 | </el-container> | 101 | </el-container> |
98 | 102 | ||
99 | </div> | 103 | </div> |
@@ -106,7 +110,7 @@ | @@ -106,7 +110,7 @@ | ||
106 | </div> | 110 | </div> |
107 | </template> | 111 | </template> |
108 | <script> | 112 | <script> |
109 | -import { formatDate } from "utils"; | 113 | +import { formatDate, formatTimeWithHours } from "utils"; |
110 | import { downloadFile, tablePrint } from "@/utils"; | 114 | import { downloadFile, tablePrint } from "@/utils"; |
111 | import RadarChart from "@/components/charts/radarChart"; | 115 | import RadarChart from "@/components/charts/radarChart"; |
112 | export default { | 116 | export default { |
@@ -168,6 +172,9 @@ export default { | @@ -168,6 +172,9 @@ export default { | ||
168 | async created() { | 172 | async created() { |
169 | }, | 173 | }, |
170 | methods: { | 174 | methods: { |
175 | + _formatTimeWithHours(seconds) { | ||
176 | + return formatTimeWithHours(seconds); | ||
177 | + }, | ||
171 | _print() { | 178 | _print() { |
172 | tablePrint({ | 179 | tablePrint({ |
173 | id: "print-content", | 180 | id: "print-content", |
@@ -177,7 +184,7 @@ export default { | @@ -177,7 +184,7 @@ export default { | ||
177 | fixedColumn: 2, | 184 | fixedColumn: 2, |
178 | diffNumber: 2, | 185 | diffNumber: 2, |
179 | diffStNumber: 15 | 186 | diffStNumber: 15 |
180 | - }); | 187 | + }); |
181 | }, | 188 | }, |
182 | _checkAll() { | 189 | _checkAll() { |
183 | // this.multipleSelection = [...] | 190 | // this.multipleSelection = [...] |
@@ -291,7 +298,7 @@ export default { | @@ -291,7 +298,7 @@ export default { | ||
291 | max = score > max ? score : max; | 298 | max = score > max ? score : max; |
292 | return item.subjectName; | 299 | return item.subjectName; |
293 | }); | 300 | }); |
294 | - max += 10; | 301 | + max += 10; |
295 | this.radarChart = { | 302 | this.radarChart = { |
296 | indicator: [ | 303 | indicator: [ |
297 | { | 304 | { |
@@ -338,7 +345,7 @@ export default { | @@ -338,7 +345,7 @@ export default { | ||
338 | ]; | 345 | ]; |
339 | 346 | ||
340 | this.radarChart.title = obj.studentName + "-多科阶段作答表现图"; | 347 | this.radarChart.title = obj.studentName + "-多科阶段作答表现图"; |
341 | - | 348 | + |
342 | this.redarVisible = true; | 349 | this.redarVisible = true; |
343 | }, | 350 | }, |
344 | async _loadData() { | 351 | async _loadData() { |
src/views/basic/askTestQuestion/components/testListReport.vue
@@ -7,9 +7,13 @@ | @@ -7,9 +7,13 @@ | ||
7 | <el-table-column prop="examPaperScore" label="卷面分" width="130" /> | 7 | <el-table-column prop="examPaperScore" label="卷面分" width="130" /> |
8 | <el-table-column prop="classCorrectRate" label="测验人数/班级人数" width="180"> | 8 | <el-table-column prop="classCorrectRate" label="测验人数/班级人数" width="180"> |
9 | <template slot-scope="scoped">{{ `${scoped.row.answeredNum}/${scoped.row.classPersonNum}` }}</template> | 9 | <template slot-scope="scoped">{{ `${scoped.row.answeredNum}/${scoped.row.classPersonNum}` }}</template> |
10 | + </el-table-column>>z | ||
11 | + <el-table-column label="测验时长" width="130" > | ||
12 | + <template slot-scope="scoped"> | ||
13 | + {{ _formatTimeWithHours(scoped.row.duration) }} | ||
14 | + </template> | ||
10 | </el-table-column> | 15 | </el-table-column> |
11 | - <el-table-column prop="questionNum" label="测验时长" width="130" /> | ||
12 | - <el-table-column prop="createdTime" label="测验开始时间" width="210" /> | 16 | + <el-table-column prop="examStartTime" label="测验开始时间" width="210" /> |
13 | <el-table-column label="操作" width="240"> | 17 | <el-table-column label="操作" width="240"> |
14 | <template slot-scope="scoped"> | 18 | <template slot-scope="scoped"> |
15 | <el-button style="margin-right: 10px;" v-if="scoped.row.answerNum != 0 || | 19 | <el-button style="margin-right: 10px;" v-if="scoped.row.answerNum != 0 || |
@@ -50,6 +54,7 @@ | @@ -50,6 +54,7 @@ | ||
50 | </template> | 54 | </template> |
51 | <script> | 55 | <script> |
52 | import ScoreSet from "../../test/components/scoreSet.vue"; | 56 | import ScoreSet from "../../test/components/scoreSet.vue"; |
57 | +import { formatTimeWithHours } from "utils"; | ||
53 | export default { | 58 | export default { |
54 | name: "testListReport", | 59 | name: "testListReport", |
55 | props: { | 60 | props: { |
@@ -89,6 +94,9 @@ export default { | @@ -89,6 +94,9 @@ export default { | ||
89 | 94 | ||
90 | }, | 95 | }, |
91 | methods: { | 96 | methods: { |
97 | + _formatTimeWithHours(seconds){ | ||
98 | + return formatTimeWithHours(seconds); | ||
99 | + }, | ||
92 | _linkToDetail(dataRow) { | 100 | _linkToDetail(dataRow) { |
93 | this.$router.push({ | 101 | this.$router.push({ |
94 | path: "/testReportDetail", | 102 | path: "/testReportDetail", |
vue.config.js
@@ -26,8 +26,8 @@ module.exports = { | @@ -26,8 +26,8 @@ module.exports = { | ||
26 | // target:"http://ezquiz.sunvotecloud.cn", | 26 | // target:"http://ezquiz.sunvotecloud.cn", |
27 | // target:"http://192.168.1.151:8089", | 27 | // target:"http://192.168.1.151:8089", |
28 | // target: "https://ezquiz.sunvotecloud.cn", | 28 | // target: "https://ezquiz.sunvotecloud.cn", |
29 | - target: "http://121.40.127.171:8090", | ||
30 | - // target:"http://127.0.0.1:8089", | 29 | + // target: "http://121.40.127.171:8090", |
30 | + target:"http://127.0.0.1:8089", | ||
31 | changeOrigin: true, | 31 | changeOrigin: true, |
32 | ws: true, | 32 | ws: true, |
33 | }, | 33 | }, |