|
@@ -9,6 +9,7 @@
|
|
|
:multiple="false"
|
|
|
:limit="1"
|
|
|
:show-file-list="false"
|
|
|
+ id="coverupload"
|
|
|
:http-request="() => {}"
|
|
|
:disabled="!!cover.percentage"
|
|
|
:before-upload="cover.upload"
|
|
@@ -16,6 +17,7 @@
|
|
|
:file-list="cover.fileList"
|
|
|
>
|
|
|
<el-button
|
|
|
+ @click.stop="coverUploadHandler"
|
|
|
ghost
|
|
|
type="primary"
|
|
|
:class="{ dispable: cover.percentage }"
|
|
@@ -79,14 +81,16 @@ import { metas, labels, images, shapes, MetaShapeType, customImage } from "./boa
|
|
|
import { BoardType } from "@/store/caseFile";
|
|
|
import { maxFileSize } from "@/constant/caseFile";
|
|
|
import { useUpload } from "@/hook/upload";
|
|
|
-import { reactive, watchEffect } from "vue";
|
|
|
+import { reactive, ref, watchEffect } from "vue";
|
|
|
import { imageCropper } from "@/view/system/quisk";
|
|
|
import { coverImageSize } from "@/util/image-rotate";
|
|
|
import { uploadFile } from "@/store/system";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
+import { confirm } from "@/helper/message";
|
|
|
|
|
|
-defineProps<{
|
|
|
+const props = defineProps<{
|
|
|
type: BoardType;
|
|
|
+ existsBgImage: boolean
|
|
|
addShape: MetaShapeType | null;
|
|
|
}>();
|
|
|
|
|
@@ -107,6 +111,13 @@ const cover = reactive(
|
|
|
})
|
|
|
);
|
|
|
|
|
|
+const coverUploadHandler = async () => {
|
|
|
+ if (props.existsBgImage && await confirm('重新上传将替换当前图体,确定要上传吗?')) {
|
|
|
+ // await cover.upload(file)
|
|
|
+ }
|
|
|
+ const input = document.querySelector('#coverupload')!.querySelector('input[type=file]') as HTMLInputElement
|
|
|
+ input.click()
|
|
|
+}
|
|
|
watchEffect(async () => {
|
|
|
if (cover.file) {
|
|
|
const coverImage = (await coverImageSize(cover.file, 540, 390, false)) || cover.file;
|