guhongwei 4 роки тому
батько
коміт
81486bbe25

+ 13 - 0
src/router/index.js

@@ -143,6 +143,19 @@ const routes = [
         meta: { title: '积分榜' },
         component: () => import('@/views/league/index.vue'),
       },
+      // 课程培训
+      {
+        path: '/trainVidoe/index',
+        name: 'trainVidoe_index',
+        meta: { title: '课程培训', sub: '管理' },
+        component: () => import('@/views/trainVidoe/index.vue'),
+      },
+      {
+        path: '/trainVidoe/viewVideo',
+        name: 'trainVidoe_viewVideo',
+        meta: { title: '课程培训', sub: '管理' },
+        component: () => import('@/views/trainVidoe/viewVideo.vue'),
+      },
     ],
   },
   {

+ 2 - 0
src/store/index.js

@@ -30,6 +30,7 @@ import group from '@frame/store/group';
 import personalscore from '@frame/store/personalscore';
 import groupscore from '@frame/store/groupscore';
 import uploadtask from '@frame/store/uploadtask';
+import trainvideo from '@frame/store/trainvideo';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 import * as dostate from '@frame/store/setting/state';
@@ -68,6 +69,7 @@ export default new Vuex.Store({
     personalscore,
     groupscore,
     uploadtask,
+    trainvideo,
   },
   state: { ...ustate, ...dostate },
   mutations: { ...umutations, ...domutations },

+ 96 - 0
src/views/trainVidoe/index.vue

@@ -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>

+ 108 - 0
src/views/trainVidoe/viewVideo.vue

@@ -0,0 +1,108 @@
+<template>
+  <div id="viewVideo">
+    <detail-frame :title="mainTitle" returns="/trainVidoe/index">
+      <el-col :span="24" class="top">
+        <span>课程权属:{{ videoInfo.teacher || '中心提供' }}</span>
+        <span>所讲课程:{{ videoInfo.subname }}</span>
+      </el-col>
+      <el-col :span="24" class="info">
+        <video :src="videoInfo.url" controls="controls">
+          您的浏览器不支持 video 标签。
+        </video>
+      </el-col>
+      <el-col :span="24" class="foot" style="display:none">
+        <el-input v-model="evaluate" type="textarea" maxlength="300" show-word-limit :autosize="{ minRows: 4, maxRows: 5 }" placeholder="请输入评价"></el-input>
+        <el-button type="primary" size="mini" @click="onSubmit">提交评价</el-button>
+      </el-col>
+    </detail-frame>
+  </div>
+</template>
+
+<script>
+import detailFrame from '@frame/layout/admin/detail-frame';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: trainvideo } = createNamespacedHelpers('trainvideo');
+export default {
+  name: 'viewVideo',
+  props: {},
+  components: { detailFrame },
+  data: function() {
+    return {
+      videoInfo: {},
+      evaluate: '',
+    };
+  },
+  created() {},
+  methods: {
+    ...trainvideo(['fetch', 'create', 'update']),
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `videoInfo`, res.data);
+      }
+    },
+    // 提交评价
+    onSubmit() {
+      console.log(this.evaluate);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+    isNew() {
+      return this.$route.query.id ? false : true;
+    },
+    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;
+    },
+  },
+  watch: {
+    isNew: {
+      immediate: true,
+      handler(val) {
+        if (val) this.loading = false;
+        else this.search();
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top {
+  height: 50px;
+  text-align: center;
+  line-height: 50px;
+  span {
+    display: inline-block;
+    margin: 0 10px;
+    font-size: 30px;
+    -webkit-text-stroke: 1px #76bdfe;
+    font-family: cursive;
+  }
+}
+.info {
+  text-align: center;
+  margin: 15px 0;
+  video {
+    width: 50%;
+  }
+}
+.foot {
+  padding: 0 20%;
+  text-align: center;
+  .el-button {
+    margin: 15px 0;
+  }
+}
+</style>

+ 1 - 1
vue.config.js

@@ -30,7 +30,7 @@ module.exports = {
         ws: true,
       },
       '/files': {
-        target: 'http://smart.cc-lotus.info',
+        target: 'http://free.liaoningdoupo.com',
         changeOrigin: true,
         ws: true,
       },