Browse Source

判断哔哩哔哩与youtobe

11wqe1 5 months ago
parent
commit
16cf89ad00

+ 8 - 1
src/components/pages/aiAddCourse/addCourse.vue

@@ -7687,9 +7687,14 @@
         :style="{marginTop: panPptCount() > 0 ? '10px' : '0'}" style="justify-content: flex-start;"
         :style="{marginTop: panPptCount() > 0 ? '10px' : '0'}" style="justify-content: flex-start;"
         @click="pptBoxDialog = !pptBoxDialog">{{ pptBoxDialog ? lang.ssFold : lang.ssExpand }}</span>
         @click="pptBoxDialog = !pptBoxDialog">{{ pptBoxDialog ? lang.ssFold : lang.ssExpand }}</span>
     </div>
     </div>
-    <aiCreateVideoDialog :dialogVisibleAiCreateVideo.sync="dialogVisibleAiCreateVideo" :courseName="courseName"
+    <aiCreateVideoDialog v-if="lang.lang == 'cn'" :dialogVisibleAiCreateVideo.sync="dialogVisibleAiCreateVideo" :courseName="courseName"
       @createAiVideo="createAiVideo" :courseState="courseState" :lineCount="lineCount" :unitJson="unitJson">
       @createAiVideo="createAiVideo" :courseState="courseState" :lineCount="lineCount" :unitJson="unitJson">
     </aiCreateVideoDialog>
     </aiCreateVideoDialog>
+
+    <aiCreateVideoDialogHK v-else :dialogVisibleAiCreateVideo.sync="dialogVisibleAiCreateVideo" :courseName="courseName"
+      @createAiVideo="createAiVideo" :courseState="courseState" :lineCount="lineCount" :unitJson="unitJson">
+    </aiCreateVideoDialogHK>
+    
     <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
     <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
     <wOffice :dialogVisibleOffice.sync="dialogVisibleOffice" :url="wurl"></wOffice>
     <wOffice :dialogVisibleOffice.sync="dialogVisibleOffice" :url="wurl"></wOffice>
     <appDialog ref="appDialog" @success="selectAppSuccess"></appDialog>
     <appDialog ref="appDialog" @success="selectAppSuccess"></appDialog>
@@ -7726,6 +7731,7 @@ import { v4 as uuidv4 } from "uuid";
 import MarkdownIt from "markdown-it";
 import MarkdownIt from "markdown-it";
 import aiCreateDialog from './aiCreateDialog.vue'
 import aiCreateDialog from './aiCreateDialog.vue'
 import aiCreateVideoDialog from './aiCreateVideoDialog.vue'
 import aiCreateVideoDialog from './aiCreateVideoDialog.vue'
+import aiCreateVideoDialogHK from './aiCreateVideoDialogHK.vue'
 import wpdf from "../test/file/wPdf2.vue";
 import wpdf from "../test/file/wPdf2.vue";
 import wOffice from "../test/file/wOffice.vue";
 import wOffice from "../test/file/wOffice.vue";
 import htmlDocx from "html-docx-js/dist/html-docx";
 import htmlDocx from "html-docx-js/dist/html-docx";
