rt-sim-training-client/src/views/teach/index.vue

66 lines
2.2 KiB
Vue
Raw Normal View History

2019-10-22 13:40:42 +08:00
<template>
<div style="height: 100%; padding-bottom: 20px;">
<el-card>
<div slot="header" style="text-align: center;">
2019-10-23 13:33:09 +08:00
<b>{{ $t('global.lessonSystem') }}</b>
2019-10-22 13:40:42 +08:00
</div>
</el-card>
<el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="name" :label="this.$t('teach.courseName')" />
<el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('teach.courseDescription')" />
<el-table-column :label="this.$t('global.operate')">
2019-10-22 13:40:42 +08:00
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
2019-10-23 13:33:09 +08:00
{{ $t('teach.enterTheCourse') }}
2019-10-22 13:40:42 +08:00
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { UrlConfig } from '@/scripts/ConstDic';
2019-10-22 14:28:22 +08:00
import localStore from 'storejs';
2019-10-22 13:40:42 +08:00
export default {
2019-10-29 14:41:47 +08:00
name: 'TeachHome',
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;
} else {
this.tableData = [];
}
}).catch(()=>{
this.$messageBox(this.$t('error.obtainCourseInformationFailed'));
});
}
},
goLesson(row) {
localStore.set('teachDetail' + this.$route.params.subSystem, `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}?lessonId=${row.id}&mapId=${row.mapId}&prdType=${row.prdType}`);
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}`, query: {lessonId: row.id, mapId: row.mapId, prdType: row.prdType}});
2019-10-29 14:41:47 +08:00
}
}
2019-10-22 13:40:42 +08:00
};
</script>