dev_2022-05-11
e 3 years ago
parent c5c8ba96dc
commit b7f2939295
  1. 9
      src/pages/achievement/show/index.vue
  2. 52
      src/pages/assessment/list/index.vue

@ -61,10 +61,17 @@
</el-table-column> </el-table-column>
<el-table-column prop="judgmentName" label="任务名称" align="center"> <el-table-column prop="judgmentName" label="任务名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="userAnswer" label="考核点" align="center">
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.lcRuleRecords">
<span>{{index+1}}. </span>{{item.name}}
</div>
</template>
</el-table-column>
<el-table-column prop="userAnswer" label="学生答案" align="center"> <el-table-column prop="userAnswer" label="学生答案" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="(item, index) in scope.row.lcRuleRecords"> <div v-for="(item, index) in scope.row.lcRuleRecords">
<span>{{index+1}}. </span>{{item.userAnswer}} <span>{{index+1}}. </span>{{item.ruleAnswer}}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>

@ -86,7 +86,7 @@
</el-table-column> </el-table-column>
<el-table-column label="倒计时" align="center"> <el-table-column label="倒计时" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.countDown | timeFilter }}</span> <span>{{ timeFilter(scope.row.countDown) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实验状态" align="center"> <el-table-column label="实验状态" align="center">
@ -186,7 +186,8 @@ export default {
listData: [], // listData: [], //
multipleSelection: [], // multipleSelection: [], //
listLoading:false,// listLoading:false,//
ticker: null // ticker: null, //
sss:1
}; };
}, },
watch: { watch: {
@ -218,27 +219,20 @@ export default {
mounted() { mounted() {
// //
this.$once("hook:beforeDestroy", function() { this.$once("hook:beforeDestroy", function() {
clearInterval(this.ticker); this.sss = 0
this.ticker = null; // clearInterval(this.ticker);
// this.ticker = null;
}); });
this.getData(); this.getData();
this.getschoolCourse(); this.getschoolCourse();
}, },
filters: {
timeFilter(countDown) {
if (countDown > 0) {
let h = Math.floor(countDown / (60 * 60));
let m = Math.floor(countDown % (60 * 60) / 60);
let s = Math.floor(countDown % (60 * 60) % 60);
return `${h > 9 ? h : `0${h}`}:${m > 9 ? m : `0${m}`}:${s > 9 ? s : `0${s}`}`;
} else {
return "00:00:00";
}
}
},
methods: { methods: {
beginTimer() { beginTimer() {
this.ticker = setInterval(() => { this.ticker = setInterval(() => {
if(this.sss == 0){
this.ticker = null;
clearInterval(this.ticker);
}else{
for (let i = 0; i < this.listData.length; i++) { for (let i = 0; i < this.listData.length; i++) {
const item = this.listData[i]; const item = this.listData[i];
if (item.countDown > 0) { if (item.countDown > 0) {
@ -255,14 +249,23 @@ export default {
item.show = true; item.show = true;
this.$set(this.listData, i, item); this.$set(this.listData, i, item);
} }
}
}, 1000); }, 1000);
}, },
timeFilter(countDown) {
if (countDown > 0) {
let h = Math.floor(countDown / (60 * 60));
let m = Math.floor(countDown % (60 * 60) / 60);
let s = Math.floor(countDown % (60 * 60) % 60);
return `${h > 9 ? h : `0${h}`}:${m > 9 ? m : `0${m}`}:${s > 9 ? s : `0${s}`}`;
} else {
return "00:00:00";
}
},
getData() { getData() {
this.listLoading = true; this.listLoading = true;
this.listData.splice(0); this.listData.splice(0);
if (this.ticker) { this.sss = 0
clearInterval(this.ticker);
}
let data = { let data = {
...this.form, ...this.form,
keyWord: this.keyWord, keyWord: this.keyWord,
@ -272,7 +275,6 @@ export default {
}; };
this.$post(this.api.pageByCondition, data).then(res => { this.$post(this.api.pageByCondition, data).then(res => {
this.listData = res.list; this.listData = res.list;
console.log(this.listData)
this.total = res.total; this.total = res.total;
this.listData.forEach(i => { this.listData.forEach(i => {
i.show = false; i.show = false;
@ -298,7 +300,8 @@ export default {
} }
} }
}); });
this.beginTimer(); this.sss = 1
this.beginTimer()
this.listLoading = false; this.listLoading = false;
}).catch(err => { }).catch(err => {
this.listLoading = false; this.listLoading = false;
@ -307,6 +310,7 @@ export default {
initData() { initData() {
this.$refs.table.clearSelection(); this.$refs.table.clearSelection();
this.pageNum = 1; this.pageNum = 1;
this.sss = 0
this.getData(); this.getData();
}, },
getschoolCourse() { // getschoolCourse() { //
@ -329,6 +333,7 @@ export default {
start(row) { start(row) {
this.$post(`${this.api.enableAssessment}?id=${row.id}`).then(res => { this.$post(`${this.api.enableAssessment}?id=${row.id}`).then(res => {
util.successMsg("启动成功!"); util.successMsg("启动成功!");
this.sss = 0
this.getData(); this.getData();
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@ -345,6 +350,7 @@ export default {
}; };
this.$post(`${this.api.collectPaper}?id=${row.id}`).then(res => { this.$post(`${this.api.collectPaper}?id=${row.id}`).then(res => {
util.successMsg("提前结束成功!"); util.successMsg("提前结束成功!");
this.sss = 0
this.getData(); this.getData();
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@ -358,6 +364,7 @@ export default {
}).then(() => { }).then(() => {
this.$post(this.api.deleteAssessment, [row.id]).then(res => { this.$post(this.api.deleteAssessment, [row.id]).then(res => {
util.successMsg("删除成功"); util.successMsg("删除成功");
this.sss = 0
this.getData(); this.getData();
}).catch(res => { }).catch(res => {
}); });
@ -376,6 +383,7 @@ export default {
this.multipleSelection = []; this.multipleSelection = [];
this.$refs.table.clearSelection(); this.$refs.table.clearSelection();
util.successMsg("删除成功"); util.successMsg("删除成功");
this.sss = 0
this.getData(); this.getData();
}).catch(res => { }).catch(res => {
}); });
@ -390,10 +398,12 @@ export default {
}, },
onSearch() { onSearch() {
this.pageNum = 1; this.pageNum = 1;
this.sss = 0
this.getData(); this.getData();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.pageNum = val; this.pageNum = val;
this.sss = 0
this.getData(); this.getData();
}, },
transferTime(date) { transferTime(date) {

Loading…
Cancel
Save