Przeglądaj źródła

feat(pptEasy): add file upload tool for course editing

add support for tool 84 to create and edit file attachment course components,
including the addFile method to handle adding/updating file tool entries
lsc 1 dzień temu
rodzic
commit
2550ae6e65
1 zmienionych plików z 34 dodań i 0 usunięć
  1. 34 0
      src/components/pages/pptEasy/addCourse3.vue

+ 34 - 0
src/components/pages/pptEasy/addCourse3.vue

@@ -2736,6 +2736,9 @@ export default {
       }else if (tool == 79){
         this.answerQ = "";
         this.addPhoto();
+      }else if (tool == 84){
+        this.answerQ = "";
+        this.addFile();
       } else if (tool == 72) {
         this.$refs.appDialog.openG(
           [],
@@ -3392,6 +3395,37 @@ export default {
         this.editId = null;
       });
     },
+    addFile() {
+      // if (this.answerQ == "") {
+      //   this.$message.error(this.lang.ssEnterQuesL);
+      //   return;
+      // }
+      let _data = { id: new Date().getTime(), tool: 84, title: this.lang.ssFile, brief: this.lang.ssFileTool, json: { answerQ: this.answerQ, fileList: [] }, url: "" }
+      if (this.editId) {
+        let oldData = this.pptCourseJson.toolsList.find(i => i.id === this.editId);
+        _data.id = oldData.id;
+        _data.title = oldData.title;
+        _data.brief = oldData.brief;
+        this.pptCourseJson.toolsList.splice(this.pptCourseJson.toolsList.findIndex(i => i.id === this.editId), 1, _data);
+      } else {
+        this.pptCourseJson.toolsList.push(_data);
+      }
+
+      this.dialogVisible8 = false;
+      this.getWorkPageId(_data.id, 84, { answerQ: this.answerQ, fileList: [] }).then(res => {
+        let baseUrl = this.setUrl()
+        let url = `${baseUrl}/pbl-teacher-table/dist/workPage.html#/setWorkPage?id=${res}&type=${_data.tool}`;
+        this.pptCourseJson.toolsList.find(i => i.id === _data.id).url = url;
+        this.setPPtToolList();
+        _data.url = url
+        if (!this.editId) {
+          this.addContent(_data)
+        } else {
+          this.addContent(_data, 2)
+        }
+        this.editId = null;
+      });
+    },
     async getWorkPageId(id, tool, json) {
       let params = [{
         userid: this.userid,