From db905ecd14f63dba9337b4f4715584ef2d7e8c7e Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Fri, 07 Mar 2025 14:45:00 +0800
Subject: [PATCH] 修改
---
src/views/onlineEducation/learnRecord/components/detailDialog.vue | 43 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/src/views/onlineEducation/learnRecord/components/detailDialog.vue b/src/views/onlineEducation/learnRecord/components/detailDialog.vue
index 7e800f3..6584be3 100644
--- a/src/views/onlineEducation/learnRecord/components/detailDialog.vue
+++ b/src/views/onlineEducation/learnRecord/components/detailDialog.vue
@@ -37,7 +37,8 @@
</div>
<el-table
:data="tableData"
- style="width: 80%;margin-left: 50px">
+ style="width: 80%;margin-left: 50px"
+ :cell-style="tableAddClass">
<el-table-column
prop="durationDesc"
label="学习时长" align="center">
@@ -58,6 +59,11 @@
label="结束位置"
prop="finishPositionDesc" align="center">
</el-table-column>
+ <el-table-column
+ label="自然时间差"
+ prop="differenceDesc" align="center">
+ </el-table-column>
+
</el-table>
<div style="margin: 30px 20px ">
<span style="font-size: 20px;font-weight: 550">认证纪录集合</span>
@@ -157,13 +163,39 @@
startTime: data.startTime,
finishTime: data.finishTime,
finishPositionDesc: data.finishPositionDesc,
- startPositionDesc: data.startPositionDesc
+ startPositionDesc: data.startPositionDesc,
+ differenceDesc: data.differenceDesc,
+ duration: data.duration,
+ difference: data.difference
})
+ // this.tableData.forEach(item => {
+ // item.timeDiff = this.getTimeDifferenceInSeconds(item.startTime,item.finishTime)
+ // })
this.trackList = data.trackList
this.authList = data.authList
},
+ getTimeDifferenceInSeconds(dateStr1, dateStr2) {
+ const date1 = new Date(dateStr1);
+ const date2 = new Date(dateStr2);
+ const timeDiff = Math.abs(date2 - date1); // 计算时间差
+
+ const seconds = Math.floor(timeDiff / 1000)
+ const hour = Math.floor(seconds / 3600)
+ const hours = hour ==0 ? '' : hour>=10 ? hour: '0' + hour
+ const minute = Math.floor((seconds % 3600) / 60);
+ const minutes = minute == 0 ? '' : minute>= 10 ? minute: '0' + minute
+ const sec = seconds % 60;
+ const secs = sec == 0 ? '' : sec >= 10 ? sec: '0' + sec
+
+ return [
+ hours ? hours + '时' : '',
+ minutes ? minutes + '分' : '',
+ secs + '秒'
+ ].filter(Boolean);
+
+ },
handleClose() {
this.tableData = [];
this.dataForm = {}
@@ -172,6 +204,13 @@
this.dialogVisible = false;
this.$emit("getList");
},
+ tableAddClass({ row, column,rowIndex, columnIndex }) {
+ console.log('1',columnIndex)
+ if (row.difference < row.duration && columnIndex === 5) {
+ return { color:' red' }
+ }
+ return "";
+ },
}
}
--
Gitblit v1.9.2