浏览代码

视频上传优化

ct 2 天之前
父节点
当前提交
bb72a7c7ac
共有 2 个文件被更改,包括 99 次插入2 次删除
  1. 1 1
      .env.prod-jnmy
  2. 98 1
      src/views/course/videoResource/index.vue

+ 1 - 1
.env.prod-jnmy

@@ -34,7 +34,7 @@ ENV = 'development'
 VUE_APP_BASE_API = '/prod-api'
 
 #默认 1、会员 2、企微
-VUE_APP_COURSE_DEFAULT = 1
+VUE_APP_COURSE_DEFAULT = 2
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 98 - 1
src/views/course/videoResource/index.vue

@@ -953,6 +953,28 @@ export default {
     this.getList();
   },
   methods: {
+    searchProjects() {
+      // 实现项目搜索逻辑
+      if (this.projectQueryParams.title) {
+        // 这里应该调用项目搜索API
+        console.log('搜索项目:', this.projectQueryParams.title);
+      }
+    },
+    /** 过滤分类节点 */
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.cateName.indexOf(value) !== -1;
+    },
+    /** 处理项目选择 */
+    handleProjectSelect(selection, row) {
+      this.selectedProjectIds = selection.map(item => item.id);
+      console.log('选中的项目:', this.selectedProjectIds);
+    },
+    /** 处理分类点击 */
+    handleCategoryClick(data) {
+      this.projectQueryParams.cateId = data.cateId;
+      this.searchProjects();
+    },
     /** 将数字索引转换为字母序号 (0->A, 1->B, 等) */
     convertToLetter(index) {
       // 确保索引是数字
@@ -1168,6 +1190,23 @@ export default {
       this.videoPreviewVisible = true;
       this.videoPreviewUrl = url || this.form.videoUrl;
     },
+    handleCloseVideoPreview(done) {
+      this.videoPreviewVisible = false;
+      if (done) {
+        done();
+      }
+    },
+    cancelSelectProject() {
+      this.projectDialogVisible = false;
+      this.selectedProjectIds = [];
+      this.projectList = [];
+      this.projectQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        title: null,
+        cateId: null
+      };
+    },
     /** 格式化视频时长 */
     formatDuration(seconds) {
       if (!seconds) return '00:00';
@@ -1659,7 +1698,7 @@ export default {
 
       const tempVideo = {
         tempId: Math.random().toString(36).substring(2, 15),
-        resourceName: file.name.split('.')[0],
+        resourceName: file.name.substring(0, file.name.lastIndexOf('.')),
         fileName: file.name,
         thumbnail: null,
         line1: null,
@@ -2241,6 +2280,64 @@ export default {
           return '#909399';
       }
     },
+    /** 复制视频链接到剪贴板 */
+    copy(url) {
+      // 创建一个临时的input元素
+      const input = document.createElement('input');
+      // 设置input的值为要复制的视频链接
+      input.value = url;
+      // 将input添加到DOM中
+      document.body.appendChild(input);
+      // 选中input的值
+      input.select();
+      // 执行复制命令
+      document.execCommand('copy');
+      // 从DOM中移除input元素
+      document.body.removeChild(input);
+      // 提示用户复制成功
+      this.$message({
+        message: '已复制到剪贴板',
+        type: 'success',
+        duration: 1500
+      });
+    },
+    // 处理项目分页变化
+    handleProjectPageChange(page) {
+      this.projectQueryParams.pageNum = page;
+      this.getProjectList();
+    },
+    
+    // 处理项目分页大小变化
+    handleProjectPageSizeChange(size) {
+      this.projectQueryParams.pageSize = size;
+      this.projectQueryParams.pageNum = 1;
+      this.getProjectList();
+    },
+    
+    // 确认选择项目
+    confirmSelectProject() {
+      if (this.selectedProjectIds.length === 0) {
+        this.$message.warning('请至少选择一个题目');
+        return;
+      }
+      
+      // 获取选中的项目详情
+      const selectedProjects = this.projectList.filter(project => 
+        this.selectedProjectIds.includes(project.id)
+      );
+      
+      // 将选中的项目添加到显示列表
+      this.projectShowList = [...selectedProjects];
+      
+      // 关闭对话框
+      this.projectDialogVisible = false;
+      
+      // 清空选择
+      this.selectedProjectIds = [];
+      this.$refs.projectTable && this.$refs.projectTable.clearSelection();
+      
+      this.$message.success(`已选择 ${selectedProjects.length} 个题目`);
+    },
   }
 }
 </script>