소스 검색

视频点播

bzkf30 2 년 전
부모
커밋
c48f52ceb4
7개의 변경된 파일275개의 추가작업 그리고 27개의 파일을 삭제
  1. 19 12
      index.html
  2. BIN
      public/images/bg.png
  3. 6 0
      src/pages/jckc/api.js
  4. 5 1
      src/pages/jckc/index.vue
  5. 136 0
      src/pages/jckc/zy_detail.vue
  6. 104 14
      src/pages/jckc/zy_index.vue
  7. 5 0
      src/router/routes/jckc.ts

+ 19 - 12
index.html

@@ -1,14 +1,21 @@
 <!DOCTYPE html>
 <html lang="zh-CN">
-  <head>
-    <meta charset="UTF-8" />
-    <!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
-    <title></title>
-  </head>
-  <body>
-    <div id="app"></div>
-    <script src="/config.js"></script>
-    <script type="module" src="/src/main.ts"></script>
-  </body>
-</html>
+
+<head>
+  <meta charset="UTF-8" />
+  <!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
+  <meta name="viewport"
+    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
+  <link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.11.0/skins/default/aliplayer-min.css" />
+  <script type="text/javascript" charset="utf-8"
+    src="https://g.alicdn.com/de/prismplayer/2.11.0/aliplayer-min.js"></script>
+  <title></title>
+</head>
+
+<body>
+  <div id="app"></div>
+  <script src="/config.js"></script>
+  <script type="module" src="/src/main.ts"></script>
+</body>
+
+</html>

BIN
public/images/bg.png


+ 6 - 0
src/pages/jckc/api.js

@@ -22,4 +22,10 @@ export const files_list = (data = {}) =>
   request({
     url: '/kczy/files/index',
     data: data
+  })
+
+export const files_detail = (data = {}) =>
+  request({
+    url: '/kczy/files/detail',
+    data: data
   })

+ 5 - 1
src/pages/jckc/index.vue

@@ -1,8 +1,10 @@
 <template>
   <div class="jckcContent">
-    <van-nav-bar title="基础课程" right-text="筛选" @click-right="handleRightClick" />
+    <van-nav-bar left-arrow title="基础课程" right-text="筛选" @click-right="handleRightClick" @click-left="onClickLeft" />
     <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="initData" />
 
+    <van-empty v-if="listData.length==0" description="无数据" />
+
     <van-loading v-if="loading" class="h-full flex items-center justify-center" />
     <van-grid v-else :border="false" :column-num="2" :center="false" :gutter="5">
       <van-grid-item v-for="(item, index) in listData" :key="index" @click="lookDetail(item.kk_id)">
@@ -65,6 +67,8 @@ const loading = ref(false);
 const keyword = ref("");
 const listData = ref([]);
 
