Переглянути джерело

看课记录bug+文件上传修复,火山云配置

xw 1 день тому
батько
коміт
ad98353426

+ 5 - 1
.env.development

@@ -25,8 +25,12 @@ VUE_APP_COS_REGION = ap-chongqing
 VUE_APP_VIDEO_LINE_1 =
 # 线路二地址
 VUE_APP_VIDEO_LINE_2 = https://zkzhobs.ylrztop.com
+#火山云视频地址域名
+VUE_APP_VIDEO_URL = https://bjczvolcengine.ylrztop.com
+# 火山云视频点播空间名
+VUE_APP_VIDEO_SPACE = czwh-2114522511
 
-VUE_APP_LIVE_WS_URL = ws://127.0.0.1:7114/ws
+VUE_APP_LIVE_WS_URL = wss://ws.moonxiang.com/ws
 
 
 # 开发环境配置

+ 31 - 4
src/views/course/courseFinishTemp/index.vue

@@ -283,8 +283,8 @@
                           :before-upload="beforeAvatarUploadFile">
                           <i class="el-icon-plus avatar-uploader-icon"></i>
                         </el-upload>
-                        <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
-                          {{ item.fileUrl }}
+                        <el-link v-if="item.fileUrl" type="primary" @click="handleDownloadFile(item.fileUrl, item.fileName)">
+                          {{ item.fileName || item.fileUrl }}
                         </el-link>
                       </el-form-item>
 
@@ -465,8 +465,8 @@
                           :before-upload="beforeAvatarUploadFile">
                           <i class="el-icon-plus avatar-uploader-icon"></i>
                         </el-upload>
-                        <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
-                          {{ item.fileUrl }}
+                        <el-link v-if="item.fileUrl" type="primary" @click="handleDownloadFile(item.fileUrl, item.fileName)">
+                          {{ item.fileName || item.fileUrl }}
                         </el-link>
                       </el-form-item>
 
