From 2a55bc0fcccfa39a1e1eddd718322a0724329ed9 Mon Sep 17 00:00:00 2001 From: luoer Date: Tue, 31 Oct 2023 17:30:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/post/media/components/upload.vue | 322 +++++++++++++-------- src/pages/post/media/index.vue | 18 +- src/styles/css-arco.less | 6 + src/types/auto-component.d.ts | 3 - src/utils/delConfirm.ts | 3 +- 5 files changed, 229 insertions(+), 123 deletions(-) diff --git a/src/pages/post/media/components/upload.vue b/src/pages/post/media/components/upload.vue index e637472..6a1c2fb 100644 --- a/src/pages/post/media/components/upload.vue +++ b/src/pages/post/media/components/upload.vue @@ -1,100 +1,233 @@ - + diff --git a/src/pages/post/media/index.vue b/src/pages/post/media/index.vue index e33becc..50f754f 100644 --- a/src/pages/post/media/index.vue +++ b/src/pages/post/media/index.vue @@ -11,6 +11,9 @@ 上传 + + 批量删除 + @@ -26,12 +29,13 @@ import { Table, createColumn, updateColumn, useTable } from "@/components"; import numeral from "numeral"; import AniGroup from "./components/group.vue"; import AniUpload from "./components/upload.vue"; +import { delConfirm } from "@/utils"; const visible = ref(false); const image = ref(""); +const selected = ref([]); const preview = (record: any) => { if (!record.mimetype.startsWith("image")) { - // Message.warning("暂不支持预览该素材"); window.open(record.path, "_blank"); return; } @@ -39,6 +43,10 @@ const preview = (record: any) => { visible.value = true; }; +const onDeleteMany = async () => { + await delConfirm(); +}; + const uploadRef = ref>(); const getIcon = (mimetype: string) => { @@ -61,6 +69,14 @@ const table = useTable({ data: async (model, paging) => { return api.file.getFiles(); }, + tableProps: { + rowSelection: { + showCheckedAll: true, + }, + onSelectionChange(rowKeys) { + selected.value = rowKeys as number[]; + }, + }, columns: [ { title: "文件名称", diff --git a/src/styles/css-arco.less b/src/styles/css-arco.less index b57b21d..9585eda 100644 --- a/src/styles/css-arco.less +++ b/src/styles/css-arco.less @@ -5,6 +5,12 @@ body { // --border-radius-small: 4px; + .arco-icon-hover::before { + width: 28px; + height: 28px; + border-radius: var(--border-radius-small); + } + div.arco-dropdown { border: none; } diff --git a/src/types/auto-component.d.ts b/src/types/auto-component.d.ts index 8998171..083c133 100644 --- a/src/types/auto-component.d.ts +++ b/src/types/auto-component.d.ts @@ -17,7 +17,6 @@ declare module '@vue/runtime-core' { ACheckbox: typeof import('@arco-design/web-vue')['Checkbox'] ACheckboxGroup: typeof import('@arco-design/web-vue')['CheckboxGroup'] AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider'] - ADatePicker: typeof import('@arco-design/web-vue')['DatePicker'] ADivider: typeof import('@arco-design/web-vue')['Divider'] ADoption: typeof import('@arco-design/web-vue')['Doption'] ADrawer: typeof import('@arco-design/web-vue')['Drawer'] @@ -50,10 +49,8 @@ declare module '@vue/runtime-core' { ARadioGroup: typeof import('@arco-design/web-vue')['RadioGroup'] AScrollbar: typeof import('@arco-design/web-vue')['Scrollbar'] ASelect: typeof import('@arco-design/web-vue')['Select'] - ASlider: typeof import('@arco-design/web-vue')['Slider'] ASpace: typeof import('@arco-design/web-vue')['Space'] ASpin: typeof import('@arco-design/web-vue')['Spin'] - ASwitch: typeof import('@arco-design/web-vue')['Switch'] ATable: typeof import('@arco-design/web-vue')['Table'] ATableColumn: typeof import('@arco-design/web-vue')['TableColumn'] ATabPane: typeof import('@arco-design/web-vue')['TabPane'] diff --git a/src/utils/delConfirm.ts b/src/utils/delConfirm.ts index 0ab5429..25d4788 100644 --- a/src/utils/delConfirm.ts +++ b/src/utils/delConfirm.ts @@ -20,11 +20,10 @@ const delConfirm = (config: DelOptions = {}) => { if (typeof config === "string") { config = { content: config }; } - const merged = merge(delOptions, config); + const merged = merge({}, delOptions, config); return new Promise((onOk: () => void, onCancel) => { Modal.open({ ...merged, onOk, onCancel }); }); }; export { delConfirm }; -