Forráskód Böngészése

课程设置迁移

吴树波 3 hete
szülő
commit
e0e15d5302

+ 35 - 0
build/index.js

@@ -0,0 +1,35 @@
+const { run } = require('runjs')
+const chalk = require('chalk')
+const config = require('../vue.config.js')
+const rawArgv = process.argv.slice(2)
+const args = rawArgv.join(' ')
+
+if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
+  const report = rawArgv.includes('--report')
+
+  run(`vue-cli-service build ${args}`)
+
+  const port = 9526
+  const publicPath = config.publicPath
+
+  var connect = require('connect')
+  var serveStatic = require('serve-static')
+  const app = connect()
+
+  app.use(
+    publicPath,
+    serveStatic('./dist', {
+      index: ['index.html', '/']
+    })
+  )
+
+  app.listen(port, function () {
+    console.log(chalk.green(`> Preview at  http://localhost:${port}${publicPath}`))
+    if (report) {
+      console.log(chalk.green(`> Report at  http://localhost:${port}${publicPath}report.html`))
+    }
+
+  })
+} else {
+  run(`vue-cli-service build ${args}`)
+}

+ 36 - 0
src/api/course/userCourseVideo.js

@@ -32,6 +32,31 @@ export function addUserCourseVideo(data) {
     data: data
   })
 }
+// 新增课堂视频
+export function updates(data) {
+  return request({
+    url: '/course/userCourseVideo/updates',
+    method: 'post',
+    data: data
+  })
+}
+
+// 新增课堂视频
+export function batchSaveVideo(data) {
+  return request({
+    url: '/course/userCourseVideo/batchSaveVideo',
+    method: 'post',
+    data: data
+  })
+}
+// 新增课堂视频
+export function batchUpdateRed(data) {
+  return request({
+    url: '/course/userCourseVideo/batchUpdateRed',
+    method: 'post',
+    data: data
+  })
+}
 
 // 修改课堂视频
 export function updateUserCourseVideo(data) {
@@ -67,3 +92,14 @@ export function getVideoListByCourseId(query) {
     params: query
   })
 }
+
+// 获取选项列表
+export function getVideoListLikeName(query) {
+  return request({
+    url: '/course/userCourseVideo/getVideoListLikeName',
+    method: 'get',
+    params: query
+  })
+}
+
+

+ 644 - 418
src/views/components/course/userCourseCatalogDetails.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <div style="padding-bottom: 20px">
-        <span v-if="courseName!=null">{{ courseName }}</span>
+      <span v-if="courseName!=null">{{ courseName }}</span>
     </div>
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="小节名称" prop="title">
@@ -28,6 +28,32 @@
           @click="handleAdd"
         >新增目录</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          :disabled="!ids || ids.length <= 0"
+          size="mini"
+          @click="openUpdates"
+        >修改时间</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          size="mini"
+          @click="openAdds"
+        >批量添加</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          size="mini"
+          v-if="isPrivate === 1"
+          @click="updateRedPageckeOpen"
+        >修改红包</el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="danger"
@@ -48,10 +74,29 @@
       <el-table-column label="视频文件名称" align="center" show-overflow-tooltip  prop="fileName" >
       </el-table-column>
       <el-table-column label="视频时长" align="center" prop="duration">
-          <template slot-scope="{ row }">
-              {{ formatDuration(row.duration) }}
-          </template>
+        <template slot-scope="{ row }">
+          {{ formatDuration(row.duration) }}
+        </template>
+      </el-table-column>
+      <el-table-column label="看课开始时间" align="center" prop="duration">
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.viewStartTime">{{row.viewStartTime}}</el-tag>
+          <el-tag type="danger" v-if="!row.viewStartTime">无</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="看课结束时间" align="center" prop="duration">
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.viewEndTime">{{row.viewEndTime}}</el-tag>
+          <el-tag type="danger" v-if="!row.viewEndTime">无</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="领取红包时间" align="center" prop="duration">
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.lastJoinTime">{{ row.lastJoinTime }}</el-tag>
+          <el-tag type="danger" v-if="!row.lastJoinTime">无</el-tag>
+        </template>
       </el-table-column>
+      <el-table-column label="红包金额" align="center" prop="redPacketMoney" v-if="isPrivate === 1"/>
       <el-table-column label="排序" align="center" prop="courseSort" />
       <el-table-column label="上传时间" align="center" prop="createTime" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -93,6 +138,27 @@
         <el-form-item label="课程排序" prop="courseSort">
           <el-input-number v-model="form.courseSort" :min="1" ></el-input-number>
         </el-form-item>
