Bläddra i källkod

feat: 修改菜单图标删除

DESKTOP-USV654P\pc 9 månader sedan
förälder
incheckning
d501750259
2 ändrade filer med 43 tillägg och 39 borttagningar
  1. 29 29
      .drone.yml
  2. 14 10
      src/components/Form/src/components/Upload.vue

+ 29 - 29
.drone.yml

@@ -6,19 +6,19 @@ node:
   mode: local_test
 
 steps:
-  #  - name: yarn-install
-  #   image: node:18.16.1
-  #   volumes:
-  #     - name: modules-cache
-  #       path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
-  #   commands:
-  #     - yarn config set registry http://registry.npmjs.org
-  #     # - yarn install
-  #     - yarn run build
+   - name: yarn-install
+    image: node:18.16.1
+    volumes:
+      - name: modules-cache
+        path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
+    commands:
+      - yarn config set registry http://registry.npmjs.org
+      - yarn install
+      - yarn run build
 
   - name: build
     image: docker:20.10.7
-    # depends_on: [yarn-install]
+    depends_on: [yarn-install]
     volumes:
       - name: docker
         path: /var/run/docker.sock
@@ -61,19 +61,19 @@ node:
   mode: local_pre
 
 steps:
-  # - name: yarn-install
-  #   image: node:18.16.1
-  #   volumes:
-  #     - name: modules-cache
-  #       path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
-  #   commands:
-  #     - yarn config set registry http://registry.npmjs.org
-  #     #- yarn install
-  #     - yarn run build
+  - name: yarn-install
+    image: node:18.16.1
+    volumes:
+      - name: modules-cache
+        path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
+    commands:
+      - yarn config set registry http://registry.npmjs.org
+      - yarn install
+      - yarn run build
 
   - name: build
     image: docker:20.10.7
-    # depends_on: [yarn-install]
+    depends_on: [yarn-install]
     volumes:
       - name: docker
         path: /var/run/docker.sock
@@ -116,19 +116,19 @@ node:
   mode: local_test
 
 steps:
-  # - name: yarn-install
-  #   depends_on: [clone]
-  #   image: node:18.16.1
-  #   volumes:
-  #     - name: modules-cache
-  #       path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
-  #   commands:
-  #     - yarn run build
+  - name: yarn-install
+    depends_on: [clone]
+    image: node:18.16.1
+    volumes:
+      - name: modules-cache
+        path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载
+    commands:
+      - yarn run build
 
   # - yarn install && yarn run build
   - name: push
     image: docker:20.10.7
-    # depends_on: [yarn-install]
+    depends_on: [yarn-install]
     volumes:
       - name: docker
         path: /var/run/docker.sock

+ 14 - 10
src/components/Form/src/components/Upload.vue

@@ -70,7 +70,7 @@
           点击上传
         </a-button>
       </div>
-      <template #itemRender="{ file,actions}">
+      <template #itemRender="{ file, actions }">
         <div class="flex flex-between mt-2">
           <div class="flex-1">
             <a href="javascript:;" @click="actions.preview">
@@ -261,19 +261,23 @@
   }
   const handleRemove = async (info) => {
     const id = info.response ? info.response.data.id : info.id;
+    if (id) {
+      const newFolderId = await deleteSingleFile(id);
 
-    const newFolderId = await deleteSingleFile(id);
+      folderId.value = newFolderId;
 
-    folderId.value = newFolderId;
+      deleteFlag.value = true;
 
-    deleteFlag.value = true;
+      const index = fileList.value.findIndex((x) => x.id === id);
+      fileList.value.splice(index, 1);
 
-    const index = fileList.value.findIndex((x) => x.id === id);
-    fileList.value.splice(index, 1);
-
-    fileList.value.forEach((x) => {
-      x.folderId = newFolderId;
-    });
+      fileList.value.forEach((x) => {
+        x.folderId = newFolderId;
+      });
+    } else {
+      const index = fileList.value.findIndex((x) => x.uid === info.uid);
+      fileList.value.splice(index, 1);
+    }
 
     emit('update:value', folderId.value);
     emit('change');