2
0

2 کامیت‌ها 9a79215676 ... 38f0a7b21d

نویسنده SHA1 پیام تاریخ
  xsc 38f0a7b21d Merge branch 'bencao' of ssh://gogs.hanyiyun.com:2222/xmnk/party into bencao 1 سال پیش
  xsc 1bc3a9807a 3.25 1 سال پیش

+ 2 - 7
src/views/video/chapter.vue

@@ -181,7 +181,7 @@ export default {
         const { message } = await chapterEdit(this.editForm);
         console.log(message, "message");
         // location.reload()
-        this.$baseMessage(message, "success", false, "vab-hey-message-success");
+        this.$message({message, type:"success"});
         this.getChapterList();
       } else {
         return;
@@ -215,12 +215,7 @@ export default {
       if (row.id) {
         this.$baseConfirm("你确定要删除当前项吗", null, async () => {
           const { message } = await chapterDelete({ id: row.id });
-          this.$baseMessage(
-            message,
-            "success",
-            false,
-            "vab-hey-message-success"
-          );
+          this.$message({message, type:"success"});
           await this.getChapterList();
         });
       }

+ 35 - 33
src/views/video/video_detail.vue

@@ -32,10 +32,10 @@
         <div class="item_wrap">
           <ul>
             <li
-              v-for="(item, key) in course_zhangjie"
-              :key="key"
+              v-for="(item, index) in course_zhangjie"
+              :key="index"
               class="out_wrap"
-              @click="zhedie(item.id)"
+              @click="zhedie(index)"
             >
               <div class="zhangjie">
                 <div class="left">
@@ -87,7 +87,7 @@
 </template>
 <script>
   import {
-    getCourseDetail,
+    videoList,
     videoDetail,
     lookRecord,
   } from './api/video'
@@ -133,6 +133,7 @@
           danmu: 'admin-pro',
         },
         player: null,
+        videoIndex:0
       }
     },
     watch: {
@@ -188,18 +189,20 @@
       async getCourse_detail() {
         const { data } = await chapterList({id:this.courseId})
         console.log(data, 'xaingqing')
-        this.course_zhangjie = data.data
+        // this.course_zhangjie = data.data
         // this.course_fenlei = data
       },
       //章节折叠
       zhedie(e) {
-        if (this.current_zhedie.includes(e)) {
-          this.current_zhedie = this.current_zhedie.filter((item) => {
-            return item != e
-          })
-        } else {
-          this.current_zhedie.push(e)
-        }
+        // if (this.current_zhedie.includes(e)) {
+        //   this.current_zhedie = this.current_zhedie.filter((item) => {
+        //     return item != e
+        //   })
+        // } else {
+        //   this.current_zhedie.push(e)
+        // }
+        this.videoIndex = e
+        this.lookVideo()
       },
       //点击重新播放
       refLook() {
@@ -348,24 +351,22 @@
       },
       //获取课程详情章节列表和视频列表
       async getCourseDetail() {
-        let slug = this.$route.query.course_slug
-        console.log(slug, 'getCourseDetail')
-        const { data } = await getCourseDetail(slug)
-
-        this.directory = data.directory
+        const { data } = await videoList()
+        console.log(data)
+        this.course_zhangjie = data.data
 
-        if (this.videoId) {
-          this.isLearn = this.videoId
-          //this.isLearn = this.video_slug
-          let route = this.$route
-          this.vIndex = route.query.v_index
-          this.cIndex = route.query.c_index
-        } else {
-          console.log(data, 'YYYYY YYY')
-          this.isLearn = this.videoId = data.directory[0].children[0].id
-          //this.isLearn = this.video_slug = data.directory[0].children[0].slug
-          this.videoList = this.directory[0].children
-        }
+        // if (this.videoId) {
+        //   this.isLearn = this.videoId
+        //   //this.isLearn = this.video_slug
+        //   let route = this.$route
+        //   this.vIndex = route.query.v_index
+        //   this.cIndex = route.query.c_index
+        // } else {
+        //   console.log(data, 'YYYYY YYY')
+        //   this.isLearn = this.videoId = data.directory[0].children[0].id
+        //   //this.isLearn = this.video_slug = data.directory[0].children[0].slug
+        //   this.videoList = this.directory[0].children
+        // }
 
         this.lookVideo()
         //   this.videoComments()
@@ -396,10 +397,11 @@
           myPlayer.removeRemoteTextTrack(oldTracks[i])
         }
         // const { data } = await videoDetail({ id: this.videoId })
-        const { data } = await videoDetail(this.video_slug)
+        // const { data } = await videoDetail(this.video_slug)
         console.log(this.video_slug, 'this.video_slug')
-        this.videoTitle = data.video.title
-        myPlayer.src(data.video.url_resource.url)
+        // this.videoTitle = data.video.title
+        console.log(this.course_zhangjie)
+        myPlayer.src(this.course_zhangjie[this.videoIndex].url_resource)
 
         this.attaches = data.attaches
         this.videoDescription = data.video.description
@@ -443,7 +445,7 @@
           path: 'courseDetail',
           query: {
             course_slug: this.course_slug,
-            course_id: this.courseId,
+            id: this.courseId,
           },
         })
       },

