rt-sim-training-client/src/views/exam/index.vue
2019-11-01 18:08:05 +08:00

64 lines
2.1 KiB
Vue

<template>
<div style="height: 100%; padding-bottom: 20px">
<el-card>
<div slot="header" style="text-align: center;">
<b>{{ $t('global.examSystem') }}</b>
</div>
</el-card>
<el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="name" :label="this.$t('exam.courseName')" />
<el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('exam.courseDescription')" />
<el-table-column :label="this.$t('global.operate')">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('exam.enterTheExam') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/router/index';
import localStore from 'storejs';
export default {
name: 'ExamHome',
data() {
return {
tableData: [],
loading: false
};
},
watch: {
'$route.params.subSystem': function(newVal) {
this.loadInitPage();
}
},
mounted() {
this.loadInitPage();
},
methods: {
loadInitPage() {
if (this.$route.params.subSystem) {
getSubSystemDetail(this.$route.params.subSystem).then(resp =>{
if (resp.data) {
this.tableData = resp.data.lessonList;
}
}).catch(()=>{
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
});
}
},
goLesson(row) {
localStore.set('examDetail' + this.$route.params.subSystem, `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}?lessonId=${row.id}`);
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}`, query: {lessonId: row.id}});
}
}
};
</script>