Tang 1 năm trước cách đây
mục cha
commit
e2be09f28a

+ 1 - 0
public/index.html

@@ -14,6 +14,7 @@
   <!-- <script src="https://manage.xyyxt.net/static/js/gsap.min.js"></script> -->
   <!-- 使用CDN的CSS文件 -->
   <link rel="stylesheet" href="https://file.xyyxt.net/web/static/js/index.min.css">
+  <link href="https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.min.css" rel="stylesheet" />
   <style>
     html,
     body,

+ 2 - 0
src/api/api.js

@@ -82,6 +82,7 @@ import examapply from '../newApi/examapply'//考试安排
 import qianpeiApi from '../newApi/qianpeiApi'//前培
 import applicationData from '../newApi/applicationData'//报考数据
 import polyv from '../newApi/polyv'//保利威
+import tc from '../newApi/tc'//腾讯
 import profiles from '../newApi/profiles'//填写资料审核管理
 import profileStamp from '../newApi/profileStamp'//盖章资料审核管理
 import recordList from '../newApi/recordList'//试卷做题记录
@@ -176,6 +177,7 @@ export default {
     ...qianpeiApi,
     ...applicationData,
     ...polyv,
+    ...tc,
     ...profiles,
     ...profileStamp,
     ...recordList,

+ 41 - 0
src/newApi/tc.js

@@ -0,0 +1,41 @@
+import request from '@/utils/request' //引入axios请求及拦截器
+export default {
+    //获取保利威视频上传签名
+    inquirepolyvvideogetPolyvUpload(data) {
+        return request({
+            url: '/polyv/video/getPolyvUpload',
+            method: 'get',
+            params: data
+        })
+    },
+    //同步保利威视频
+    uploadPolyvvideocata(data) {
+        return request({
+            url: '/polyv/video/importList',
+            method: 'post',
+            data
+        })
+    },
+    //查询保利威视频分类
+    obtainpolyvvideosignlistCata(data) {
+        return request({
+            url: '/polyv/video/listCata',
+            method: 'get',
+            params: data
+        })
+    },
+    //获取腾讯视频播放凭证
+    obtaintcvideosign(data) {
+        return request({
+            url: `/vod/video/sign/` + data,
+            method: 'get',
+        })
+    },
+    //获取腾讯视频信息详细信息
+    inquirevodvideodetail(data) {
+        return request({
+            url: `/vod/video/detail/` + data,
+            method: 'get',
+        })
+    },
+}

+ 2 - 2
src/utils/request.js

@@ -8,8 +8,8 @@ import { paramMate } from "@/utils/common";
 
 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 // 创建axios实例
-// export const baseURL = process.env.VUE_APP_BASE_API
-export const baseURL = 'http://192.168.1.24:5030/'
+export const baseURL = process.env.VUE_APP_BASE_API
+// export const baseURL = 'http://192.168.1.24:5030/'
 export const BASE_IMG_URL = process.env.VUE_APP_IMG_API
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分

+ 48 - 2
src/views/Marketing/goods/courseInquiryList/index.vue

@@ -45,7 +45,7 @@
           <span v-if="!activeId" style="font-size: 30px"
             >请打开目录详情,点击播放您需要观看的视频内容。</span
           >
-          <div v-show="vid" id="player"></div>
+          <div v-show="vid && viewSign == 1" id="player"></div>
           <div v-show="vidzb" id="playerzb"></div>
         </div>
         <div class="rightBoxslist">
@@ -292,7 +292,10 @@ export default {
       dialogVisible: false,
       courseList: [], //详情列表
       activeId: "", //当前选中ID
+      viewSign: 1,
       vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJsForTCPlayer:
+        "https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js",
       vid: "",
       playerJs:
         "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
@@ -380,6 +383,7 @@ export default {
      */
     msgInfo(option) {
       this.goodsBoxName = option.goodsName
+      this.viewSign = option.viewSign
       this.$api.obtainCourseSgoodsId(option.goodsId).then(async (res) => {
         // if (res.rows.length) {
         if (!res.rows.length) {
@@ -663,7 +667,11 @@ export default {
         this.loadPlayerScriptzb(this.loadPlayerzb);
       } else {
         this.vid = option.recordingUrl;
-        this.loadPlayerScript(this.loadPlayer);
+        if(this.viewSign == 2) {
+          this.loadPlayerScript_tencent(this.loadPlayer_tencent);
+        }else {
+          this.loadPlayerScript(this.loadPlayer);
+        }
       }
     },
     loadPlayerScript(callback) {
@@ -676,6 +684,16 @@ export default {
         callback();
       }
     },
+    loadPlayerScript_tencent(callback) {
+      if (!window.TCPlayer) {
+        const myScript = document.createElement("script");
+        myScript.setAttribute("src", this.vodPlayerJsForTCPlayer);
+        myScript.onload = callback;
+        document.body.appendChild(myScript);
+      } else {
+        callback();
+      }
+    },
     loadPlayer() {
       var self = this;
       const polyvPlayer = window.polyvPlayer;
@@ -692,6 +710,31 @@ export default {
         },
       });
     },
+    loadPlayer_tencent() {
+      var self = this;
+      const TCPlayer = window.TCPlayer;
+      try {
+        let video = document.querySelector("video");
+        video.parentNode.removeChild(video);
+      } catch (error) {
+        console.log("清除video标签异常");
+      }
+      let player_tencent = document.createElement("video");
+      player_tencent.id = "player-tencent";
+      document
+        .getElementById("player")
+        .insertAdjacentElement("afterend", player_tencent);
+      self.$api.obtaintcvideosign(self.vid).then(res => {
+        self.player_tencent = TCPlayer("player-tencent", {
+          width: 932,
+        height: 627,
+          fileID: self.vid,
+          appID: res.data.appID,
+          psign: res.data.psign,
+          licenseUrl: res.data.licenseUrl
+        });
+      });
+    },
     /**
      * @param {String} 关闭视频窗口-销毁实例
      */
@@ -703,6 +746,9 @@ export default {
         if (this.player) {
           this.player.destroy();
         }
+        if (this.player_tencent) {
+          this.player.dispose();
+        }
         if (this.playerzb) {
           this.playerzb.destroy();
         }

+ 219 - 222
src/views/resource/videoManagement/festival/add/index.vue

@@ -9,31 +9,21 @@
         ref="listData"
       >
         <el-form-item label="适用业务层级" required>
-          <el-select
-            v-model="eduType"
-            placeholder="请选择教育类型"
-            @change="changeEduType"
-          >
+          <el-select v-model="eduType" placeholder="请选择教育类型" @change="changeEduType">
             <el-option
               v-for="(item, index) in eduTypeOptions"
               :key="index"
               :label="item.educationName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
-          <el-select
-            v-model="courType"
-            placeholder="请选择业务层次"
-            @change="changecourseType"
-          >
+          <el-select v-model="courType" placeholder="请选择业务层次" @change="changecourseType">
             <el-option
               v-for="(item, index) in newCourTypeOptions"
               :key="index"
               :label="item.projectName + '-' + item.businessName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <el-popover
             ref="popovers"
@@ -47,8 +37,7 @@
               v-model="checkAll"
               @change="handleCheckAllChange"
               :indeterminate="isIndeterminate"
-              >全选</el-checkbox
-            >
+            >全选</el-checkbox>
             <el-checkbox-group
               v-model="sujectArray"
               class="checkboxSty"
@@ -58,47 +47,34 @@
                 v-for="(item, index) in newSujectOption"
                 :label="item.newId"
                 :key="index"
-                >{{ item.subjectName }}</el-checkbox
-              >
+              >{{ item.subjectName }}</el-checkbox>
             </el-checkbox-group>
             <div style="display: block; text-align: center; margin-top: 10px">
-              <el-button size="mini" type="primary" @click="submitSujectArray"
-                >确定</el-button
-              >
+              <el-button size="mini" type="primary" @click="submitSujectArray">确定</el-button>
             </div>
-            <el-button
-              slot="reference"
-              style="margin-left: 12px"
-              @click="getMessage"
-              >请选择科目</el-button
-            >
+            <el-button slot="reference" style="margin-left: 12px" @click="getMessage">请选择科目</el-button>
           </el-popover>
           <span style="margin-left: 10px">注:可多选</span>
         </el-form-item>
-        <el-form-item label="">
+        <el-form-item label>
           <div :class="changeHeight ? 'ach' : 'clh'">
-            <div
-              v-for="(item, index) in newSujectApis"
-              :key="index"
-              class="listBoxStys"
-            >
+            <div v-for="(item, index) in newSujectApis" :key="index" class="listBoxStys">
               {{
-                item.educationName +
-                " - " +
-                item.projectName +
-                " - " +
-                item.businessName +
-                " - " +
-                item.subjectName
+              item.educationName +
+              " - " +
+              item.projectName +
+              " - " +
+              item.businessName +
+              " - " +
+              item.subjectName
               }}
-              <i class="el-icon-error closeIcons" @click="closeType(index)"></i>
+              <i
+                class="el-icon-error closeIcons"
+                @click="closeType(index)"
+              ></i>
             </div>
           </div>
-          <el-popover
-            placement="bottom-start"
-            trigger="hover"
-            :close-delay="50"
-          >
+          <el-popover placement="bottom-start" trigger="hover" :close-delay="50">
             <ul style="margin: 0; max-width: 600px">
               <li
                 class="copyDataLi"
@@ -108,7 +84,7 @@
                 @click="unTime(itemT)"
               >
                 {{
-                  `${itemT.educationName}-${itemT.projectName}-${itemT.businessName}-${itemT.subjectName}`
+                `${itemT.educationName}-${itemT.projectName}-${itemT.businessName}-${itemT.subjectName}`
                 }}
               </li>
             </ul>
@@ -118,20 +94,14 @@
               slot="reference"
               size="mini"
               style="margin-right: 10px"
-              >最近选择</el-button
-            >
+            >最近选择</el-button>
           </el-popover>
           <el-button
             size="mini"
             v-if="newSujectApis.length > 1"
             @click="changeType"
-            >{{ changeHeight ? "展开" : "关闭" }}</el-button
-          ><el-button
-            size="mini"
-            v-if="newSujectApis.length > 0"
-            @click="sujectApis = []"
-            >清空</el-button
-          >
+          >{{ changeHeight ? "展开" : "关闭" }}</el-button>
+          <el-button size="mini" v-if="newSujectApis.length > 0" @click="sujectApis = []">清空</el-button>
           <!-- <span v-if="newSujectApis.length === 0">未选项目类型</span> -->
         </el-form-item>
         <el-form-item label="标题前缀">
@@ -140,9 +110,7 @@
         </el-form-item>
         <el-form-item label="节标题" prop="name">
           <el-input v-model="listData.name"></el-input>
-          <div style="color: #999">
-            注:请尽量规范易懂,方便在课程目录表呈现给学员
-          </div>
+          <div style="color: #999">注:请尽量规范易懂,方便在课程目录表呈现给学员</div>
         </el-form-item>
         <el-form-item label="节类型">
           <el-select
@@ -156,67 +124,46 @@
               :key="index"
               :label="item.label"
               :value="item.value"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item
-          label="频道号"
-          v-if="listData.sectionType === 2"
-          prop="liveUrl"
-        >
-          <el-input
-            style="width: 300px"
-            v-model="listData.liveUrl"
-            placeholder="请输入频道号"
-          ></el-input>
-          <el-select
-            v-model="newActiveLiveUrl"
-            placeholder="快捷选中频道号"
-            @change="changeLiveUrl"
-          >
+
+        <el-form-item label="视频类型" prop="viewSign">
+          <el-radio-group v-model="listData.viewSign">
+            <el-radio :label="1">保利威</el-radio>
+            <el-radio :label="2">腾讯</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item label="频道号" v-if="listData.sectionType === 2" prop="liveUrl">
+          <el-input style="width: 300px" v-model="listData.liveUrl" placeholder="请输入频道号"></el-input>
+          <el-select v-model="newActiveLiveUrl" placeholder="快捷选中频道号" @change="changeLiveUrl">
             <el-option
               v-for="(item, index) in newLiveUrl"
               :key="index"
               :label="item.streamingName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <div v-if="listData.liveUrl" style="margin-top: 10px">
-            <el-button
-              size="small"
-              type="warning"
-              @click="watchZbVideo(listData.liveUrl)"
-              >直播预览</el-button
-            >
+            <el-button size="small" type="warning" @click="watchZbVideo(listData.liveUrl)">直播预览</el-button>
           </div>
         </el-form-item>
-        <el-form-item
-          label="直播开始时间"
-          v-if="listData.sectionType === 2"
-          prop="liveStartTime"
-        >
+        <el-form-item label="直播开始时间" v-if="listData.sectionType === 2" prop="liveStartTime">
           <el-date-picker
             v-model="listData.liveStartTime"
             type="datetime"
             placeholder="请选择直播开始时间"
             value-format="timestamp"
-          >
-          </el-date-picker>
+          ></el-date-picker>
         </el-form-item>
-        <el-form-item
-          label="直播结束时间"
-          v-if="listData.sectionType === 2"
-          prop="liveEndTime"
-        >
+        <el-form-item label="直播结束时间" v-if="listData.sectionType === 2" prop="liveEndTime">
           <el-date-picker
             v-model="listData.liveEndTime"
             type="datetime"
             placeholder="请选择直播结束时间"
             value-format="timestamp"
-          >
-          </el-date-picker>
+          ></el-date-picker>
         </el-form-item>
         <el-form-item
           label="直播时长"
@@ -225,9 +172,7 @@
             listData.liveStartTime &&
             listData.liveEndTime
           "
-        >
-          {{ compTimeOUT(listData.liveStartTime, listData.liveEndTime) }}
-        </el-form-item>
+        >{{ compTimeOUT(listData.liveStartTime, listData.liveEndTime) }}</el-form-item>
         <el-form-item
           label="URL地址"
           v-if="listData.sectionType === 1 || listData.sectionType === 3"
@@ -243,13 +188,8 @@
             for="mobles"
             class="el-button el-button--primary"
             style="margin: 0px 6px; padding: 10px 20px"
-            >上传</label
-          ><input
-            style="display: none"
-            type="file"
-            id="mobles"
-            @change="importMoble"
-          />
+          >上传</label>
+          <input style="display: none" type="file" id="mobles" @change="importMoble" />
           <el-select
             v-if="listData.sectionType === 1"
             v-model="newActiveRecordingUrl1"
@@ -262,8 +202,7 @@
               :key="index"
               :label="item.streamingName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <el-select
             v-if="listData.sectionType === 3"
@@ -277,16 +216,10 @@
               :key="index"
               :label="item.streamingName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <div v-if="listData.recordingUrl" style="margin-top: 10px">
-            <el-button
-              size="small"
-              type="warning"
-              @click="watchVideo(listData.recordingUrl)"
-              >视频预览</el-button
-            >
+            <el-button size="small" type="warning" @click="watchVideo(listData.recordingUrl)">视频预览</el-button>
           </div>
         </el-form-item>
         <el-form-item
@@ -300,25 +233,16 @@
             range-separator=":"
             v-model="listData.durationTime"
             placeholder="请填入节时长"
-          >
-          </el-time-picker>
+          ></el-time-picker>
         </el-form-item>
-        <el-form-item
-          label="讲师"
-          :prop="listData.sectionType === 2 ? 'teacherId' : ''"
-        >
-          <el-select
-            v-model="listData.teacherId"
-            placeholder="请选择讲师"
-            filterable
-          >
+        <el-form-item label="讲师" :prop="listData.sectionType === 2 ? 'teacherId' : ''">
+          <el-select v-model="listData.teacherId" placeholder="请选择讲师" filterable>
             <el-option
               v-for="(item, index) in teacherList"
               :key="index"
               :label="item.teacherName"
               :value="item.teacherId"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="节封面" prop="coverUrl">
@@ -336,8 +260,8 @@
                 v-if="!listData.coverUrl"
               >
                 <label for="uplose">
-                  <i class="el-icon-circle-plus-outline iconStsz"></i
-                ></label>
+                  <i class="el-icon-circle-plus-outline iconStsz"></i>
+                </label>
                 <input
                   ref="file"
                   type="file"
@@ -353,13 +277,12 @@
                 :preview-src-list="[
                   $methodsTools.splitImgHost(listData.coverUrl),
                 ]"
-              >
-              </el-image>
+              ></el-image>
             </el-col>
             <el-col :span="11">
-              <span style="color: #999; font-size: 14px"
-                >注:请上传小于300kb,尺寸为750*440的图片,支持gif、jpg、jpeg、png等类型</span
-              >
+              <span
+                style="color: #999; font-size: 14px"
+              >注:请上传小于300kb,尺寸为750*440的图片,支持gif、jpg、jpeg、png等类型</span>
             </el-col>
           </el-row>
           <el-button
@@ -368,8 +291,7 @@
             size="mini"
             class="margin-top: 20px;"
             @click="clearImgs"
-            >删除</el-button
-          >
+          >删除</el-button>
         </el-form-item>
         <el-form-item label="是否发布" prop="publishStatus">
           <el-radio-group v-model="listData.publishStatus">
@@ -379,12 +301,7 @@
         </el-form-item>
         <el-form-item>
           <el-button @click="backPage">取消</el-button>
-          <el-button
-            type="primary"
-            @click="submit('listData')"
-            :loading="disabledBtn"
-            >确定</el-button
-          >
+          <el-button type="primary" @click="submit('listData')" :loading="disabledBtn">确定</el-button>
         </el-form-item>
       </el-form>
     </div>
@@ -399,11 +316,11 @@
       <div slot="title" class="hearders">
         <div class="leftTitle">视频预览</div>
         <div class="rightBoxs">
-          <img src="@/assets/images/Close@2x.png" alt="" @click="clears" />
+          <img src="@/assets/images/Close@2x.png" alt @click="clears" />
         </div>
       </div>
       <div>
-        <div id="player"></div>
+        <div id="player" v-show="listData.viewSign == 1"></div>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="clears">取 消</el-button>
@@ -419,7 +336,7 @@
       <div slot="title" class="hearders">
         <div class="leftTitle">直播预览</div>
         <div class="rightBoxs">
-          <img src="@/assets/images/Close@2x.png" alt="" @click="clearszb" />
+          <img src="@/assets/images/Close@2x.png" alt @click="clearszb" />
         </div>
       </div>
       <div>
@@ -442,6 +359,8 @@ export default {
       isIndeterminate: false,
       checkAll: false,
       vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJsForTCPlayer:
+        "https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js",
       vid: "",
       playerJs:
         "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
@@ -454,17 +373,17 @@ export default {
         cataid: "1639399775001", // 分类ID 可以后端传递 也可以不写 或写死
         tag: "i am tag", // 标签
         luping: 0, // 是否开启视频课件优化处理,对于上传录屏类视频清晰度有所优化:0为不开启,1为开启
-        keepsource: 1, // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
+        keepsource: 1 // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
       },
       sectionTypeOptions: [
         {
           label: "录播",
-          value: 1,
+          value: 1
         },
         {
           label: "直播",
-          value: 2,
-        },
+          value: 2
+        }
         // {
         //   label: "回放",
         //   value: 3,
@@ -474,12 +393,13 @@ export default {
       changeHeight: true,
       bfImg: "oss/images/avatar/20211013/1634097664410_1397766697",
       listData: {
+        viewSign: 1,
         durationTime: "",
         sectionType: 1,
         publishStatus: 1,
         recordingUrl: "",
         liveUrl: "",
-        coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697",
+        coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697"
       },
       newActiveLiveUrl: "",
       newLiveUrl: [], //直播流地址
@@ -504,46 +424,47 @@ export default {
       //表单验证
       rules: {
         prefixName: [
-          { required: true, message: "请输入标题前缀", trigger: "blur" },
+          { required: true, message: "请输入标题前缀", trigger: "blur" }
         ],
         name: [{ required: true, message: "请输入节标题", trigger: "blur" }],
         // liveDuration: [
         //   { required: true, message: "节时长不能为空" },
         //   { type: "number", message: "节时长必须为数字值" },
         // ],
+        viewSign: [
+          { required: true, message: "请选择视频类型", trigger: "change" }
+        ],
         recordingUrl: [
           {
             required: true,
             message: "请输入URL地址",
-            trigger: ["blur", "change"],
-          },
+            trigger: ["blur", "change"]
+          }
         ],
         durationTime: [
-          { required: false, message: "请选择节时长", trigger: "change" },
+          { required: false, message: "请选择节时长", trigger: "change" }
         ],
         liveUrl: [
           {
             required: true,
             message: "请输入频道号",
-            trigger: ["blur", "change"],
-          },
+            trigger: ["blur", "change"]
+          }
         ],
         liveStartTime: [
-          { required: true, message: "请选择直播开始时间", trigger: "change" },
+          { required: true, message: "请选择直播开始时间", trigger: "change" }
         ],
         liveEndTime: [
-          { required: true, message: "请选择直播结束时间", trigger: "change" },
+          { required: true, message: "请选择直播结束时间", trigger: "change" }
         ],
         teacherId: [
-          { required: true, message: "请选择讲师", trigger: "change" },
+          { required: true, message: "请选择讲师", trigger: "change" }
         ],
         publishStatus: [
-          { required: true, message: "请选择是否发布", trigger: "change" },
+          { required: true, message: "请选择是否发布", trigger: "change" }
         ],
-        coverUrl: [
-          { required: true, message: "请上传封面", trigger: "change" },
-        ],
-      },
+        coverUrl: [{ required: true, message: "请上传封面", trigger: "change" }]
+      }
     };
   },
   watch: {
@@ -551,8 +472,8 @@ export default {
       immediate: true,
       handler(newName, oldName) {
         this.changeTypes();
-      },
-    },
+      }
+    }
   },
   mounted() {
     this.localData = this.$methodsTools.getBusinessList();
@@ -574,7 +495,7 @@ export default {
     },
     changeSty(val) {
       var arr = "";
-      this.sujectApis.forEach((item) => {
+      this.sujectApis.forEach(item => {
         let arr1 = item.split("-").map(Number);
         if (val.businessId == arr1[0] && val.subjectId == arr1[1]) {
           arr = "activeStyIcons";
@@ -583,7 +504,7 @@ export default {
       return arr;
     },
     handleCheckedCitiesChange() {
-      let nid = this.newSujectOption.map((item) => {
+      let nid = this.newSujectOption.map(item => {
         return item.newId;
       });
       this.checkAll = this.sujectArray.length === nid.length;
@@ -601,18 +522,18 @@ export default {
     },
     handleCheckAllChange(val) {
       if (val) {
-        let nid = this.newSujectOption.map((item) => {
+        let nid = this.newSujectOption.map(item => {
           return item.newId;
         });
         let arrays = this.sujectArray.concat(nid);
         this.sujectArray = this.setFunc(arrays);
         this.isIndeterminate = false;
       } else {
-        let nid = this.newSujectOption.map((item) => {
+        let nid = this.newSujectOption.map(item => {
           return item.newId;
         });
         let newArr = [];
-        this.sujectArray.forEach((item) => {
+        this.sujectArray.forEach(item => {
           if (!nid.includes(item)) {
             newArr.push(item);
           }
@@ -633,26 +554,52 @@ export default {
       }
     },
     getApiTime(val) {
+      console.log("获取时长", this.listData.viewSign == 2);
       var self = this;
       const valueUrl = val.replace(/\s/g, "");
-      if (valueUrl && valueUrl.length > 30) {
+      if (this.listData.viewSign == 2) {
         this.disabledBtn = true;
         this.$api
-          .inquirepolyvvideo(valueUrl)
-          .then((res) => {
+          .inquirevodvideodetail(valueUrl)
+          .then(res => {
+            console.log("请求腾讯时长", res.data.duration);
             if (res.data.duration) {
-              self.listData.durationTime = res.data.duration;
+              self.listData.durationTime = this.$methodsTools.secondToDate(
+                res.data.duration,
+                false
+              );
+              console.log("转换后的腾讯时间", self.listData.durationTime);
               self.disabloutime = true;
             } else {
               self.disabloutime = false;
             }
           })
-          .catch((err) => {
+          .catch(err => {
             self.disabloutime = false;
           })
           .finally(() => {
             this.disabledBtn = false;
           });
+      } else {
+        if (valueUrl && valueUrl.length > 30) {
+          this.disabledBtn = true;
+          this.$api
+            .inquirepolyvvideo(valueUrl)
+            .then(res => {
+              if (res.data.duration) {
+                self.listData.durationTime = res.data.duration;
+                self.disabloutime = true;
+              } else {
+                self.disabloutime = false;
+              }
+            })
+            .catch(err => {
+              self.disabloutime = false;
+            })
+            .finally(() => {
+              this.disabledBtn = false;
+            });
+        }
       }
     },
     loadPlayerScript(callback) {
@@ -668,6 +615,19 @@ export default {
         });
       }
     },
+    loadPlayerScript_tencent(callback) {
+      if (!window.TCPlayer) {
+        const myScript = document.createElement("script");
+        myScript.setAttribute("src", this.vodPlayerJsForTCPlayer);
+        myScript.onload = callback;
+        document.body.appendChild(myScript);
+      } else {
+        callback();
+        this.player_tencent.on("error", (...params) => {
+          this.$message.error(returnTitle(params[1]));
+        });
+      }
+    },
     loadPlayer() {
       var self = this;
       const polyvPlayer = window.polyvPlayer;
@@ -677,11 +637,36 @@ export default {
         height: 533,
         vid: self.vid,
         teaser_show: 0,
-        playsafe: function (vid, next) {
-          self.$api.obtainpolyvvideosign(vid).then((res) => {
+        playsafe: function(vid, next) {
+          self.$api.obtainpolyvvideosign(vid).then(res => {
             next(res.data);
           });
-        },
+        }
+      });
+    },
+    loadPlayer_tencent() {
+      var self = this;
+      const TCPlayer = window.TCPlayer;
+      try {
+        let video = document.querySelector("video");
+        video.parentNode.removeChild(video);
+      } catch (error) {
+        console.log("清除video标签异常");
+      }
+      let player_tencent = document.createElement("video");
+      player_tencent.id = "player-tencent";
+      document
+        .getElementById("player")
+        .insertAdjacentElement("afterend", player_tencent);
+      self.$api.obtaintcvideosign(self.vid).then(res => {
+        self.player_tencent = TCPlayer("player-tencent", {
+          width: 800,
+          height: 533,
+          fileID: self.vid,
+          appID: res.data.appID,
+          psign: res.data.psign,
+          licenseUrl: res.data.licenseUrl
+        });
       });
     },
     /**
@@ -692,6 +677,9 @@ export default {
       if (this.player) {
         this.player.destroy();
       }
+      if (this.player_tencent) {
+        this.player_tencent.dispose();
+      }
     },
     /**
      * @param {String} 视频查看
@@ -705,12 +693,19 @@ export default {
       this.diavos = true;
     },
     isOkBf() {
-      this.loadPlayerScript(this.loadPlayer);
+      if (this.listData.viewSign == 2) {
+        this.loadPlayerScript_tencent(this.loadPlayer_tencent);
+      } else {
+        this.loadPlayerScript(this.loadPlayer);
+      }
     },
     closePlayer() {
       if (this.player) {
         this.player.destroy();
       }
+      if (this.player_tencent) {
+        this.player_tencent.dispose();
+      }
     },
     /**
      * @param {String} 直播预览
@@ -741,7 +736,7 @@ export default {
         width: 800,
         height: 533,
         uid: this.uidzb,
-        vid: this.vidzb,
+        vid: this.vidzb
       });
     },
     clearszb() {
@@ -767,7 +762,7 @@ export default {
        * @param: this.fileSetting -> 常规配置 上面有备注
        * @param: 回调
        */
-      uploadFile(file, this.fileSetting, (event) => {
+      uploadFile(file, this.fileSetting, event => {
         this.listData.recordingUrl = event.vid;
         this.listData.durationTime = "";
         this.getApiTime(event.vid);
@@ -786,7 +781,7 @@ export default {
       var self = this;
       var arrays = [];
       this.sujectApis.map((item, index) => {
-        this.courTypeOptions.map((items) => {
+        this.courTypeOptions.map(items => {
           if (items.id === item.split("-").map(Number)[0]) {
             var obj = {
               educationTypeId: items.educationId,
@@ -794,9 +789,9 @@ export default {
               projectId: items.projectId,
               projectName: items.projectName,
               businessId: items.id,
-              businessName: items.businessName,
+              businessName: items.businessName
             };
-            self.sujectOption.map((i) => {
+            self.sujectOption.map(i => {
               if (
                 i.id === item.split("-").map(Number)[1] &&
                 i.courseArrays.indexOf(items.projectId) !== -1
@@ -828,7 +823,7 @@ export default {
       });
     },
     changeUrl() {
-      var arr = this.newSujectApis.map((val) => val.businessId);
+      var arr = this.newSujectApis.map(val => val.businessId);
       const unique = [...new Set(arr)];
       var busId = "";
       if (unique.length) {
@@ -836,11 +831,11 @@ export default {
       } else {
         busId = "";
       }
-      this.$api.inquireCourseStreaming({ status: 1 }).then((res) => {
+      this.$api.inquireCourseStreaming({ status: 1 }).then(res => {
         var arraystt = [];
         var newarrays1tt = [];
         var newarrays2tt = [];
-        res.rows.map((item) => {
+        res.rows.map(item => {
           if (item.streamingType === 1) {
             arraystt.push(item);
           }
@@ -853,11 +848,11 @@ export default {
         });
         this.$api
           .inquireCourseStreaming({ status: 1, businessId: busId })
-          .then((result) => {
+          .then(result => {
             var arrays = [];
             var newarrays1 = [];
             var newarrays2 = [];
-            result.rows.map((item) => {
+            result.rows.map(item => {
               if (item.streamingType === 1) {
                 arrays.push(item);
               }
@@ -901,27 +896,27 @@ export default {
         this.$refs.popovers.doClose();
         return;
       }
-      this.newSujectOption.map((item) => {
+      this.newSujectOption.map(item => {
         item.newId = this.courType + "-" + item.id;
       });
       this.handleCheckedCitiesChange();
     },
     hideHandle() {},
     getDict() {
-      this.$api.inquiresystemteacherlist({ status: 1 }).then((res) => {
+      this.$api.inquiresystemteacherlist({ status: 1 }).then(res => {
         this.teacherList = res.rows;
       });
-      this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
+      this.$api.inquireCourseEducationType({ status: 1 }).then(res => {
         this.eduTypeOptions = res.rows;
       });
-      this.$api.inquireCourseProjectType({ status: 1 }).then((res) => {
+      this.$api.inquireCourseProjectType({ status: 1 }).then(res => {
         this.projectTypeOptions = res.rows;
       });
-      this.$api.inquirebusinessList({ status: 1 }).then((res) => {
+      this.$api.inquirebusinessList({ status: 1 }).then(res => {
         this.courTypeOptions = res.rows;
         this.newCourTypeOptions = res.rows;
       });
-      this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
+      this.$api.inquireCourseSubject({ status: 1 }).then(res => {
         res.rows.map((item, index) => {
           var array = [];
           item.courseProjectTypes.map((items, indexs) => {
@@ -931,11 +926,11 @@ export default {
         });
         this.sujectOption = res.rows;
       });
-      this.$api.inquireCourseStreaming({ status: 1 }).then((res) => {
+      this.$api.inquireCourseStreaming({ status: 1 }).then(res => {
         var arrays = [];
         var newarrays1 = [];
         var newarrays2 = [];
-        res.rows.map((item) => {
+        res.rows.map(item => {
           if (item.streamingType === 1) {
             arrays.push(item);
           }
@@ -956,7 +951,7 @@ export default {
         this.courType = "";
       }
       var arrays = [];
-      this.courTypeOptions.map((item) => {
+      this.courTypeOptions.map(item => {
         if (item.educationId === this.eduType) {
           arrays.push(item);
         }
@@ -977,7 +972,7 @@ export default {
         }
       });
       var arrays = [];
-      this.courTypeOptions.map((item) => {
+      this.courTypeOptions.map(item => {
         if (item.educationId === this.eduType) {
           arrays.push(item);
         }
@@ -986,7 +981,7 @@ export default {
       this.$refs.popovers.doClose();
     },
     submit(formName) {
-      this.$refs[formName].validate((valid) => {
+      this.$refs[formName].validate(valid => {
         if (valid) {
           if (!this.newSujectApis.length) {
             this.$message.error("请选择适用业务层级");
@@ -1011,11 +1006,12 @@ export default {
       var dataInfos = {
         status: 1,
         businessList: this.newSujectApis,
+        viewSign: this.listData.viewSign,
         coverUrl: this.listData.coverUrl,
         name: this.listData.name,
         prefixName: this.listData.prefixName,
         publishStatus: this.listData.publishStatus,
-        teacherId: this.listData.teacherId,
+        teacherId: this.listData.teacherId
       };
 
       if (this.listData.sectionType === 2) {
@@ -1057,17 +1053,15 @@ export default {
       }
       this.$api
         .appCourseSection(dataInfos)
-        .then((res) => {
+        .then(res => {
           this.$methodsTools.cacheBusinessList(this.newSujectApis);
           this.$message.success("新增成功");
           setTimeout(() => {
-            this.$store
-              .dispatch("tagsView/exitView", this.$route)
-              .then((res) => {
-                this.$router.push({
-                  path: "festival",
-                });
+            this.$store.dispatch("tagsView/exitView", this.$route).then(res => {
+              this.$router.push({
+                path: "festival"
               });
+            });
           }, 500);
         })
         .catch(() => {
@@ -1075,9 +1069,9 @@ export default {
         });
     },
     backPage() {
-      this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
+      this.$store.dispatch("tagsView/delView", this.$route).then(res => {
         this.$router.push({
-          path: "festival",
+          path: "festival"
         });
       });
     },
@@ -1088,7 +1082,7 @@ export default {
       });
     },
     changeLiveUrl() {
-      this.newLiveUrl.map((item) => {
+      this.newLiveUrl.map(item => {
         if (item.id === this.newActiveLiveUrl) {
           this.listData.liveUrl = item.liveUrl;
         }
@@ -1096,7 +1090,7 @@ export default {
       this.newActiveLiveUrl = "";
     },
     changeRecordingUrl1() {
-      this.newSteamUrl1.map((item) => {
+      this.newSteamUrl1.map(item => {
         if (item.id === this.newActiveRecordingUrl1) {
           this.listData.recordingUrl = item.recordingVideoId;
           this.getApiTime(item.recordingVideoId);
@@ -1105,7 +1099,7 @@ export default {
       this.newActiveRecordingUrl1 = "";
     },
     changeRecordingUrl2() {
-      this.newSteamUrl2.map((item) => {
+      this.newSteamUrl2.map(item => {
         if (item.id === this.newActiveRecordingUrl2) {
           this.listData.recordingUrl = item.playbackUrl;
           this.getApiTime(item.recordingVideoId);
@@ -1124,7 +1118,10 @@ export default {
         self.$message.error("图片不得大于300kb");
         return;
       }
-      var type = self.$refs.file.value.toLowerCase().split(".").splice(-1);
+      var type = self.$refs.file.value
+        .toLowerCase()
+        .split(".")
+        .splice(-1);
       if (
         type[0] != "jpg" &&
         type[0] != "png" &&
@@ -1135,15 +1132,15 @@ export default {
         self.$refs.file.value = "";
         return;
       }
-      this.$upload.upload(file, 0).then((res) => {
+      this.$upload.upload(file, 0).then(res => {
         self.listData.coverUrl = res;
         self.$refs.listData.validateField("coverUrl");
       });
-    },
+    }
   },
   destroyed() {
     this.closePlayer();
-  },
+  }
 };
 </script>
 

+ 227 - 222
src/views/resource/videoManagement/festival/edit/index.vue

@@ -9,31 +9,21 @@
         ref="listData"
       >
         <el-form-item label="适用业务层级" required>
-          <el-select
-            v-model="eduType"
-            placeholder="请选择教育类型"
-            @change="changeEduType"
-          >
+          <el-select v-model="eduType" placeholder="请选择教育类型" @change="changeEduType">
             <el-option
               v-for="(item, index) in eduTypeOptions"
               :key="index"
               :label="item.educationName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
-          <el-select
-            v-model="courType"
-            placeholder="请选择业务层次"
-            @change="changecourseType"
-          >
+          <el-select v-model="courType" placeholder="请选择业务层次" @change="changecourseType">
             <el-option
               v-for="(item, index) in newCourTypeOptions"
               :key="index"
               :label="item.projectName + '-' + item.businessName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <el-popover
             ref="popovers"
@@ -47,8 +37,7 @@
               v-model="checkAll"
               @change="handleCheckAllChange"
               :indeterminate="isIndeterminate"
-              >全选</el-checkbox
-            >
+            >全选</el-checkbox>
             <el-checkbox-group
               v-model="sujectArray"
               class="checkboxSty"
@@ -58,53 +47,39 @@
                 v-for="(item, index) in newSujectOption"
                 :label="item.newId"
                 :key="index"
-                >{{ item.subjectName }}</el-checkbox
-              >
+              >{{ item.subjectName }}</el-checkbox>
             </el-checkbox-group>
             <div style="display: block; text-align: center; margin-top: 10px">
-              <el-button size="mini" type="primary" @click="submitSujectArray"
-                >确定</el-button
-              >
+              <el-button size="mini" type="primary" @click="submitSujectArray">确定</el-button>
             </div>
-            <el-button
-              slot="reference"
-              style="margin-left: 12px"
-              @click="getMessage"
-              >请选择科目</el-button
-            >
+            <el-button slot="reference" style="margin-left: 12px" @click="getMessage">请选择科目</el-button>
           </el-popover>
           <span style="margin-left: 10px">注:可多选</span>
         </el-form-item>
-        <el-form-item label="">
+        <el-form-item label>
           <div :class="changeHeight ? 'ach' : 'clh'">
-            <div
-              v-for="(item, index) in newSujectApis"
-              :key="index"
-              class="listBoxStys"
-            >
+            <div v-for="(item, index) in newSujectApis" :key="index" class="listBoxStys">
               {{
-                item.educationName +
-                " - " +
-                item.projectName +
-                " - " +
-                item.businessName +
-                " - " +
-                item.subjectName
+              item.educationName +
+              " - " +
+              item.projectName +
+              " - " +
+              item.businessName +
+              " - " +
+              item.subjectName
               }}
-              <i class="el-icon-error closeIcons" @click="closeType(index)"></i>
+              <i
+                class="el-icon-error closeIcons"
+                @click="closeType(index)"
+              ></i>
             </div>
           </div>
           <el-button
             size="mini"
             v-if="newSujectApis.length > 1"
             @click="changeType"
-            >{{ changeHeight ? "展开" : "关闭" }}</el-button
-          ><el-button
-            size="mini"
-            v-if="newSujectApis.length > 0"
-            @click="sujectApis = []"
-            >清空</el-button
-          >
+          >{{ changeHeight ? "展开" : "关闭" }}</el-button>
+          <el-button size="mini" v-if="newSujectApis.length > 0" @click="sujectApis = []">清空</el-button>
           <!-- <span v-if="newSujectApis.length === 0">未选项目类型</span> -->
         </el-form-item>
         <el-form-item label="标题前缀">
@@ -113,9 +88,7 @@
         </el-form-item>
         <el-form-item label="节标题" prop="name">
           <el-input v-model="listData.name"></el-input>
-          <div style="color: #999">
-            注:请尽量规范易懂,方便在课程目录表呈现给学员
-          </div>
+          <div style="color: #999">注:请尽量规范易懂,方便在课程目录表呈现给学员</div>
         </el-form-item>
         <el-form-item label="节类型">
           <el-select
@@ -131,67 +104,46 @@
               :disabled="item.value == 1"
               :label="item.label"
               :value="item.value"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item
-          label="频道号"
-          v-if="listData.sectionType === 2"
-          prop="liveUrl"
-        >
-          <el-input
-            style="width: 300px"
-            v-model="listData.liveUrl"
-            placeholder="请输入频道号"
-          ></el-input>
-          <el-select
-            v-model="newActiveLiveUrl"
-            placeholder="快捷选中频道号"
-            @change="changeLiveUrl"
-          >
+
+        <el-form-item label="视频类型" prop="viewSign">
+          <el-radio-group v-model="listData.viewSign">
+            <el-radio :label="1">保利威</el-radio>
+            <el-radio :label="2">腾讯</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item label="频道号" v-if="listData.sectionType === 2" prop="liveUrl">
+          <el-input style="width: 300px" v-model="listData.liveUrl" placeholder="请输入频道号"></el-input>
+          <el-select v-model="newActiveLiveUrl" placeholder="快捷选中频道号" @change="changeLiveUrl">
             <el-option
               v-for="(item, index) in newLiveUrl"
               :key="index"
               :label="item.streamingName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <div v-if="listData.liveUrl" style="margin-top: 10px">
-            <el-button
-              size="small"
-              type="warning"
-              @click="watchZbVideo(listData.liveUrl)"
-              >直播预览</el-button
-            >
+            <el-button size="small" type="warning" @click="watchZbVideo(listData.liveUrl)">直播预览</el-button>
           </div>
         </el-form-item>
-        <el-form-item
-          label="直播开始时间"
-          prop="liveStartTime"
-          v-if="listData.sectionType === 2"
-        >
+        <el-form-item label="直播开始时间" prop="liveStartTime" v-if="listData.sectionType === 2">
           <el-date-picker
             v-model="listData.liveStartTime"
             type="datetime"
             placeholder="请选择直播开始时间"
             value-format="timestamp"
-          >
-          </el-date-picker>
+          ></el-date-picker>
         </el-form-item>
-        <el-form-item
-          label="直播结束时间"
-          prop="liveEndTime"
-          v-if="listData.sectionType === 2"
-        >
+        <el-form-item label="直播结束时间" prop="liveEndTime" v-if="listData.sectionType === 2">
           <el-date-picker
             v-model="listData.liveEndTime"
             type="datetime"
             placeholder="请选择直播结束时间"
             value-format="timestamp"
-          >
-          </el-date-picker>
+          ></el-date-picker>
         </el-form-item>
         <el-form-item
           label="直播时长"
@@ -200,9 +152,7 @@
             listData.liveStartTime &&
             listData.liveEndTime
           "
-        >
-          {{ compTimeOUT(listData.liveStartTime, listData.liveEndTime) }}
-        </el-form-item>
+        >{{ compTimeOUT(listData.liveStartTime, listData.liveEndTime) }}</el-form-item>
         <el-form-item
           label="URL地址"
           v-if="listData.sectionType === 1 || listData.sectionType === 3"
@@ -218,13 +168,8 @@
             for="mobles"
             class="el-button el-button--primary"
             style="margin: 0px 6px; padding: 10px 20px"
-            >上传</label
-          ><input
-            style="display: none"
-            type="file"
-            id="mobles"
-            @change="importMoble"
-          />
+          >上传</label>
+          <input style="display: none" type="file" id="mobles" @change="importMoble" />
           <el-select
             v-if="listData.sectionType === 1"
             v-model="newActiveRecordingUrl1"
@@ -237,8 +182,7 @@
               :key="index"
               :label="item.streamingName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <el-select
             v-if="listData.sectionType === 3"
@@ -252,16 +196,10 @@
               :key="index"
               :label="item.streamingName"
               :value="item.id"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
           <div v-if="listData.recordingUrl" style="margin-top: 10px">
-            <el-button
-              size="small"
-              type="warning"
-              @click="watchVideo(listData.recordingUrl)"
-              >视频预览</el-button
-            >
+            <el-button size="small" type="warning" @click="watchVideo(listData.recordingUrl)">视频预览</el-button>
           </div>
         </el-form-item>
         <el-form-item
@@ -275,25 +213,16 @@
             range-separator=":"
             v-model="listData.durationTime"
             placeholder="请填入节时长"
-          >
-          </el-time-picker>
+          ></el-time-picker>
         </el-form-item>
-        <el-form-item
-          label="讲师"
-          :prop="listData.sectionType === 2 ? 'teacherId' : ''"
-        >
-          <el-select
-            v-model="listData.teacherId"
-            placeholder="请选择讲师"
-            filterable
-          >
+        <el-form-item label="讲师" :prop="listData.sectionType === 2 ? 'teacherId' : ''">
+          <el-select v-model="listData.teacherId" placeholder="请选择讲师" filterable>
             <el-option
               v-for="(item, index) in teacherList"
               :key="index"
               :label="item.teacherName"
               :value="item.teacherId"
-            >
-            </el-option>
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="节封面" prop="coverUrl">
@@ -311,8 +240,8 @@
                 v-if="!listData.coverUrl"
               >
                 <label for="uplose">
-                  <i class="el-icon-circle-plus-outline iconStsz"></i
-                ></label>
+                  <i class="el-icon-circle-plus-outline iconStsz"></i>
+                </label>
                 <input
                   ref="file"
                   type="file"
@@ -328,13 +257,12 @@
                 :preview-src-list="[
                   $methodsTools.splitImgHost(listData.coverUrl),
                 ]"
-              >
-              </el-image>
+              ></el-image>
             </el-col>
             <el-col :span="11">
-              <span style="color: #999; font-size: 14px"
-                >注:请上传小于300kb,尺寸为750*440的图片,支持gif、jpg、jpeg、png等类型</span
-              >
+              <span
+                style="color: #999; font-size: 14px"
+              >注:请上传小于300kb,尺寸为750*440的图片,支持gif、jpg、jpeg、png等类型</span>
             </el-col>
           </el-row>
           <el-button
@@ -343,8 +271,7 @@
             size="mini"
             class="margin-top: 20px;"
             @click="clearImgs"
-            >删除</el-button
-          >
+          >删除</el-button>
         </el-form-item>
         <el-form-item label="是否发布" prop="publishStatus">
           <el-radio-group v-model="listData.publishStatus">
@@ -359,8 +286,7 @@
             @click="submit('listData')"
             :disabled="listData.sectionType === 1 ? !noStudent : false"
             :loading="disabledBtn"
-            >确定</el-button
-          >
+          >确定</el-button>
         </el-form-item>
       </el-form>
     </div>
@@ -375,11 +301,11 @@
       <div slot="title" class="hearders">
         <div class="leftTitle">视频预览</div>
         <div class="rightBoxs">
-          <img src="@/assets/images/Close@2x.png" alt="" @click="clears" />
+          <img src="@/assets/images/Close@2x.png" alt @click="clears" />
         </div>
       </div>
       <div>
-        <div id="player"></div>
+        <div id="player" v-show="listData.viewSign == 1"></div>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="clears">取 消</el-button>
@@ -395,7 +321,7 @@
       <div slot="title" class="hearders">
         <div class="leftTitle">直播预览</div>
         <div class="rightBoxs">
-          <img src="@/assets/images/Close@2x.png" alt="" @click="clearszb" />
+          <img src="@/assets/images/Close@2x.png" alt @click="clearszb" />
         </div>
       </div>
       <div>
@@ -419,6 +345,8 @@ export default {
       isIndeterminate: false,
       checkAll: false,
       vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJsForTCPlayer:
+        "https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js",
       vid: "",
       playerJs:
         "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
@@ -431,21 +359,21 @@ export default {
         cataid: "1639399775001", // 分类ID 可以后端传递 也可以不写 或写死
         tag: "i am tag", // 标签
         luping: 0, // 是否开启视频课件优化处理,对于上传录屏类视频清晰度有所优化:0为不开启,1为开启
-        keepsource: 1, // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
+        keepsource: 1 // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
       },
       sectionTypeOptions: [
         {
           label: "录播",
-          value: 1,
+          value: 1
         },
         {
           label: "直播",
-          value: 2,
+          value: 2
         },
         {
           label: "回放",
-          value: 3,
-        },
+          value: 3
+        }
       ],
       //   弹窗数据
       changeHeight: true,
@@ -453,7 +381,7 @@ export default {
       listData: {
         recordingUrl: "",
         liveUrl: "",
-        coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697",
+        coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697"
       },
       newActiveLiveUrl: "",
       newLiveUrl: [], //直播地址
@@ -479,47 +407,48 @@ export default {
       //表单验证
       rules: {
         prefixName: [
-          { required: true, message: "请输入标题前缀", trigger: "blur" },
+          { required: true, message: "请输入标题前缀", trigger: "blur" }
         ],
         name: [{ required: true, message: "请输入节标题", trigger: "blur" }],
         // liveDuration: [
         //   { required: true, message: "节时长不能为空" },
         //   { type: "number", message: "节时长必须为数字值" },
         // ],
+        viewSign: [
+          { required: true, message: "请选择视频类型", trigger: "change" }
+        ],
         recordingUrl: [
           {
             required: true,
             message: "请输入URL地址",
-            trigger: ["blur", "change"],
-          },
+            trigger: ["blur", "change"]
+          }
         ],
         durationTime: [
-          { required: false, message: "请选择节时长", trigger: "change" },
+          { required: false, message: "请选择节时长", trigger: "change" }
         ],
         liveUrl: [
           {
             required: true,
             message: "请输入频道号",
-            trigger: ["blur", "change"],
-          },
+            trigger: ["blur", "change"]
+          }
         ],
         liveStartTime: [
-          { required: true, message: "请选择直播开始时间", trigger: "change" },
+          { required: true, message: "请选择直播开始时间", trigger: "change" }
         ],
         liveEndTime: [
-          { required: true, message: "请选择直播结束时间", trigger: "change" },
+          { required: true, message: "请选择直播结束时间", trigger: "change" }
         ],
         teacherId: [
-          { required: true, message: "请选择讲师", trigger: "change" },
+          { required: true, message: "请选择讲师", trigger: "change" }
         ],
         publishStatus: [
-          { required: true, message: "请选择是否发布", trigger: "change" },
-        ],
-        coverUrl: [
-          { required: true, message: "请上传封面", trigger: "change" },
+          { required: true, message: "请选择是否发布", trigger: "change" }
         ],
+        coverUrl: [{ required: true, message: "请上传封面", trigger: "change" }]
       },
-      pageId: this.$route.query.id,
+      pageId: this.$route.query.id
     };
   },
   watch: {
@@ -527,12 +456,12 @@ export default {
       immediate: true,
       handler(newName, oldName) {
         this.changeTypes();
-      },
-    },
+      }
+    }
   },
   mounted() {
     this.$modal.loading("正在导入数据,请稍后...");
-    this.$api.gradecheckGoodsChange({ sectionId: this.pageId }).then((res) => {
+    this.$api.gradecheckGoodsChange({ sectionId: this.pageId }).then(res => {
       if (res.data > 0) {
         // this.noStudent = false;
       }
@@ -544,7 +473,7 @@ export default {
      * 复选框点击触发
      */
     handleCheckedCitiesChange() {
-      let nid = this.newSujectOption.map((item) => {
+      let nid = this.newSujectOption.map(item => {
         return item.newId;
       });
       this.checkAll = this.sujectArray.length === nid.length;
@@ -567,18 +496,18 @@ export default {
      */
     handleCheckAllChange(val) {
       if (val) {
-        let nid = this.newSujectOption.map((item) => {
+        let nid = this.newSujectOption.map(item => {
           return item.newId;
         });
         let arrays = this.sujectArray.concat(nid);
         this.sujectArray = this.setFunc(arrays);
         this.isIndeterminate = false;
       } else {
-        let nid = this.newSujectOption.map((item) => {
+        let nid = this.newSujectOption.map(item => {
           return item.newId;
         });
         let newArr = [];
-        this.sujectArray.forEach((item) => {
+        this.sujectArray.forEach(item => {
           if (!nid.includes(item)) {
             newArr.push(item);
           }
@@ -618,27 +547,53 @@ export default {
       }
     },
     getApiTime(val) {
+      console.log("获取时长");
       var self = this;
       this.clearTimes(val);
       const valueUrl = val.replace(/\s/g, "");
-      if (valueUrl && valueUrl.length > 30) {
+      if (this.listData.viewSign == 2) {
         this.disabledBtn = true;
         this.$api
-          .inquirepolyvvideo(valueUrl)
-          .then((res) => {
+          .inquirevodvideodetail(valueUrl)
+          .then(res => {
+            console.log("请求腾讯时长", res.data.duration);
             if (res.data.duration) {
-              self.listData.durationTime = res.data.duration;
+              self.listData.durationTime = this.$methodsTools.secondToDate(
+                res.data.duration,
+                false
+              );
+              console.log("转换后的腾讯时间", self.listData.durationTime);
               self.disabloutime = true;
             } else {
               self.disabloutime = false;
             }
           })
-          .catch((err) => {
+          .catch(err => {
             self.disabloutime = false;
           })
           .finally(() => {
             this.disabledBtn = false;
           });
+      } else {
+        if (valueUrl && valueUrl.length > 30) {
+          this.disabledBtn = true;
+          this.$api
+            .inquirepolyvvideo(valueUrl)
+            .then(res => {
+              if (res.data.duration) {
+                self.listData.durationTime = res.data.duration;
+                self.disabloutime = true;
+              } else {
+                self.disabloutime = false;
+              }
+            })
+            .catch(err => {
+              self.disabloutime = false;
+            })
+            .finally(() => {
+              this.disabledBtn = false;
+            });
+        }
       }
     },
     loadPlayerScript(callback) {
@@ -654,6 +609,19 @@ export default {
         });
       }
     },
+    loadPlayerScript_tencent(callback) {
+      if (!window.TCPlayer) {
+        const myScript = document.createElement("script");
+        myScript.setAttribute("src", this.vodPlayerJsForTCPlayer);
+        myScript.onload = callback;
+        document.body.appendChild(myScript);
+      } else {
+        callback();
+        this.player_tencent.on("error", (...params) => {
+          this.$message.error(returnTitle(params[1]));
+        });
+      }
+    },
     loadPlayer() {
       var self = this;
       const polyvPlayer = window.polyvPlayer;
@@ -663,11 +631,36 @@ export default {
         height: 533,
         vid: self.vid,
         teaser_show: 0,
-        playsafe: function (vid, next) {
-          self.$api.obtainpolyvvideosign(vid).then((res) => {
+        playsafe: function(vid, next) {
+          self.$api.obtainpolyvvideosign(vid).then(res => {
             next(res.data);
           });
-        },
+        }
+      });
+    },
+    loadPlayer_tencent() {
+      var self = this;
+      const TCPlayer = window.TCPlayer;
+      try {
+        let video = document.querySelector("video");
+        video.parentNode.removeChild(video);
+      } catch (error) {
+        console.log("清除video标签异常");
+      }
+      let player_tencent = document.createElement("video");
+      player_tencent.id = "player-tencent";
+      document
+        .getElementById("player")
+        .insertAdjacentElement("afterend", player_tencent);
+      self.$api.obtaintcvideosign(self.vid).then(res => {
+        self.player_tencent = TCPlayer("player-tencent", {
+          width: 800,
+          height: 533,
+          fileID: self.vid,
+          appID: res.data.appID,
+          psign: res.data.psign,
+          licenseUrl: res.data.licenseUrl
+        });
       });
     },
     /**
@@ -678,6 +671,9 @@ export default {
       if (this.player) {
         this.player.destroy();
       }
+      if (this.player_tencent) {
+        this.player_tencent.dispose();
+      }
     },
     /**
      * @param {String} 视频查看
@@ -691,12 +687,19 @@ export default {
       this.diavos = true;
     },
     isOkBf() {
-      this.loadPlayerScript(this.loadPlayer);
+      if (this.listData.viewSign == 2) {
+        this.loadPlayerScript_tencent(this.loadPlayer_tencent);
+      } else {
+        this.loadPlayerScript(this.loadPlayer);
+      }
     },
     closePlayer() {
       if (this.player) {
         this.player.destroy();
       }
+      if (this.player_tencent) {
+        this.player_tencent.dispose();
+      }
     },
     /**
      * @param {String} 直播预览
@@ -727,7 +730,7 @@ export default {
         width: 800,
         height: 533,
         uid: this.uidzb,
-        vid: this.vidzb,
+        vid: this.vidzb
       });
     },
     clearszb() {
@@ -751,7 +754,7 @@ export default {
        * @param: this.fileSetting -> 常规配置 上面有备注
        * @param: 回调
        */
-      uploadFile(file, this.fileSetting, (event) => {
+      uploadFile(file, this.fileSetting, event => {
         this.listData.recordingUrl = event.vid;
         this.listData.durationTime = "";
         this.getApiTime(event.vid);
@@ -765,7 +768,7 @@ export default {
     search() {
       this.$api
         .obtainCourseSection(this.pageId)
-        .then((res) => {
+        .then(res => {
           this.bfImg = res.data.coverUrl;
           if (res.data.sectionType === 2) {
             res.data.liveStartTime = this.$methodsTools.time10to13(
@@ -786,9 +789,9 @@ export default {
           }
           this.typeSection = res.data.sectionType;
           this.listData = JSON.parse(JSON.stringify(res.data));
-          this.$api.obtaincourseSectionbusiness(this.pageId).then((result) => {
+          this.$api.obtaincourseSectionbusiness(this.pageId).then(result => {
             var arrays = [];
-            result.data.map((item) => {
+            result.data.map(item => {
               arrays.push(item.businessId + "-" + item.subjectId);
             });
             this.sujectApis = arrays;
@@ -806,7 +809,7 @@ export default {
       var self = this;
       var arrays = [];
       this.sujectApis.map((item, index) => {
-        this.courTypeOptions.map((items) => {
+        this.courTypeOptions.map(items => {
           if (items.id === item.split("-").map(Number)[0]) {
             var obj = {
               educationTypeId: items.educationId,
@@ -814,9 +817,9 @@ export default {
               projectId: items.projectId,
               projectName: items.projectName,
               businessId: items.id,
-              businessName: items.businessName,
+              businessName: items.businessName
             };
-            self.sujectOption.map((i) => {
+            self.sujectOption.map(i => {
               if (
                 i.id === item.split("-").map(Number)[1] &&
                 i.courseArrays.indexOf(items.projectId) !== -1
@@ -848,7 +851,7 @@ export default {
       });
     },
     changeUrl() {
-      var arr = this.newSujectApis.map((val) => val.businessId);
+      var arr = this.newSujectApis.map(val => val.businessId);
       const unique = [...new Set(arr)];
       var busId = "";
       if (unique.length) {
@@ -856,11 +859,11 @@ export default {
       } else {
         busId = "";
       }
-      this.$api.inquireCourseStreaming({ status: 1 }).then((res) => {
+      this.$api.inquireCourseStreaming({ status: 1 }).then(res => {
         var arraystt = [];
         var newarrays1tt = [];
         var newarrays2tt = [];
-        res.rows.map((item) => {
+        res.rows.map(item => {
           if (item.streamingType === 1) {
             arraystt.push(item);
           }
@@ -873,11 +876,11 @@ export default {
         });
         this.$api
           .inquireCourseStreaming({ status: 1, businessId: busId })
-          .then((result) => {
+          .then(result => {
             var arrays = [];
             var newarrays1 = [];
             var newarrays2 = [];
-            result.rows.map((item) => {
+            result.rows.map(item => {
               if (item.streamingType === 1) {
                 arrays.push(item);
               }
@@ -922,7 +925,7 @@ export default {
         this.$refs.popovers.doClose();
         return;
       }
-      this.newSujectOption.map((item) => {
+      this.newSujectOption.map(item => {
         item.newId = this.courType + "-" + item.id;
       });
       this.handleCheckedCitiesChange();
@@ -939,7 +942,7 @@ export default {
     },
     tearchApi() {
       return new Promise((resolve, reject) => {
-        this.$api.inquiresystemteacherlist({ status: 1 }).then((res) => {
+        this.$api.inquiresystemteacherlist({ status: 1 }).then(res => {
           this.teacherList = res.rows;
           resolve();
         });
@@ -947,7 +950,7 @@ export default {
     },
     eduTys() {
       return new Promise((resolve, reject) => {
-        this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
+        this.$api.inquireCourseEducationType({ status: 1 }).then(res => {
           this.eduTypeOptions = res.rows;
           resolve();
         });
@@ -955,7 +958,7 @@ export default {
     },
     courseTys() {
       return new Promise((resolve, reject) => {
-        this.$api.inquireCourseProjectType({ status: 1 }).then((res) => {
+        this.$api.inquireCourseProjectType({ status: 1 }).then(res => {
           this.projectTypeOptions = res.rows;
           resolve();
         });
@@ -963,7 +966,7 @@ export default {
     },
     businTys() {
       return new Promise((resolve, reject) => {
-        this.$api.inquirebusinessList({ status: 1 }).then((res) => {
+        this.$api.inquirebusinessList({ status: 1 }).then(res => {
           this.courTypeOptions = res.rows;
           this.newCourTypeOptions = res.rows;
           resolve();
@@ -972,7 +975,7 @@ export default {
     },
     courseSubject() {
       return new Promise((resolve, reject) => {
-        this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
+        this.$api.inquireCourseSubject({ status: 1 }).then(res => {
           res.rows.map((item, index) => {
             var array = [];
             item.courseProjectTypes.map((items, indexs) => {
@@ -987,11 +990,11 @@ export default {
     },
     Streaming() {
       return new Promise((resolve, reject) => {
-        this.$api.inquireCourseStreaming({ status: 1 }).then((res) => {
+        this.$api.inquireCourseStreaming({ status: 1 }).then(res => {
           var arrays = [];
           var newarrays1 = [];
           var newarrays2 = [];
-          res.rows.map((item) => {
+          res.rows.map(item => {
             if (item.streamingType === 1) {
               arrays.push(item);
             }
@@ -1014,7 +1017,7 @@ export default {
         this.courType = "";
       }
       var arrays = [];
-      this.courTypeOptions.map((item) => {
+      this.courTypeOptions.map(item => {
         if (item.educationId === this.eduType) {
           arrays.push(item);
         }
@@ -1035,7 +1038,7 @@ export default {
         }
       });
       var arrays = [];
-      this.courTypeOptions.map((item) => {
+      this.courTypeOptions.map(item => {
         if (item.educationId === this.eduType) {
           arrays.push(item);
         }
@@ -1044,7 +1047,7 @@ export default {
       this.$refs.popovers.doClose();
     },
     submit(formName) {
-      this.$refs[formName].validate((valid) => {
+      this.$refs[formName].validate(valid => {
         if (valid) {
           if (!this.newSujectApis.length) {
             this.$message.error("请选择适用业务层级");
@@ -1070,11 +1073,12 @@ export default {
         status: 1,
         sectionId: this.pageId,
         businessList: this.newSujectApis,
+        viewSign: this.listData.viewSign,
         coverUrl: this.listData.coverUrl,
         name: this.listData.name,
         prefixName: this.listData.prefixName,
         publishStatus: this.listData.publishStatus,
-        teacherId: this.listData.teacherId,
+        teacherId: this.listData.teacherId
       };
 
       if (this.listData.sectionType === 2) {
@@ -1116,22 +1120,20 @@ export default {
       }
       this.$api
         .editCourseSection(dataInfos)
-        .then((res) => {
+        .then(res => {
           this.$message.success("修改成功");
           setTimeout(() => {
-            this.$store
-              .dispatch("tagsView/exitView", this.$route)
-              .then((res) => {
-                if (this.$store.getters.festivalPage) {
-                  this.$router.push({
-                    path: this.$store.getters.festivalPage.name,
-                  });
-                } else {
-                  this.$router.push({
-                    path: "festival",
-                  });
-                }
-              });
+            this.$store.dispatch("tagsView/exitView", this.$route).then(res => {
+              if (this.$store.getters.festivalPage) {
+                this.$router.push({
+                  path: this.$store.getters.festivalPage.name
+                });
+              } else {
+                this.$router.push({
+                  path: "festival"
+                });
+              }
+            });
           }, 500);
         })
         .catch(() => {
@@ -1139,14 +1141,14 @@ export default {
         });
     },
     backPage() {
-      this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
+      this.$store.dispatch("tagsView/delView", this.$route).then(res => {
         if (this.$store.getters.festivalPage) {
           this.$router.push({
-            path: this.$store.getters.festivalPage.name,
+            path: this.$store.getters.festivalPage.name
           });
         } else {
           this.$router.push({
-            path: "festival",
+            path: "festival"
           });
         }
       });
@@ -1158,7 +1160,7 @@ export default {
       });
     },
     changeLiveUrl() {
-      this.newLiveUrl.map((item) => {
+      this.newLiveUrl.map(item => {
         if (item.id === this.newActiveLiveUrl) {
           this.listData.liveUrl = item.liveUrl;
         }
@@ -1166,7 +1168,7 @@ export default {
       this.newActiveLiveUrl = "";
     },
     changeRecordingUrl1() {
-      this.newSteamUrl1.map((item) => {
+      this.newSteamUrl1.map(item => {
         if (item.id === this.newActiveRecordingUrl1) {
           this.listData.recordingUrl = item.recordingVideoId;
           this.getApiTime(item.recordingVideoId);
@@ -1175,7 +1177,7 @@ export default {
       this.newActiveRecordingUrl1 = "";
     },
     changeRecordingUrl2() {
-      this.newSteamUrl2.map((item) => {
+      this.newSteamUrl2.map(item => {
         if (item.id === this.newActiveRecordingUrl2) {
           this.listData.recordingUrl = item.playbackUrl;
           this.getApiTime(item.recordingVideoId);
@@ -1194,7 +1196,10 @@ export default {
         self.$message.error("图片不得大于300kb");
         return;
       }
-      var type = self.$refs.file.value.toLowerCase().split(".").splice(-1);
+      var type = self.$refs.file.value
+        .toLowerCase()
+        .split(".")
+        .splice(-1);
       if (
         type[0] != "jpg" &&
         type[0] != "png" &&
@@ -1205,15 +1210,15 @@ export default {
         self.$refs.file.value = "";
         return;
       }
-      this.$upload.upload(file, 0).then((res) => {
+      this.$upload.upload(file, 0).then(res => {
         self.listData.coverUrl = res;
         self.$refs.listData.validateField("coverUrl");
       });
-    },
+    }
   },
   destroyed() {
     this.closePlayer();
-  },
+  }
 };
 </script>
 

+ 48 - 2
src/views/secondBuild/courseList/index.vue

@@ -41,7 +41,7 @@
           <span v-if="!activeId" style="font-size: 30px"
             >请打开目录详情,点击播放您需要观看的视频内容。</span
           >
-          <div v-show="vid" id="player"></div>
+          <div v-show="vid && viewSign == 1" id="player"></div>
           <div v-show="vidzb" id="playerzb"></div>
         </div>
         <div class="rightBoxslist">
@@ -236,7 +236,10 @@ export default {
       dialogVisible: false,
       courseList: [], //详情列表
       activeId: "", //当前选中ID
+      viewSign: 1,
       vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJsForTCPlayer:
+        "https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js",
       vid: "",
       playerJs:
         "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
@@ -335,6 +338,7 @@ export default {
      */
     msgInfo(option) {
       this.goodsBoxName = option.goodsName;
+      this.viewSign = option.viewSign
       this.$api.obtainCourseSgoodsId(option.goodsId).then(async (res) => {
         // if (res.rows.length) {
         if (!res.rows.length) {
@@ -618,7 +622,11 @@ export default {
         this.loadPlayerScriptzb(this.loadPlayerzb);
       } else {
         this.vid = option.recordingUrl;
-        this.loadPlayerScript(this.loadPlayer);
+        if(this.viewSign == 2) {
+          this.loadPlayerScript_tencent(this.loadPlayer_tencent);
+        }else {
+          this.loadPlayerScript(this.loadPlayer);
+        }
       }
     },
     loadPlayerScript(callback) {
@@ -631,6 +639,16 @@ export default {
         callback();
       }
     },
+    loadPlayerScript_tencent(callback) {
+      if (!window.TCPlayer) {
+        const myScript = document.createElement("script");
+        myScript.setAttribute("src", this.vodPlayerJsForTCPlayer);
+        myScript.onload = callback;
+        document.body.appendChild(myScript);
+      } else {
+        callback();
+      }
+    },
     loadPlayer() {
       var self = this;
       const polyvPlayer = window.polyvPlayer;
@@ -647,6 +665,31 @@ export default {
         },
       });
     },
+    loadPlayer_tencent() {
+      var self = this;
+      const TCPlayer = window.TCPlayer;
+      try {
+        let video = document.querySelector("video");
+        video.parentNode.removeChild(video);
+      } catch (error) {
+        console.log("清除video标签异常");
+      }
+      let player_tencent = document.createElement("video");
+      player_tencent.id = "player-tencent";
+      document
+        .getElementById("player")
+        .insertAdjacentElement("afterend", player_tencent);
+      self.$api.obtaintcvideosign(self.vid).then(res => {
+        self.player_tencent = TCPlayer("player-tencent", {
+          width: 932,
+        height: 627,
+          fileID: self.vid,
+          appID: res.data.appID,
+          psign: res.data.psign,
+          licenseUrl: res.data.licenseUrl
+        });
+      });
+    },
     /**
      * @param {String} 关闭视频窗口-销毁实例
      */
@@ -658,6 +701,9 @@ export default {
         if (this.player) {
           this.player.destroy();
         }
+        if (this.player_tencent) {
+          this.player.dispose();
+        }
         if (this.playerzb) {
           this.playerzb.destroy();
         }

+ 48 - 2
src/views/secondJian/courseList/index.vue

@@ -41,7 +41,7 @@
           <span v-if="!activeId" style="font-size: 30px"
             >请打开目录详情,点击播放您需要观看的视频内容。</span
           >
-          <div v-show="vid" id="player"></div>
+          <div v-show="vid && viewSign == 1" id="player"></div>
           <div v-show="vidzb" id="playerzb"></div>
         </div>
         <div class="rightBoxslist">
@@ -238,7 +238,10 @@ export default {
       dialogVisible: false,
       courseList: [], //详情列表
       activeId: "", //当前选中ID
+      viewSign: 1,
       vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJsForTCPlayer:
+        "https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js",
       vid: "",
       playerJs:
         "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
@@ -320,6 +323,7 @@ export default {
      */
     msgInfo(option) {
       this.goodsBoxName = option.goodsName;
+      this.viewSign = option.viewSign;
       this.$api.obtainCourseSgoodsId(option.goodsId).then(async (res) => {
         // if (res.rows.length) {
         if (!res.rows.length) {
@@ -603,7 +607,11 @@ export default {
         this.loadPlayerScriptzb(this.loadPlayerzb);
       } else {
         this.vid = option.recordingUrl;
-        this.loadPlayerScript(this.loadPlayer);
+        if(this.viewSign == 2) {
+          this.loadPlayerScript_tencent(this.loadPlayer_tencent);
+        }else {
+          this.loadPlayerScript(this.loadPlayer);
+        }
       }
     },
     loadPlayerScript(callback) {
@@ -616,6 +624,16 @@ export default {
         callback();
       }
     },
+    loadPlayerScript_tencent(callback) {
+      if (!window.TCPlayer) {
+        const myScript = document.createElement("script");
+        myScript.setAttribute("src", this.vodPlayerJsForTCPlayer);
+        myScript.onload = callback;
+        document.body.appendChild(myScript);
+      } else {
+        callback();
+      }
+    },
     loadPlayer() {
       var self = this;
       const polyvPlayer = window.polyvPlayer;
@@ -632,6 +650,31 @@ export default {
         },
       });
     },
+    loadPlayer_tencent() {
+      var self = this;
+      const TCPlayer = window.TCPlayer;
+      try {
+        let video = document.querySelector("video");
+        video.parentNode.removeChild(video);
+      } catch (error) {
+        console.log("清除video标签异常");
+      }
+      let player_tencent = document.createElement("video");
+      player_tencent.id = "player-tencent";
+      document
+        .getElementById("player")
+        .insertAdjacentElement("afterend", player_tencent);
+      self.$api.obtaintcvideosign(self.vid).then(res => {
+        self.player_tencent = TCPlayer("player-tencent", {
+          width: 932,
+        height: 627,
+          fileID: self.vid,
+          appID: res.data.appID,
+          psign: res.data.psign,
+          licenseUrl: res.data.licenseUrl
+        });
+      });
+    },
     /**
      * @param {String} 关闭视频窗口-销毁实例
      */
@@ -643,6 +686,9 @@ export default {
         if (this.player) {
           this.player.destroy();
         }
+        if (this.player_tencent) {
+          this.player.dispose();
+        }
         if (this.playerzb) {
           this.playerzb.destroy();
         }

+ 48 - 2
src/views/secondSeven/courseList/index.vue

@@ -41,7 +41,7 @@
           <span v-if="!activeId" style="font-size: 30px"
             >请打开目录详情,点击播放您需要观看的视频内容。</span
           >
-          <div v-show="vid" id="player"></div>
+          <div v-show="vid && viewSign == 1" id="player"></div>
           <div v-show="vidzb" id="playerzb"></div>
         </div>
         <div class="rightBoxslist">
@@ -238,7 +238,10 @@ export default {
       dialogVisible: false,
       courseList: [], //详情列表
       activeId: "", //当前选中ID
+      viewSign: 1,
       vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJsForTCPlayer:
+        "https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js",
       vid: "",
       playerJs:
         "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
@@ -320,6 +323,7 @@ export default {
      */
     msgInfo(option) {
       this.goodsBoxName = option.goodsName;
+      this.viewSign = option.viewSign;
       this.$api.obtainCourseSgoodsId(option.goodsId).then(async (res) => {
         // if (res.rows.length) {
         if (!res.rows.length) {
@@ -603,7 +607,11 @@ export default {
         this.loadPlayerScriptzb(this.loadPlayerzb);
       } else {
         this.vid = option.recordingUrl;
-        this.loadPlayerScript(this.loadPlayer);
+        if(this.viewSign == 2) {
+          this.loadPlayerScript_tencent(this.loadPlayer_tencent);
+        }else {
+          this.loadPlayerScript(this.loadPlayer);
+        }
       }
     },
     loadPlayerScript(callback) {
@@ -616,6 +624,16 @@ export default {
         callback();
       }
     },
+    loadPlayerScript_tencent(callback) {
+      if (!window.TCPlayer) {
+        const myScript = document.createElement("script");
+        myScript.setAttribute("src", this.vodPlayerJsForTCPlayer);
+        myScript.onload = callback;
+        document.body.appendChild(myScript);
+      } else {
+        callback();
+      }
+    },
     loadPlayer() {
       var self = this;
       const polyvPlayer = window.polyvPlayer;
@@ -632,6 +650,31 @@ export default {
         },
       });
     },
+    loadPlayer_tencent() {
+      var self = this;
+      const TCPlayer = window.TCPlayer;
+      try {
+        let video = document.querySelector("video");
+        video.parentNode.removeChild(video);
+      } catch (error) {
+        console.log("清除video标签异常");
+      }
+      let player_tencent = document.createElement("video");
+      player_tencent.id = "player-tencent";
+      document
+        .getElementById("player")
+        .insertAdjacentElement("afterend", player_tencent);
+      self.$api.obtaintcvideosign(self.vid).then(res => {
+        self.player_tencent = TCPlayer("player-tencent", {
+          width: 932,
+        height: 627,
+          fileID: self.vid,
+          appID: res.data.appID,
+          psign: res.data.psign,
+          licenseUrl: res.data.licenseUrl
+        });
+      });
+    },
     /**
      * @param {String} 关闭视频窗口-销毁实例
      */
@@ -643,6 +686,9 @@ export default {
         if (this.player) {
           this.player.destroy();
         }
+        if (this.player_tencent) {
+          this.player.dispose();
+        }
         if (this.playerzb) {
           this.playerzb.destroy();
         }

+ 48 - 2
src/views/secondZao/courseList/index.vue

@@ -41,7 +41,7 @@
           <span v-if="!activeId" style="font-size: 30px"
             >请打开目录详情,点击播放您需要观看的视频内容。</span
           >
-          <div v-show="vid" id="player"></div>
+          <div v-show="vid && viewSign == 1" id="player"></div>
           <div v-show="vidzb" id="playerzb"></div>
         </div>
         <div class="rightBoxslist">
@@ -238,7 +238,10 @@ export default {
       dialogVisible: false,
       courseList: [], //详情列表
       activeId: "", //当前选中ID
+      viewSign: 1,
       vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJsForTCPlayer:
+        "https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js",
       vid: "",
       playerJs:
         "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
@@ -320,6 +323,7 @@ export default {
      */
     msgInfo(option) {
       this.goodsBoxName = option.goodsName;
+      this.viewSign = option.viewSign;
       this.$api.obtainCourseSgoodsId(option.goodsId).then(async (res) => {
         // if (res.rows.length) {
         if (!res.rows.length) {
@@ -603,7 +607,11 @@ export default {
         this.loadPlayerScriptzb(this.loadPlayerzb);
       } else {
         this.vid = option.recordingUrl;
-        this.loadPlayerScript(this.loadPlayer);
+        if(this.viewSign == 2) {
+          this.loadPlayerScript_tencent(this.loadPlayer_tencent);
+        }else {
+          this.loadPlayerScript(this.loadPlayer);
+        }
       }
     },
     loadPlayerScript(callback) {
@@ -616,6 +624,16 @@ export default {
         callback();
       }
     },
+    loadPlayerScript_tencent(callback) {
+      if (!window.TCPlayer) {
+        const myScript = document.createElement("script");
+        myScript.setAttribute("src", this.vodPlayerJsForTCPlayer);
+        myScript.onload = callback;
+        document.body.appendChild(myScript);
+      } else {
+        callback();
+      }
+    },
     loadPlayer() {
       var self = this;
       const polyvPlayer = window.polyvPlayer;
@@ -632,6 +650,31 @@ export default {
         },
       });
     },
+    loadPlayer_tencent() {
+      var self = this;
+      const TCPlayer = window.TCPlayer;
+      try {
+        let video = document.querySelector("video");
+        video.parentNode.removeChild(video);
+      } catch (error) {
+        console.log("清除video标签异常");
+      }
+      let player_tencent = document.createElement("video");
+      player_tencent.id = "player-tencent";
+      document
+        .getElementById("player")
+        .insertAdjacentElement("afterend", player_tencent);
+      self.$api.obtaintcvideosign(self.vid).then(res => {
+        self.player_tencent = TCPlayer("player-tencent", {
+          width: 932,
+        height: 627,
+          fileID: self.vid,
+          appID: res.data.appID,
+          psign: res.data.psign,
+          licenseUrl: res.data.licenseUrl
+        });
+      });
+    },
     /**
      * @param {String} 关闭视频窗口-销毁实例
      */
@@ -643,6 +686,9 @@ export default {
         if (this.player) {
           this.player.destroy();
         }
+        if (this.player_tencent) {
+          this.player.dispose();
+        }
         if (this.playerzb) {
           this.playerzb.destroy();
         }