11wqe1 1 month ago
parent
commit
42dc4d2294

+ 41 - 5
src/components/pages/pptEasy/dialog/BilibiliSearchDialog.vue

@@ -179,7 +179,7 @@ export default {
         this.data = [];
         let data2 = [];
         for (var a = 0; a < keywords.length; a++) {
-          let _data = await this.searchBilibili(keywords[a]);
+          let _data = await this.lang.lang == 'cn' ? this.searchBilibili(keywords[a]) : this.aiGet2(keywords[a]);
           data2[a] = _data;
         }
         this.data = _.flatMap(_.zip(...data2), (pair) => pair.filter(value => value !== undefined));
@@ -192,8 +192,29 @@ export default {
         this.$message.error(this.lang.ssSearchFail);
       }
     },
+    async aiGet2(msg) {
+            let _this = this
+            return new Promise((resolve, reject) => {
+                this.ajax.post(`https://gpt4.cocorobo.cn/get_network_search`, {
+                    engine: "youtubeNew",
+                    keyword: msg,
+                    // page: 1,
+                    // page_size: 20,
+                    order: this.navActive,
+                    // duration: 0,
+                }).then(response => {
+                    console.log(response);
+                    // _this.data = [..._this.data,...response.data.FunctionResponse]
+                    resolve(response.data.FunctionResponse)
+                })
+                    .catch((error) => {
+                        resolve([])
+                        console.log(error);
+                    });
+            });
+        },
     // Bilibili搜索接口
-    searchBilibili(keyword) {
+    async searchBilibili(keyword) {
       return new Promise((resolve, reject) => {
         this.ajax.post(`https://gpt4.cocorobo.cn/get_network_search`, {
           engine: "bilibiliNew",
@@ -223,15 +244,25 @@ export default {
     },
     // 打开视频链接
     openUrl(bvid) {
-      window.open(`//www.bilibili.com/video/${bvid}`);
+      if (this.lang.lang == 'cn') {
+        window.open(`//www.bilibili.com/video/${bvid}`);
+      } else {
+        window.open('https://www.youtube.com/embed/'+bvid)
+      }
+      // window.open(`//www.bilibili.com/video/${bvid}`);
     },
     // 添加单个视频
     addSingleVideo(item) {
       const videoTitle = item.title.replace(/<[^>]*>?/gm, ''); // 移除HTML标签
+      if (this.lang.lang == 'cn') {
+        url = `//player.bilibili.com/player.html?isOutside=true&bvid=${item.bvid}`;
+      } else {
+        url = 'https://www.youtube.com/embed/'+item.bvid;
+      }
       const videoData = {
         name: "链接",
         title: item.title.replace(/<[^>]*>?/gm, ''),
-        url: `//player.bilibili.com/player.html?isOutside=true&bvid=${item.bvid}`,
+        url: url,
         id: new Date().getTime(),
         bvid: item.bvid,
         type: 75  // B站视频使用type 75
@@ -262,10 +293,15 @@ export default {
       }
       this.selectedVideos.forEach(video => {
         const videoTitle = video.title.replace(/<[^>]*>?/gm, ''); // 移除HTML标签
+        if (this.lang.lang == 'cn') {
+          url = `//player.bilibili.com/player.html?isOutside=true&bvid=${video.bvid}`;
+        } else {
+          url = 'https://www.youtube.com/embed/'+video.bvid;
+        }
         const videoData = {
           name: this.lang.ssLink,
           title: video.title.replace(/<[^>]*>?/gm, ''),
-          url: `//player.bilibili.com/player.html?isOutside=true&bvid=${video.bvid}`,
+          url: url,
           id: new Date().getTime(),
           bvid: video.bvid,
           type: 75  // B站视频使用type 75

+ 1 - 1
src/components/pages/workPage/components/choiceQuestion.vue

@@ -13,7 +13,7 @@
     <img class="cq_image" v-if="work.testJson[showIndex].timuList.length>0" :src="work.testJson[showIndex].timuList[0].src" @click="$hevueImgPreview(work.testJson[showIndex].timuList[0].src)">
 
     <div class="cq_type" v-if="work.testJson[showIndex]">
-      {{ work.testJson[showIndex].type == 1 ? lang.SingleChoice : lang.MultipleChoice }}
+      {{ work.testJson[showIndex].type == 1 ? lang.MultipleChoice : lang.MultipleChoice }}
       <span v-if="work.testJson.length>1">({{showIndex+1}}/{{work.testJson.length}})</span>
 
     </div>