diff --git a/src/assets/icons/CLibrary.svg b/src/assets/icons/CLibrary.svg new file mode 100644 index 00000000..b8524188 --- /dev/null +++ b/src/assets/icons/CLibrary.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/component/Canvas/CanvasEditor/components/ToolsSidebar.vue b/src/component/Canvas/CanvasEditor/components/ToolsSidebar.vue index 678b8497..c3c2ab46 100644 --- a/src/component/Canvas/CanvasEditor/components/ToolsSidebar.vue +++ b/src/component/Canvas/CanvasEditor/components/ToolsSidebar.vue @@ -16,6 +16,7 @@ const emit = defineEmits([ "zoom-out", "toggle-red-green-mode", "undo-redo-status-changed", + "trigger-library" ]); const {t} = useI18n() const props = defineProps({ @@ -151,6 +152,13 @@ const normalToolsList = ref([ icon: { name: "CUpload", size: "26" }, class: "upload-btn", }, + { + id: "library", + title: t("LibraryPage.library"), + action: triggerLibrary, + icon: { name: "CLibrary", size: "26" }, + class: "library-btn", + }, { id: "addText", title: t("Canvas.AddText"), @@ -228,6 +236,10 @@ function triggerImageUpload() { emit("trigger-image-upload"); } +function triggerLibrary() { + emit("trigger-library"); +} + function addText() { emit("add-text"); } diff --git a/src/component/Canvas/CanvasEditor/index.vue b/src/component/Canvas/CanvasEditor/index.vue index 632a8b44..4fab1a07 100644 --- a/src/component/Canvas/CanvasEditor/index.vue +++ b/src/component/Canvas/CanvasEditor/index.vue @@ -52,6 +52,7 @@ const emit = defineEmits([ "trigger-red-green-mouseup", // 红绿图模式鼠标抬起事件 "changeCanvas", // 画布变更事件 "canvasInit", // 画布初始化事件 + "trigger-library", // 触发打开Library选择图片事件 ]); const props = defineProps({ @@ -705,6 +706,11 @@ function handleImageUpload(event) { }); } +function triggerLibrary() { + console.log('打开收藏') + emit("trigger-library"); +} + function handleAddText() { if (toolManager && canvasManager && canvasManager.canvas) { // 在画布中央创建文本 @@ -1043,6 +1049,7 @@ defineExpose({ @zoom-in="zoomIn" @zoom-out="zoomOut" @undo-redo-status-changed="changeCanvas" + @trigger-library="triggerLibrary" > diff --git a/src/component/common/SelectImages.vue b/src/component/common/SelectImages.vue new file mode 100644 index 00000000..50db5d45 --- /dev/null +++ b/src/component/common/SelectImages.vue @@ -0,0 +1,720 @@ + + + + + {{ $t(navTypeList(t).library.label) }} + × + + + + + + + {{ category }} + + + + + + + + + + {{ item.name || '未命名' }} + + + + + + + + + + + + 加载中... + + + + + 📷 + {{ $t('Canvas.NoPicture') }} + + + + + + + + + + + diff --git a/src/component/home/design/tools.vue b/src/component/home/design/tools.vue index 47aadcd2..43f7436a 100644 --- a/src/component/home/design/tools.vue +++ b/src/component/home/design/tools.vue @@ -54,6 +54,7 @@ @@ -76,6 +77,12 @@ +
加载中...
{{ $t('Canvas.NoPicture') }}