@@ -7813,6 +7819,7 @@ export default {
     tipsDialog,
     tipsDialog,
     aiCreateDialog,
     aiCreateDialog,
     aiCreateVideoDialog,
     aiCreateVideoDialog,
+    aiCreateVideoDialogHK,
     wpdf,
     wpdf,
     wOffice,
     wOffice,
     evaList,
     evaList,

+ 58 - 10
src/components/pages/pptEasy/dialog/BilibiliSearchDialog.vue

@@ -37,7 +37,7 @@
         </div>
         </div>
       </div>
       </div>
       <!-- 视频列表 -->
       <!-- 视频列表 -->
-      <div class="Box">
+      <div class="Box" v-if="lang.lang == 'cn'">
         <div 
         <div 
           class="video_box video_box2" 
           class="video_box video_box2" 
           :class="{ 'selected': isVideoSelected(item) }"
           :class="{ 'selected': isVideoSelected(item) }"
@@ -72,6 +72,42 @@
         </div>
         </div>
         <div v-if="data.length == 0" class="no_data">{{ lang.ssNoData }}</div>
         <div v-if="data.length == 0" class="no_data">{{ lang.ssNoData }}</div>
       </div>
       </div>
+      <div class="Box" v-else>
+        <div 
+          class="video_box video_box2" 
+          :class="{ 'selected': isVideoSelected(item) }"
+          v-for="(item, index) in paginatedData" 
+          :key="index"
+          @click="toggleVideoSelection(item)"
+        >
+          <div class="video-checkbox" @click.stop>
+            <el-checkbox 
+              :value="isVideoSelected(item)" 
+              @change="toggleVideoSelection(item)"
+            ></el-checkbox>
+          </div>
+          <span class="name" v-html="item.channel.title"></span>
+          <span class="detail">{{ item.description || '' }}</span>
+          <div class="video-info">
+            <span class="author">{{ lang.ssAut }}:{{ item.channel.title || '' }}</span>
+            <span class="duration">{{ lang.ssDuration }}:{{ item.length || '' }}</span>
+          </div>
+          <div class="tag" v-if="item.badges && typeof item.badges === 'string' && item.badges.split(',').length > 0">
+            <el-tooltip :content="badges" placement="top" effect="dark" v-for="(tag, index) in item.badges.split(',').slice(0, 5)" :key="index">
+              <span>{{ tag }}</span>
+            </el-tooltip>
+          </div>
+          <div class="external-link" @click.stop="openUrl(item.id)" :title="lang.ssView">
+            <svg t="1755224440400" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4991" width="16" height="16">
+              <path d="M853.333 469.333a42.667 42.667 0 0 0-42.666 42.667v256a42.667 42.667 0 0 1-42.667 42.667H256a42.667 42.667 0 0 1-42.667-42.667V256a42.667 42.667 0 0 1 42.667-42.667h256a42.667 42.667 0 0 0 0-85.333H256a128 128 0 0 0-128 128v512a128 128 0 0 0 128 128h512a128 128 0 0 0 128-128V512a42.667 42.667 0 0 0-42.667-42.667z" fill="#909399" p-id="4992"></path>
+              <path d="M682.667 213.333h270.933v270.933a42.667 42.667 0 1 0 85.334 0V170.667a42.667 42.667 0 0 0-42.667-42.667H682.667a42.667 42.667 0 0 0 0 85.333z" fill="#909399" p-id="4993"></path>
+              <path d="M894.293 174.293a42.667 42.667 0 0 0-60.586 0L591.147 417.707a42.667 42.667 0 0 0 60.586 60.586L894.293 234.88a42.667 42.667 0 0 0 0-60.587z" fill="#909399" p-id="4994"></path>
+            </svg>
+          </div>
+        </div>
+        <div v-if="data.length == 0" class="no_data">{{ lang.ssNoData }}</div>
+      </div>
+
       <!-- 分页控件 -->
       <!-- 分页控件 -->
       <div class="pagination-box" v-if="data.length > 0">
       <div class="pagination-box" v-if="data.length > 0">
         <el-button 
         <el-button 
@@ -198,10 +234,10 @@ export default {
                 this.ajax.post(`https://gpt4.cocorobo.cn/get_network_search`, {
                 this.ajax.post(`https://gpt4.cocorobo.cn/get_network_search`, {
                     engine: "youtubeNew",
                     engine: "youtubeNew",
                     keyword: msg,
                     keyword: msg,
-                    // page: 1,
-                    // page_size: 20,
+                    page: 1,
+                    page_size: 50,
                     order: this.navActive,
                     order: this.navActive,
-                    // duration: 0,
+                    duration: 0,
                 }).then(response => {
                 }).then(response => {
                     console.log(response);
                     console.log(response);
                     // _this.data = [..._this.data,...response.data.FunctionResponse]
                     // _this.data = [..._this.data,...response.data.FunctionResponse]
@@ -254,17 +290,18 @@ export default {
     // 添加单个视频
     // 添加单个视频
     addSingleVideo(item) {
     addSingleVideo(item) {
       const videoTitle = item.title.replace(/<[^>]*>?/gm, ''); // 移除HTML标签
       const videoTitle = item.title.replace(/<[^>]*>?/gm, ''); // 移除HTML标签
+      let url = '';
       if (this.lang.lang == 'cn') {
       if (this.lang.lang == 'cn') {
         url = `//player.bilibili.com/player.html?isOutside=true&bvid=${item.bvid}`;
         url = `//player.bilibili.com/player.html?isOutside=true&bvid=${item.bvid}`;
       } else {
       } else {
-        url = 'https://www.youtube.com/embed/'+item.bvid;
+        url = 'https://www.youtube.com/embed/'+item.id;
       }
       }
       const videoData = {
       const videoData = {
         name: "链接",
         name: "链接",
         title: item.title.replace(/<[^>]*>?/gm, ''),
         title: item.title.replace(/<[^>]*>?/gm, ''),
         url: url,
         url: url,
         id: new Date().getTime(),
         id: new Date().getTime(),
-        bvid: item.bvid,
+        bvid: this.lang.lang == 'cn' ? item.bvid : item.id,
         type: 75  // B站视频使用type 75
         type: 75  // B站视频使用type 75
       };
       };
       this.$emit('addVideo', videoData);
       this.$emit('addVideo', videoData);
@@ -274,11 +311,21 @@ export default {
     },
     },
     // 检查视频是否被选中
     // 检查视频是否被选中
     isVideoSelected(item) {
     isVideoSelected(item) {
-      return this.selectedVideos.some(v => v.bvid === item.bvid);
+      if (this.lang.lang == 'cn') {
+        return this.selectedVideos.some(v => v.bvid === item.bvid);
+      } else {
+        return this.selectedVideos.some(v => v.id === item.id);
+      }
     },
     },
     // 切换视频选择状态
     // 切换视频选择状态
     toggleVideoSelection(item) {
     toggleVideoSelection(item) {
-      const index = this.selectedVideos.findIndex(v => v.bvid === item.bvid);
+      let index = 0;
+      if (this.lang.lang == 'cn') {
+        index = this.selectedVideos.findIndex(v => v.bvid === item.bvid);
+      } else {
+        index = this.selectedVideos.findIndex(v => v.id === item.id);
+      }
+      // this.selectedVideos.findIndex(v => v.bvid === item.bvid);
       if (index > -1) {
       if (index > -1) {
         this.selectedVideos.splice(index, 1);
         this.selectedVideos.splice(index, 1);
       } else {
       } else {
@@ -293,17 +340,18 @@ export default {
       }
       }
       this.selectedVideos.forEach(video => {
       this.selectedVideos.forEach(video => {
         const videoTitle = video.title.replace(/<[^>]*>?/gm, ''); // 移除HTML标签
         const videoTitle = video.title.replace(/<[^>]*>?/gm, ''); // 移除HTML标签
+        let url = '';
         if (this.lang.lang == 'cn') {
         if (this.lang.lang == 'cn') {
           url = `//player.bilibili.com/player.html?isOutside=true&bvid=${video.bvid}`;
           url = `//player.bilibili.com/player.html?isOutside=true&bvid=${video.bvid}`;
         } else {
         } else {
-          url = 'https://www.youtube.com/embed/'+video.bvid;
+          url = 'https://www.youtube.com/embed/'+video.id;
         }
         }
         const videoData = {
         const videoData = {
           name: this.lang.ssLink,
           name: this.lang.ssLink,
           title: video.title.replace(/<[^>]*>?/gm, ''),
           title: video.title.replace(/<[^>]*>?/gm, ''),
           url: url,
           url: url,
           id: new Date().getTime(),
           id: new Date().getTime(),
-          bvid: video.bvid,
+          bvid: this.lang.lang == 'cn' ? video.bvid : video.id,
           type: 75  // B站视频使用type 75
           type: 75  // B站视频使用type 75
         };
         };
         this.$emit('addVideo', videoData);
         this.$emit('addVideo', videoData);