zx vor 3 Wochen
Ursprung
Commit
6d0112d898

+ 11 - 9
.env.development

@@ -1,7 +1,7 @@
 # 页面标题
 VUE_APP_TITLE =互联网医院管理系统
 # 公司名称
-VUE_APP_VUE_APP_COMPANY_NAME =重庆云联融智科技有限公司
+VUE_APP_COMPANY_NAME =重庆云联融智科技有限公司
 # ICP备案号
 VUE_APP_ICP_RECORD =蜀ICP备2023036719号
 # ICP网站访问地址
@@ -9,24 +9,26 @@ VUE_APP_ICP_URL =https://beian.miit.gov.cn
 # 网站LOG
 VUE_APP_LOG_URL =@/assets/logo/logo.png
 # 存储桶配置
-VUE_APP_OSS_ACCESS_KEY_ID = K2UTJGIN7UTZJR2XMXYG
+VUE_APP_OBS_ACCESS_KEY_ID = K2UTJGIN7UTZJR2XMXYG
 # 存储桶配置
-VUE_APP_OSS_SECRET_ACCESS_KEY = sbyeNJLbcYmH6copxeFP9pAoksM4NIT9Zw4x0SRX
+VUE_APP_OBS_SECRET_ACCESS_KEY = sbyeNJLbcYmH6copxeFP9pAoksM4NIT9Zw4x0SRX
 # 存储桶配置
-VUE_APP_OSS_SERVER = https://obs.cn-north-4.myhuaweicloud.com
+VUE_APP_OBS_SERVER = https://obs.cn-north-4.myhuaweicloud.com
 # 存储桶配置
-VUE_APP_OSS_BUCKET = hzyy-1323137866
+VUE_APP_OBS_BUCKET = zkzh-hw079058881
 # 存储桶配置
-VUE_APP_OSS_REGION = ap-chongqing
+VUE_APP_COS_BUCKET = zkzh-1323137866
+# 存储桶配置
+VUE_APP_COS_REGION = ap-chongqing
 # 线路一地址
-VUE_APP_VUE_APP_OSS_LINE_1 = https://hzyytcpv.ylrzcloud.com
+VUE_APP_VIDEO_LINE_1 = https://zkzhtcpv.ylrzcloud.com
 # 线路二地址
-VUE_APP_OSS_LINE_2 = https://hzyyobs.ylrztop.com
+VUE_APP_VIDEO_LINE_2 = https://zkzhobs.ylrztop.com
 
 # 开发环境配置
 ENV = 'development'
 
-# 弘珍医药互联网医院管理系统/开发环境
+# FS管理系统/开发环境
 VUE_APP_BASE_API = '/dev-api'
 
 # 路由懒加载

+ 35 - 0
.env.prod-hzyy

@@ -0,0 +1,35 @@
+# 页面标题
+VUE_APP_TITLE =弘珍医药管理系统
+# 公司名称
+VUE_APP_COMPANY_NAME =南宁良庆区宝和堂金悦澜湾大药房
+# ICP备案号
+VUE_APP_ICP_RECORD =桂ICP备2025059156号-1
+# ICP网站访问地址
+VUE_APP_ICP_URL =https://beian.miit.gov.cn
+# 网站LOG
+VUE_APP_LOG_URL =@/assets/logo/hzyy.png
+# 存储桶配置
+VUE_APP_OBS_ACCESS_KEY_ID = K2UTJGIN7UTZJR2XMXYG
+# 存储桶配置
+VUE_APP_OBS_SECRET_ACCESS_KEY = sbyeNJLbcYmH6copxeFP9pAoksM4NIT9Zw4x0SRX
+# 存储桶配置
+VUE_APP_OBS_SERVER = https://obs.cn-north-4.myhuaweicloud.com
+# 存储桶配置
+VUE_APP_OBS_BUCKET = hzyy-hw079058881
+# 存储桶配置
+VUE_APP_COS_BUCKET = hzyy-1323137866
+# 存储桶配置
+VUE_APP_COS_REGION = ap-chongqing
+# 线路一地址
+VUE_APP_VIDEO_LINE_1 = https://hzyytcpv.ylrzcloud.com
+# 线路二地址
+VUE_APP_VIDEO_LINE_2 = https://hzyyobs.ylrztop.com
+
+# 开发环境配置
+ENV = 'development'
+
+# FS管理系统/开发环境
+VUE_APP_BASE_API = '/prod-api'
+
+# 路由懒加载
+VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 1 - 1
package.json

