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

@ -61,10 +61,17 @@
</el-table-column>
<el-table-column prop="judgmentName" label="任务名称" align="center">
</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">
<template slot-scope="scope">
<div v-for="(item, index) in scope.row.lcRuleRecords">
<span>{{index+1}}. </span>{{item.userAnswer}}
<span>{{index+1}}. </span>{{item.ruleAnswer}}
</div>
</template>
</el-table-column>

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

Loading…
Cancel
Save