@@ -852,6 +852,8 @@ export default {
       if (res.code === 200) {
         // 使用 $set 确保响应式更新
         this.$set(item, 'fileUrl', res.url);
+        // 优先使用后端返回的fileName,兜底使用前端文件名
+        this.$set(item, 'fileName', res.fileName || file.name);
       } else {
         this.msgError(res.msg);
       }
@@ -869,6 +871,31 @@ export default {
       // 直接返回文件 URL
       return materialUrl;
     },
+    // 处理文件下载(支持中文文件名)
+    handleDownloadFile(fileUrl, fileName) {
+      if (!fileUrl) return;
+      
+      // 使用 fetch 下载文件并设置正确的文件名
+      fetch(fileUrl)
+        .then(response => response.blob())
+        .then(blob => {
+          // 创建下载链接
+          const url = window.URL.createObjectURL(blob);
+          const link = document.createElement('a');
+          link.href = url;
+          link.download = fileName || fileUrl.substring(fileUrl.lastIndexOf('/') + 1);
+          document.body.appendChild(link);
+          link.click();
+          
+          // 清理
+          document.body.removeChild(link);
+          window.URL.revokeObjectURL(url);
+        })
+        .catch(error => {
+          console.error('下载失败:', error);
+          this.$message.error('文件下载失败');
+        });
+    },
     handleInputVideoText(value, content) {
       // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
       const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;

+ 31 - 4
src/views/course/courseFinishTempParent/index.vue

@@ -237,8 +237,8 @@
                           :before-upload="beforeAvatarUploadFile">
                           <i class="el-icon-plus avatar-uploader-icon"></i>
                         </el-upload>
-                        <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
-                          {{ item.fileUrl }}
+                        <el-link v-if="item.fileUrl" type="primary" @click="handleDownloadFile(item.fileUrl, item.fileName)">
+                          {{ item.fileName || item.fileUrl }}
                         </el-link>
                       </el-form-item>
 
@@ -419,8 +419,8 @@
                           :before-upload="beforeAvatarUploadFile">
                           <i class="el-icon-plus avatar-uploader-icon"></i>
                         </el-upload>
-                        <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
-                          {{ item.fileUrl }}
+                        <el-link v-if="item.fileUrl" type="primary" @click="handleDownloadFile(item.fileUrl, item.fileName)">
+                          {{ item.fileName || item.fileUrl }}
                         </el-link>
                       </el-form-item>
 
@@ -912,6 +912,8 @@ export default {
       if (res.code === 200) {
         // 使用 $set 确保响应式更新
         this.$set(item, 'fileUrl', res.url);
+        // 优先使用后端返回的文件名,兜底使用前端文件名
+        this.$set(item, 'fileName', res.fileName || file.name);
       } else {
         this.msgError(res.msg);
       }
@@ -929,6 +931,31 @@ export default {
       // 直接返回文件 URL
       return materialUrl;
     },
+    // 处理文件下载(支持中文文件名)
+    handleDownloadFile(fileUrl, fileName) {
+      if (!fileUrl) return;
+      
+      // 使用 fetch 下载文件并设置正确的文件名
+      fetch(fileUrl)
+        .then(response => response.blob())
+        .then(blob => {
+          // 创建下载链接
+          const url = window.URL.createObjectURL(blob);
+          const link = document.createElement('a');
+          link.href = url;
+          link.download = fileName || fileUrl.substring(fileUrl.lastIndexOf('/') + 1);
+          document.body.appendChild(link);
+          link.click();
+          
+          // 清理
+          document.body.removeChild(link);
+          window.URL.revokeObjectURL(url);
+        })
+        .catch(error => {
+          console.error('下载失败:', error);
+          this.$message.error('文件下载失败');
+        });
+    },
     handleInputVideoText(value, content) {
       // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
       const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;

+ 0 - 6
src/views/course/courseWatchLog/watchLog.vue

@@ -392,12 +392,6 @@
           {{ queryParams.sendType=='1' ? scope.row.fsNickName : scope.row.externalUserName }}
         </template>
       </el-table-column>
-      <el-table-column label="头像" align="center" v-if="queryParams.sendType == 1">
-        <template slot-scope="scope">
-          <img v-if="queryParams.sendType=='1'" :src="scope.row.fsAvatar" style="width:50px;height:50px" />
-          <img v-else :src="scope.row.externalUserAvatar" style="width:50px;height:50px" />
-        </template>
-      </el-table-column>
       <el-table-column label="营期名称" align="center" prop="periodIdName" v-if="this.queryParams.sendType==1" />
       <el-table-column label="课程名称" align="center" prop="courseName"/>
       <el-table-column label="小节名称" align="center" prop="videoName"/>

+ 1 - 1
src/views/qw/externalContactTransfer/companyTransfer.vue

@@ -196,7 +196,7 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <div style="background-color: rgb(239, 250, 255); margin: 10px;padding: 15px;">
           <div>可将选中的客户转接给其他员工,进行后续服务</div>
-          <div>注意:90天内客户只能被转接一次,一个客户最多只能被转接两次</div>
+          <div>注意:90天内客户只能被转接次</div>
           <div>需等待总后台审核才会进行转接</div>
         </div>
 

+ 1 - 1
src/views/qw/externalContactTransfer/deptTransferIndex.vue

@@ -229,7 +229,7 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <div style="background-color: rgb(239, 250, 255); margin: 10px;padding: 15px;">
           <div>可将选中的客户转接给其他员工,进行后续服务</div>
-          <div>注意:90天内客户只能被转接一次,一个客户最多只能被转接两次</div>
+          <div>注意:90天内客户只能被转接次</div>
         </div>
 
         <el-form-item label="接替员工" prop="userId">

+ 1 - 1
src/views/qw/externalContactTransfer/index.vue

@@ -267,7 +267,7 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <div style="background-color: rgb(239, 250, 255); margin: 10px;padding: 15px;">
           <div>可将选中的客户转接给其他员工,进行后续服务</div>
-          <div>注意:90天内客户只能被转接一次,一个客户最多只能被转接两次</div>
+          <div>注意:90天内客户只能被转接次</div>
         </div>
 
         <el-form-item label="接替员工" prop="userId">

+ 1 - 1
src/views/qw/externalContactTransfer/index旧.vue

@@ -230,7 +230,7 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <div style="background-color: rgb(239, 250, 255); margin: 10px;padding: 15px;">
           <div>可将选中的客户转接给其他员工,进行后续服务</div>
-          <div>注意:90天内客户只能被转接一次,一个客户最多只能被转接两次</div>
+          <div>注意:90天内客户只能被转接次</div>
         </div>
 
         <el-form-item label="接替员工" prop="userId">