@@ -7,7 +7,7 @@
   "scripts": {
     "dev": "vue-cli-service serve",
     "build:prod": "vue-cli-service build",
-    "build:prod-sxjz": "vue-cli-service build --mode prod-sxjz",
+    "build:prod-hzyy": "vue-cli-service build --mode prod-hzyy",
     "build:stage": "vue-cli-service build --mode staging",
     "preview": "node build/index.js --preview",
     "lint": "eslint --ext .js,.vue src"

BIN
src/assets/logo/hzyy.png


+ 172 - 14
src/components/VideoUpload/index.vue

@@ -16,8 +16,8 @@
         >
           <el-button slot="trigger" size="small" type="primary" >选取视频</el-button>
           <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">点击上传</el-button>
-<!--          <el-progress style="margin-top: 10px;" :key="'线路一'" class="progress" :text-inside="true" :stroke-width="18" :percentage="txProgress" status="success"></el-progress>-->
-<!--          <el-progress style="margin-top: 10px;" :key="'线路二'" class="progress" :text-inside="true" :stroke-width="18" :percentage="hwProgress" status="success"></el-progress>-->
+          <!-- 仅当showControl为true时显示视频库选取按钮 -->
+          <el-button v-if="showControl" style="margin-left: 10px;" size="small" type="success" @click="openVideoLibrary">视频库选取</el-button>
           <!-- 线路一 -->
           <div class="progress-container">
             <span class="progress-label">线路一</span>
@@ -53,12 +53,71 @@
       <div v-if="fileKey">文件Key: {{ fileKey }}</div>
       <div v-if="fileSize">文件大小(MB): {{ (fileSize / (1024 * 1024)).toFixed(2) }} MB</div>
     </el-form-item>
-    <el-form-item label="播放线路"  >
+    <!-- 仅当showControl为true时显示播放线路选择器 -->
+    <el-form-item v-if="showControl" label="播放线路">
       <el-radio-group v-model="localUploadType">
         <el-radio :label="1" >线路一</el-radio>
         <el-radio :label="2" >线路二</el-radio>
+        <!--        <el-radio :label="3" >线路三</el-radio>-->
       </el-radio-group>
     </el-form-item>
+
+    <!-- 视频库选择对话框 -->
+    <el-dialog title="视频库选择" :visible.sync="libraryOpen" width="900px" append-to-body>
+      <!-- 搜索条件 -->
+      <el-form :inline="true" :model="libraryQueryParams" class="library-search">
+        <el-form-item label="素材名称">
+          <el-input
+            v-model="libraryQueryParams.resourceName"
+            placeholder="请输入素材名称"
+            clearable
+            size="small"
+            @keyup.enter.native="handleLibraryQuery"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleLibraryQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetLibraryQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+
+      <!-- 视频列表 -->
+      <el-table v-loading="libraryLoading" :data="libraryList" @row-click="handleLibrarySelect" highlight-current-row>
+        <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="libraryTotal>0"
+        :total="libraryTotal"
+        :page.sync="libraryQueryParams.pageNum"
+        :limit.sync="libraryQueryParams.pageSize"
+        @pagination="getLibraryList"
+      />
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="confirmVideoSelection">确 定</el-button>
+        <el-button @click="cancelVideoSelection">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -68,8 +127,13 @@ import {getThumbnail} from "@/api/course/userVideo";
 import TcVod from "vod-js-sdk-v6";
 import { uploadObject } from "@/utils/cos.js";
 import { uploadToOBS } from "@/utils/obs.js";
+import Pagination from "@/components/Pagination";
+import { listVideoResource } from '@/api/course/videoResource';
 
 export default {
+  components: {
+    Pagination
+  },
   props: {
     videoUrl: {
       type: String,
@@ -115,6 +179,12 @@ export default {
       type: Number,
       default: 0,
     },
+
+    // 使用一个变量控制显示,默认为true显示所有控制项
+    showControl: {
+      type: Boolean,
+      default: true,
+    }
   },
   data() {
     return {
@@ -124,8 +194,8 @@ export default {
       duration: 0,
       fileId: "",
       uploadTypeOptions: [
-        { dictLabel: "线路一", dictValue: 1 }, //腾讯pcdn
-        { dictLabel: "线路二", dictValue: 2 }, //华为云obs
+        { dictLabel: "线路一", dictValue: 1 }, // 腾讯pcdn
+        { dictLabel: "线路二", dictValue: 2 }, // 华为云obs
         // { dictLabel: "华为云VOD", dictValue: 4 },
         // { dictLabel: "腾讯云VOD", dictValue: 5 },
       ],
@@ -134,7 +204,17 @@ export default {
       hwProgress: 0,
       uploadLoading: false,
       uploadKey: 0,
-      // thumbnail: '',
+      // 视频库选择相关数据
+      libraryOpen: false,
+      libraryLoading: false,
+      libraryTotal: 0,
+      libraryList: [],
+      selectedVideo: null,
+      libraryQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        resourceName: null
+      }
     };
   },
   watch: {
@@ -147,10 +227,15 @@ export default {
     },
   },
   methods: {
+    // 打开视频库对话框
+    openVideoLibrary() {
+      this.libraryOpen = true;
+      this.selectedVideo = null;
+      this.getLibraryList();
+    },
     handleChange(file, fileList) {
       this.fileList = fileList;
       this.getVideoDuration(file.raw);
-
     },
     getVideoDuration(file) {
       const video = document.createElement("video");
@@ -200,9 +285,9 @@ export default {
         console.log("isPrivate=======>",this.isPrivate)
         let line_1='' ;
         if (this.isPrivate===0){
-          line_1 = `${process.env.VUE_APP_VUE_APP_OSS_LINE_1}${data.urlPath}`;
+          line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
         }else {
-          line_1 = `${process.env.VUE_APP_VUE_APP_OSS_LINE_1}${data.urlPath}`;
+          line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
         }
 
         let urlPathWithoutFirstSlash = data.urlPath.substring(1);
@@ -226,9 +311,9 @@ export default {
         console.log("华为OBS返回========>",data);
         let line_2='' ;
         if (this.isPrivate===0){
-          line_2 = `${process.env.VUE_APP_OSS_LINE_2}/${data.urlPath}`;
+          line_2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
         }else {
-          line_2 = `${process.env.VUE_APP_OSS_LINE_2}/${data.urlPath}`;
+          line_2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
         }
         // this.$emit("update:videoUrl", data);
         this.$emit("update:line_2", line_2);
@@ -241,12 +326,77 @@ export default {
       console.log(file, fileList.length);
     },
     resetUpload() {
+      // 重置内部状态
       this.txProgress = 0;
-      this.hwProgress=0;
+      this.hwProgress = 0;
       this.fileList = [];
       this.uploadKey++;
     },
-  },
+    /** 查询视频库列表 */
+    getLibraryList() {
+      this.libraryLoading = true;
+      listVideoResource(this.libraryQueryParams).then(response => {
+        this.libraryList = response.rows;
+        this.libraryTotal = response.total;
+        this.libraryLoading = false;
+      });
+    },
+    /** 搜索视频库按钮操作 */
+    handleLibraryQuery() {
+      this.libraryQueryParams.pageNum = 1;
+      this.getLibraryList();
+    },
+    /** 重置视频库查询按钮操作 */
+    resetLibraryQuery() {
+      this.libraryQueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        resourceName: null
+      };
+      this.handleLibraryQuery();
+    },
+    /** 视频库选择行点击 */
+    handleLibrarySelect(row) {
+      this.selectedVideo = row;
+    },
+    /** 格式化视频时长 */
+    formatDuration(seconds) {
+      if (!seconds) return '00:00';
+
+      const minutes = Math.floor(seconds / 60);
+      const remainingSeconds = seconds % 60;
+
+      return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
+    },
+    /** 确认选择视频 */
+    confirmVideoSelection() {
+      if (!this.selectedVideo) {
+        this.$message.warning("请选择一个视频");
+        return;
+      }
+
+      // 更新组件内部数据
+      this.$emit("update:fileName", this.selectedVideo.fileName);
+      this.$emit("update:thumbnail", this.selectedVideo.thumbnail);
+      this.$emit("update:line_1", this.selectedVideo.line1);
+      this.$emit("update:line_2", this.selectedVideo.line2);
+      this.$emit("update:line_3", this.selectedVideo.line3);
+      this.$emit("update:fileSize", this.selectedVideo.fileSize);
+      this.$emit("update:fileKey", this.selectedVideo.fileKey);
+      this.$emit("update:uploadType", this.selectedVideo.uploadType);
+      this.$emit("video-duration", this.selectedVideo.duration);
+
+      // 设置预览URL
+      this.$emit("update:videoUrl", this.selectedVideo.videoUrl);
+
+      this.libraryOpen = false;
+    },
+    /** 取消视频选择 */
+    cancelVideoSelection() {
+      this.libraryOpen = false;
+      this.selectedVideo = null;
+    }
+  }
 };
 </script>
 
@@ -257,9 +407,17 @@ export default {
 
 .progress-label {
   display: block;
-  //margin-bottom: 5px;
   font-weight: bold;
   font-size: 13px;
   color: #303331; /* 标签颜色,可以根据需要调整 */
 }
+
+/* 视频库选择对话框样式 */
+.library-search {
+  margin-bottom: 15px;
+}
+
+.el-table .el-table__row:hover {
+  cursor: pointer;
+}
 </style>

+ 11 - 4
src/utils/cos.js

@@ -2,10 +2,16 @@ import COS from 'cos-js-sdk-v5';
 import { Message } from 'element-ui';
 import { getTmpSecretKey } from '@/api/common';
 
+console.log('环境变量:', process.env);
+console.log('NODE_ENV:', process.env.NODE_ENV);
+console.log('VUE_APP_COS_BUCKET:', process.env.VUE_APP_COS_BUCKET);
+console.log('VUE_APP_COS_REGION:', process.env.VUE_APP_COS_REGION);
+
 const config = {
-    Bucket: process.env.VUE_APP_OSS_BUCKET,
-    Region: process.env.VUE_APP_OSS_REGION,
+  Bucket: process.env.VUE_APP_COS_BUCKET,
+  Region: process.env.VUE_APP_COS_REGION,
 };
+console.log('COS配置:', config);
 
 // 上传到腾讯云cos
 export const uploadObject = async (file,onProgress,type,callBackUp) => {
@@ -34,7 +40,7 @@ export const uploadObject = async (file,onProgress,type,callBackUp) => {
             },
         });
 
-
+        console.log("初始化成功")
         let fileName = file.name || ""
         const upload_file_name = new Date().getTime() + '.' + fileName.split(".")[fileName.split(".").length - 1];
         let date =  new Date()
@@ -45,10 +51,11 @@ export const uploadObject = async (file,onProgress,type,callBackUp) => {
         let videoKey = `/userVideo/${uploadDay}/${upload_file_name}`
         let courseKey = `/course/${uploadDay}/${upload_file_name}`
         let key = type ===1 ? courseKey : videoKey;
+        console.log("开始上传")
         return new Promise((resolve, reject) => {
+            console.log("uploadFile")
             cos.uploadFile(
                 {
-
                     Bucket: config.Bucket, /* 必须 */
                     Region: config.Region, /* 存储桶所在地域,必须字段 */
                     Key: key, // 文件名

+ 4 - 4
src/utils/obs.js

@@ -4,9 +4,9 @@ import ObsClient from "esdk-obs-browserjs/src/obs";
 export const uploadToOBS = async(file,progressCallback,type) =>  {
     try {
         const obsClient = new ObsClient({
-            access_key_id: process.env.VUE_APP_OSS_ACCESS_KEY_ID,
-            secret_access_key: process.env.VUE_APP_OSS_SECRET_ACCESS_KEY,
-            server: process.env.VUE_APP_OSS_SERVER
+          access_key_id: process.env.VUE_APP_OBS_ACCESS_KEY_ID,
+          secret_access_key: process.env.VUE_APP_OBS_SECRET_ACCESS_KEY,
+          server: process.env.VUE_APP_OBS_SERVER
         });
         let fileName = file.name || ""
         const upload_file_name = new Date().getTime() + '.' + fileName.split(".")[fileName.split(".").length - 1];
@@ -29,7 +29,7 @@ export const uploadToOBS = async(file,progressCallback,type) =>  {
         return new Promise((resolve, reject) => {
             //上传对象
             obsClient.putObject({
-                Bucket: 'hzyy-hw079058881',//桶名称
+                Bucket: process.env.VUE_APP_OBS_BUCKET,//桶名称
                 Key: key,//文件名
                 Body: file,
                 ProgressCallback: callback,//进度回调

+ 11 - 11
src/views/course/videoResource/index.vue

@@ -84,19 +84,19 @@
                 {{ scope.$index + 1 }}
               </template>
             </el-table-column>
-      <el-table-column label="素材名称" align="center" :show-overflow-tooltip="true" prop="resourceName" width="300"/>
-      <el-table-column label="文件名称" align="center" :show-overflow-tooltip="true" prop="fileName" width="300"/>
-      <el-table-column label="分类" align="center" width="120">
+      <el-table-column label="素材名称" align="center" :show-overflow-tooltip="true" prop="resourceName"/>
+      <el-table-column label="文件名称" align="center" :show-overflow-tooltip="true" prop="fileName"/>
+      <el-table-column label="分类" align="center">
         <template slot-scope="scope">
           <span v-if="scope.row.typeId">{{ getTypeName(scope.row.typeId) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="子分类" align="center" width="120">
+      <el-table-column label="子分类" align="center">
         <template slot-scope="scope">
           <span v-if="scope.row.typeSubId">{{ getTypeName(scope.row.typeSubId) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="视频文件" align="center" width="120">
+      <el-table-column label="视频文件" align="center">
         <template slot-scope="scope">
           <a
             @click="handleVideoPreview(scope.row.videoUrl)"
@@ -105,7 +105,7 @@
           </a>
         </template>
       </el-table-column>
-      <el-table-column label="CDN" align="center" width="120">
+      <el-table-column label="CDN" align="center">
         <template slot-scope="scope">
           <a
             @click="copy(scope.row.videoUrl)"
@@ -114,7 +114,7 @@
           </a>
         </template>
       </el-table-column>
-      <el-table-column label="关联题目" align="center" width="150">
+      <el-table-column label="关联题目" align="center">
         <template slot-scope="scope">
           <a
             @click="handleViewProject(scope.row, 3)"
@@ -143,12 +143,12 @@
           </a>
         </template>
       </el-table-column>
-      <el-table-column label="视频时长" align="center" width="150">
+      <el-table-column label="视频时长" align="center">
         <template slot-scope="scope">
           <div style="padding: 4px 12px;background: linear-gradient(to right, rgb(196 219 255), #409EFF)">{{ formatDuration(scope.row.duration) }}</div>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -1029,7 +1029,7 @@ export default {
           onProgress(progressEvent);
         }, 1);
 
-        let line_1 = `${process.env.VUE_APP_VUE_APP_OSS_LINE_1}${data.urlPath}`;
+        let line_1 = `${process.env.VUE_APP_VIDEO_LINE_1}${data.urlPath}`;
 
         form.fileKey = data.urlPath.substring(1);
         form.videoUrl = line_1;
@@ -1053,7 +1053,7 @@ export default {
           onProgress(progressEvent);
         }, 1);
 
-        form.line2 = `${process.env.VUE_APP_OSS_LINE_2}/${data.urlPath}`;
+        form.line2 = `${process.env.VUE_APP_VIDEO_LINE_2}/${data.urlPath}`;
         this.$message.success("线路二上传成功");
       } catch (error) {
         this.$message.error("线路二上传失败");