From bd82158c1ef6b3f71115bfc1d5fe77fb7c9287db Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期四, 25 七月 2024 19:01:01 +0800
Subject: [PATCH] 知识库操作功能开发以及解析方法的开发

---
 src/views/dmx/knowledgeLib/add.vue |   82 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 75 insertions(+), 7 deletions(-)

diff --git a/src/views/dmx/knowledgeLib/add.vue b/src/views/dmx/knowledgeLib/add.vue
index 4fa459a..b1f803a 100644
--- a/src/views/dmx/knowledgeLib/add.vue
+++ b/src/views/dmx/knowledgeLib/add.vue
@@ -4,14 +4,14 @@
     <template #icon>
       <icon-plus />
     </template>
-    鏂板缓鏂囦欢
+    鏂板鏂囦欢
   </a-button>
   <a-modal v-model:visible="visible" title="涓婁紶鏂囦欢" @before-open="handleOpened" @cancel="handleCancel" @before-ok="handleBeforeOk" title-align="start">
     <a-tabs :default-active-key="activeKey" @change="activeKeyChange">
       <a-tab-pane key="1" title="鏂囦欢">
         <div class="aUpload">
 <!--          <a-upload :file-list="uploadList" draggable accept=".word, .pdf, .ppt, .excel, .txt, .zip, .rar, .7z, .doc, .docx, .xls, .xlsx, .pptx, .ppt, .pdf, .mp4, .avi, .mp3,.wav, .wma, .wmv, .rm," :custom-request="customRequest" />-->
-          <a-upload :file-list="uploadList" draggable accept=".word, .pdf, .ppt, .excel, .txt, .zip, .rar, .7z, .doc, .docx, .xls, .xlsx, .pptx, .ppt," :custom-request="customRequest" />
+          <a-upload :file-list="uploadList" draggable :accept="acceptNameList" :custom-request="customRequest" />
         </div>
       </a-tab-pane>
       <a-tab-pane key="2" title="鏂囦欢澶�">
@@ -24,8 +24,10 @@
 </template>
 
 <script lang="ts" setup>
-import { onMounted ,onBeforeMount, reactive, ref } from "vue";
-
+import { onMounted, onBeforeMount, reactive, ref, computed } from "vue";
+import axios from 'axios';
+let CancelToken = axios.CancelToken
+let source = null
 const visible = ref(false);
 const loading = ref(false);
 const activeKey = ref('1');
@@ -37,8 +39,11 @@
   post: '',// 宀椾綅
   txt: '',// 澶囨敞
 });
-
-
+const acceptNameList = computed(
+  ()=>{
+    return '.word, .pdf, .ppt, .excel, .txt, .zip, .rar, .7z, .doc, .docx, .xls, .xlsx, .pptx, .ppt, .pdf, .mp4, .avi, .mp3,.wav, .wma, .wmv, .rm,'
+  }
+)
 const customRequest = (option) => {
   const {onProgress, onError, onSuccess, fileItem, name} = option
   const xhr = new XMLHttpRequest();
@@ -64,7 +69,7 @@
 
   const formData = new FormData();
   formData.append(name || 'file', fileItem.file);
-  xhr.open('post', '//upload-z2.qbox.me/', true);
+  xhr.open('post', '/v1/user/login', true);
   xhr.send(formData);
 
   return {
@@ -73,6 +78,69 @@
     }
   }
 };
+// 涓婁紶鏂囦欢
+// async submitForm = ()=>{
+//   if (this.fileList && this.fileList.length > 0) {
+//     source = CancelToken.source()
+//     this.fileUploadLoad = true
+//     const formdata = new FormData()
+//     let param = {
+//       userName: this.userInfo.userName,
+//       userId: this.userInfo.userID,
+//       cfeId: this.currow.conferences[0].id,
+//     }
+//     this.fileList.map((item) => {
+//       formdata.append('file', item.raw)
+//     })
+//     uploadCfeFile(
+//       { param, formdata },
+//       (progressEvent) => {
+//         let total = progressEvent.total
+//         let loaded = progressEvent.loaded
+//         this.uploadPercent = parseInt(((loaded / total) * 100).toFixed(0))
+//       },
+//       source
+//     )
+//       .then((res) => {
+//         if (res.data.code === '0') {
+//           //涓婁紶鎴愬姛
+//           this.$successMessage(
+//             this.translateTitle(
+//               'json_fileupload.json_file_tip.json_file_tip08'
+//             )
+//           )
+//           this.fileList = []
+//           this.$refs.upload.clearFiles()
+//           this.queryList()
+//         } else {
+//           this.$errorMessage(res.data.message)
+//         }
+//         this.fileUploadLoad = false
+//         this.uploadPercent = 0
+//       })
+//       .catch((error) => {
+//         this.fileUploadLoad = false
+//         this.uploadPercent = 0
+//         if (axios.isCancel(error)) {
+//           //宸茬粓姝笂浼�
+//           this.$errorMessage(
+//             this.translateTitle(
+//               'json_fileupload.json_file_tip.json_file_tip09'
+//             )
+//           )
+//         } else {
+//           this.$errorMessage('鏂囦欢澶у皬瓒呰繃闄愬埗锛屼笂浼犲け璐�')
+//         }
+//       })
+//   } else {
+//     //璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢
+//     this.$warningMessage(
+//       this.translateTitle('json_fileupload.json_file_tip.json_file_tip10')
+//     )
+//   }
+// }
+
+
 
 const handleSubmit = ({values, errors}) => {
   console.log('values:', values, '\nerrors:', errors)

--
Gitblit v1.8.0