From 7ab0179a983da7e157c57e716fd985b529e47112 Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Wed, 1 Nov 2023 23:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E4=B8=8A=E4=BC=A0=20=E5=92=8C=20=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/pages/config/upload.vue | 83 +++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 16 deletions(-) diff --git a/admin/src/pages/config/upload.vue b/admin/src/pages/config/upload.vue index edcfa1c..f36c93a 100644 --- a/admin/src/pages/config/upload.vue +++ b/admin/src/pages/config/upload.vue @@ -8,10 +8,11 @@ import { UploadDeleteAction, UploadSearchAction, UploadListAction, - $response, $image + $response, $image, $base64, UploadImageAction } from '~/api' import $router from '~/router' import {onBeforeRouteUpdate} from "vue-router"; +import {$copy} from "~/tool/copy"; const default_page_options = { search: '', @@ -102,19 +103,38 @@ const UploadDelete = async () => { } const deleteClick = () => { window.$box.confirm( - '是否确认删除该上传文件?', - '提示', - { - confirmButtonText: '确认', - cancelButtonText: '取消', - type: 'warning', - } + '是否确认删除该上传文件?', + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } ).then(() => { UploadDelete() }).catch(() => { }) } const image_arr = ['png', 'jpeg', 'jpg', 'gif'] + +const fileChange = async (e) => { + if (e.size > 1024 * 1024 * 2) return window.$message().error('图片大小不能超过2M') + await UploadImage(await $base64(e.raw)) +} +const UploadImage = async (base64) => { + const response = await UploadImageAction({ + base64 + }) + $response(response, () => { + UploadList() + }) +} + +const copyLinkClick = (link) => { + $copy(link, () => { + window.$message().success('复制成功') + }) +}