SanHQin vor 11 Monaten
Ursprung
Commit
0625615beb

+ 52 - 32
src/components/pages/classroomObservation/components/analysis.vue

@@ -13,8 +13,21 @@
 			</div>
 		</div>
 		<div class="a-main" v-show="showItem">
-			<analysisItem ref="analysisItemRef" v-if="analysisItemList.length > 0" v-for="(item,index) in analysisItemList" :key="item.id" :data="item" :tid="tid" :fileId="fileId" :index="index" @delItem="delItem" @editItem="editItem"/>
-			<div class="a_m_empty" v-if="analysisItemList.length == 0">暂无模块...</div>
+			<analysisItem
+				ref="analysisItemRef"
+				v-if="analysisItemList.length > 0"
+				v-for="(item, index) in analysisItemList"
+				:key="item.id"
+				:data="item"
+				:tid="tid"
+				:fileId="fileId"
+				:index="index"
+				@delItem="delItem"
+				@editItem="editItem"
+			/>
+			<div class="a_m_empty" v-if="analysisItemList.length == 0">
+				暂无模块...
+			</div>
 		</div>
 	</div>
 </template>
@@ -22,30 +35,30 @@
 <script>
 import analysisItem from "./analysisItem";
 export default {
-	emits:["delItem","editItem"],
+	emits: ["delItem", "editItem"],
 	props: {
-		title:{
-			type:String,
-			default:"分析"
+		title: {
+			type: String,
+			default: "分析",
 		},
-		analysisItemList:{
-			type:Array,
-			default:()=>{
-				return []
-			}
+		analysisItemList: {
+			type: Array,
+			default: () => {
+				return [];
+			},
+		},
+		type: {
+			type: Number,
+			default: 0,
 		},
-		type:{
-			type:Number,
-			default:0
+		tid: {
+			type: String,
+			require: true,
 		},
-		tid:{
-			type:String,
-			require:true,
+		fileId: {
+			type: String,
+			require: true,
 		},
-		fileId:{
-			type:String,
-			require:true,
-		}
 	},
 	components: {
 		analysisItem,
@@ -58,22 +71,29 @@ export default {
 	},
 	methods: {
 		addTemplate() {
-			this.$emit('updateMessage',  this.type);
+			this.$emit("updateMessage", this.type);
 		},
 		changeShowItem(newValue) {
 			this.showItem = newValue;
 		},
-		delItem(id){
-			this.$emit("delItem",id)
+		delItem(id) {
+			this.$emit("delItem", id);
 		},
-		editItem(id,_data){
-			this.$emit("editItem",id,_data)
+		editItem(id, _data) {
+			this.$emit("editItem", id, _data);
+		},
+		getReport(index) {
+			if (!index && index < 0) {
+				this.$refs.analysisItemRef.forEach((i) => {
+					i.editBtn();
+				});
+			} else {
+				this.$nextTick(()=>{
+					this.$refs.analysisItemRef[index].editBtn();
+				})
+				
+			}
 		},
-		getReport(){
-			this.$refs.analysisItemRef.forEach(i=>{
-				i.editBtn();
-			})
-		}
 	},
 };
 </script>
@@ -391,7 +411,7 @@ export default {
 	align-items: center;
 	cursor: pointer;
 }
-.a_m_empty{
+.a_m_empty {
 	display: flex;
 	width: 100%;
 	justify-content: center;

+ 362 - 342
src/components/pages/classroomObservation/components/analysisItem.vue

@@ -1,415 +1,435 @@
 <template>
-  <div class="analysisItem">
-    <div class="ai-header">
-      <div class="ai-h-left" @click.stop="changeOpenItem(!openItem)">
-        <span
-          :class="['ai-h-l-icon', openItem ? 'ai-h-l-iconActive' : '']"
-        ></span>
-        <span class="ai-h-l-text">{{ data.jsonData.name }}</span>
-      </div>
-      <div class="ai-h-right">
-        <!-- <span class="ai-h-r-icon1" @click.stop="backLeft()"></span> -->
-        <!-- <span class="ai-h-r-icon2" @click.stop="backRight()"></span> -->
-        <span style="width: 100px;color: red;" v-if="loadNum == 2"
-          >优化失败
-        </span>
-        <span
-          :class="loading ? 'text1' : 'text2'"
-          style="width: 100px"
-          v-if="loadNum == 1"
-          >{{ loading ? "优化中..." : "优化完成" }}
-        </span>
-        <span
-          v-if="loadNum == 0 && !openItem"
-          class="ai-h-r-icon4"
-          @click.stop="delBtn()"
-        ></span>
-        <span
-          v-if="loadNum == 0 && openItem"
-          class="ai-h-r-icon1"
-          @click.stop="backLeft()"
-        ></span>
-        <span
-          v-if="loadNum != 1 && openItem"
-          class="ai-h-r-icon2"
-          @click.stop="backRight()"
-        ></span>
-        <span
-          v-if="loadNum != 1 && openItem"
-          class="ai-h-r-icon3"
-          @click.stop="editBtn()"
-        ></span>
-        <!-- <span class="ai-h-r-icon4" @click.stop="delBtn()"></span> -->
-      </div>
-    </div>
-    <div class="ai-main" v-if="openItem">
-      <!-- <div class="a-m-title">
+	<div class="analysisItem">
+		<div class="ai-header">
+			<div class="ai-h-left" @click.stop="changeOpenItem(!openItem)">
+				<span
+					:class="['ai-h-l-icon', openItem ? 'ai-h-l-iconActive' : '']"
+				></span>
+				<span class="ai-h-l-text">{{ data.jsonData.name }}</span>
+			</div>
+			<div class="ai-h-right">
+				<!-- <span class="ai-h-r-icon1" @click.stop="backLeft()"></span> -->
+				<!-- <span class="ai-h-r-icon2" @click.stop="backRight()"></span> -->
+				<span style="width: 100px; color: red" v-if="loadNum == 2"
+					>优化失败
+				</span>
+				<span
+					:class="loading ? 'text1' : 'text2'"
+					style="width: 100px"
+					v-if="loadNum == 1"
+					>{{ loading ? "优化中..." : "优化完成" }}
+				</span>
+				<span
+					v-if="loadNum == 0 && !openItem"
+					class="ai-h-r-icon4"
+					@click.stop="delBtn()"
+				></span>
+				<span
+					v-if="loadNum == 0 && openItem"
+					class="ai-h-r-icon1"
+					@click.stop="changeShowIndex(-1)"
+				></span>
+				<span
+					v-if="loadNum != 1 && openItem"
+					class="ai-h-r-icon2"
+					@click.stop="changeShowIndex(1)"
+				></span>
+				<span
+					v-if="loadNum != 1 && openItem"
+					class="ai-h-r-icon3"
+					@click.stop="editBtn()"
+				></span>
+				<!-- <span class="ai-h-r-icon4" @click.stop="delBtn()"></span> -->
+			</div>
+		</div>
+		<div class="ai-main" v-if="openItem">
+			<!-- <div class="a-m-title">
 				<span></span>
 				<div>{{ data.title }}分析</div>
 			</div> -->
 
-      <div class="a-m-brief">
-        <mdView :text="data.jsonData.result" />
-        <!-- {{ data.jsonData.result }} -->
-      </div>
-      <div v-for="(item, index) in data.jsonData.dataFileList" :key="item.uid">
-        <div v-if="imgTypeList.includes(checkFileType(item.url))">
-          <img style="max-width: 100%;" :src="item.url" alt="" />
-        </div>
-        <div v-else-if="checkFileType(item.url) == 'md'">
-          <mdView :url="item.url" />
-        </div>
-        <div v-else-if="checkFileType(item.url) == 'json'">
-          <pieChart :url="item.url" />
-        </div>
-      </div>
+			<div class="a-m-brief">
+				<mdView :text="data.jsonData.result" />
+				<!-- {{ data.jsonData.result }} -->
+			</div>
+			<div v-for="(item, index) in data.jsonData.dataFileList" :key="item.uid">
+				<div v-if="imgTypeList.includes(checkFileType(item.url))">
+					<img style="max-width: 100%" :src="item.url" alt="" />
+				</div>
+				<div v-else-if="checkFileType(item.url) == 'md'">
+					<mdView :url="item.url" />
+				</div>
+				<div v-else-if="checkFileType(item.url) == 'json'">
+					<pieChart :url="item.url" />
+				</div>
+			</div>
 
-      <div v-for="(item, index) in data.jsonData.fileList" :key="item.uid">
-        <div v-if="imgTypeList.includes(checkFileType(item.url))">
-          <img style="max-width: 100%;" :src="item.url" alt="" />
-        </div>
-        <div v-else-if="checkFileType(item.url) == 'md'">
-          <mdView :url="item.url" />
-        </div>
-        <div v-else-if="checkFileType(item.url) == 'json'">
-          <pieChart :url="item.url" />
-        </div>
-      </div>
-    </div>
-  </div>
+			<div v-for="(item, index) in data.jsonData.fileList" :key="item.uid">
+				<div v-if="imgTypeList.includes(checkFileType(item.url))">
+					<img style="max-width: 100%" :src="item.url" alt="" />
+				</div>
+				<div v-else-if="checkFileType(item.url) == 'md'">
+					<mdView :url="item.url" />
+				</div>
+				<div v-else-if="checkFileType(item.url) == 'json'">
+					<pieChart :url="item.url" />
+				</div>
+			</div>
+		</div>
+	</div>
 </template>
 
 <script>
 import mdView from "./mdView.vue";
 import pieChart from "./pieChart.vue";
 export default {
-  emits: ["delItem", "editItem"],
-  components: {
-    mdView,
-    pieChart
-  },
-  props: {
-    data: {
-      type: Object,
-      default: () => {
-        return {};
-      }
-    },
-    index: {
-      type: Number,
-      default: 0
-    },
-    tid: {
-      type: String,
-      require: true
-    },
-    fileId: {
-      type: String,
-      require: true
-    }
-  },
-  data() {
-    return {
-      openItem: false,
-      loading: false,
-      loadNum: 0,
-      text1: "text1",
-      text2: "text2",
-      imgTypeList: [
-        "png",
-        "jpg",
-        "jpeg",
-        "bmp",
-        "gif",
-        "webp",
-        "psd",
-        "svg",
-        "tiff"
-      ]
-    };
-  },
-  computed: {
-    checkFileType() {
-      return url => {
-        return url.split(".").pop();
-      };
-    }
-  },
-  methods: {
-    changeOpenItem(newValue) {
-      if (this.loading == true && this.loadNum != 0)
-        return this.$message("请稍后...");
-      this.loadNum = 0;
-      this.openItem = newValue;
-    },
-    backLeft() {
-      this.$message.info("回退左");
-    },
-    backRight() {
-      this.$message.info("回退右");
-    },
-    editBtn() {
-      console.log("👇");
-      this.loading = true;
-      this.openItem = false;
-      this.loadNum = 1;
-      let assistant_id = {
-        课堂观察: { value: "8ab07d41-e143-11ee-aaca-12e77c4cb76b", type: 0 },
-        教学阶段九事件分析: {
-          value: "5e0466b3-0075-11ef-aaca-12e77c4cb76b",
-          type: 0
-        },
-        OMO智慧课堂分析: {
-          value: "4cc367c1-0076-11ef-aaca-12e77c4cb76b",
-          type: 0
-        },
-        布鲁姆问题分类: {
-          value: "eac63117-00a7-11ef-aaca-12e77c4cb76b",
-          type: 0
-        },
-        麦卡锡问题分类: {
-          value: "18545cf7-0125-11ef-aaca-12e77c4cb76b",
-          type: 0
-        },
-        学生回答统计: {
-          value: "2c6ede88-0125-11ef-aaca-12e77c4cb76b",
-          type: 0
-        },
-        课堂活动类型: {
-          value: "41d2d2d4-0125-11ef-aaca-12e77c4cb76b",
-          type: 1
-        },
-        素养目标分析: {
-          value: "b13a98de-0125-11ef-aaca-12e77c4cb76b",
-          type: 1
-        },
-        科学教育目标分析: {
-          value: "d6cd48ab-0125-11ef-aaca-12e77c4cb76b",
-          type: 1
-        },
-        "5E课程改编": {
-          value: "f757826e-0125-11ef-aaca-12e77c4cb76b",
-          type: 2
-        },
-        "5EX课程改编": {
-          value: "0b6b08b7-0126-11ef-aaca-12e77c4cb76b",
-          type: 2
-        },
-        UTOP课程观察: {
-          value: "8e3a389b-014f-11ef-aaca-12e77c4cb76b",
-          type: 3
-        },
-        RST模型: {
-          value: "e649112e-0150-11ef-aaca-12e77c4cb76b",
-          type: 3
-        },
-        RTOP模型: {
-          value: "68265b18-0151-11ef-aaca-12e77c4cb76b",
-          type: 3
-        },
-        课堂质量评价: {
-          value: "25e53379-0152-11ef-aaca-12e77c4cb76b",
-          type: 3
-        },
-        SCOP课堂观察: {
-          value: "d0c76d35-0152-11ef-aaca-12e77c4cb76b",
-          type: 3
-        },
-        RTOP课堂观察: {
-          value: "2ace7ff6-0154-11ef-aaca-12e77c4cb76b",
-          type: 3
-        }
-      };
-      let file_ids = {
-        "03": ["file-E8SvjCHbmhmjKczRWr11OuHx"],
-        "04": ["file-r5phg4I2oFqly4WpW7oOOTnA"]
-      };
-      let parm = {
-        assistant_id: assistant_id[this.data.jsonData.name]
-          ? assistant_id[this.data.jsonData.name].value
-          : null,
-        message:
-          "请使用代码解析器获取文件,帮我根据要求完整的分析,输出请按照要求。",
-        session_name: new Date().getTime(),
-        userId: "1cf9dc4b-d95f-11ea-af4c-52540005ab01",
-        file_ids: this.fileId ? [this.fileId] : file_ids[this.tid]
-      };
+	emits: ["delItem", "editItem"],
+	components: {
+		mdView,
+		pieChart,
+	},
+	props: {
+		data: {
+			type: Object,
+			default: () => {
+				return {};
+			},
+		},
+		index: {
+			type: Number,
+			default: 0,
+		},
+		tid: {
+			type: String,
+			require: true,
+		},
+		fileId: {
+			type: String,
+			require: true,
+		},
+	},
+	data() {
+		return {
+			openItem: false,
+			loading: false,
+			loadNum: 0,
+			showIndex:0,
+			historyResult:[],
+			imgTypeList: [
+				"png",
+				"jpg",
+				"jpeg",
+				"bmp",
+				"gif",
+				"webp",
+				"psd",
+				"svg",
+				"tiff",
+			],
+		};
+	},
+	computed: {
+		checkFileType() {
+			return (url) => {
+				return url.split(".").pop();
+			};
+		},
+	},
+	watch:{
+		showIndex(){
+			let _copyData = JSON.parse(JSON.stringify(this.data));
+			_copyData.jsonData = this.historyResult[this.showIndex];
+			_copyData.json_data = JSON.stringify(_copyData.jsonData);
+			console.log(_copyData)
+			this.$emit("editItem", this.data.id, _copyData);
+		}
+	},
+	methods: {
+		changeOpenItem(newValue) {
+			if (this.loading == true && this.loadNum != 0)
+				return this.$message("请稍后...");
+			this.loadNum = 0;
+			this.openItem = newValue;
+		},
+		backLeft() {
+			this.$message.info("回退左");
+		},
+		backRight() {
+			this.$message.info("回退右");
+		},
+		editBtn() {
+			this.$nextTick(() => {
+				this.loading = true;
+				this.openItem = false;
+				this.loadNum = 1;
+				let assistant_id = {
+					课堂观察: { value: "8ab07d41-e143-11ee-aaca-12e77c4cb76b", type: 0 },
+					教学阶段九事件分析: {
+						value: "5e0466b3-0075-11ef-aaca-12e77c4cb76b",
+						type: 0,
+					},
+					OMO智慧课堂分析: {
+						value: "4cc367c1-0076-11ef-aaca-12e77c4cb76b",
+						type: 0,
+					},
+					布鲁姆问题分类: {
+						value: "eac63117-00a7-11ef-aaca-12e77c4cb76b",
+						type: 0,
+					},
+					麦卡锡问题分类: {
+						value: "18545cf7-0125-11ef-aaca-12e77c4cb76b",
+						type: 0,
+					},
+					学生回答统计: {
+						value: "2c6ede88-0125-11ef-aaca-12e77c4cb76b",
+						type: 0,
+					},
+					课堂活动类型: {
+						value: "41d2d2d4-0125-11ef-aaca-12e77c4cb76b",
+						type: 1,
+					},
+					素养目标分析: {
+						value: "b13a98de-0125-11ef-aaca-12e77c4cb76b",
+						type: 1,
+					},
+					科学教育目标分析: {
+						value: "d6cd48ab-0125-11ef-aaca-12e77c4cb76b",
+						type: 1,
+					},
+					"5E课程改编": {
+						value: "f757826e-0125-11ef-aaca-12e77c4cb76b",
+						type: 2,
+					},
+					"5EX课程改编": {
+						value: "0b6b08b7-0126-11ef-aaca-12e77c4cb76b",
+						type: 2,
+					},
+					UTOP课程观察: {
+						value: "8e3a389b-014f-11ef-aaca-12e77c4cb76b",
+						type: 3,
+					},
+					RST模型: {
+						value: "e649112e-0150-11ef-aaca-12e77c4cb76b",
+						type: 3,
+					},
+					RTOP模型: {
+						value: "68265b18-0151-11ef-aaca-12e77c4cb76b",
+						type: 3,
+					},
+					课堂质量评价: {
+						value: "25e53379-0152-11ef-aaca-12e77c4cb76b",
+						type: 3,
+					},
+					SCOP课堂观察: {
+						value: "d0c76d35-0152-11ef-aaca-12e77c4cb76b",
+						type: 3,
+					},
+					RTOP课堂观察: {
+						value: "2ace7ff6-0154-11ef-aaca-12e77c4cb76b",
+						type: 3,
+					},
+				};
+				let file_ids = {
+					"03": ["file-E8SvjCHbmhmjKczRWr11OuHx"],
+					"04": ["file-r5phg4I2oFqly4WpW7oOOTnA"],
+				};
+				let parm = {
+					assistant_id: assistant_id[this.data.jsonData.name]
+						? assistant_id[this.data.jsonData.name].value
+						: null,
+					message:
+						"请使用代码解析器获取文件,帮我根据要求完整的分析,输出请按照要求。",
+					session_name: new Date().getTime(),
+					userId: "1cf9dc4b-d95f-11ea-af4c-52540005ab01",
+					file_ids: this.fileId ? [this.fileId] : file_ids[this.tid],
+				};
 
-      if (!parm.assistant_id) {
-        this.loading = false;
-        this.loadNum = 2;
-        return this.$message.error("未找到对应的AI助手");
-      }
+				if (!parm.assistant_id) {
+					this.loading = false;
+					this.loadNum = 2;
+					return this.$message.error("未找到对应的AI助手");
+				}
 
-      this.ajax
-        .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
-        .then(res => {
-          console.log("👇👇");
-          let _data = res.data.FunctionResponse;
-          if (
-            !_data.message ||
-            _data.message.indexOf("由于我无法直接访问您上传的文件内容") > -1
-          ) {
-            this.loading = false;
-            return this.$message.error("AI无法识别优化");
-          }
-          let _copyData = JSON.parse(JSON.stringify(this.data));
-          _copyData.jsonData.result = _data.message;
-          _copyData.jsonData.dataFileList = [];
-          _copyData.jsonData.fileList = [];
-          _copyData.json_data = JSON.stringify(_copyData.jsonData);
-          this.$emit("editItem", this.data.id, _copyData);
-          let pram2 = {
-            id: _copyData.id,
-            json_data: _copyData.json_data
-          };
-          this.ajax.post(
-            "https://gpt4.cocorobo.cn/update_classroom_observation",
-            pram2
-          );
-          this.loading = false;
-        })
-        .catch(err => {
-          this.$message.error("AI无法识别优化");
-          this.loading = false;
-          this.loadNum = 2;
-        });
-      // this.$emit
-      // setTimeout(()=>{
-      // 	this.loading = false;
-      // 	this.$emit("editItem", this.data);
-      // },1000)
-    },
-    delBtn() {
-      this.$confirm("确定删除?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "error"
-      }).then(() => {
-        this.$emit("delItem", this.data.id);
-      });
-    }
-  }
+				this.ajax
+					.post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
+					.then((res) => {
+						console.log("👇👇");
+						let _data = res.data.FunctionResponse;
+						if (
+							!_data.message ||
+							_data.message.indexOf("由于我无法直接访问您上传的文件内容") > -1
+						) {
+							this.loading = false;
+							return this.$message.error("AI无法识别优化");
+						}
+						let _copyData = JSON.parse(JSON.stringify(this.data));
+						_copyData.jsonData.result = _data.message;
+						_copyData.jsonData.dataFileList = [];
+						_copyData.jsonData.fileList = [];
+						_copyData.json_data = JSON.stringify(_copyData.jsonData);
+						// this.historyResult.push(_copyData.jsonData)
+						this.historyResult.splice(this.showIndex+1,0,_copyData.jsonData)
+						this.changeShowIndex(1);
+						// this.$emit("editItem", this.data.id, _copyData);
+						
+
+						this.loading = false;
+						
+					})
+					.catch((err) => {
+						this.$message.error("AI无法识别优化");
+						this.loading = false;
+						this.loadNum = 2;
+					});
+				// this.$emit
+				// setTimeout(()=>{
+				// 	this.loading = false;
+				// 	this.$emit("editItem", this.data);
+				// },1000)
+			});
+		},
+		delBtn() {
+			this.$confirm("确定删除?", "提示", {
+				confirmButtonText: "确定",
+				cancelButtonText: "取消",
+				type: "error",
+			}).then(() => {
+				this.$emit("delItem", this.data.id);
+			});
+		},
+		changeShowIndex(value){
+			if(value==-1){
+				if(this.showIndex<=0)return this.$message.info("已经是第一个了")
+				this.showIndex--;
+			}else if(value==1){
+				if(this.showIndex>=this.historyResult.length-1)return this.$message.info("已经是最后一个了");
+				this.showIndex++;
+			}
+		}
+	},
+	mounted(){
+		this.historyResult.push(this.data.jsonData)
+	},
 };
 </script>
 
 <style scoped>
 .analysisItem {
-  width: 100%;
-  height: auto;
+	width: 100%;
+	height: auto;
 
-  margin: 11.7px 0px;
+	margin: 11.7px 0px;
 
-  padding-right: 10px;
-  box-sizing: border-box;
+	padding-right: 10px;
+	box-sizing: border-box;
 }
 .text1 {
-  color: rgba(54, 129, 252, 1);
+	color: rgba(54, 129, 252, 1);
 }
 .text2 {
-  color: rgba(23, 196, 105, 1);
+	color: rgba(23, 196, 105, 1);
 }
 .ai-header {
-  width: 100%;
-  height: 50px;
-  display: flex;
-  background-color: white;
-  border-radius: 5px;
+	width: 100%;
+	height: 50px;
+	display: flex;
+	background-color: white;
+	border-radius: 5px;
 }
 .ai-h-left {
-  flex: 1;
-  height: 100%;
-  display: flex;
-  align-items: center;
-  box-sizing: border-box;
-  padding: 0 10px;
-  cursor: pointer;
+	flex: 1;
+	height: 100%;
+	display: flex;
+	align-items: center;
+	box-sizing: border-box;
+	padding: 0 10px;
+	cursor: pointer;
 }
 
 .ai-h-l-icon {
-  width: 16px;
-  height: 16px;
-  background: url("../../../../assets/icon/classroomObservation/right.png")
-    no-repeat;
-  background-size: 100% 100%;
-  margin-right: 10px;
-  transition: 0.3s;
+	width: 16px;
+	height: 16px;
+	background: url("../../../../assets/icon/classroomObservation/right.png")
+		no-repeat;
+	background-size: 100% 100%;
+	margin-right: 10px;
+	transition: 0.3s;
 }
 
 .ai-h-l-iconActive {
-  transform: rotate(90deg);
+	transform: rotate(90deg);
 }
 .ai-h-l-text {
-  font-size: 18px;
+	font-size: 18px;
 }
 
 .ai-h-right {
-  width: auto;
-  height: 100%;
-  display: flex;
-  align-items: center;
-  justify-content: space-around;
-  position: relative;
+	width: auto;
+	height: 100%;
+	display: flex;
+	align-items: center;
+	justify-content: space-around;
+	position: relative;
 }
 
 .ai-h-right > span {
-  width: 18px;
-  height: 18px;
-  background-size: 100% 100%;
-  margin: 0 10px;
-  cursor: pointer;
+	width: 18px;
+	height: 18px;
+	background-size: 100% 100%;
+	margin: 0 10px;
+	cursor: pointer;
 }
 
 .ai-h-r-icon1 {
-  background: url("../../../../assets/icon/classroomObservation/back.png");
-  /* 镜像 */
-  transform: scaleX(-1);
+	background: url("../../../../assets/icon/classroomObservation/back.png");
+	/* 镜像 */
+	transform: scaleX(-1);
 }
 
 .ai-h-r-icon2 {
-  background: url("../../../../assets/icon/classroomObservation/back.png");
+	background: url("../../../../assets/icon/classroomObservation/back.png");
 }
 
 .ai-h-r-icon3 {
-  background: url("../../../../assets/icon/classroomObservation/edit.png");
-  /* background: url("../../../../assets/icon/classroomObservation/del.png"); */
-  /* display: none; */
+	background: url("../../../../assets/icon/classroomObservation/edit.png");
+	/* background: url("../../../../assets/icon/classroomObservation/del.png"); */
+	/* display: none; */
 }
 
 .ai-header:hover .ai-h-r-icon4 {
-  display: block;
+	display: block;
 }
 
 .ai-h-r-icon4 {
-  background: url("../../../../assets/icon/classroomObservation/del.png");
-  /* position: absolute; */
-  /* right: -40px; */
-  display: none;
+	background: url("../../../../assets/icon/classroomObservation/del.png");
+	/* position: absolute; */
+	/* right: -40px; */
+	display: none;
 }
 
 .analysisItem:hover .ai-h-r-icon4 {
-  display: block;
+	display: block;
 }
 
 .ai-main {
-  width: 100%;
-  height: auto;
-  background-color: white;
-  border-radius: 0 0 5px 5px;
-  overflow: auto;
-  box-sizing: border-box;
-  padding: 10px 20px;
+	width: 100%;
+	height: auto;
+	background-color: white;
+	border-radius: 0 0 5px 5px;
+	overflow: auto;
+	box-sizing: border-box;
+	padding: 10px 20px;
 }
 
 .a-m-brief {
-  font-size: 16px;
-  /* 斜体 */
-  /* font-style: italic; */
-  margin-bottom: 10px;
+	font-size: 16px;
+	/* 斜体 */
+	/* font-style: italic; */
+	margin-bottom: 10px;
 }
 
 td,
 th {
-  padding: 10px;
+	padding: 10px;
 }
 </style>

+ 4 - 0
src/components/pages/classroomObservation/components/mdView.vue

@@ -114,4 +114,8 @@ export default {
     text-align: center;
     padding: 10px 10px;
 }
+
+.mdView>>>ol{
+	margin-left: 20px;
+}
 </style>

+ 256 - 202
src/components/pages/classroomObservation/components/messageArea.vue

@@ -24,7 +24,8 @@
 				v-loading="baseMessageLoading"
 			/>
 
-			<analysis @updateMessage="updateMessage"
+			<analysis
+				@updateMessage="updateMessage"
 				ref="analysis0"
 				@delItem="delAnalysisItem"
 				@editItem="editAnalysisItem"
@@ -33,8 +34,10 @@
 				:type="0"
 				:tid="tid"
 				:fileId="fileId"
-				v-loading="currencyLoading"/>
-			<analysis @updateMessage="updateMessage"
+				v-loading="currencyLoading"
+			/>
+			<analysis
+				@updateMessage="updateMessage"
 				ref="analysis1"
 				@delItem="delAnalysisItem"
 				@editItem="editAnalysisItem"
@@ -43,8 +46,10 @@
 				:type="1"
 				:tid="tid"
 				:fileId="fileId"
-				v-loading="scienceLoading"/>
-			<analysis @updateMessage="updateMessage"
+				v-loading="scienceLoading"
+			/>
+			<analysis
+				@updateMessage="updateMessage"
 				ref="analysis2"
 				@delItem="delAnalysisItem"
 				@editItem="editAnalysisItem"
@@ -53,8 +58,10 @@
 				:type="2"
 				:tid="tid"
 				:fileId="fileId"
-				v-loading="extendLoading"/>
-			<analysis @updateMessage="updateMessage"
+				v-loading="extendLoading"
+			/>
+			<analysis
+				@updateMessage="updateMessage"
 				ref="analysis3"
 				@delItem="delAnalysisItem"
 				@editItem="editAnalysisItem"
@@ -63,7 +70,8 @@
 				:type="3"
 				:tid="tid"
 				:fileId="fileId"
-				v-loading="valueAddedLoading"/>
+				v-loading="valueAddedLoading"
+			/>
 			<!-- <currencyAnalysis
 				@updateMessage="updateMessage"
 				@delItem="delAnalysisItem"
@@ -145,7 +153,9 @@
 					<div style="display: flex; flex-wrap: wrap">
 						<div
 							class="a-d-b-item"
-							v-for="(item, index) in dialogTagDataList.filter(i=>i.type==tagIndex)"
+							v-for="(item, index) in dialogTagDataList.filter(
+								(i) => i.type == tagIndex
+							)"
 							:key="index"
 						>
 							<div class="a-d-b-i-top">
@@ -170,7 +180,10 @@
 									"
 								>
 									<!-- <div class="a-d-b-i-t-btn">详情</div> -->
-									<div class="a-d-b-i-t-btn1" @click="addAnalysisItem(item.title)">
+									<div
+										class="a-d-b-i-t-btn1"
+										@click="addAnalysisItem(item.title)"
+									>
 										添加
 									</div>
 								</div>
@@ -197,17 +210,17 @@ export default {
 		// currencyAnalysis,
 		// scienceAnalysis,
 		// extendAnalysis,
-		analysis
+		analysis,
 	},
 	props: {
 		tid: {
 			type: String,
 			default: "",
 		},
-		fileId:{
-			type:String,
-			default:""
-		}
+		fileId: {
+			type: String,
+			default: "",
+		},
 	},
 	data() {
 		return {
@@ -215,113 +228,113 @@ export default {
 			dialogVisible: false,
 			tagIndex: 0,
 			loading: false,
-			baseMessageLoading:false,
+			baseMessageLoading: false,
 			currencyLoading: false,
 			scienceLoading: false,
 			extendLoading: false,
-			valueAddedLoading:false,
+			valueAddedLoading: false,
 			input2: "",
 			dialogTagList: [
 				{ id: 0, name: "通用课堂分析" },
 				{ id: 1, name: "科学课堂分析" },
 				{ id: 2, name: "扩展分析" },
-				{ id: 3, name: "增值性分析"}
+				{ id: 3, name: "增值性分析" },
 			],
 			dialogTagDataList: [
-					{
-						title: "OMO智慧课堂分析",
-						brief: "多维度分析课堂整体情况",
-						type:0
-					},
-					{
-						title: "教学阶段九事件分析",
-						brief: "使用加涅九事件分析教学环节",
-						type:0
-					},
-					{
-						title: "布鲁姆问题分类",
-						brief: "多维度分析课堂整体情况",
-						type:0
-					},
-					{
-						title: "麦卡锡问题分类",
-						brief: "多维度分析课堂整体情况",
-						type:0
-					},
-					{
-						title: "学生回答情况",
-						brief: "多维度分析课堂整体情况",
-						type:0
-					},
-					{ title: "课堂时间分配", brief: "多维度分析课堂整体情况",type:0 },
-					{ title: "师生互动分析", brief: "多维度分析课堂整体情况",type:0 },
-					{ title: "教学模式分析", brief: "多维度分析课堂整体情况",type:0 },
-					{
-						title: "课堂活动类型",
-						brief: "多维度分析课堂整体情况",
-						type:1
-					},
-					{
-						title: "学科核心素养发展",
-						brief: "使用加涅九事件分析教学环节",
-						type:1
-					},
-					{
-						title: "科学教育目标分析",
-						brief: "多维度分析课堂整体情况",
-						type:1
-					},
-					{
-						title: "PORTAAL课堂观察",
-						brief: "使用加涅九事件分析教学环节",
-						type:1
-					},
-					{
-						title: "5E课程改编",
-						brief: "多维度分析课堂整体情况",
-						type:2
-					},
-					{
-						title: "5EX课程改编",
-						brief: "使用加涅九事件分析教学环节",
-						type:2
-					},
-					{
-						title:"UTOP课程观察",
-						brief:"多维度分析课堂整体情况",
-						value: "8e3a389b-014f-11ef-aaca-12e77c4cb76b",
-						type: 3,
-					},
-					{
-						title:"RST模型",
-						brief:"多维度分析课堂整体情况",
-						value:"e649112e-0150-11ef-aaca-12e77c4cb76b",
-						type:3,
-					},
-					{
-						title:"RTOP模型",
-						brief:"多维度分析课堂整体情况",
-						value:"68265b18-0151-11ef-aaca-12e77c4cb76b",
-						type:3,
-					},
-					{
-						title:"课堂质量评价",
-						brief:"多维度分析课堂整体情况",
-						value:"25e53379-0152-11ef-aaca-12e77c4cb76b",
-						type:3,
-					},
-					{
-						title:"SCOP课堂观察",
-						brief:"多维度分析课堂整体情况",
-						value:"d0c76d35-0152-11ef-aaca-12e77c4cb76b",
-						type:3,
-					},
-					{
-						title:"RTOP课堂观察",
-						brief:"多维度分析课堂整体情况",
-						value:"2ace7ff6-0154-11ef-aaca-12e77c4cb76b",
-						type:3
-					}
+				{
+					title: "OMO智慧课堂分析",
+					brief: "多维度分析课堂整体情况",
+					type: 0,
+				},
+				{
+					title: "教学阶段九事件分析",
+					brief: "使用加涅九事件分析教学环节",
+					type: 0,
+				},
+				{
+					title: "布鲁姆问题分类",
+					brief: "多维度分析课堂整体情况",
+					type: 0,
+				},
+				{
+					title: "麦卡锡问题分类",
+					brief: "多维度分析课堂整体情况",
+					type: 0,
+				},
+				{
+					title: "学生回答情况",
+					brief: "多维度分析课堂整体情况",
+					type: 0,
+				},
+				{ title: "课堂时间分配", brief: "多维度分析课堂整体情况", type: 0 },
+				{ title: "师生互动分析", brief: "多维度分析课堂整体情况", type: 0 },
+				{ title: "教学模式分析", brief: "多维度分析课堂整体情况", type: 0 },
+				{
+					title: "课堂活动类型",
+					brief: "多维度分析课堂整体情况",
+					type: 1,
+				},
+				{
+					title: "学科核心素养发展",
+					brief: "使用加涅九事件分析教学环节",
+					type: 1,
+				},
+				{
+					title: "科学教育目标分析",
+					brief: "多维度分析课堂整体情况",
+					type: 1,
+				},
+				{
+					title: "PORTAAL课堂观察",
+					brief: "使用加涅九事件分析教学环节",
+					type: 1,
+				},
+				{
+					title: "5E课程改编",
+					brief: "多维度分析课堂整体情况",
+					type: 2,
+				},
+				{
+					title: "5EX课程改编",
+					brief: "使用加涅九事件分析教学环节",
+					type: 2,
+				},
+				{
+					title: "UTOP课程观察",
+					brief: "多维度分析课堂整体情况",
+					value: "8e3a389b-014f-11ef-aaca-12e77c4cb76b",
+					type: 3,
+				},
+				{
+					title: "RST模型",
+					brief: "多维度分析课堂整体情况",
+					value: "e649112e-0150-11ef-aaca-12e77c4cb76b",
+					type: 3,
+				},
+				{
+					title: "RTOP模型",
+					brief: "多维度分析课堂整体情况",
+					value: "68265b18-0151-11ef-aaca-12e77c4cb76b",
+					type: 3,
+				},
+				{
+					title: "课堂质量评价",
+					brief: "多维度分析课堂整体情况",
+					value: "25e53379-0152-11ef-aaca-12e77c4cb76b",
+					type: 3,
+				},
+				{
+					title: "SCOP课堂观察",
+					brief: "多维度分析课堂整体情况",
+					value: "d0c76d35-0152-11ef-aaca-12e77c4cb76b",
+					type: 3,
+				},
+				{
+					title: "RTOP课堂观察",
+					brief: "多维度分析课堂整体情况",
+					value: "2ace7ff6-0154-11ef-aaca-12e77c4cb76b",
+					type: 3,
+				},
 			],
 			bmData: {},
 			dataList: [],
@@ -342,6 +355,16 @@ export default {
 			let _index = this.dataList.findIndex((i) => i.id == id);
 			if (_index > -1) {
 				this.dataList[_index] = _data;
+				if (this.dataList[_index].id) {
+					let pram2 = {
+						id: this.dataList[_index].id,
+						json_data: this.dataList[_index].json_data,
+					};
+					this.ajax.post(
+						"https://gpt4.cocorobo.cn/update_classroom_observation",
+						pram2
+					);
+				}
 				this.$forceUpdate();
 				this.$message.success("执行成功");
 			} else {
@@ -374,38 +397,37 @@ export default {
 		addAnalysisItem(title) {
 			return new Promise((resolve, reject) => {
 				this.dialogVisible = false;
-				this.loading = true;
 				let assistant_id = {
-					"课堂观察": { value: "8ab07d41-e143-11ee-aaca-12e77c4cb76b", type: 0 },
-					"教学阶段九事件分析": {
+					课堂观察: { value: "8ab07d41-e143-11ee-aaca-12e77c4cb76b", type: 0 },
+					教学阶段九事件分析: {
 						value: "5e0466b3-0075-11ef-aaca-12e77c4cb76b",
 						type: 0,
 					},
-					"OMO智慧课堂分析": {
+					OMO智慧课堂分析: {
 						value: "4cc367c1-0076-11ef-aaca-12e77c4cb76b",
 						type: 0,
 					},
-					"布鲁姆问题分类": {
+					布鲁姆问题分类: {
 						value: "eac63117-00a7-11ef-aaca-12e77c4cb76b",
 						type: 0,
 					},
-					"麦卡锡问题分类": {
+					麦卡锡问题分类: {
 						value: "18545cf7-0125-11ef-aaca-12e77c4cb76b",
 						type: 0,
 					},
-					"学生回答统计": {
+					学生回答统计: {
 						value: "2c6ede88-0125-11ef-aaca-12e77c4cb76b",
 						type: 0,
 					},
-					"课堂活动类型": {
+					课堂活动类型: {
 						value: "41d2d2d4-0125-11ef-aaca-12e77c4cb76b",
 						type: 1,
 					},
-					"素养目标分析": {
+					素养目标分析: {
 						value: "b13a98de-0125-11ef-aaca-12e77c4cb76b",
 						type: 1,
 					},
-					"科学教育目标分析": {
+					科学教育目标分析: {
 						value: "d6cd48ab-0125-11ef-aaca-12e77c4cb76b",
 						type: 1,
 					},
@@ -417,81 +439,113 @@ export default {
 						value: "0b6b08b7-0126-11ef-aaca-12e77c4cb76b",
 						type: 2,
 					},
-					"UTOP课程观察":{
+					UTOP课程观察: {
 						value: "8e3a389b-014f-11ef-aaca-12e77c4cb76b",
 						type: 3,
 					},
-					"RST模型":{
-						value:"e649112e-0150-11ef-aaca-12e77c4cb76b",
-						type:3,
+					RST模型: {
+						value: "e649112e-0150-11ef-aaca-12e77c4cb76b",
+						type: 3,
 					},
-					"RTOP模型":{
-						value:"68265b18-0151-11ef-aaca-12e77c4cb76b",
-						type:3,
+					RTOP模型: {
+						value: "68265b18-0151-11ef-aaca-12e77c4cb76b",
+						type: 3,
 					},
-					"课堂质量评价":{
-						value:"25e53379-0152-11ef-aaca-12e77c4cb76b",
-						type:3,
+					课堂质量评价: {
+						value: "25e53379-0152-11ef-aaca-12e77c4cb76b",
+						type: 3,
 					},
-					"SCOP课堂观察":{
-						value:"d0c76d35-0152-11ef-aaca-12e77c4cb76b",
-						type:3,
+					SCOP课堂观察: {
+						value: "d0c76d35-0152-11ef-aaca-12e77c4cb76b",
+						type: 3,
+					},
+					RTOP课堂观察: {
+						value: "2ace7ff6-0154-11ef-aaca-12e77c4cb76b",
+						type: 3,
 					},
-					"RTOP课堂观察":{
-						value:"2ace7ff6-0154-11ef-aaca-12e77c4cb76b",
-						type:3
-					}
 				};
 				let file_ids = {
-					'03':["file-E8SvjCHbmhmjKczRWr11OuHx"],
-					'04':["file-r5phg4I2oFqly4WpW7oOOTnA"],
+					"03": ["file-E8SvjCHbmhmjKczRWr11OuHx"],
+					"04": ["file-r5phg4I2oFqly4WpW7oOOTnA"],
 				};
 				let parm = {
-					assistant_id: assistant_id[title]
-						? assistant_id[title].value
-						: null,
-					message: "请使用代码解析器获取文件,帮我根据要求完整的分析,输出请按照要求。",
+					assistant_id: assistant_id[title] ? assistant_id[title].value : null,
+					message:
+						"请使用代码解析器获取文件,帮我根据要求完整的分析,输出请按照要求。",
 					session_name: new Date().getTime(),
 					userId: "1cf9dc4b-d95f-11ea-af4c-52540005ab01",
-					file_ids: this.fileId?[this.fileId]:file_ids[this.tid],
+					file_ids: this.fileId ? [this.fileId] : file_ids[this.tid],
 				};
 
 				if (!parm.assistant_id) {
-					this.loading = false;
 					resolve();
 					return this.$message.error("未找到对应的AI助手");
 				}
-				this.ajax
-					.post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
-					.then((res) => {
-						let result = res.data.FunctionResponse;
-						if(!result.message || result.message.indexOf('由于我无法直接访问您上传的文件内容')>-1){
-							this.loading = false;
-							resolve();
-							return this.$message.error(`${title}无法生成`)
-						}
-						this.dataList.push({
-							id:assistant_id[result.title].value,
-							Type:assistant_id[result.title].type,
-							createTime:new Date(),
-							tId:this.tid,
-							tIndex:2,
-							jsonData:{
-								dataFileList:[],
-								fileList:[],
-								fileList2:[],
-								name:result.title,
-								result:result.message
-							}
-						})
-						resolve();
-						this.loading = false;
-					})
-					.catch((e) => {
-						this.$message.error(`${title}无法生成`)
-						this.loading = false;
-						resolve();
-					});
+				this.dataList.push({
+					id: assistant_id[title].value,
+					Type: assistant_id[title].type,
+					createTime: new Date(),
+					tId: this.tid,
+					tIndex: 2,
+					jsonData: {
+						dataFileList: [],
+						fileList: [],
+						fileList2: [],
+						name: title,
+						result: "",
+					},
+				});
+
+				if (assistant_id[title].type == 0) {
+					this.$refs.analysis0.getReport(
+						this.dataList.filter((i) => i.Type == 0).length - 1
+					);
+				} else if (assistant_id[title].type == 1) {
+					this.$refs.analysis1.getReport(
+						this.dataList.filter((i) => i.Type == 1).length - 1
+					);
+				} else if (assistant_id[title].type == 2) {
+					this.$refs.analysis1.getReport(
+						this.dataList.filter((i) => i.Type == 2).length - 1
+					);
+				} else if (assistant_id[title].type == 3) {
+					this.$refs.analysis1.getReport(
+						this.dataList.filter((i) => i.Type == 3).length - 1
+					);
+				}
+				this.$message.success("添加成功");
+				resolve();
+				// this.ajax
+				// 	.post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
+				// 	.then((res) => {
+				// 		let result = res.data.FunctionResponse;
+				// 		if(!result.message || result.message.indexOf('由于我无法直接访问您上传的文件内容')>-1){
+				// 			this.loading = false;
+				// 			resolve();
+				// 			return this.$message.error(`${title}无法生成`)
+				// 		}
+				// 		this.dataList.push({
+				// 			id:assistant_id[result.title].value,
+				// 			Type:assistant_id[result.title].type,
+				// 			createTime:new Date(),
+				// 			tId:this.tid,
+				// 			tIndex:2,
+				// 			jsonData:{
+				// 				dataFileList:[],
+				// 				fileList:[],
+				// 				fileList2:[],
+				// 				name:result.title,
+				// 				result:result.message
+				// 			}
+				// 		})
+				// 		resolve();
+				// 		this.loading = false;
+				// 	})
+				// 	.catch((e) => {
+				// 		this.$message.error(`${title}无法生成`)
+				// 		this.loading = false;
+				// 		resolve();
+				// 	});
 			});
 		},
 		// getFileId() {
@@ -507,9 +561,9 @@ export default {
 		// 				: [];
 		// 			this.$emit('updateFileIdid', _data[0].id)
 		// 			if(_data[0].jsonData !='' ){
-		// 				this.$emit("updateFileId", JSON.parse(_data[0].jsonData).file_ids)				
+		// 				this.$emit("updateFileId", JSON.parse(_data[0].jsonData).file_ids)
 		// 			}else {
-		// 				this.$emit("updateFileId", '')				
+		// 				this.$emit("updateFileId", '')
 		// 			}
 		// 		});
 		// },
@@ -522,22 +576,22 @@ export default {
 			this.currencyLoading = true;
 			this.baseMessageLoading = true;
 			this.bmData = {
-				id:"",
-				tId:this.tid,
-				tIndex:0,
-				jsonData:{
-					activity_methods:"",
-					activity_structure:"",
-					classroom_resources:"",
-					courseName:"",
-					name:"",
-					studentNum:0,
-					subject:"",
-					textbook:"",
-				}
-			}
+				id: "",
+				tId: this.tid,
+				tIndex: 0,
+				jsonData: {
+					activity_methods: "",
+					activity_structure: "",
+					classroom_resources: "",
+					courseName: "",
+					name: "",
+					studentNum: 0,
+					subject: "",
+					textbook: "",
+				},
+			};
 			this.imageList = [];
-				this.dataList = [];
+			this.dataList = [];
 			this.ajax
 				.post("https://gpt4.cocorobo.cn/get_classroom_observation_new", pram)
 				.then((res) => {
@@ -621,7 +675,7 @@ export default {
 					this.extendLoading = false;
 				});
 		},
-		getValueAddedData(){
+		getValueAddedData() {
 			let pram = {
 				tid: this.tid,
 				// tid:'02',
@@ -700,12 +754,12 @@ export default {
 				fn ? fn() : "";
 			});
 		},
-		getReport(){
-			this.$refs.analysis0.getReport()
-			this.$refs.analysis1.getReport()
-			this.$refs.analysis2.getReport()
-			this.$refs.analysis3.getReport()
-		}
+		getReport() {
+			this.$refs.analysis0.getReport();
+			this.$refs.analysis1.getReport();
+			this.$refs.analysis2.getReport();
+			this.$refs.analysis3.getReport();
+		},
 	},
 	mounted() {
 		this.getData();