+const onClickLeft = () => history.back();
+
 const gradeData = ref([
   {
     grade_id: "",

+ 136 - 0
src/pages/jckc/zy_detail.vue

@@ -0,0 +1,136 @@
+<template>
+  <div class="zyDetailContent">
+    <div class="top flex justify-between items-center w-full p-1">
+      <van-icon name="arrow-left" color="#fff" size="16" @click="onClickLeft" />
+    </div>
+    <div class="look px-2">当前观看人数:{{detailInfo.kf_view_num}}</div>
+    <div class="videoDiv">
+      <div class="aliPlayerShow" id="J_prismPlayer"></div>
+    </div>
+    <!-- <video ref="videoPlay" controls>
+      <source :src="commonUrl" type="video/mp4" />
+      <source :src="commonUrl" type="video/ogg" />
+    </video> -->
+
+    <div></div>
+
+    <div class="flex justify-between items-center px-3 mt-2">
+      <div style="font-size: 15px;">{{detailInfo.kf_name}}</div>
+      <div class="flex space-x-4 tip">
+        <div>
+          <van-icon :name="detailInfo.is_like==0 ? 'good-job-o' : 'good-job'" />
+          <span>{{detailInfo.kf_like_num}}</span>
+        </div>
+        <div class="icon-item">
+          <van-icon :name="detailInfo.is_fav==0 ? 'like-o' : 'like'" />
+          <span>{{detailInfo.kf_fav_num}}</span>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { getFullUrl } from '@/utils/helper';
+import { files_detail } from "./api.js";
+import { useRouter } from 'vue-router';
+const router = useRouter();
+const parentId = ref(router.currentRoute.value.params.id);
+const parentKkId = ref("");
+const detailInfo = ref({});
+const detailLoad = ref(false);
+const commonUrl = ref("");
+const sourceUrl = ref("");
+
+const player = ref("");
+const onClickLeft = () => history.back();
+
+initDetailData();
+function initDetailData() {
+  detailLoad.value = true;
+  files_detail({ kf_id: parentId.value }).then((res) => {
+    if (res.code == 1) {
+      detailInfo.value = res.data.one_info;
+      parentKkId.value = detailInfo.value.kk_id;
+      commonUrl.value = getFullUrl(res.data.one_info.kf_path);
+      // detailLoad.value = false;
+
+      // console.log(detailInfo.value)
+
+      // let tempD = res.data.one_info.kf_path;
+      // this.typeKind = tempD.substr(tempD.lastIndexOf(".") + 1);
+      // this.$refs.urlResouce.src = res.data.one_info.kf_path;
+
+      //示例设置清晰度为超清和高清的地址("OD": "<原画URL>","FD": "<流畅URL>","LD":"<标清URL>","SD": "<高清URL>","HD": "<超清URL>","2K": "<2K URL>","4K": "<4K URL>")
+      // source:'{"HD":"http://******/player/hdexample.mp4","SD":"http://******/player/sdexample.mp4"}'
+
+      sourceUrl.value = { "OD": detailInfo.value.kf_path_od, "FD": detailInfo.value.kf_path_fd, "LD": detailInfo.value.kf_path_ld };
+      let stringSourceUrl = JSON.stringify(sourceUrl.value)
+      // 初始换aliplayer
+      player.value = new Aliplayer({
+        id: 'J_prismPlayer',
+        source: stringSourceUrl,
+        language: "zh-cn",
+        width: '100%', //容器的大小
+        height: '100%', //容器的大小
+        isLive: false,//是不是直播
+        preload: true,//播放器自动加载
+        autoplay: true,//是否自动播放
+        qualitySort: 'asc',//从小到大排序
+      }, function (player) {
+        console.log('播发器创建完成~')
+      });
+      if (localStorage.getItem('cur_time_' + parentKkId.value)) {
+        player.value.seek(localStorage.getItem('cur_time_' + parentKkId.value));
+      }
+      var timer = setInterval(() => {
+        var curTime = parseInt(player.value.getCurrentTime());
+        if (player.value && player.value.getStatus() == "playing") {
+          localStorage.setItem('cur_time_' + parentKkId.value, curTime);
+        }
+      }, 30000);
+
+      // this.fingerNum = res.data.one_info.kf_like_num; //点赞数
+      // this.fingerSwitch = res.data.one_info.is_like; //0:关 1:开
+      // this.loveNum = res.data.one_info.kf_fav_num; //关注
+      // this.loveSwitch = res.data.one_info.is_fav; //0:关 1:开
+    }
+  });
+}
+
+</script>
+
+<style lang="scss" scoped>
+.zyDetailContent {
+  height: 100vh;
+  background: #fcfeff;
+  .top {
+    position: absolute;
+    z-index: 10;
+    background: linear-gradient(180deg, rgba(0, 0, 0, 0.69), rgba(0, 0, 0, 0));
+    color: #fff;
+    font-size: 12px;
+  }
+  .look {
+    background: rgba($color: #050026, $alpha: 0.5);
+    border-radius: 5px;
+    line-height: 22px;
+    position: absolute;
+    z-index: 10;
+    top: 24px;
+    right: 10px;
+    color: #fff;
+    font-size: 12px;
+  }
+  .videoDiv {
+    height: 220px;
+  }
+  video {
+    width: 100%;
+  }
+  .tip {
+    color: #00a3ff;
+    font-size: 12px;
+  }
+}
+</style>

+ 104 - 14
src/pages/jckc/zy_index.vue

@@ -1,29 +1,59 @@
 <template>
-  <div>
-    <van-nav-bar :title="detailInfo.kk_name" />
+  <div class="zyContent">
+    <van-loading v-if="loading || detailLoad" class="h-full flex items-center justify-center" />
 
-    <van-loading v-if="loading" class="h-full flex items-center justify-center" />
-    <!-- <van-grid v-else :border="false" :column-num="2" :center="false" :gutter="5">
-      <van-grid-item v-for="(item, index) in listData" :key="index" @click="lookDetail(item.kk_id)">
+    <van-nav-bar left-arrow :title="detailInfo.grade_name+' 《'+ detailInfo.kk_name+'》'" @click-left="onClickLeft" />
+
+    <div class="production p-5">
+      <div class="title">{{detailInfo.grade_name+' 《'+ detailInfo.kk_name+'》'}}</div>
+      <div class="flex space-x-5 my-1">
+        <div>责任教师:{{detailInfo.kk_zrjs}}</div>
+        <div>机构名称:{{detailInfo.kk_jgmc}}</div>
+      </div>
+      <div>简介:<br />{{detailInfo.kc_jj}}</div>
+    </div>
+
+    <div class="flex justify-between items-center space-x-1">
+      <van-search class="flex-1" v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="initData" />
+      <!-- <div @click="onClickRight" class="flex items-center" style="color: #00A3FF;font-size: 12px;">
+        课程安排
+        <van-icon name="arrow" size="14" />
+      </div> -->
+    </div>
+
+    <van-empty v-if="listData.length==0" description="无数据" />
+
+    <van-grid v-if="!loading" :border="false" :column-num="2" :center="false" :gutter="5">
+      <van-grid-item v-for="(item, index) in listData" :key="index" @click="lookDetail(item.kf_id)">
         <div class="shadow">
-          <van-image :src="getFullUrl(item.kk_img)" />
+          <van-image :src="getFullUrl(item.kf_img)" />
           <div class="p-2">
-            <div class="van-ellipsis title">{{item.kk_name}}</div>
-            <van-rate class="my-2" v-model="item.kk_star_num" color="#ffd21e" void-icon="star" void-color="#eee" size="16px" readonly allow-half />
+            <div class="van-ellipsis title">{{item.kf_name}}</div>
+            <van-rate class="my-2" v-model="item.kf_star_num" color="#ffd21e" void-icon="star" void-color="#eee" size="16px" readonly allow-half />
             <div class="flex space-x-4 tip">
               <div>
                 <van-icon name="good-job-o" />
-                <span>{{item.kk_like_num}}</span>
+                <span>{{item.kf_like_num}}</span>
               </div>
               <div class="icon-item">
                 <van-icon name="like-o" />
-                <span>{{item.kk_fav_num}}</span>
+                <span>{{item.kf_fav_num}}</span>
               </div>
             </div>
           </div>
         </div>
       </van-grid-item>
-    </van-grid> -->
+    </van-grid>
+
+    <van-dialog v-model:show="dialogShow" :show-confirm-button="false" message-align="left" style="height: 60%;">
+      <template #title>
+        <div class="flex justify-between items-center">
+          课程安排
+          <van-icon name="cross" @click="dialogShow=false" />
+        </div>
+      </template>
+      <iframe class="iframe" :src="detailInfo.file_preview" width="100%" style="height: 100%;" frameborder="0" scrolling="auto"></iframe>
+    </van-dialog>
   </div>
 </template>
 
@@ -31,15 +61,22 @@
 import { kc_detail, files_list } from "./api.js";
 import { useRouter } from 'vue-router';
 const router = useRouter();
-const parentId = router.currentRoute.value.params.id;
+const parentId = ref(router.currentRoute.value.params.id);
 const loading = ref(false);
+const detailLoad = ref(false);
 const keyword = ref("");
 const listData = ref([]);
 const detailInfo = ref({});
+const dialogShow = ref(false);
+
+const onClickLeft = () => history.back();
 
 initData();
 function initData() {
   let obj = {
+    page: "1",
+    limit: "9999",
+    keyword: keyword.value,
     kk_id: parentId.value,
   }
   loading.value = true;
@@ -54,15 +91,68 @@ function initData() {
 
 initDetailData();
 function initDetailData() {
+  detailLoad.value = true;
   kc_detail({ kk_id: parentId.value }).then((res) => {
     if (res.code == 1) {
       detailInfo.value = res.data.one_info;
-      console.log(detailInfo.value)
+      detailLoad.value = false;
     }
   });
 }
 
+const lookDetail = (id) => {
+  router.push({ name: 'jckc_zyDetail', params: { id } })
+}
+
+const onClickRight = () => {
+  dialogShow.value = true;
+}
 </script>
 
-<style>
+<style lang="scss" scoped>
+.zyContent {
+  height: 100vh;
+  background: #fcfeff;
+  .production {
+    background: url(/images/bg.png) no-repeat top left;
+    color: #fff;
+    font-size: 12px;
+    .title {
+      font-size: 15px;
+    }
+  }
+  :deep(.van-search__content--round) {
+    box-shadow: 0px 1px 2px 0px rgba(153, 160, 168, 0.18);
+    background: #fff;
+    // .van-search__field {
+    //   background: #fff;
+    // }
+  }
+  :deep(.van-grid-item) {
+    width: 50%;
+    .van-grid-item__content {
+      padding-top: 0;
+    }
+  }
+  :deep(.shadow) {
+    border-radius: 6px;
+    box-shadow: 0px 5px 12px 0px rgba(153, 160, 168, 0.18);
+    .van-image {
+      display: block;
+      .van-image__img {
+        border-radius: 6px 6px 0 0;
+        height: 98px;
+      }
+    }
+  }
+  .tip {
+    color: #9a9a9a;
+    font-size: 12px;
+  }
+  :deep(.van-dialog) {
+    .van-dialog__header {
+      padding: 10px;
+    }
+  }
+}
 </style>

+ 5 - 0
src/router/routes/jckc.ts

@@ -14,6 +14,11 @@ export default <RouteRecordRaw>{
       path: 'zy/:id',
       name: "jckc_zy",
       component: () => import('~/pages/jckc/zy_index.vue'),
+    },
+    {
+      path: 'zyDetail/:id',
+      name: "jckc_zyDetail",
+      component: () => import('~/pages/jckc/zy_detail.vue'),
     }
   ]
 }