|
@@ -273,7 +273,11 @@
|
|
|
@success="bindingForm"
|
|
|
/>
|
|
|
<!-- 保存模板 -->
|
|
|
- <saveTemplateDialog ref="saveTemplateDialogRef" :dataList="dataList" />
|
|
|
+ <saveTemplateDialog
|
|
|
+ ref="saveTemplateDialogRef"
|
|
|
+ :bmData="bmData"
|
|
|
+ :dataList="dataList"
|
|
|
+ />
|
|
|
<!-- 分析模板 -->
|
|
|
<analysisTemplateDialog
|
|
|
ref="analysisTemplateDialogRef"
|
|
@@ -449,6 +453,7 @@ export default {
|
|
|
useTemplate(json) {
|
|
|
let _result = [];
|
|
|
json.forEach(i => {
|
|
|
+ if(i.isOtherData)return _result.push(i);
|
|
|
let _obj = {
|
|
|
jsonData: i.jsonData,
|
|
|
type: i.Type,
|
|
@@ -456,10 +461,12 @@ export default {
|
|
|
};
|
|
|
_result.push(_obj);
|
|
|
});
|
|
|
+ // return console.log(_result);
|
|
|
this.$parent
|
|
|
.addNewCourseByTemplate(_result)
|
|
|
.then(res => {
|
|
|
this.$refs.analysisTemplateDialogRef.close();
|
|
|
+
|
|
|
this.$refs.analysisTemplateDialogRef.loading = false;
|
|
|
})
|
|
|
.catch(e => {
|
|
@@ -474,7 +481,7 @@ export default {
|
|
|
this.$refs.saveTemplateDialogRef.open();
|
|
|
// this.$message.info("另存为模板");
|
|
|
},
|
|
|
- addAnalysisItem(name, id) {
|
|
|
+ addAnalysisItem(name, id, type) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
var OpenCC = require("opencc-js");
|
|
|
let converter = OpenCC.Converter({
|
|
@@ -499,14 +506,14 @@ export default {
|
|
|
return this.$message.error("未找到对应的AI助手");
|
|
|
}
|
|
|
let newIndexData = this.dataList
|
|
|
- .filter(i => i.Type == assistant.type)
|
|
|
+ .filter(i => i.Type == type)
|
|
|
.sort((a, b) => new Date(a.createtime) - new Date(b.createtime));
|
|
|
newIndexData = newIndexData.length
|
|
|
? newIndexData[newIndexData.length - 1]
|
|
|
: null;
|
|
|
let newIndex = newIndexData
|
|
|
? newIndexData.tIndex + 1
|
|
|
- : assistant.type == 0
|
|
|
+ : type == 0
|
|
|
? 2
|
|
|
: 0;
|
|
|
let params = {
|
|
@@ -516,13 +523,14 @@ export default {
|
|
|
name: assistant.name,
|
|
|
anotherName: assistant.name,
|
|
|
mId: assistant.id,
|
|
|
+ echartsType: assistant.echartsType,
|
|
|
result: assistant.detail,
|
|
|
fileList: [],
|
|
|
dataFileList: [],
|
|
|
content: ""
|
|
|
}),
|
|
|
tid: this.tid,
|
|
|
- type: assistant.type.toString()
|
|
|
+ type: type
|
|
|
};
|
|
|
|
|
|
// 这里调用添加
|
|
@@ -555,171 +563,183 @@ export default {
|
|
|
},
|
|
|
getCurrencyAndBaseMessageData() {
|
|
|
if (!this.tid) return;
|
|
|
- let pram = {
|
|
|
- tid: this.tid,
|
|
|
- // tid:'02',
|
|
|
- type: "0"
|
|
|
- };
|
|
|
- this.currencyLoading = true;
|
|
|
- this.dialogTagList.find(i => i.value == 0).loading = 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: ""
|
|
|
- }
|
|
|
- };
|
|
|
- this.imageList = [];
|
|
|
- this.dataList = [];
|
|
|
- this.dialogTagList = [
|
|
|
- { value: 0, name: "通用课堂分析", loading: false },
|
|
|
- { value: 1, name: "学科课堂分析", loading: false },
|
|
|
- { value: 2, name: "扩展分析", loading: false }
|
|
|
- ];
|
|
|
- this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/get_classroom_observation_new", pram)
|
|
|
- .then(res => {
|
|
|
- let _data = res.data.FunctionResponse.result.length
|
|
|
- ? JSON.parse(res.data.FunctionResponse.result)
|
|
|
- : [];
|
|
|
- if (_data.length == 0) {
|
|
|
- return this.insertBaseMessage().then(_ => {
|
|
|
- this.getCurrencyAndBaseMessageData();
|
|
|
- });
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let pram = {
|
|
|
+ tid: this.tid,
|
|
|
+ // tid:'02',
|
|
|
+ type: "0"
|
|
|
+ };
|
|
|
+ this.currencyLoading = true;
|
|
|
+ this.dialogTagList.find(i => i.value == 0).loading = 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: ""
|
|
|
}
|
|
|
- let _bmData = _data.find(i => i.tIndex == 0);
|
|
|
- let _dialogTagList = [];
|
|
|
- // 基础信息
|
|
|
- _bmData.jsonData = JSON.parse(_bmData.jsonData);
|
|
|
- _dialogTagList = _bmData.jsonData.dialogTagList || [
|
|
|
- { value: 0, name: "通用课堂分析", loading: false },
|
|
|
- { value: 1, name: "学科课堂分析", loading: false },
|
|
|
- { value: 2, name: "扩展分析", loading: false }
|
|
|
- ];
|
|
|
- // 图片
|
|
|
- let _imageList = _data.find(i => i.tIndex == 1);
|
|
|
- _imageList.jsonData = JSON.parse(_imageList.jsonData);
|
|
|
+ };
|
|
|
+ this.imageList = [];
|
|
|
+ this.dataList = [];
|
|
|
+ this.dialogTagList = [
|
|
|
+ { value: 0, name: "通用课堂分析", loading: false },
|
|
|
+ { value: 1, name: "学科课堂分析", loading: false },
|
|
|
+ { value: 2, name: "扩展分析", loading: false }
|
|
|
+ ];
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/get_classroom_observation_new", pram)
|
|
|
+ .then(res => {
|
|
|
+ let _data = res.data.FunctionResponse.result.length
|
|
|
+ ? JSON.parse(res.data.FunctionResponse.result)
|
|
|
+ : [];
|
|
|
+ if (_data.length == 0) {
|
|
|
+ return this.insertBaseMessage().then(_ => {
|
|
|
+ this.getCurrencyAndBaseMessageData();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let _bmData = _data.find(i => i.tIndex == 0);
|
|
|
+ let _dialogTagList = [];
|
|
|
+ // 基础信息
|
|
|
+ _bmData.jsonData = JSON.parse(_bmData.jsonData);
|
|
|
+ _dialogTagList = _bmData.jsonData.dialogTagList || [
|
|
|
+ { value: 0, name: "通用课堂分析", loading: false },
|
|
|
+ { value: 1, name: "学科课堂分析", loading: false },
|
|
|
+ { value: 2, name: "扩展分析", loading: false }
|
|
|
+ ];
|
|
|
+ // 图片
|
|
|
+ let _imageList = _data.find(i => i.tIndex == 1);
|
|
|
+ _imageList.jsonData = JSON.parse(_imageList.jsonData);
|
|
|
|
|
|
- if (!_imageList.jsonData.videoList) {
|
|
|
- _imageList.jsonData.videoList = [];
|
|
|
- }
|
|
|
- if (!_imageList.jsonData.NephogramList) {
|
|
|
- _imageList.jsonData.NephogramList = [];
|
|
|
- }
|
|
|
- //通用分析
|
|
|
- let currency = [];
|
|
|
- for (let i = 2; i < _data.length; i++) {
|
|
|
- let _currency = _data[i];
|
|
|
- _currency.jsonData = JSON.parse(_currency.jsonData);
|
|
|
- currency.push(_currency);
|
|
|
- }
|
|
|
+ if (!_imageList.jsonData.videoList) {
|
|
|
+ _imageList.jsonData.videoList = [];
|
|
|
+ }
|
|
|
+ if (!_imageList.jsonData.NephogramList) {
|
|
|
+ _imageList.jsonData.NephogramList = [];
|
|
|
+ }
|
|
|
+ //通用分析
|
|
|
+ let currency = [];
|
|
|
+ for (let i = 2; i < _data.length; i++) {
|
|
|
+ let _currency = _data[i];
|
|
|
+ _currency.jsonData = JSON.parse(_currency.jsonData);
|
|
|
+ currency.push(_currency);
|
|
|
+ }
|
|
|
|
|
|
- this.dataList.push(...currency);
|
|
|
- this.bmData = _bmData;
|
|
|
- this.dialogTagList = _dialogTagList;
|
|
|
- this.$emit("changeTranscription", {
|
|
|
- transcriptionData: this.bmData.jsonData.transcriptionData
|
|
|
- ? this.bmData.jsonData.transcriptionData
|
|
|
- : "",
|
|
|
- editorBarData: this.bmData.jsonData.editorBarData
|
|
|
- ? this.bmData.jsonData.editorBarData
|
|
|
- : { type: "0", content: "", url: "" }
|
|
|
+ this.dataList.push(...currency);
|
|
|
+ this.bmData = _bmData;
|
|
|
+ this.dialogTagList = _dialogTagList;
|
|
|
+ this.$emit("changeTranscription", {
|
|
|
+ transcriptionData: this.bmData.jsonData.transcriptionData
|
|
|
+ ? this.bmData.jsonData.transcriptionData
|
|
|
+ : "",
|
|
|
+ editorBarData: this.bmData.jsonData.editorBarData
|
|
|
+ ? this.bmData.jsonData.editorBarData
|
|
|
+ : { type: "0", content: "", url: "" }
|
|
|
+ });
|
|
|
+ this.imageList = _imageList;
|
|
|
+ if (this.imageList.jsonData.fileList.length > 0) {
|
|
|
+ this.$emit(
|
|
|
+ "changeChatAreaAudioUrl",
|
|
|
+ this.imageList.jsonData.fileList[0]
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$emit("changeChatAreaAudioUrl", { name: "", url: "" });
|
|
|
+ }
|
|
|
+ this.$emit("updateTime", this.bmData.createtime);
|
|
|
+ this.baseMessageLoading = false;
|
|
|
+ this.dialogTagList.find(i => i.value == 0).loading = false;
|
|
|
+ this.currencyLoading = false;
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$message.error("获取通用分析失败");
|
|
|
+ console.log(e);
|
|
|
+ resolve();
|
|
|
});
|
|
|
- this.imageList = _imageList;
|
|
|
- if (this.imageList.jsonData.fileList.length > 0) {
|
|
|
- this.$emit(
|
|
|
- "changeChatAreaAudioUrl",
|
|
|
- this.imageList.jsonData.fileList[0]
|
|
|
- );
|
|
|
- } else {
|
|
|
- this.$emit("changeChatAreaAudioUrl", { name: "", url: "" });
|
|
|
- }
|
|
|
- this.$emit("updateTime", this.bmData.createtime);
|
|
|
- this.baseMessageLoading = false;
|
|
|
- this.dialogTagList.find(i => i.value == 0).loading = false;
|
|
|
- this.currencyLoading = false;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- this.$message.error("获取通用分析失败");
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
+ });
|
|
|
},
|
|
|
getScienceData() {
|
|
|
if (!this.tid) return;
|
|
|
- let pram = {
|
|
|
- tid: this.tid,
|
|
|
- // tid:'02',
|
|
|
- type: "1"
|
|
|
- };
|
|
|
- this.scienceLoading = true;
|
|
|
- this.dialogTagList.find(i => i.value == 1).loading = true;
|
|
|
- this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/get_classroom_observation_new", pram)
|
|
|
- .then(res => {
|
|
|
- let _data = res.data.FunctionResponse.result.length
|
|
|
- ? JSON.parse(res.data.FunctionResponse.result)
|
|
|
- : [];
|
|
|
- if (_data.length == 0) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let pram = {
|
|
|
+ tid: this.tid,
|
|
|
+ // tid:'02',
|
|
|
+ type: "1"
|
|
|
+ };
|
|
|
+ this.scienceLoading = true;
|
|
|
+ this.dialogTagList.find(i => i.value == 1).loading = true;
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/get_classroom_observation_new", pram)
|
|
|
+ .then(res => {
|
|
|
+ let _data = res.data.FunctionResponse.result.length
|
|
|
+ ? JSON.parse(res.data.FunctionResponse.result)
|
|
|
+ : [];
|
|
|
+ if (_data.length == 0) {
|
|
|
+ this.dialogTagList.find(i => i.value == 1).loading = false;
|
|
|
+ return (this.scienceLoading = false);
|
|
|
+ }
|
|
|
+ let science = [];
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ let _science = _data[i];
|
|
|
+ _science.jsonData = JSON.parse(_science.jsonData);
|
|
|
+ science.push(_science);
|
|
|
+ }
|
|
|
+ this.dataList.push(...science);
|
|
|
this.dialogTagList.find(i => i.value == 1).loading = false;
|
|
|
- return (this.scienceLoading = false);
|
|
|
- }
|
|
|
- let science = [];
|
|
|
- for (let i = 0; i < _data.length; i++) {
|
|
|
- let _science = _data[i];
|
|
|
- _science.jsonData = JSON.parse(_science.jsonData);
|
|
|
- science.push(_science);
|
|
|
- }
|
|
|
- this.dataList.push(...science);
|
|
|
- this.dialogTagList.find(i => i.value == 1).loading = false;
|
|
|
- this.scienceLoading = false;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- this.$message.error("获取科学分析失败");
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
+ this.scienceLoading = false;
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$message.error("获取科学分析失败");
|
|
|
+ resolve();
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
getExtendData() {
|
|
|
if (!this.tid) return;
|
|
|
- let pram = {
|
|
|
- tid: this.tid,
|
|
|
- // tid:'02',
|
|
|
- type: "2"
|
|
|
- };
|
|
|
- this.extendLoading = true;
|
|
|
- this.dialogTagList.find(i => i.value == 2).loading = true;
|
|
|
- this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/get_classroom_observation_new", pram)
|
|
|
- .then(res => {
|
|
|
- let _data = res.data.FunctionResponse.result.length
|
|
|
- ? JSON.parse(res.data.FunctionResponse.result)
|
|
|
- : [];
|
|
|
- if (_data.length == 0) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let pram = {
|
|
|
+ tid: this.tid,
|
|
|
+ // tid:'02',
|
|
|
+ type: "2"
|
|
|
+ };
|
|
|
+ this.extendLoading = true;
|
|
|
+ this.dialogTagList.find(i => i.value == 2).loading = true;
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/get_classroom_observation_new", pram)
|
|
|
+ .then(res => {
|
|
|
+ let _data = res.data.FunctionResponse.result.length
|
|
|
+ ? JSON.parse(res.data.FunctionResponse.result)
|
|
|
+ : [];
|
|
|
+ if (_data.length == 0) {
|
|
|
+ this.dialogTagList.find(i => i.value == 2).loading = false;
|
|
|
+ return (this.extendLoading = false);
|
|
|
+ }
|
|
|
+ let extent = [];
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ let _extent = _data[i];
|
|
|
+ _extent.jsonData = JSON.parse(_extent.jsonData);
|
|
|
+ extent.push(_extent);
|
|
|
+ }
|
|
|
+ this.dataList.push(...extent);
|
|
|
this.dialogTagList.find(i => i.value == 2).loading = false;
|
|
|
- return (this.extendLoading = false);
|
|
|
- }
|
|
|
- let extent = [];
|
|
|
- for (let i = 0; i < _data.length; i++) {
|
|
|
- let _extent = _data[i];
|
|
|
- _extent.jsonData = JSON.parse(_extent.jsonData);
|
|
|
- extent.push(_extent);
|
|
|
- }
|
|
|
- this.dataList.push(...extent);
|
|
|
- this.dialogTagList.find(i => i.value == 2).loading = false;
|
|
|
- this.extendLoading = false;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- this.$message.error("获取扩展分析失败");
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
+ this.extendLoading = false;
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$message.error("获取扩展分析失败");
|
|
|
+ console.log(e);
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
getValueAddedData() {
|
|
|
if (!this.tid) return;
|
|
@@ -761,33 +781,42 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getData() {
|
|
|
- this.dataList = [];
|
|
|
- if (this.tid) {
|
|
|
- this.getCurrencyAndBaseMessageData();
|
|
|
- this.getScienceData();
|
|
|
- this.getExtendData();
|
|
|
- } else {
|
|
|
- this.getDefaultData();
|
|
|
- }
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.dataList = [];
|
|
|
+ if (this.tid) {
|
|
|
+ Promise.all([
|
|
|
+ this.getCurrencyAndBaseMessageData(),
|
|
|
+ this.getScienceData(),
|
|
|
+ this.getExtendData()
|
|
|
+ ]).then(res => {
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.getDefaultData()
|
|
|
+ }
|
|
|
+ });
|
|
|
// this.getValueAddedData();
|
|
|
// this.getFileId();
|
|
|
},
|
|
|
getDefaultData() {
|
|
|
if (this.tid) return;
|
|
|
- let params = {
|
|
|
- uid: this.userId
|
|
|
- };
|
|
|
- this.loading = true;
|
|
|
- this.ajax
|
|
|
- .get(this.$store.state.api + "selectClassroomDefault", params)
|
|
|
- .then(res => {
|
|
|
- let _data = res.data[0][0];
|
|
|
- if (_data) {
|
|
|
- _data.tips = JSON.parse(_data.tips);
|
|
|
- this.dataList = _data.tips;
|
|
|
- }
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let params = {
|
|
|
+ uid: this.userId
|
|
|
+ };
|
|
|
+ this.loading = true;
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "selectClassroomDefault", params)
|
|
|
+ .then(res => {
|
|
|
+ let _data = res.data[0][0];
|
|
|
+ if (_data) {
|
|
|
+ _data.tips = JSON.parse(_data.tips);
|
|
|
+ this.dataList = _data.tips;
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
saveData(data) {
|
|
|
return new Promise((resolve, reject) => {
|
|
@@ -1078,8 +1107,12 @@ export default {
|
|
|
this.$message.error("获取模块分析列表失败");
|
|
|
});
|
|
|
},
|
|
|
- changeAnalysisName(data) {
|
|
|
- this.dialogTagList.find(i => i.value == data.type).name = data.name;
|
|
|
+ changeAnalysisName(data,type = 0) {
|
|
|
+ if(type==0){
|
|
|
+ this.dialogTagList.find(i => i.value == data.type).name = data.name;
|
|
|
+ }else if(type==1){
|
|
|
+ this.dialogTagList = data;
|
|
|
+ }
|
|
|
this.bmData.jsonData["dialogTagList"] = this.dialogTagList;
|
|
|
this.saveData(this.bmData).then(res => {
|
|
|
// this.$message.success("修改名称成功");
|