From 8e0b9f72d5fe2adbd100b37b04edad23bea76ab2 Mon Sep 17 00:00:00 2001
From: zhuhao <979263092@qq.com>
Date: Fri, 20 Dec 2024 11:16:44 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=AB=E6=A0=BC=E5=9B=BE=E7=89=87=E6=8F=92?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
.../src/components/grid-pic/index.vue | 75 ++++++++++++++-----
.../src/components/grid-pic/viewer-item.vue | 19 ++---
src/renderer/src/views/prepare/index.vue | 2 +-
4 files changed, 68 insertions(+), 30 deletions(-)
diff --git a/package.json b/package.json
index 0f89d82..e8adfd8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "aix-win-ws",
- "version": "2.5.6",
+ "version": "2.5.7",
"description": "",
"main": "./out/main/index.js",
"author": "上海交大重庆人工智能研究院",
diff --git a/src/renderer/src/components/grid-pic/index.vue b/src/renderer/src/components/grid-pic/index.vue
index 4769a98..9725af6 100644
--- a/src/renderer/src/components/grid-pic/index.vue
+++ b/src/renderer/src/components/grid-pic/index.vue
@@ -1,3 +1,16 @@
+
@@ -9,16 +22,21 @@
-
-
- 添加
-
-
- 画笔
-
-
-
+
+
+
+ 添加
+
+
+ 清空
+
+
+
@@ -26,10 +44,18 @@
import {ref, computed, onMounted} from 'vue'
import Draggable from 'vuedraggable'
import ViewerItem from "./viewer-item.vue";
- import Fabric from 'fabric';
+ // import Fabric from 'fabric';
const gridPicList = ref([])
const inputValue = ref('')
const isShow = ref(false)
+ const emits = defineEmits(['clear','outIndex']);
+
+ const props = defineProps({
+ showToolbar: {
+ type: Boolean,
+ default: true
+ }
+ })
// 获取图片样式
const getWH = (item,index)=>{
return {
@@ -118,13 +144,19 @@
}
})
+ const pushPic = () => {
+ let src = inputValue.value||picList[gridPicList.value.length]
+ addPic(src)
+ }
// 添加图片
- const addPic = () => {
+ const addPic = (src) => {
if (gridPicList.value.length >= 9) {
+ console.log("超出九个图片")
+ emits('outIndex')
return
}
- let src = inputValue.value||picList[gridPicList.value.length]
if (!src) {
+ console.log("图片链接不能为空")
return;
}
gridPicList.value.push({
@@ -133,6 +165,11 @@
})
inputValue.value = ''
}
+ // 清空图片
+ const clearPic = () => {
+ gridPicList.value = []
+ emits('clear')
+ }
//开始画笔
const startPencil = () => {
isShow.value = !isShow.value
@@ -148,7 +185,7 @@
b = b.length === 1? '0' + b : b;
return `#${r}${g}${b}`;
}
- //初始化画笔
+ /* //初始化画笔
const initPend = () => {
let canvas = new Fabric.fabric.Canvas('canvas_pic_001',{
interactive: false,
@@ -162,10 +199,11 @@
canvas.freeDrawingBrush = new Fabric.fabric.PencilBrush(canvas)
canvas.freeDrawingBrush.width = 1//设置画笔粗细
canvas.freeDrawingBrush.color = "red"//设置画笔颜色
- }
- onMounted(() => {
+ }*/
+ /*onMounted(() => {
initPend()
- })
+ })*/
+ defineExpose({addPic,clearPic})