|
@@ -0,0 +1,96 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <list-frame :title="mainTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @view="toview" @delete="toDelete"></data-table>
|
|
|
+ </list-frame>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import listFrame from '@frame/layout/admin/list-frame';
|
|
|
+import dataTable from '@frame/components/data-table';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: trainvideo } = createNamespacedHelpers('trainvideo');
|
|
|
+const { mapActions: subject } = createNamespacedHelpers('subject');
|
|
|
+export default {
|
|
|
+ metaInfo: { title: '课程培训' },
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ listFrame,
|
|
|
+ dataTable,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '观看',
|
|
|
+ icon: 'el-icon-view',
|
|
|
+ method: 'view',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '课程名称', prop: 'subname' },
|
|
|
+ { label: '教师', prop: 'teacher' },
|
|
|
+ { label: '面向对象', prop: 'touser', format: i => (i === '0' ? '所有人' : i === '1' ? '教师' : i === '2' ? '学生' : i === '3' ? '班主任' : '暂无') },
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ // 查询科目
|
|
|
+ subjectList: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getOtherList();
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...subject({ getSubjectList: 'query' }),
|
|
|
+ ...trainvideo(['query', 'delete']),
|
|
|
+ // 查询科目
|
|
|
+ async getOtherList() {
|
|
|
+ let res = await this.getSubjectList();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `subjectList`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 查询列表
|
|
|
+ async search({ skip, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.query({ skip, limit, ...info });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ },
|
|
|
+ // 观看
|
|
|
+ toview({ data }) {
|
|
|
+ this.$router.push({ path: '/trainVidoe/viewVideo', query: { id: data.id } });
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ async toDelete({ data }) {
|
|
|
+ let res = await this.delete(data.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '刪除信息成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ mainTitle() {
|
|
|
+ let meta = this.$route.meta;
|
|
|
+ let main = meta.title || '';
|
|
|
+ let sub = meta.sub || '';
|
|
|
+ return `${main}${sub}`;
|
|
|
+ },
|
|
|
+ keyWord() {
|
|
|
+ let meta = this.$route.meta;
|
|
|
+ let main = meta.title || '';
|
|
|
+ return main;
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|