Ver Fonte

开始上传

huangtao há 4 anos atrás
pai
commit
0631bf0281

+ 4 - 4
src/router/menu.js

@@ -65,10 +65,10 @@ export default [
           },
         ],
       },
-      // {
-      //   path: '/examQuestionManagement/batchImport',
-      //   meta: { title: '批量导入' },
-      // },
+      {
+        path: '/examQuestionManagement/batchImport',
+        meta: { title: '批量导入' },
+      },
     ],
   },
   {

+ 26 - 1
src/views/examQuestionManagement/examQuestionBatchImport.vue

@@ -1,7 +1,16 @@
 <template>
   <div class="app-container">
     <a-spin :spinning="loading">
-      <div class="common-card">这里是批量导入</div>
+      <div class="common-card">
+        <a-upload
+          name="file"
+          accept=".pdf"
+          :headers="headers"
+          @change="handleChange"
+        >
+          <a-button> <a-icon type="upload" /> Click to Upload </a-button>
+        </a-upload>
+      </div>
     </a-spin>
     <div class="company-info">
       <span>
@@ -19,6 +28,9 @@ export default {
   data() {
     return {
       loading: false, // 是否显示加载动画
+      headers: {
+        authorization: 'authorization-text',
+      },
     };
   },
   created() {
@@ -31,6 +43,19 @@ export default {
   methods: {
     //初始化数据
     initDataFun() {},
+    handleChange(info) {
+      if (info.file.status !== 'uploading') {
+        console.log(info.file, info.fileList);
+      }
+      if (info.file.status === 'done') {
+        this.$message.success(`${info.file.name} file uploaded successfully`);
+      } else if (info.file.status === 'error') {
+        this.$message.error(`${info.file.name} file upload failed.`);
+      }
+    },
+    uploadFileFun(e, v, m) {
+      console.log(e, v, m);
+    },
   },
 };
 </script>