scorpioyq 3 years ago
parent
commit
09c0a01cba
3 changed files with 35 additions and 17 deletions
  1. 2 2
      src/api/fetch.js
  2. 32 14
      src/views/home/component/files_list.vue
  3. 1 1
      src/views/home/component/folder_list.vue

+ 2 - 2
src/api/fetch.js

@@ -3,7 +3,7 @@
  */
 import axios from './axios.js'
 import router from '../router'
-import { removeToken, getToken } from '../utils/auth'
+import { getToken, removeToken } from '../utils/auth'
 import { ElMessage } from 'element-plus'
 
 axios.defaults.baseURL = ''
@@ -31,7 +31,7 @@ function fetch (url = '', params = {}, method = 'get', contentType = 'form', hea
     query.push(k + '=' + params[k])
   }
   let qs = query.join('&')
-  if (contentType === 'application/x-www-form-urlencoded' && query.length > 0) {
+  if (contentType === 'application/x-www-form-urlencoded' && query.length > 0 && method === 'get') {
     url += (url.indexOf('?') < 0 ? '?' : '&') + qs
   }
   if (contentType !== 'application/x-www-form-urlencoded' && method !== 'get') {

+ 32 - 14
src/views/home/component/files_list.vue

@@ -19,7 +19,7 @@
           <img v-else class="icon" src="../../../assets/svg/folder/other.svg">
         </div>
         <div v-else class="flex-1">
-          <img class="icon" src="../../../assets/svg/folder/see.svg" style="width: 50px;height: 46px">
+          <img src="../../../assets/svg/folder/see.svg" style="width: 50px;height: 46px">
           <!--          <img v-else-if="item.suffix === 'pdf'" class="icon" src="../../../assets/svg/folder/pdf.svg">-->
           <!--          <img v-else-if="item.suffix === 'xlsx'" class="icon" src="../../../assets/svg/folder/xls.svg">-->
           <!--          <img v-else class="icon" src="../../../assets/svg/folder/other.svg">-->
@@ -142,21 +142,39 @@ export default {
       this.imgList = []
     },
     removeFile (item) {
-      this.$confirm('确认是否删除该文件?', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          this.$api.project.fileRemove({ ids: item.id }).then(res => {
-            if (res.code === 200) {
-              this.$bus.emit('delete')
-              this.$message.success(res.msg)
-            } else {
-              this.$message.error(res.msg)
-            }
+      if (item.type === '1') {
+        this.$confirm('确认是否删除所选文件/文件夹?', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            this.$api.project.fileRemove({ ids: item.id }).then(res => {
+              if (res.code === 200) {
+                this.$bus.emit('delete')
+                this.$message.success(res.msg)
+              } else {
+                this.$message.error(res.msg)
+              }
+            })
           })
+      } else if (item.type === '2') {
+        this.$confirm('确认是否删除所选文件/文件夹?', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         })
+          .then(() => {
+            this.$api.project.folderRemove({ ids: item.id }).then(res => {
+              if (res.code === 200) {
+                this.$message.success(res.msg)
+                this.$bus.emit('delete')
+              } else {
+                this.$message.error(res.msg)
+              }
+            })
+          })
+      }
     }
 
   }

+ 1 - 1
src/views/home/component/folder_list.vue

@@ -178,7 +178,7 @@ export default {
       this.show = true
     },
     folderRemove (item) {
-      this.$confirm('确认是否删除该文件夹及所包含的文件?', {
+      this.$confirm('确认是否删除所选文件/文件夹?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'