rt-sim-training-client/src/views/lesson/home.vue

86 lines
2.4 KiB
Vue
Raw Normal View History

2019-09-26 15:08:53 +08:00
<template>
2019-09-29 15:55:01 +08:00
<div style="height: 100%; overflow: hidden">
<el-card>
<div class="button_group">
<el-button type="primary" >查询</el-button>
</div>
</el-card>
<el-card v-loading="loading">
<el-table
:data="tableData"
row-key="id"
border
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column
prop="name"
border
label="课程">
</el-table-column>
<el-table-column
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
>创建章节</el-button>
<el-button
size="mini"
type="primary" plain
v-if="scope.row.type === 'lesson'"
>内容排序</el-button>
<el-button size="mini"
type="info"
>{{ scope.row.type==='lesson'? '编辑课程':'更新章节' }}</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
2019-09-29 14:27:58 +08:00
</div>
2019-09-26 15:08:53 +08:00
</template>
<script>
2019-09-29 14:27:58 +08:00
import { getDraftLesson } from '@/api/designPlatform';
2019-09-26 15:08:53 +08:00
export default {
2019-09-29 14:27:58 +08:00
name: 'LessonHome',
2019-09-26 15:08:53 +08:00
components: {
},
computed: {
2019-09-29 14:27:58 +08:00
mapId() {
return this.$route.params.mapId;
2019-09-26 15:08:53 +08:00
}
},
2019-09-29 14:27:58 +08:00
data() {
return {
2019-09-29 15:55:01 +08:00
tableData: [],
loading: 'false'
2019-09-29 14:27:58 +08:00
};
2019-09-26 15:08:53 +08:00
},
2019-09-29 14:27:58 +08:00
2019-09-26 15:08:53 +08:00
mounted() {
2019-09-29 15:55:01 +08:00
this.loading = true;
2019-09-29 14:27:58 +08:00
this.loadInitData();
2019-09-26 15:08:53 +08:00
},
methods: {
2019-09-29 14:27:58 +08:00
loadInitData() {
getDraftLesson({},this.mapId).then(response=> {
2019-09-29 15:55:01 +08:00
this.tableData = response.data;
this.loading = false;
2019-09-29 14:27:58 +08:00
});
2019-09-26 15:08:53 +08:00
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
2019-09-29 14:27:58 +08:00
.draft {
width: 400px;
2019-09-26 15:08:53 +08:00
text-align: center;
2019-09-29 14:27:58 +08:00
margin: 20px auto;
2019-09-26 15:08:53 +08:00
}
2019-09-29 15:55:01 +08:00
.button_group {
float: right;
margin: 10px 10px;
}
2019-09-26 15:08:53 +08:00
</style>