SanHQin 8 місяців тому
батько
коміт
33e15674db

BIN
src/assets/icon/course/sImg2.png


BIN
src/assets/icon/course/sRio2.png


+ 17 - 0
src/common/axios.config.js

@@ -95,7 +95,24 @@ function get(url, param) {
             })
     })
 }
+
+//返回一个Promise(发送put请求)
+function put(url, params) {
+	return new Promise((resolve, reject) => {
+			axios.put(url, params)
+					.then(response => {
+							resolve(response);
+					}, err => {
+							reject(err);
+					})
+					.catch((error) => {
+							reject(error)
+					})
+	})
+}
+
 export default {
     get,
     post,
+		put
 }

Різницю між файлами не показано, бо вона завелика
+ 35 - 67
src/components/classRoomHelper/component/dialogArea.vue


+ 31 - 10
src/components/classRoomHelper/component/levitatedSphere.vue

@@ -54,7 +54,8 @@ export default {
       aiText: "您好,我是小可,有什么可以帮助您的?",
       userText: "",
       showTextIndex: 0, //0:ai,1:用户, 2:组织语言
-      timer: null
+      timer: null,
+			isOpen:false,
     };
   },
   computed: {
@@ -73,12 +74,17 @@ export default {
   },
   methods: {
     recordStart(_text) {
-      try {
+      // try {
+			// this.$parent.changeRecordType(1);
+			// return this.$message.success("已开启语音助手,请说“可可同学”来唤醒")
+				if(this.isOpen)return this.$message.info("已开启语音助手,无需重复开启")
         let iiframe = this.$refs["iiframe"];
         iiframe.contentWindow.window.document.getElementById(
           "languageOptions"
         ).selectedIndex = 2; //普通话
         iiframe.contentWindow.testdoContinuousPronunciationAssessment();
+				this.$message.success("已开启语音助手,请说“可可同学”来唤醒")
+				this.isOpen = true;
         iiframe.contentWindow.onRecognizedResult = e => {
           let _msg = e.privText;
           // let _msg = _text;
@@ -157,14 +163,29 @@ export default {
             console.log("不响应");
           }
         };
-      } catch (error) {
-        console.log("ai录音报错👇");
-        console.log(error);
-        setTimeout(() => {
-          this.recordStart();
-        }, 1000);
-      }
+      // } catch (error) {
+      //   console.log("ai录音报错👇");
+      //   console.log(error);
+      //   setTimeout(() => {
+      //     this.recordStart();
+      //   }, 1000);
+      // }
     },
+		stopRecord(){
+			// this.$parent.changeRecordType(0);
+			// this.$message.success("已关闭语音助手")
+			// return 
+			let iiframe = this.$refs["iiframe"];
+				iiframe.contentWindow.window.document
+					.getElementById("scenarioStopButton")
+					.click();
+				// 录音借宿
+				iiframe.contentWindow.onSessionStopped = (s, e) => {
+					this.isOpen = false;
+					this.$parent.changeRecordType(0);
+					this.$message.success("已关闭语音助手")
+				};
+		},
     chineseToNumber(chinese) {
       const chineseNumbers = {
         零: 0,
@@ -222,7 +243,7 @@ export default {
     }
   },
   mounted() {
-    this.recordStart();
+    // this.recordStart();
     // setTimeout(() => {
     //   this.recordStart("嘿哟黑");
     //   setTimeout(() => {

Різницю між файлами не показано, бо вона завелика
+ 197 - 165
src/components/classRoomHelper/component/searchArea.vue


Різницю між файлами не показано, бо вона завелика
+ 106 - 88
src/components/classRoomHelper/component/taskArea.vue


+ 111 - 53
src/components/classRoomHelper/index.vue

@@ -1,26 +1,29 @@
 <template>
   <div class="ch_box" ref="ch_box">
-		
     <div class="ch_content_box" v-if="type == 1">
       <searchArea
         :courseDetail="courseDetail"
         ref="searchAreaRef"
-				:navList="navList"
-				:tcid="tcid"
+        :navList="navList"
+        :tcid="tcid"
+				:fileId="fileId"
+				:recordType="recordType"
         v-if="itemType == 1"
       />
       <taskArea
         :courseDetail="courseDetail"
-				:navList="navList"
-				:courseType="courseType"
-				:taskCount="taskCount"
-				:worksStudent="worksStudent"
+        :navList="navList"
+        :courseType="courseType"
+        :taskCount="taskCount"
+        :worksStudent="worksStudent"
         ref="taskAreaRef"
+				:fileId="fileId"
         v-if="itemType == 2"
       />
       <dialogArea
         :courseDetail="courseDetail"
         ref="dialogAreaRef"
+				:fileId="fileId"
         v-if="itemType == 3"
       />
     </div>
@@ -41,7 +44,7 @@
           </el-tooltip>
         </div>
 
-        <div @click="$emit('review')" v-if="tType==1">
+        <div @click="$emit('review')" v-if="tType == 1">
           <el-tooltip class="item" effect="dark" content="评论" placement="top">
             <img
               :src="require('../../assets/icon/course/comment.png')"
@@ -50,7 +53,8 @@
             />
           </el-tooltip>
         </div>
-        <div @click="$emit('authority')" v-if="(tType==1 || tType == 4)"><!-- -->
+        <div @click="$emit('authority')" v-if="tType == 1 || tType == 4">
+          <!-- -->
           <el-tooltip class="item" effect="dark" content="权限" placement="top">
             <img
               :src="require('../../assets/icon/course/setting.png')"
@@ -150,8 +154,8 @@
         </div>
       </div>
     </div>
-		<levitatedSphere @startTime="startTime"/>
-		<timepiece ref="timepieceRef"/>
+    <levitatedSphere ref="levitatedSphereRef" @startTime="startTime" />
+    <timepiece ref="timepieceRef" />
   </div>
 </template>
 
@@ -159,7 +163,7 @@
 import searchArea from "./component/searchArea.vue";
 import taskArea from "./component/taskArea.vue";
 import dialogArea from "./component/dialogArea.vue";
-import levitatedSphere from './component/levitatedSphere.vue'
+import levitatedSphere from "./component/levitatedSphere.vue";
 import timepiece from "./component/timepiece.vue";
 export default {
   emits: ["refresh", "goStep", "backPage", "authority", "review"],
@@ -167,47 +171,55 @@ export default {
     searchArea,
     taskArea,
     dialogArea,
-		levitatedSphere,
-		timepiece
+    levitatedSphere,
+    timepiece
   },
   props: {
     courseDetail: {
       type: Object,
       default: () => {}
     },
-		tType:{
-			type:Number,
-			default:0,
-		},
-		navList:{
-			type:Array,
-			default:()=>[]
-		},
-		tcid:{
-			type:String,
-			default:""
-		},
-		courseType:{
-			type:Number,
-			default:0
-		},
-		taskCount:{
-			type:Number,
-			default:0
-		},
-		worksStudent:{
-			type:Array,
-			default:()=>[]
-		}
+    tType: {
+      type: Number,
+      default: 0
+    },
+    navList: {
+      type: Array,
+      default: () => []
+    },
+    tcid: {
+      type: String,
+      default: ""
+    },
+    courseType: {
+      type: Number,
+      default: 0
+    },
+    taskCount: {
+      type: Number,
+      default: 0
+    },
+    worksStudent: {
+      type: Array,
+      default: () => []
+    },
+    fileList: {
+      type: Array,
+      default: () => []
+    }
   },
   data() {
     return {
       type: 0,
-      itemType: 0 //0--无  1-搜索  2-任务 3-对话
+      itemType: 0, //0--无  1-搜索  2-任务 3-对话
+      fileId: [],
+			recordType:0,
+      getFileIdLoading: false
     };
   },
   mounted() {
     this.setWidth();
+    this.getFileId();
   },
   methods: {
     setWidth() {
@@ -236,16 +248,62 @@ export default {
         this.itemType = type;
       });
     },
-		//计时
-		startTime(time){
-			this.$refs.timepieceRef.startTime(time);
-		}
-  },
-	mounted(){
-		// setTimeout(()=>{
-		// 	this.startTime(10)
-		// },2000)
-	}
+    //计时
+    startTime(time) {
+      this.$refs.timepieceRef.startTime(time);
+    },
+    getFileId() {
+      if (this.getFileIdLoading) return;
+			this.getFileIdLoading = true;
+      this.fileId = [];
+			let _this = this;
+      let _successFileUrl = [];
+      if (this.fileList.length <= 0) retrun;
+      let addType = ["DOCX", "DOC", "PPT", "PPTX", "MD", "TXT"];
+      this.fileList.forEach(i => {
+        if (
+          addType.includes(
+            i.url.split(".")[i.url.split(".").length - 1].toLocaleUpperCase()
+          )
+        ) {
+          _successFileUrl.push(i.url);
+        }
+      });
+      let promiseList = [];
+      _successFileUrl.forEach(i => {
+        promiseList.push(
+          new Promise((resolve, reject) => {
+            _this.ajax
+              .put("https://gpt4.cocorobo.cn/upload_file_knowledge", {
+                url: i
+              })
+              .then(res => {
+                let _data = res.data.FunctionResponse;
+                if (_data.result && _data.result.id) {
+                  this.fileId.push(_data.result.id);
+                }
+								resolve();
+              });
+          })
+        );
+      });
+      Promise.all(promiseList).then(res => {
+        this.getFileIdLoading = false;
+      });
+    },
+		startAssistant(){
+			if(this.recordType==0){
+				this.$refs.levitatedSphereRef.recordStart();
+			}else if(this.recordType==1){
+				this.$refs.levitatedSphereRef.stopRecord();
+			}
+		},
+		changeRecordType(type){
+			console.log("修改了")
+			this.recordType = type;
+			console.log(this.recordType)
+		},
+  }
 };
 </script>
 
@@ -261,7 +319,7 @@ export default {
   /* overflow: hidden; */
   display: flex;
   top: 20px;
-	z-index:1000;
+  z-index: 1000;
 }
 
 .ch_nav_box {
@@ -270,9 +328,9 @@ export default {
   display: flex;
   flex-direction: column;
   /* justify-content: flex-end; */
-	margin-top: auto;
+  margin-top: auto;
   align-items: center;
-	overflow: auto;
+  overflow: auto;
 }
 
 .ch_content_box {
@@ -353,7 +411,7 @@ export default {
 .ch_nav_box_top {
   width: 100%;
   height: auto;
-	margin-top: auto;
+  margin-top: auto;
 }
 .ch_nav_box_top > div {
   width: 100%;

+ 1 - 1
src/components/easy2/studyStudent.vue

@@ -8081,7 +8081,7 @@
       </div>
     </div>
 		<!-- v-show="org == '1973f6c7-1561-11ee-91d8-005056b86db5' || org == '777559d2-7239-11ee-b98c-005056b86db5' || org == '884c5665-a453-46f3-b7b6-01d575290aa9'" -->
-		<classRoomHelper :worksStudent="worksStudent" :courseType="parseInt(courseType)" :taskCount="taskCount" :tcid="tcid" :navList="navList" v-show="orgArray.includes(org) || oidArray.includes(oid)" ref="classRoomHelperRef" :courseDetail="courseDetail" :tType="tType" @setWidth="setClassRoomHelperWidth" @refresh="refreshCourse" @goStep="nextOrpreSteps" @authority="juriVisible = true" @review="setPz" @backPage="goTo(
+		<classRoomHelper :fileList="vChapterData[taskCount]" :worksStudent="worksStudent" :courseType="parseInt(courseType)" :taskCount="taskCount" :tcid="tcid" :navList="navList" v-show="orgArray.includes(org) || oidArray.includes(oid)" ref="classRoomHelperRef" :courseDetail="courseDetail" :tType="tType" @setWidth="setClassRoomHelperWidth" @refresh="refreshCourse" @goStep="nextOrpreSteps" @authority="juriVisible = true" @review="setPz" @backPage="goTo(
                     '/courseDetail?userid=' +
                       userid +
                       '&oid=' +

+ 1 - 1
src/components/easy3/studyStudent.vue

@@ -8111,7 +8111,7 @@
       </div>
     </div>
 				<!-- v-show="org == '1973f6c7-1561-11ee-91d8-005056b86db5' || org == '777559d2-7239-11ee-b98c-005056b86db5' || org == '884c5665-a453-46f3-b7b6-01d575290aa9'" -->
-		<classRoomHelper :worksStudent="worksStudent" :courseType="parseInt(courseType)" :taskCount="taskCount" :tcid="tcid" :navList="navList" v-show="orgArray.includes(org) || oidArray.includes(oid)" ref="classRoomHelperRef" :courseDetail="courseDetail" :tType="tType" @setWidth="setClassRoomHelperWidth" @refresh="refreshCourse" @goStep="nextOrpreSteps" @authority="juriVisible = true" @review="setPz" @backPage="goTo(
+		<classRoomHelper :fileList="vChapterData[taskCount]" :worksStudent="worksStudent" :courseType="parseInt(courseType)" :taskCount="taskCount" :tcid="tcid" :navList="navList" v-show="orgArray.includes(org) || oidArray.includes(oid)" ref="classRoomHelperRef" :courseDetail="courseDetail" :tType="tType" @setWidth="setClassRoomHelperWidth" @refresh="refreshCourse" @goStep="nextOrpreSteps" @authority="juriVisible = true" @review="setPz" @backPage="goTo(
                     '/courseDetail?userid=' +
                       userid +
                       '&oid=' +

+ 1 - 1
src/components/studyStudent.vue

@@ -8078,7 +8078,7 @@
         </el-dialog>
       </div>
 			<!-- v-show="org == '1973f6c7-1561-11ee-91d8-005056b86db5' || org == '777559d2-7239-11ee-b98c-005056b86db5' || org == '884c5665-a453-46f3-b7b6-01d575290aa9'" -->
-      <classRoomHelper :worksStudent="worksStudent" :courseType="parseInt(courseType)" :taskCount="taskCount" :tcid="tcid" :navList="navList" v-show="orgArray.includes(org) || oidArray.includes(oid)"  ref="classRoomHelperRef" :courseDetail="courseDetail" :tType="tType" @setWidth="setClassRoomHelperWidth" @refresh="refreshCourse" @goStep="nextOrpreSteps" @authority="juriVisible = true" @review="setPz" @backPage="goTo(
+      <classRoomHelper :fileList="vChapterData[taskCount]" :worksStudent="worksStudent" :courseType="parseInt(courseType)" :taskCount="taskCount" :tcid="tcid" :navList="navList" v-show="orgArray.includes(org) || oidArray.includes(oid)"  ref="classRoomHelperRef" :courseDetail="courseDetail" :tType="tType" @setWidth="setClassRoomHelperWidth" @refresh="refreshCourse" @goStep="nextOrpreSteps" @authority="juriVisible = true" @review="setPz" @backPage="goTo(
                     '/courseDetail?userid=' +
                       userid +
                       '&oid=' +

Деякі файли не було показано, через те що забагато файлів було змінено