Sfoglia il codice sorgente

```
feat(video): 更新视频播放器配置和API基础URL

- 修改.env.development中的VITE_API_BASE_URL指向新的开发服务器地址
- 在VideoPlayer组件中添加对空视频源的检查,避免无效播放
- 注释掉source标签的直接使用,改用videojs配置方式
- 调整播放器初始化逻辑,只有当src不为空时才设置视频源

fix(learning): 修复课程详情页面视频播放和组件传参问题

- 修复OtherCourse组件未正确传递info属性的问题
- 注释掉视频自动播放逻辑,避免重复初始化播放器
- 简化playNextVideo函数实现,暂时只输出日志

refactor(directory): 优化课程目录组件的查找逻辑

- 将章节查找的严格相等比较改为宽松相等,提高兼容性

style(workflow): 重构工作流交易页面的列表展示

zhangningning 1 mese fa
parent
commit
5e47357e33

+ 1 - 1
.env.development

@@ -1,6 +1,6 @@
 # 乔功
 VITE_API_BASE_URL=http://192.168.100.134:8080/api
 # 高运甲
-# VITE_API_BASE_URL=http://192.168.100.89:8080/api
+VITE_API_BASE_URL=http://192.168.100.89:8080/api
 
 

+ 10 - 5
src/components/VideoPlayer.vue

@@ -7,7 +7,7 @@
       preload="auto"
       :poster="poster"
     >
-      <source :src="src" :type="type">
+      <!-- <source :src="src" :type="type"/> -->
       <!-- <track 
         v-if="subtitle" 
         kind="subtitles" 
@@ -153,16 +153,21 @@ const initPlay = ()=>{
     player = null
   }
   // 创建video.js播放器实例
-  player = videojs(videoElement.value, {
+  const playerOptions = {
     autoplay: props.autoplay,
     controls: props.controls,
     fluid: props.fluid,
     preload: props.preload,
     aspectRatio: "16:9",
-    // playbackRates: props.playbackRates,// 播放速度选项
-    sources: [{ src: props.src, type: props.type }], // 添加这行
     controlBar: props.controlBar,
-  })
+  }
+  
+  // 只有当src不为空时才设置视频源
+  if (props.src) {
+    playerOptions.sources = [{ src: props.src, type: props.type }]
+  }
+  
+  player = videojs(videoElement.value, playerOptions)
 
   // 绑定事件
   player.on('play', () => emit('play'))

+ 7 - 33
src/pages/LearningSystem/CourseDetail.vue

@@ -66,7 +66,7 @@
             <CourseDirectory :info="info" ref="courseDirectory" :chapterId="chapterId" @purchaseFn="purchaseFn"/>
           </div>
           <div class=" bg_color_fff padding16 border_radius_16 box_shadow_card mt10" v-show="!isShowNote">
-            <OtherCourse />
+            <OtherCourse :info="info"/>
           </div>
           <div class="isShowNote bg_color_fff padding16 border_radius_16 box_shadow_card mt10" v-show="isShowNote">
             <div class="CloseBold" @click="isShowNote=false">
@@ -148,8 +148,11 @@ const purchaseFn = async (chapterId, chapterInfoItem={}) => {
     isLoading.value = false;
     if(res.code === 200){
       if(res.data?.buyFlag == 1){
-        currentVideoUrl.value = res.data?.contentUrl || ''
-        // videoPlayer.value.initPlay();
+        currentVideoUrl.value = res.data?.contentUrl || '';
+        // 播放视频
+        // if (videoPlayer.value) {
+        //   videoPlayer.value.initPlay();
+        // }
       }else{
         confirmBuy({
           callback:purchaseFn,
@@ -232,36 +235,7 @@ const onPlayerReady = (player) => {
 
 // 播放下一个视频
 const playNextVideo = () => {
-  if (!currentCourseChapters.value || currentPlayingVideoId.value === null) return
-  
-  // 查找当前播放视频的位置
-  let currentIndex = -1
-  let chapterIndex = -1
-  
-  for (let i = 0; i < currentCourseChapters.value.length; i++) {
-    const chapter = currentCourseChapters.value[i]
-    const index = chapter.videos.findIndex(v => v.id === currentPlayingVideoId.value)
-    
-    if (index !== -1) {
-      chapterIndex = i
-      currentIndex = index
-      break
-    }
-  }
-  
-  // 如果找到当前视频
-  if (chapterIndex !== -1 && currentIndex !== -1) {
-    const currentChapter = currentCourseChapters.value[chapterIndex]
-    
-    // 如果当前章节还有下一个视频
-    if (currentIndex < currentChapter.videos.length - 1) {
-      playVideo(currentChapter.videos[currentIndex + 1])
-    } 
-    // 如果是当前章节最后一个视频,且有下一个章节
-    else if (chapterIndex < currentCourseChapters.value.length - 1) {
-      playVideo(currentCourseChapters.value[chapterIndex + 1].videos[0])
-    }
-  }
+   console.log('播放下一个视频')
 };
 const collectFn = () => {
   collect({objectId: courseId.value}).then(res => {

+ 1 - 1
src/pages/LearningSystem/components/CourseDirectory.vue

@@ -67,7 +67,7 @@ const getChaptersListFn = () => {
       list.value = res.rows || [];
       if(list.value.length > 0){
         if(props.chapterId){
-          selectedItem.value = list.value.find(item => item.chapterId === props.chapterId) || {};
+          selectedItem.value = list.value.find(item => item.chapterId == props.chapterId) || {};
         }else{
           selectedItem.value = list.value[0];
         }

+ 10 - 13
src/pages/workflowTrade/workflowTradeAdd.vue

@@ -145,13 +145,13 @@
               <div class="font_size20 bold">发布提示</div>
             </div>
             <!-- 无序列表 -->
-            <ul class="font_size16">
-              <li>标题要简洁明了,突出核心需求</li>
-              <li>详细描述需求背景和具体要求</li>
-              <li>明确交付标准和验收方式</li>
-              <li>合理设置预算范围</li>
-              <li>添加相关标签提高匹配度</li>
-            </ul>
+            <div class="font_size16">
+              <div>· 标题要简洁明了,突出核心需求</div>
+              <div>· 详细描述需求背景和具体要求</div>
+              <div>· 明确交付标准和验收方式</div>
+              <div>· 合理设置预算范围</div>
+              <div>· 添加相关标签提高匹配度</div>
+            </div>
           </div>
           <div class="padding16 bg_color_fff border_radius_16 mt20 box_shadow_card">
             <div class="gap10">
@@ -159,12 +159,9 @@
               <div class="font_size20 bold">发布规则</div>
             </div>
             <!-- 有序列表 -->
-            <ol class="font_size16">
-              <li>这里是发布规则文字说明</li>
-              <li>这里是发布规则文字说明</li>
-              <li>这里是发布规则文字说明</li>
-              <li>这里是发布规则文字说明</li>
-            </ol>
+            <div class="font_size16">
+              <div v-for="(item,index) in 4" :key="index">{{index+1}} 这里是发布规则文字说明</div>
+            </div>
           </div>
         </div>
       </div>