SanHQin преди 10 месеца
родител
ревизия
7f1072dcc5
променени са 1 файла, в които са добавени 33 реда и са изтрити 14 реда
  1. 33 14
      src/components/pages/classroomObservation/index.vue

+ 33 - 14
src/components/pages/classroomObservation/index.vue

@@ -12,9 +12,13 @@
 		</div> -->
 		<div class="co-header2">
 			<div class="co-h2-left">
-				<span
+				<!-- <span
 					class="co-h2-l-icon"
 					@click="$refs.addNewCourseDialogRef.open()"
+				></span> -->
+				<span
+					class="co-h2-l-icon"
+					@click="addNewCourse()"
 				></span>
 				<span class="co-h2-l-hr"></span>
 				<span class="co-h2-l-text">
@@ -153,11 +157,11 @@
 			@shareBtn="shareBtn"
 		></sharePdf>
 
-		<addNewCourseDialog
+		<!-- <addNewCourseDialog
 			:courseList="optionData"
 			ref="addNewCourseDialogRef"
 			@success="addNewCourse"
-		/>
+		/> -->
 	</div>
 </template>
 
@@ -168,14 +172,16 @@ import chatArea from "./components/chatArea.vue";
 import messageArea from "./components/messageArea.vue";
 
 import sharePdf from "./components/sharePdf.vue";
+
+import { v4 as uuidv4 } from "uuid";
 // 添加课堂弹窗
-import addNewCourseDialog from "./components/addNewCourseDialog.vue";
+// import addNewCourseDialog from "./components/addNewCourseDialog.vue";
 export default {
 	components: {
 		chatArea,
 		messageArea,
 		sharePdf,
-		addNewCourseDialog,
+		// addNewCourseDialog,
 	},
 	data() {
 		return {
@@ -186,6 +192,7 @@ export default {
 			fileId: "",
 			fileIdId: "",
 			optionData: [],
+			userId:this.$route.query["userid"]
 		};
 	},
 	methods: {
@@ -197,13 +204,22 @@ export default {
 				this.getFileIdId();
 			});
 		},
-		addNewCourse(form) {
+		addNewCourse() {
 			if (this.loading) return this.$message.info("请稍等");
 			this.loading = true;
+			let date = new Date();
+			let month = date.getMonth()+1
+			let day = date.getDate();
+			let classroomName =  `${month<10?'0'+month:month}${day<10?'0'+day:day}新建课堂`
+			let sum = this.optionData.filter(i=>i.label.indexOf(classroomName)!=-1).length;
+			if(!sum==0){
+				classroomName+=sum;
+			}
 			let params = {
-				tid: form.no,
-				name: form.name,
-			};
+				tid:uuidv4(),
+				name:classroomName,
+				userid:this.userId
+			}
 			this.ajax
 				.post(
 					"https://gpt4.cocorobo.cn/insert_classroom_observation_tid",
@@ -212,7 +228,7 @@ export default {
 				.then((res) => {
 					let _data = res.data.FunctionResponse;
 					if (_data.message == "创建成功") {
-						this.tid = form.no;
+						this.tid = params.tid;
 						// 设置该课堂的tid
 						this.ajax
 							.post("https://gpt4.cocorobo.cn/insert_classroom_observation", {
@@ -220,6 +236,7 @@ export default {
 								type: 10,
 								index: 0,
 								json_data: JSON.stringify({ file_ids: "" }),
+								userid:this.userId
 							})
 							.then((res2) => {
 								let _data2 = res2.data.FunctionResponse;
@@ -359,7 +376,9 @@ export default {
 			this.loading = true;
 			return new Promise((resolve, reject) => {
 				this.ajax
-					.post("https://gpt4.cocorobo.cn/get_classroom_observation_all")
+					.post("https://gpt4.cocorobo.cn/get_classroom_observation_all",{
+						userid:this.userId
+					})
 					.then((res) => {
 						let _data = res.data.FunctionResponse.result;
 						let _result = []
@@ -387,9 +406,9 @@ export default {
 							(i) => i.label != "" && i.tId != ""
 						);
 						this.optionData = _optionData;
-						// if (this.optionData.length > 0) {
-						// 	if (!this.tid) this.tid = this.optionData[0].value;
-						// }
+						if (this.optionData.length > 0) {
+							this.$refs.chatAreaRef.$refs.startPageRef.showIntroduce = false
+						}
 						this.loading = false;
 						resolve();
 					});