+        <!--        <el-form-item label="看课时间" prop="timeRange" v-if="isPrivate === 1">-->
+        <!--          <el-time-picker-->
+        <!--            is-range-->
+        <!--            v-model="form.timeRange"-->
+        <!--            range-separator="至"-->
+        <!--            start-placeholder="开始时间"-->
+        <!--            value-format="HH:mm:ss"-->
+        <!--            end-placeholder="结束时间"-->
+        <!--            placeholder="选择时间范围">-->
+        <!--          </el-time-picker>-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="领取红包时间" prop="lastJoinTime" v-if="isPrivate === 1">-->
+        <!--          <el-time-picker-->
+        <!--            v-model="form.lastJoinTime"-->
+        <!--            :selectableRange="form.timeRange"-->
+        <!--            value-format="HH:mm:ss"-->
+        <!--            placeholder="选择时间范围">-->
+        <!--          </el-time-picker>-->
+        <!--          <p style="color: red;margin: 0;font-size: 12px">超过领取红包时间,只允许看课,不允许领取红包</p>-->
+        <!--        </el-form-item>-->
+
         <el-form-item label="视频缩略图" prop="thumbnail">
           <el-upload
             v-model="form.thumbnail"
@@ -122,43 +188,8 @@
           ref="videoUpload"
           append-to-body
         />
-        <el-form-item label="关联疗法" >
-          <el-button size="small" type="primary" @click="choosePackage">选取疗法</el-button>
-          <el-table border width="100%" style="margin-top:5px;"  :data="packageList">
-            <el-table-column label="疗法名称" align="center" prop="packageName"/>
-            <el-table-column label="疗法图片" align="center" prop="imgUrl">
-              <template slot-scope="scope">
-                <img :src="scope.row.imgUrl" style="height: 80px;">
-              </template>
-            </el-table-column>
-            <el-table-column label="疗法别名" align="center" prop="secondName"/>
-            <el-table-column label="总金额" align="center" prop="totalPrice"/>
-            <el-table-column label="弹出时间" align="center"  width="250px" >
-              <template slot-scope="scope">
-                <div>
-                  <el-time-select
-                    v-model="scope.row.duration"
-                    size="mini"
-                    placeholder="选择时间"
-                    :picker-options="getPickerOptions()"
-                  ></el-time-select>
-                </div>
-              </template>
-            </el-table-column>
-            <el-table-column label="操作" align="center" width="100px" fixed="right">
-              <template slot-scope="scope">
-                <el-button
-                  size="mini"
-                  type="text"
-                  icon="el-icon-delete"
-                  @click="handlePackageDelete(scope.row)"
-                >删除</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-        </el-form-item >
 
-        <el-form-item label="课题选择" prop="questionBankId">
+        <el-form-item label="课题选择" prop="questionBankId" v-if="isPrivate === 1">
           <el-button size="small" type="primary" @click="chooseQuestionBank">选取课题</el-button>
           <el-table border width="100%" style="margin-top:5px;"  :data="form.questionBankList">
 
@@ -189,438 +220,633 @@
             </el-table-column>
           </el-table>
         </el-form-item >
-        <el-form-item label="红包金额" prop="redPacketMoney">
+        <el-form-item label="红包金额" prop="redPacketMoney" v-if="isPrivate === 1">
           <el-input-number v-model="form.redPacketMoney" :min="0.1" :max="200" :step="0.1" ></el-input-number>
         </el-form-item>
-		<el-form-item label="是否先导课" prop="isFirst">
-		  <el-radio-group v-model="form.isFirst">
-		    <el-radio :label="1">是</el-radio>
-		    <el-radio :label="0">否</el-radio>
-		  </el-radio-group>
-		</el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+    <el-dialog :title="title" :visible.sync="updateBatchData.open" width="1000px" append-to-body >
+      <el-form ref="form" :model="updateBatchData.form" label-width="110px">
+        <el-form-item label="看课时间" prop="timeRange">
+          <el-time-picker
+            is-range
+            v-model="updateBatchData.form.timeRange"
+            range-separator="至"
+            start-placeholder="开始时间"
+            value-format="HH:mm:ss"
+            end-placeholder="结束时间"
+            placeholder="选择时间范围">
+          </el-time-picker>
+        </el-form-item>
+        <el-form-item label="领取红包时间" prop="lastJoinTime">
+          <el-time-picker
+            v-model="updateBatchData.form.lastJoinTime"
+            :selectableRange="updateBatchData.form.timeRange"
+            value-format="HH:mm:ss"
+            placeholder="选择时间范围">
+          </el-time-picker>
+          <p style="color: red;margin: 0;font-size: 12px">超过领取红包时间,只允许看课,不允许领取红包</p>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="updateBatch">确 定</el-button>
+        <el-button @click="updateBatchData.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
     <el-dialog :title="questionBank.title" :visible.sync="questionBank.open" width="800px" append-to-body >
       <question-bank ref="questionBank" @questionBankResult="questionBankResult" ></question-bank>
     </el-dialog>
