|
@@ -16,10 +16,7 @@
|
|
|
class="co-h2-l-icon"
|
|
|
@click="$refs.addNewCourseDialogRef.open()"
|
|
|
></span> -->
|
|
|
- <span
|
|
|
- class="co-h2-l-icon"
|
|
|
- @click="addNewCourse()"
|
|
|
- ></span>
|
|
|
+ <span class="co-h2-l-icon" @click="addNewCourse()"></span>
|
|
|
<span class="co-h2-l-hr"></span>
|
|
|
<span class="co-h2-l-text">
|
|
|
<el-select
|
|
@@ -187,12 +184,12 @@ export default {
|
|
|
return {
|
|
|
loading: false,
|
|
|
dialogVisibleShare: false,
|
|
|
- createTime:new Date().toLocaleString().replaceAll('/','-'),
|
|
|
+ createTime: new Date().toLocaleString().replaceAll("/", "-"),
|
|
|
tid: "",
|
|
|
fileId: "",
|
|
|
fileIdId: "",
|
|
|
optionData: [],
|
|
|
- userId:this.$route.query["userid"]
|
|
|
+ userId: this.$route.query["userid"],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -205,62 +202,69 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
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:uuidv4(),
|
|
|
- name:classroomName,
|
|
|
- userid:this.userId
|
|
|
- }
|
|
|
- this.ajax
|
|
|
- .post(
|
|
|
- "https://gpt4.cocorobo.cn/insert_classroom_observation_tid",
|
|
|
- params
|
|
|
- )
|
|
|
- .then((res) => {
|
|
|
- let _data = res.data.FunctionResponse;
|
|
|
- if (_data.message == "创建成功") {
|
|
|
- this.tid = params.tid;
|
|
|
- // 设置该课堂的tid
|
|
|
- this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/insert_classroom_observation", {
|
|
|
- tid: this.tid,
|
|
|
- type: 10,
|
|
|
- index: 0,
|
|
|
- json_data: JSON.stringify({ file_ids: "" }),
|
|
|
- userid:this.userId
|
|
|
- })
|
|
|
- .then((res2) => {
|
|
|
- let _data2 = res2.data.FunctionResponse;
|
|
|
- if (_data2.message == "创建成功") {
|
|
|
- this.loading = false;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.getCourseList().then((_) => {
|
|
|
- this.getFileIdId();
|
|
|
- this.$refs.messageAreaRef.getData();
|
|
|
- this.$refs.chatAreaRef.getData();
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ 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: uuidv4(),
|
|
|
+ name: classroomName,
|
|
|
+ userid: this.userId,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .post(
|
|
|
+ "https://gpt4.cocorobo.cn/insert_classroom_observation_tid",
|
|
|
+ params
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ let _data = res.data.FunctionResponse;
|
|
|
+ if (_data.message == "创建成功") {
|
|
|
+ // 设置该课堂的tid
|
|
|
+ this.tid = params.tid;
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/insert_classroom_observation", {
|
|
|
+ tid: params.tid,
|
|
|
+ type: 10,
|
|
|
+ index: 0,
|
|
|
+ json_data: JSON.stringify({ file_ids: "" }),
|
|
|
+ userid: this.userId,
|
|
|
+ })
|
|
|
+ .then((res2) => {
|
|
|
+ let _data2 = res2.data.FunctionResponse;
|
|
|
+ if (_data2.message == "创建成功") {
|
|
|
+ this.loading = false;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.getCourseList().then((_) => {
|
|
|
+ this.getFileIdId();
|
|
|
+ this.$refs.messageAreaRef.getData();
|
|
|
+ this.$refs.chatAreaRef.getData();
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$message.error("创建fileIds失败");
|
|
|
- }
|
|
|
- });
|
|
|
- } else if (_data.message == "tid重复") {
|
|
|
- this.$message.error("该课堂已存在");
|
|
|
- this.loading = false;
|
|
|
- } else {
|
|
|
- this.$message.error("创建失败");
|
|
|
- this.loading = false;
|
|
|
- }
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ this.$message.error("创建fileIds失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (_data.message == "tid重复") {
|
|
|
+ this.$message.error("该课堂已存在");
|
|
|
+ this.loading = false;
|
|
|
+ } else {
|
|
|
+ this.$message.error("创建失败");
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
updateFileId(newValue) {
|
|
|
this.fileId = newValue;
|
|
@@ -268,7 +272,16 @@ export default {
|
|
|
// 生成报告
|
|
|
getReport() {
|
|
|
if (!this.fileId) return;
|
|
|
- this.$refs.messageAreaRef.getReport();
|
|
|
+ this.$confirm("操作将覆盖原有内容,是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$refs.messageAreaRef.getReport();
|
|
|
+ }).catch(e=>{
|
|
|
+ console.log("取消生成报告")
|
|
|
+ })
|
|
|
},
|
|
|
//预览
|
|
|
preview() {
|
|
@@ -320,23 +333,26 @@ export default {
|
|
|
// });
|
|
|
let params = {
|
|
|
tid: _value,
|
|
|
- }
|
|
|
+ };
|
|
|
this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/update_classroom_observation_isdel", params)
|
|
|
- .then((res) => {
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "删除成功!",
|
|
|
- });
|
|
|
- // 清空tid
|
|
|
- this.tid = "";
|
|
|
- this.getCourseList().then((_) => {
|
|
|
- if (!this.tid) return;
|
|
|
- this.getFileIdId();
|
|
|
- this.$refs.messageAreaRef.getData();
|
|
|
- this.$refs.chatAreaRef.getData();
|
|
|
+ .post(
|
|
|
+ "https://gpt4.cocorobo.cn/update_classroom_observation_isdel",
|
|
|
+ params
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功!",
|
|
|
+ });
|
|
|
+ // 清空tid
|
|
|
+ this.tid = "";
|
|
|
+ this.getCourseList().then((_) => {
|
|
|
+ if (!this.tid) return;
|
|
|
+ this.getFileIdId();
|
|
|
+ this.$refs.messageAreaRef.getData();
|
|
|
+ this.$refs.chatAreaRef.getData();
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
},
|
|
@@ -376,22 +392,22 @@ export default {
|
|
|
this.loading = true;
|
|
|
return new Promise((resolve, reject) => {
|
|
|
this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/get_classroom_observation_all",{
|
|
|
- userid:this.userId
|
|
|
+ .post("https://gpt4.cocorobo.cn/get_classroom_observation_all", {
|
|
|
+ userid: this.userId,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
let _data = res.data.FunctionResponse.result;
|
|
|
- let _result = []
|
|
|
+ let _result = [];
|
|
|
try {
|
|
|
_result = _data ? JSON.parse(_data) : [];
|
|
|
} catch (error) {
|
|
|
- _result = []
|
|
|
+ _result = [];
|
|
|
}
|
|
|
|
|
|
- if (_result.length <= 0) {
|
|
|
+ if (_result.length <= 0) {
|
|
|
this.loading = false;
|
|
|
- return
|
|
|
- };
|
|
|
+ return;
|
|
|
+ }
|
|
|
let _optionData = _result.map((item) => {
|
|
|
item.jsonData = item.jsonData ? JSON.parse(item.jsonData) : {};
|
|
|
return {
|
|
@@ -399,7 +415,7 @@ export default {
|
|
|
? item.jsonData.courseName
|
|
|
: `${item.tId}课堂`,
|
|
|
value: item.tId,
|
|
|
- id:item.id
|
|
|
+ id: item.id,
|
|
|
};
|
|
|
});
|
|
|
_optionData = _optionData.filter(
|
|
@@ -407,9 +423,10 @@ export default {
|
|
|
);
|
|
|
this.optionData = _optionData;
|
|
|
if (this.optionData.length > 0) {
|
|
|
- this.$refs.chatAreaRef.$refs.startPageRef.showIntroduce = false
|
|
|
+ this.$refs.chatAreaRef.$refs.startPageRef.showIntroduce = false;
|
|
|
}
|
|
|
this.loading = false;
|
|
|
+ console.log(this.optionData);
|
|
|
resolve();
|
|
|
});
|
|
|
});
|
|
@@ -437,9 +454,9 @@ export default {
|
|
|
}
|
|
|
console.log(this.optionData);
|
|
|
},
|
|
|
- updateTime(time){
|
|
|
+ updateTime(time) {
|
|
|
this.createTime = time;
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getCourseList().then((_) => {
|