+ 1 - 1
src/views/xuexi/api/video.js

@@ -4,7 +4,7 @@
  * @Author: King
  * @Date: 2022-02-14 14:46:14
  * @LastEditors: king
- * @LastEditTime: 2023-03-24 18:36:56
+ * @LastEditTime: 2023-03-25 17:46:11
  */
 import request from '@/utils/request'
 //视频模块接口--------------------------------------------------------------

+ 1 - 8
src/views/xuexi/course_detail.vue

@@ -4,7 +4,7 @@
  * @Author: 小六
  * @Date: 2022-01-21 10:44:04
  * @LastEditors: king
- * @LastEditTime: 2023-03-25 15:25:28
+ * @LastEditTime: 2023-03-25 17:53:37
 -->
 <template>
   <div class="class_container">
@@ -318,7 +318,6 @@
       },
       to_video(video_id, video_slug) {
         console.log(video_id, 'taiozhaun')
-        if (this.detail.watch_progress || this.detail.watch_progress === 0) {
           // 跳转到视频页
           this.$router.push({
             path: './videoList',
@@ -329,12 +328,6 @@
               video_slug: video_slug,
             },
           })
-        } else {
-          this.$message({
-            message: '请先订阅课程',
-            type: 'warning',
-          })
-        }
       },
     },
   }

+ 15 - 12
src/views/xuexi/video_detail.vue

@@ -32,10 +32,10 @@
         <div class="item_wrap">
           <ul>
             <li
-              v-for="(item, key) in course_zhangjie"
-              :key="key"
+              v-for="(item, index) in course_zhangjie"
+              :key="index"
               class="out_wrap"
-              @click="zhedie(item.id)"
+              @click="zhedie(index)"
             >
               <div class="zhangjie">
                 <div class="left">
@@ -133,6 +133,7 @@
           danmu: 'admin-pro',
         },
         player: null,
+        videoIndex:0
       }
     },
     watch: {
@@ -193,13 +194,15 @@
       },
       //章节折叠
       zhedie(e) {
-        if (this.current_zhedie.includes(e)) {
-          this.current_zhedie = this.current_zhedie.filter((item) => {
-            return item != e
-          })
-        } else {
-          this.current_zhedie.push(e)
-        }
+        // if (this.current_zhedie.includes(e)) {
+        //   this.current_zhedie = this.current_zhedie.filter((item) => {
+        //     return item != e
+        //   })
+        // } else {
+        //   this.current_zhedie.push(e)
+        // }
+        this.videoIndex = e
+        this.lookVideo()
       },
       //点击重新播放
       refLook() {
@@ -398,7 +401,7 @@
         console.log(this.video_slug, 'this.video_slug')
         // this.videoTitle = data.video.title
         console.log(this.course_zhangjie)
-        myPlayer.src(this.course_zhangjie[4].url_resource)
+        myPlayer.src(this.course_zhangjie[this.videoIndex].url_resource)
 
         this.attaches = data.attaches
         this.videoDescription = data.video.description
@@ -442,7 +445,7 @@
           path: 'courseDetail',
           query: {
             course_slug: this.course_slug,
-            course_id: this.courseId,
+            id: this.courseId,
           },
         })
       },