-    <el-dialog :title="package.title" :visible.sync="package.open" width="800px" append-to-body >
-      <package-select ref="packageSelect" @selectPackage="selectPackage" ></package-select>
+    <el-dialog title="视频库选择" :visible.sync="addBatchData.open" width="900px" append-to-body>
+      <!-- 搜索条件 -->
+      <el-form :inline="true" :model="addBatchData.queryParams" class="library-search">
+        <el-form-item label="素材名称">
+          <el-input
+            v-model="addBatchData.queryParams.resourceName"
+            placeholder="请输入素材名称"
+            clearable
+            size="small"
+            @keyup.enter.native="resourceList"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="resourceList">搜索</el-button>
+        </el-form-item>
+      </el-form>
+
+      <!-- 视频列表 -->
+      <el-table v-loading="addBatchData.loading" :data="addBatchData.list" @selection-change="handVideoleSelectionChange" height="400px">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="素材名称" align="center" prop="resourceName" />
+        <el-table-column label="文件名称" align="center" prop="fileName" />
+        <el-table-column label="缩略图" align="center">
+          <template slot-scope="scope">
+            <el-popover
+              placement="right"
+              title=""
+              trigger="hover"
+            >
+              <img alt="" slot="reference" :src="scope.row.thumbnail" style="width: 80px; height: 50px" />
+              <img alt="" :src="scope.row.thumbnail" style="max-width: 150px;" />
+            </el-popover>
+          </template>
+        </el-table-column>
+        <el-table-column label="视频时长" align="center">
+          <template slot-scope="scope">
+            <span>{{ formatDuration(scope.row.duration) }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <pagination
+        v-show="addBatchData.total>0"
+        :total="addBatchData.total"
+        :page.sync="addBatchData.queryParams.pageNum"
+        :limit.sync="addBatchData.queryParams.pageSize"
+        @pagination="resourceList"
+      />
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="batchVideoSave">确 定</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog title="章节红包" :visible.sync="redData.open" width="900px" append-to-body>
+      <el-table border v-loading="redData.loading" :data="redData.list" height="600px">
+        <el-table-column label="小节名称" align="center" show-overflow-tooltip prop="title" />
+        <el-table-column label="视频文件名称" align="center" show-overflow-tooltip  prop="fileName" >
+        </el-table-column>
+        <el-table-column label="视频时长" align="center" prop="duration">
+          <template slot-scope="{ row }">
+            {{ formatDuration(row.duration) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="红包金额" align="center" prop="redPacketMoney">
+          <template slot-scope="scope">
+            <el-input class="el-input" v-model="scope.row.redPacketMoney" />
+          </template>
+        </el-table-column>
+        <el-table-column label="排序" align="center" prop="courseSort" />
+        <el-table-column label="上传时间" align="center" prop="createTime" />
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="batchRedSave">确 定</el-button>
+      </div>
     </el-dialog>
 
   </div>
 </template>
 
 <script>
-import { getSort,getVideoListByCourseId,delUserCourseVideo,getUserCourseVideo,addUserCourseVideo,updateUserCourseVideo } from "@/api/course/userCourseVideo";
-import {getSignature,uploadHuaWeiVod,uploadHuaWeiObs} from "@/api/common"
-import  QuestionBank from  "@/views/course/courseQuestionBank/QuestionBank.vue";
-import packageSelect from '../his/packageSelect.vue'
-import TcVod from 'vod-js-sdk-v6'
-import request from '@/utils/request'
-import {uploadObject} from "@/utils/cos";
+import {
+  addUserCourseVideo,
+  delUserCourseVideo,
+  getSort,
+  getUserCourseVideo,
+  getVideoListByCourseId,
+  updates,
+  batchSaveVideo,
+  batchUpdateRed,
+  updateUserCourseVideo
+} from "@/api/course/userCourseVideo";
+import QuestionBank from "@/views/course/courseQuestionBank/QuestionBank.vue";
 import VideoUpload from "@/components/VideoUpload/index.vue";
-  export default {
-    name: "userCourseCatalog",
-    components: {VideoUpload,QuestionBank,packageSelect},
-    data() {
-      return {
-        duration: null,
-        packageList:[],
-        //课题
-        package:{
-          title:'',
-          open:false,
-        },
-        //课题
-        questionBank:{
-          title:'',
-          open:false,
-        },
-        isPrivate:null,
-        videoUrl: "",
-        uploadTypeOptions: [
-          { dictLabel: "线路一", dictValue: 2 },
+import { listVideoResource } from '@/api/course/videoResource';
 
-          { dictLabel: "线路二", dictValue: 3 },
-        ],
-        uploadLoading:false,
-        courseId:null,
-        videoName:'',
-        title: "",
-        // 是否显示弹出层
-        open: false,
-        uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
-        baseUrl: process.env.VUE_APP_BASE_API,
-        typeOptions:[],
-        files:[],
-        fileList: [],
-        // 上传成功后的地址
-        videoURL: '',
-        // 进度条百分比
-        progress: 0,
-        // 上传视频获取成功后拿到的fileID【备用】
-        fileId: '',
-        courseName:null,
-        userCourseVideoList:[],
-        total: 0,
+export default {
+  name: "userCourseCatalog",
+  components: {VideoUpload,QuestionBank},
+  data() {
+    return {
+      duration: null,
+      packageList:[],
+      //课题
+      package:{
+        title:'',
+        open:false,
+      },
+      //课题
+      questionBank:{
+        title:'',
+        open:false,
+      },
+      isPrivate:null,
+      videoUrl: "",
+      uploadTypeOptions: [
+        { dictLabel: "线路一", dictValue: 2 },
+
+        { dictLabel: "线路二", dictValue: 3 },
+      ],
+      uploadLoading:false,
+      courseId:null,
+      videoName:'',
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
+      baseUrl: process.env.VUE_APP_BASE_API,
+      typeOptions:[],
+      files:[],
+      fileList: [],
+      // 上传成功后的地址
+      videoURL: '',
+      // 进度条百分比
+      progress: 0,
+      // 上传视频获取成功后拿到的fileID【备用】
+      fileId: '',
+      courseName:null,
+      userCourseVideoList:[],
+      total: 0,
+      redData:{
         queryParams: {
           pageNum: 1,
-          pageSize: 10,
+          pageSize: 99999,
           courseId:null,
-          title:null
         },
-        // 显示搜索条件
-        showSearch: true,
-        // 遮罩层
+        list: [],
+        open: false,
+        loading:true,
+        form:{
+        }
+      },
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        courseId:null,
+        title:null
+      },
+      addBatchData: {
+        open: false,
         loading: true,
-        // 导出遮罩层
-        exportLoading: false,
-        // 选中数组
-        ids: [],
-        // 非单个禁用
-        single: true,
-        // 非多个禁用
-        multiple: true,
-          // 表单参数
         form: {},
-        // 表单校验
-        rules: {
-          title: [
-            { required: true, message: "小节名称不能为空", trigger: "change" }
-          ],
-          courseSort: [
-            { required: true, message: "排序不能为空", trigger: "change" }
-          ],
+        select: [],
+        total:0,
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+        },
+      },
+      // 显示搜索条件
+      showSearch: true,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 表单参数
+      form: {},
+      updateBatchData: {
+        open: false,
+        form:{}
+      },
+      // 表单校验
+      rules: {
+        title: [
+          { required: true, message: "小节名称不能为空", trigger: "change" }
+        ],
+        courseSort: [
+          { required: true, message: "排序不能为空", trigger: "change" }
+        ],
 
-        }
       }
+    }
+  },
+  created() {
+    this.getDicts("sys_course_temp_type").then(response => {
+      this.typeOptions = response.data;
+    });
+  },
+  methods: {
+    getPickerOptions() {
+      const durationInMinutes = Math.floor(this.form.duration / 60); // 将秒转换为分钟
+      const endHour  = Math.floor(durationInMinutes / 60); // 起始小时
+      const endMinute  = durationInMinutes % 60; // 起始分钟
+      return {
+        start: "00:00", // 固定开始时间
+        step: "00:01", // 时间间隔
+        end: `${endHour.toString().padStart(2, "0")}:${endMinute
+          .toString()
+          .padStart(2, "0")}`, // 动态结束时间
+      };
     },
-    created() {
-      this.getDicts("sys_course_temp_type").then(response => {
-        this.typeOptions = response.data;
-      });
+    handlePackageDelete(row){
+      this.packageList.splice(this.packageList.findIndex(item => item.packageId === row.packageId), 1)
+    },
+    choosePackage(){
+      this.package.open=true;
+      this.package.title='疗法选择';
+    },
+    /**
+     * 选择课题
+     */
+    chooseQuestionBank(){
+      this.questionBank.open=true;
+      this.questionBank.title='课题选择';
     },
-    methods: {
-      getPickerOptions() {
-        const durationInMinutes = Math.floor(this.form.duration / 60); // 将秒转换为分钟
-        const endHour  = Math.floor(durationInMinutes / 60); // 起始小时
-        const endMinute  = durationInMinutes % 60; // 起始分钟
-        return {
-          start: "00:00", // 固定开始时间
-          step: "00:01", // 时间间隔
-          end: `${endHour.toString().padStart(2, "0")}:${endMinute
-            .toString()
-            .padStart(2, "0")}`, // 动态结束时间
-        };
-      },
-      handlePackageDelete(row){
-        this.packageList.splice(this.packageList.findIndex(item => item.packageId === row.packageId), 1)
-      },
-      choosePackage(){
-        this.package.open=true;
-        this.package.title='疗法选择';
-      },
-      /**
-       * 选择课题
-       */
-      chooseQuestionBank(){
-        this.questionBank.open=true;
-        this.questionBank.title='课题选择';
-      },
 
-      //选择疗法
-      selectPackage(row){
-        const drug = {};
-        for(var i=0;i<this.packageList.length;i++){
-          if(this.packageList[i].packageId==row.packageId){
-            this.$message.warning("疗法已存在!")
-            return;
-          }
+    //选择疗法
+    selectPackage(row){
+      const drug = {};
+      for(var i=0;i<this.packageList.length;i++){
+        if(this.packageList[i].packageId==row.packageId){
+          this.$message.warning("疗法已存在!")
+          return;
         }
-        drug.packageId=row.packageId;
-        drug.packageName=row.packageName;
-        drug.secondName=row.secondName;
-        drug.totalPrice=row.totalPrice;
-        drug.imgUrl=row.imgUrl;
-        this.packageList.push(drug);
-        this.$message({
-          message: '添加成功',
-          type: 'success'
-        });
+      }
+      drug.packageId=row.packageId;
+      drug.packageName=row.packageName;
+      drug.secondName=row.secondName;
+      drug.totalPrice=row.totalPrice;
+      drug.imgUrl=row.imgUrl;
+      this.packageList.push(drug);
+      this.$message({
+        message: '添加成功',
+        type: 'success'
+      });
 
-      },
+    },
 
-      //选择结果
-      questionBankResult(val){
+    //选择结果
+    questionBankResult(val){
 
-        // 确保 questionBankList 是数组
-        this.form.questionBankList = this.form.questionBankList || [];
+      // 确保 questionBankList 是数组
+      this.form.questionBankList = this.form.questionBankList || [];
 
-        for(var i=0;i<this.form.questionBankList.length;i++){
-          if(this.form.questionBankList[i].id==val.id){
-            return this.$message.error("当前课题已选择")
-          }
+      for(var i=0;i<this.form.questionBankList.length;i++){
+        if(this.form.questionBankList[i].id==val.id){
+          return this.$message.error("当前课题已选择")
         }
+      }
 
-        this.form.questionBankList.push(val);
-        this.$message({
-          message: '添加成功',
-          type: 'success'
-        });
-      },
+      this.form.questionBankList.push(val);
+      this.$message({
+        message: '添加成功',
+        type: 'success'
+      });
+    },
 
-      //删除课题
-      handleQuestionBankDelete(row){
-        this.form.questionBankList.splice(this.form.questionBankList.findIndex(item => item.id === row.id), 1)
-      },
-      handleVideoChange(){
-        if(this.form.uploadType==1){
-          this.videoUrl = this.form.lineOne;
-        }else if(this.form.uploadType==2){
-          this.videoUrl = this.form.lineTwo;
-        }else if(this.form.uploadType==3){
-          this.videoUrl = this.form.lineThree;
-        }
-        // console.log("选择的video=======>>>>>>>",this.videoUrl)
-      },
-      handleVideoDuration(duration) {
-        this.form.duration = duration;
-      },
-      formatDuration(seconds) {
-        if (seconds === null || seconds === undefined) {
-            return '未上传视频'; // 或者您可以根据具体需求返回其他默认值
-        }
-        const hours = Math.floor(seconds / 3600);
-        const minutes = Math.floor((seconds % 3600) / 60);
-        const remainingSeconds = seconds % 60;
+    //删除课题
+    handleQuestionBankDelete(row){
+      this.form.questionBankList.splice(this.form.questionBankList.findIndex(item => item.id === row.id), 1)
+    },
+    handleVideoChange(){
+      if(this.form.uploadType==1){
+        this.videoUrl = this.form.lineOne;
+      }else if(this.form.uploadType==2){
+        this.videoUrl = this.form.lineTwo;
+      }else if(this.form.uploadType==3){
+        this.videoUrl = this.form.lineThree;
+      }
+      // console.log("选择的video=======>>>>>>>",this.videoUrl)
+    },
+    handleVideoDuration(duration) {
+      this.form.duration = duration;
+    },
+    formatDuration(seconds) {
+      if (seconds === null || seconds === undefined) {
+        return '未上传视频'; // 或者您可以根据具体需求返回其他默认值
+      }
+      const hours = Math.floor(seconds / 3600);
+      const minutes = Math.floor((seconds % 3600) / 60);
+      const remainingSeconds = seconds % 60;
 
-        const formattedHours = hours > 0 ? hours.toString() + ':' : '';
-        const formattedMinutes = minutes.toString().padStart(2, '0');
-        const formattedSeconds = remainingSeconds.toString().padStart(2, '0');
+      const formattedHours = hours > 0 ? hours.toString() + ':' : '';
+      const formattedMinutes = minutes.toString().padStart(2, '0');
+      const formattedSeconds = remainingSeconds.toString().padStart(2, '0');
 
-        return `${formattedHours}${formattedMinutes}:${formattedSeconds}`;
-      },
+      return `${formattedHours}${formattedMinutes}:${formattedSeconds}`;
+    },
 
-      handleAvatarSuccess(res, file) {
-        if(res.code==200){
-          this.form.thumbnail=res.url;
-          this.$forceUpdate()
+    handleAvatarSuccess(res, file) {
+      if(res.code==200){
+        this.form.thumbnail=res.url;
+        this.$forceUpdate()
+      }
+      else{
+        this.msgError(res.msg);
+      }
+    },
+    beforeAvatarUpload(file) {
+      const isLt1M = file.size / 1024 / 1024 < 1;
+      if (!isLt1M) {
+        this.$message.error('上传图片大小不能超过 1MB!');
+      }
+      return   isLt1M;
+    },
+    getDetails(courseId,courseName,isPrivate) {
+      this.isPrivate = isPrivate
+      this.courseName = courseName
+      this.courseId = courseId;
+      this.queryParams.courseId = courseId;
+      this.getList();
+    },
+    getList() {
+      this.loading = true;
+      getVideoListByCourseId(this.queryParams).then(response => {
+        this.userCourseVideoList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        videoId: null,
+        title: null,
+        description: null,
+        url: null,
+        thumbnail: null,
+        duration: null,
+        createTime: null,
+        uploadType:null,
+        lineOne:null,
+        lineTwo:null,
+        lineThree:null,
+        fileName:null,
+        userId: null,
+        cateId: null,
+        courseId: null,
+        likes: null,
+        views: null,
+        comments: null,
+        status: 0,
+        courseSort: 1,
+        isHot: null,
+        isShow: null,
+        isAudit: null,
+        auditBy: null,
+        auditTime: null,
+        updateTime: null,
+        source: null,
+        isDel: null,
+        shares: null,
+        tags: null,
+        productId: null,
+        productJson: null,
+        questionBankId:null,
+        questionBankList:[],
+        redPacketMoney:0,
+      };
+      this.videoURL = '';
+      this.progress=0;
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.videoId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    // 多选框选中数据
+    handVideoleSelectionChange(selection) {
+      this.addBatchData.select = selection.map(item => item.id);
+    },
+    handleAdd(){
+      this.reset();
+      this.form.courseId = this.courseId;
+      this.open = true;
+      this.title = "添加课堂视频";
+      this.videoUrl = '';
+      this.packageList=[];
+      getSort(this.courseId).then(response => {
+        this.form.courseSort = Number(response.data);
+      })
+      setTimeout(() => {
+        this.$refs.videoUpload.resetUpload();
+      }, 500);
+
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      this.packageList=[];
+      const videoId = row.videoId || this.ids
+      getUserCourseVideo(videoId).then(response => {
+        this.form = response.data;
+        if(response.data.videoUrl!=null && response.data.videoUrl!==''){
+          this.videoUrl = response.data.videoUrl;
         }
-        else{
-          this.msgError(res.msg);
+        if (this.form.packageJson!=null){
+          this.packageList = JSON.parse(this.form.packageJson);
         }
-      },
-      beforeAvatarUpload(file) {
-        const isLt1M = file.size / 1024 / 1024 < 1;
-        if (!isLt1M) {
-          this.$message.error('上传图片大小不能超过 1MB!');
+
+        if(response.data.viewStartTime != null && response.data.viewEndTime != null){
+          this.form.timeRange = [response.data.viewStartTime, response.data.viewEndTime]
         }
-        return   isLt1M;
-      },
-      getDetails(courseId,courseName,isPrivate) {
-        this.isPrivate = isPrivate
-        this.courseName = courseName
-        this.courseId = courseId;
-        this.queryParams.courseId = courseId;
-        this.getList();
-      },
-      getList() {
-        this.loading = true;
-        getVideoListByCourseId(this.queryParams).then(response => {
-          this.userCourseVideoList = response.rows;
-          this.total = response.total;
-          this.loading = false;
-        });
-      },
-      // 取消按钮
-      cancel() {
-        this.open = false;
-        this.reset();
-      },
-      // 表单重置
-      reset() {
-        this.form = {
-          videoId: null,
-          title: null,
-          description: null,
-          url: null,
-          thumbnail: null,
-          duration: null,
-          createTime: null,
-          uploadType:null,
-          lineOne:null,
-          lineTwo:null,
-          lineThree:null,
-          fileName:null,
-          userId: null,
-          cateId: null,
-          courseId: null,
-          likes: null,
-          views: null,
-          comments: null,
-          status: 0,
-          courseSort: 1,
-          isHot: null,
-          isShow: null,
-          isAudit: null,
-          auditBy: null,
-          auditTime: null,
-          updateTime: null,
-          source: null,
-          isDel: null,
-          shares: null,
-          tags: null,
-          productId: null,
-          productJson: null,
-          questionBankId:null,
-          questionBankList:[],
-		  redPacketMoney:0,
-        };
-        this.videoURL = '';
-        this.progress=0;
-        this.resetForm("form");
-      },
-      /** 搜索按钮操作 */
-      handleQuery() {
-        this.queryParams.pageNum = 1;
-        this.getList();
-      },
-      /** 重置按钮操作 */
-      resetQuery() {
-        this.resetForm("queryForm");
-        this.handleQuery();
-      },
-      // 多选框选中数据
-      handleSelectionChange(selection) {
-        this.ids = selection.map(item => item.courseId)
-        this.single = selection.length!==1
-        this.multiple = !selection.length
-      },
-      handleAdd(){
-        this.reset();
-        this.form.courseId = this.courseId;
-        this.open = true;
-        this.title = "添加课堂视频";
-        this.videoUrl = '';
-        this.packageList=[];
-        getSort(this.courseId).then(response => {
-          this.form.courseSort = Number(response.data);
-        })
         setTimeout(() => {
           this.$refs.videoUpload.resetUpload();
         }, 500);
+        this.open = true;
+        this.title = "修改课堂视频";
+      });
 
-      },
-      /** 修改按钮操作 */
-      handleUpdate(row) {
-        this.reset();
-        this.packageList=[];
-        const videoId = row.videoId || this.ids
-        getUserCourseVideo(videoId).then(response => {
-          this.form = response.data;
-          if(response.data.videoUrl!=null && response.data.videoUrl!==''){
-            this.videoUrl = response.data.videoUrl;
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+
+        if (valid) {
+          this.form.videoUrl = this.videoUrl;
+          if(this.form.videoUrl==null || this.form.videoUrl===''){
+            this.$message({
+              message: '请上传视频!',
+              type: 'warning'
+            });
+            return
           }
-          if (this.form.packageJson!=null){
-            this.packageList = JSON.parse(this.form.packageJson);
+          if(this.form.timeRange != null && this.form.timeRange.length === 2){
+            this.form.viewStartTime = this.form.timeRange[0];
+            this.form.viewEndTime = this.form.timeRange[1];
           }
-          setTimeout(() => {
-            this.$refs.videoUpload.resetUpload();
-          }, 500);
-          this.open = true;
-          this.title = "修改课堂视频";
-        });
-
-      },
-      /** 提交按钮 */
-      submitForm() {
-        this.$refs["form"].validate(valid => {
-
-          if (valid) {
-            this.form.videoUrl = this.videoUrl;
-            if(this.form.videoUrl==null || this.form.videoUrl===''){
-              this.$message({
-                message: '请上传视频!',
-                type: 'warning'
-              });
-              return
-            }
-            if(this.form.duration==null){
-              this.$message({
-                message: '未识别到视频时长请稍等。。。',
-                type: 'warning'
-              });
-              return
-            }
-            if(this.form.uploadType==null){
-              this.$message({
-                message: '请选择播放线路!',
-                type: 'warning'
-              });
-              return
-            }
-            if (this.form.questionBankList!==null){
-              this.form.questionBankId = this.form.questionBankList.map(item => item.id).join(',');
-            }
-            if (this.packageList.length>0){
-              this.form.packageJson = JSON.stringify(this.packageList);
-            }
-            if (this.form.videoId != null) {
-              updateUserCourseVideo(this.form).then(response => {
-                this.msgSuccess("修改成功");
-                this.open = false;
-                this.getList();
-              });
-            } else {
-              addUserCourseVideo(this.form).then(response => {
-                this.msgSuccess("新增成功");
-                this.open = false;
-                this.getList();
-              });
-            }
+          if(this.form.duration==null){
+            this.$message({
+              message: '未识别到视频时长请稍等。。。',
+              type: 'warning'
+            });
+            return
           }
-        });
-      },
-      /** 删除按钮操作 */
-      handleDelete(row) {
-        const videoIds = row.videoId || this.ids;
-        this.$confirm('是否确认删除视频编号为"' + videoIds + '"的数据项?', "警告", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          }).then(function() {
-            return delUserCourseVideo(videoIds);
-          }).then(() => {
-            this.getList();
-            this.msgSuccess("删除成功");
-          }).catch(() => {});
-      },
-    }
+          if(this.form.uploadType==null){
+            this.$message({
+              message: '请选择播放线路!',
+              type: 'warning'
+            });
+            return
+          }
+          if (this.form.questionBankList!==null){
+            this.form.questionBankId = this.form.questionBankList.map(item => item.id).join(',');
+          }
+          if (this.packageList.length>0){
+            this.form.packageJson = JSON.stringify(this.packageList);
+          }
+          if (this.form.videoId != null) {
+            updateUserCourseVideo(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addUserCourseVideo(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    openUpdates(){
+      this.updateBatchData.form = {};
+      this.updateBatchData.open = true;
+    },
+    /** 提交按钮 */
+    updateBatch() {
+      this.updateBatchData.form.ids = this.ids;
+      if(this.updateBatchData.form.timeRange != null && this.updateBatchData.form.timeRange.length === 2){
+        this.updateBatchData.form.viewStartTime = this.updateBatchData.form.timeRange[0];
+        this.updateBatchData.form.viewEndTime = this.updateBatchData.form.timeRange[1];
+      }
+      updates(this.updateBatchData.form).then(response => {
+        this.msgSuccess("修改成功");
+        this.updateBatchData.open = false;
+        this.getList();
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const videoIds = row.videoId || this.ids;
+      this.$confirm('是否确认删除视频编号为"' + videoIds + '"的数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return delUserCourseVideo(videoIds);
+      }).then(() => {
+        this.getList();
+        this.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    openAdds(){
+      this.addBatchData.open = true;
+      this.addBatchData.form = {
+        courseId: this.courseId,
+      };
+      this.resourceList();
+    },
+    resourceList(){
+      this.addBatchData.loading = true;
+      listVideoResource(this.addBatchData.queryParams).then(response => {
+        this.addBatchData.loading = false;
+        this.addBatchData.list = response.rows;
+        this.addBatchData.total = response.total;
+      });
+    },
+    batchVideoSave(){
+      this.addBatchData.form.ids = this.addBatchData.select;
+      batchSaveVideo(this.addBatchData.form).then(response => {
+        this.addBatchData.open = false;
+        this.getList();
+      })
+    },
+    updateRedPageckeOpen(){
+      this.redData.open = true;
+      this.redData.loading = true;
+      this.redData.queryParams.courseId = this.courseId;
+      getVideoListByCourseId(this.redData.queryParams).then(response => {
+        this.redData.list = response.rows;
+        this.redData.loading = false;
+      });
+    },
+    batchRedSave(){
+      batchUpdateRed(this.redData.list).then(response => {
+        this.redData.open = false;
+        this.getList();
+      })
+    },
   }
+}
 </script>
 <style>
-  .avatar-uploader .el-upload {
-       border: 1px dashed #d9d9d9;
-       border-radius: 6px;
-       cursor: pointer;
-       position: relative;
-       overflow: hidden;
-     }
-     .avatar-uploader .el-upload:hover {
-       border-color: #409EFF;
-     }
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409EFF;
+}
 
-     .avatar-uploader-icon {
-       font-size: 28px;
-       color: #8c939d;
-       width: 150px;
-       height: 150px;
-       line-height: 150px;
-       text-align: center;
-     }
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 150px;
+  height: 150px;
+  line-height: 150px;
+  text-align: center;
+}
 
 </style>