Bladeren bron

考试资源

smith_du 2 jaren geleden
bovenliggende
commit
87d371499b
2 gewijzigde bestanden met toevoegingen van 60 en 4 verwijderingen
  1. 13 3
      src/views/menu4/menu4-1/index.vue
  2. 47 1
      src/views/menu4/menu4-2/index.vue

+ 13 - 3
src/views/menu4/menu4-1/index.vue

@@ -104,6 +104,9 @@
           <el-button class="add" size="small" @click="addItems()"
             >新增资源</el-button
           >
+          <el-button class="add" size="small" @click="paperTemp()"
+            >下载试卷模板</el-button
+          >
         </template>
       </cloudTable>
     </el-col>
@@ -210,7 +213,7 @@
           </el-upload>
         </el-form-item>
 
-        <div class="ques" v-for="(item, index) in dialog3Content">
+        <div class="ques" v-for="(item, index) in quesContent">
           <span v-exchangeHtml:foo="item.tx"></span>
           <span v-exchangeHtml:foo="item.tg"></span>
           <span v-exchangeHtml:foo="item.da"></span>
@@ -401,7 +404,7 @@ export default {
           },
         ],
       },
-      dialog3Content: [],
+      quesContent: [],
     };
   },
   watch: {
@@ -448,6 +451,7 @@ export default {
         this.dialogForm1.ctype = "work";
         this.dialogForm1.subject = this.leftQuery.subject;
         this.dialogForm1.period = this.leftQuery.period;
+        this.dialogForm1.ques = this.quesContent
       }
       this.$refs.dialog1.open((cancel) => {
         this.$refs["dialogForm1"].validate((valid) => {
@@ -586,7 +590,7 @@ export default {
         .then((res) => {
           this.dataTable.loading = false;
           // this.open3();
-          this.dialog3Content = res.data;
+          this.quesContent = res.data;
           this.$refs.upload.clearFiles();
         })
         .catch((err) => {
@@ -687,6 +691,12 @@ export default {
           break;
       }
     },
+    paperTemp() {
+      var link = document.createElement("a");
+      link.href =
+        "http://osscache.scxjc.club/static/say365/eques_template.docx";
+      link.click();
+    },
   },
 };
 </script>

+ 47 - 1
src/views/menu4/menu4-2/index.vue

@@ -112,6 +112,9 @@
           <el-button class="add" size="small" @click="addItems()"
             >新增资源</el-button
           >
+          <el-button class="add" size="small" @click="paperTemp()"
+            >下载试卷模板</el-button
+          >
         </template>
       </cloudTable>
     </el-col>
@@ -215,6 +218,7 @@
         <el-form-item label="资源附件">
           <!-- <Button @click="choiceImg" icon="ios-cloud-upload-outline" type="primary">选择文件</Button> -->
           <el-upload
+            ref="upload"
             class="uploadItems"
             action="/v1/common/upfile"
             :limit="1"
@@ -226,6 +230,14 @@
             <el-button size="small" type="primary">点击上传</el-button>
           </el-upload>
         </el-form-item>
+        <div class="ques" v-for="(item, index) in quesContent">
+          <span v-exchangeHtml:foo="item.tx"></span>
+          <span v-exchangeHtml:foo="item.tg"></span>
+          <span v-exchangeHtml:foo="item.da"></span>
+          <span v-exchangeHtml:foo="item.zsd"></span>
+          <span v-exchangeHtml:foo="item.nd"></span>
+          <span v-exchangeHtml:foo="item.jx"></span>
+        </div>
       </el-form>
     </cloudDialog>
     <!-- <cloudDialog ref="dialog2" :config="dialogConfig2" :beforeClose="beforeClose2" @close="resetForm2">
@@ -259,7 +271,7 @@ export default {
       listQuery: {
         name: "",
         year: null,
-        sid:null
+        sid: null,
       },
       treeData: [
         {
@@ -457,6 +469,7 @@ export default {
           },
         ],
       },
+      quesContent: [],
     };
   },
   watch: {
@@ -518,6 +531,7 @@ export default {
         this.dialogForm1.ctype = "exam";
         this.dialogForm1.subject = this.leftQuery.subject;
         this.dialogForm1.period = this.leftQuery.period;
+        this.dialogForm1.ques = this.quesContent;
       }
       this.$refs.dialog1.open((cancel) => {
         this.$refs["dialogForm1"].validate((valid) => {
@@ -650,6 +664,32 @@ export default {
     handleAvatarSuccess(res, file) {
       this.dialogForm.name = file.name;
       this.dialogForm.attach_url = [res.data];
+      this.clickup(file);
+    },
+    clickup(file) {
+      this.dataTable.loading = true;
+      var formData = new FormData();
+      formData.append("file", file);
+      // let fileList = new FormData();
+      var token = this.Cookies.get("www-authenticate");
+      axios({
+        url: "http://127.0.0.1:19882/parsedocx.aspx",
+        // url: "http://10.10.153.242:19882/parsedocx.aspx",
+        method: "post",
+        data: formData,
+        headers: {
+          Authorization: `Bearer ${token}`,
+        },
+      })
+        .then((res) => {
+          this.dataTable.loading = false;
+          // this.open3();
+          this.quesContent = res.data;
+          this.$refs.upload.clearFiles();
+        })
+        .catch((err) => {
+          this.loading = false;
+        });
     },
     addItems() {
       this.dialogForm = {
@@ -746,6 +786,12 @@ export default {
           break;
       }
     },
+    paperTemp() {
+      var link = document.createElement("a");
+      link.href =
+        "http://osscache.scxjc.club/static/say365/eques_template.docx";
+      link.click();
+    },
   },
 };
 </script>