浏览代码

个人资源库收藏视频

shilipojs 2 年之前
父节点
当前提交
15539d139e

+ 27 - 0
src/components/MxCondition/condition-object/condition-subject-list.js

@@ -0,0 +1,27 @@
+import conditionObjectBase from '../condition-object-base.js'
+import * as system from "@/api/webApi/system";
+
+export default {
+  ...conditionObjectBase,
+  key: 'subjectByVideo',
+  title: '科目',
+  getList: function(param,$ref) {
+    return new Promise((resolve, reject) => {
+      system.getSubjectsList({  }).then(res => resolve(
+        res.rows.map(item => {
+          return {
+            code: item.subjectid,
+            label:item.subjectname
+          }
+        })
+      ))
+        .catch(e => reject(e))
+    })
+  },
+  getCode: function(item) {
+    return item.code
+  },
+  getLabel: function(item) {
+    return item.label
+  }
+}

+ 307 - 0
src/views/accurateTeaching/collect/index.vue

@@ -0,0 +1,307 @@
+<template>
+  <div class="app-container">
+    <el-card>
+      <mx-condition ref="condition" :query-params="queryParams" :require-fields="requireFields" @query="handleQuery"
+                    @invalid="handleInvalidQuery"
+      ></mx-condition>
+    </el-card>
+    <el-card class="box-card mt20">
+      <div slot="header" class="clearfix">
+        <el-row :gutter="10">
+          <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToCloudResourse']">
+            <el-button plain icon="el-icon-upload2" size="small" @click="upToCloudResourse" :disabled="multiple">上传至云库
+            </el-button>
+          </el-col>
+          <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToSchoolResourse']">
+            <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolResourse" :disabled="multiple">
+              上传至校本资源库
+            </el-button>
+          </el-col>
+          <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToBoard']">
+            <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolClass" :disabled="multiple">上传至班牌
+            </el-button>
+          </el-col>
+          <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToStudent']">
+            <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolStudent" :disabled="multiple">
+              上传至学生端
+            </el-button>
+          </el-col>
+          <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToParent']">
+            <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolParent" :disabled="multiple">上传至家长端
+            </el-button>
+          </el-col>
+        </el-row>
+      </div>
+      <mx-table :rows="list" :prop-defines="propDefines" @selection-change="handleSelectionChange">
+        <template #img="{row}">
+          <img style="width: 130px; height: 80px; cursor: pointer" @click="playVideo(row)" :src="img.ship" alt/>
+        </template>
+      </mx-table>
+    </el-card>
+
+
+    <upload-dialog
+      v-if="dialogVisible"
+      :title="title"
+      :pageName="pageName"
+      :isZdy="isZdy"
+      :selectType="selectType"
+      :dialogVisible="dialogVisible"
+      @handleClose="handleClose"
+      @dialogVisibleClose="dialogVisibleClose"
+    ></upload-dialog>
+    <el-dialog title="查看视频" :visible.sync="dialogVideo" width="60%">
+      <mx-video v-if="dialogVideo" :aliIdType="aliIdType" :src="src" controls controlslist="nodownload"
+                disablepictureinpicture
+      ></mx-video>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+
+import MxCondition from '@/components/MxCondition/mx-condition'
+import {
+  list,
+  upToCloudResourse,
+  upToSchoolClass,
+  upToSchoolParent,
+  upToSchoolResourse,
+  upToSchoolStudent
+} from '@/api/webApi/person'
+
+export default {
+  components: { MxCondition },
+  data() {
+    return {
+      queryParams: {
+        subjectByVideo: ''
+      },
+      img: {
+        ship: require('@/assets/images/ship.png')
+      },
+      requireFields: [],
+      pageForm: {
+        pageSize: 10,
+        pageNum: 1
+      },
+      dialogVideo: false,
+      list: [],
+      total: 0,
+      propDefines: {
+        sele: {
+          label: '文件',
+          type: 'selection'
+        },
+        paper: {
+          label: '文件',
+          slot: 'img'
+        },
+        resourcesName: {
+          label: '文件名'
+        },
+        createBy: {
+          label: '发布人'
+        },
+        createTime: {
+          label: '时间'
+        }
+      },
+      multiple: true,
+      // 非单个禁用
+      single: true,
+      ids: [],
+      idsSel: [],
+      resourcesNames: [],
+      isZdy: true,
+      title:'',
+      selectType:'',
+      dialogVisible:'',
+      pageName:"视频课程",
+    }
+  },
+  created() {
+
+  },
+  watch: {},
+  methods: {
+    dialogVisibleClose() {
+      this.dialogVisible = false;
+    },
+    handleClose(type, name, selectData) {
+      console.log("------------");
+      console.log(type);
+      console.log(name);
+      console.log(selectData);
+      let _this = this
+      if (this.title == '上传至云库') {
+        _this.ids.forEach((item, index) => {
+          let Ajax = {
+            resourseId: item
+          }
+          if (name) {
+            Ajax.resourcesName = name
+          }
+          upToCloudResourse(Ajax).then(() => {
+            if (index == _this.ids.length - 1) {
+              _this.msgSuccess('操作成功')
+              _this.dialogVisible = false
+            }
+          })
+        })
+      } else if (this.title == '上传至校本资源库') {
+        _this.ids.forEach((item, index) => {
+          let Ajax = {
+            resourseId: item
+          }
+          if (name) {
+            Ajax.resourcesName = name
+          }
+          upToSchoolResourse(Ajax).then(() => {
+            if (index == _this.ids.length - 1) {
+              _this.msgSuccess('操作成功')
+              _this.dialogVisible = false
+            }
+          })
+        })
+      } else if (this.title == '上传至班牌') {
+        console.log('上传至班牌')
+        console.log(selectData)
+        _this.ids.forEach((item, index) => {
+          let Ajax = {
+            resourseId: item,
+            classId: selectData.checkedClass,
+            studentCodes: selectData.checkedStudent
+              ? selectData.checkedStudent.join(',')
+              : ''
+          }
+          if (name) {
+            Ajax.resourcesName = name
+          }
+          console.log('上传至班牌', Ajax)
+          upToSchoolClass(Ajax).then(() => {
+            if (index == _this.ids.length - 1) {
+              _this.msgSuccess('操作成功')
+              _this.dialogVisible = false
+            }
+          })
+        })
+      } else if (this.title == '上传至学生端') {
+        console.log('上传至学生端')
+        console.log(selectData)
+        _this.ids.forEach((item, index) => {
+          let Ajax = {
+            resourseId: item,
+            classId: selectData.checkedClass,
+            remark: selectData.remark,
+            studentCodes: selectData.checkedStudent.join(',')
+          }
+          if (name) {
+            Ajax.resourcesName = name
+          }
+          upToSchoolStudent(Ajax).then(() => {
+            if (index == _this.ids.length - 1) {
+              _this.msgSuccess('操作成功')
+              _this.dialogVisible = false
+            }
+          })
+        })
+      } else if (this.title == '上传至家长端') {
+        console.log('上传至家长端')
+        console.log(selectData)
+        _this.ids.forEach((item, index) => {
+          let Ajax = {
+            resourseId: item,
+            classId: selectData.checkedClass,
+            remark: selectData.remark,
+            studentCodes: selectData.checkedStudent.join(',')
+          }
+          if (name) {
+            Ajax.resourcesName = name
+          }
+          upToSchoolParent(Ajax).then(() => {
+            if (index == _this.ids.length - 1) {
+              _this.msgSuccess('操作成功')
+              _this.dialogVisible = false
+            }
+          })
+        })
+      }
+    },
+    upToCloudResourse() {
+      this.isZdy = false
+      let _this = this
+      const resourcesIds = this.ids.join(',')
+      this.title = '上传至云库'
+      this.selectType = ''
+      this.dialogVisible = true
+    },
+    upToSchoolResourse() {
+      this.isZdy = true
+      let _this = this
+      const resourcesIds = this.ids.join(',')
+      this.title = '上传至校本资源库'
+      this.selectType = ''
+      this.dialogVisible = true
+    },
+    upToSchoolClass() {
+      this.isZdy = false
+      let _this = this
+      const resourcesIds = this.ids.join(',')
+      this.title = '上传至班牌'
+      this.selectType = 'class'
+      this.dialogVisible = true
+    },
+    upToSchoolStudent() {
+      this.isZdy = false
+      let _this = this
+      const resourcesIds = this.ids.join(',')
+      this.title = '上传至学生端'
+      this.selectType = 'student'
+      this.dialogVisible = true
+    },
+    upToSchoolParent() {
+      this.isZdy = false
+      let _this = this
+      const resourcesIds = this.ids.join(',')
+      this.title = '上传至家长端'
+      this.selectType = 'parent'
+      this.dialogVisible = true
+    },
+    handleSelectionChange(selection) {
+      this.idsSel = selection.map((item) => item)
+      this.ids = selection.map((item) => item.resourcesId)
+      this.resourcesNames = selection.map((item) => item.resourcesName)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    handleQuery() {
+      this.getList()
+    },
+    playVideo(row) {
+      this.aliIdType = row.aliIdType
+      this.src = row.resourcesUrl
+      this.dialogVideo = true
+    },
+    getList() {
+      this.tableLoading = true
+      list({
+        subjectId: this.queryParams.subjectByVideo, //科目
+        category: '视频课程',
+        ...this.pageForm
+      })
+        .then(res => {
+          this.list = res.rows
+          this.total = res.total
+        })
+        .finally(_ => {
+          this.tableLoading = false
+        })
+    },
+    handleInvalidQuery() {
+
+    }
+  }
+}
+</script>

+ 9 - 4
src/views/videocourse/video_course.vue

@@ -33,7 +33,8 @@
           />
           <p class="fx-row jc-between ai-center">
             <span class="text-ellipsis"> {{ item.section_name }} </span>
-            <span @click="toCollect(item)" class="pointer iconfont icon-shoucang" :class="{'f-primary':item.isCollect}"></span>
+            <!-- 老师才能收藏 -->
+            <span v-if="role" @click="toCollect(item)" class="pointer iconfont icon-shoucang" :class="{'f-primary':item.isCollect}"></span>
           </p>
         </el-col>
       </el-row>
@@ -56,7 +57,7 @@
 import { videoList,collectVideoCourse } from '@/api/webApi/webVideo'
 import MxSearchGroup from '@/components/MxSearch/mx-search-group'
 import MxCondition from '@/components/MxCondition/mx-condition'
-
+import { checkRole } from  '@/utils/permission'
 export default {
   components: { MxSearchGroup, MxCondition },
   data() {
@@ -65,6 +66,7 @@ export default {
         pageNum: 1,
         pageSize: 16
       },
+      role:checkRole(['frontTeacher','frontHeadteacher']),
       sectionName: '',
       queryParams: {
         videoType: '',
@@ -73,7 +75,9 @@ export default {
         videoVersion: '',
         videoPack: ''
       },
-      requireFields: ['videoType', 'videoCourse',
+      requireFields: [
+        'videoType',
+        'videoCourse',
         'videoGrade',
         'videoVersion',
         'videoPack'
@@ -106,9 +110,10 @@ export default {
     },
     toCollect(item) {
       collectVideoCourse({
+        isCollect:!item.isCollect,
         id:item.id
       }).then(res => {
-        item = !item.isCollect
+        item.isCollect = !item.isCollect
       }).catch(_ => {
 
       })