diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index a9f62599..80862845 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -71,4 +71,4 @@ "watchPostEffect": true, "watchSyncEffect": true } -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index fb5f9ac5..0641a795 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,5 +11,8 @@ "src/language" ], "i18n-ally.sourceLanguage": "zh", - "i18n-ally.keystyle": "nested" // 需要Prettier的配置文件 + "i18n-ally.keystyle": "nested", + "[vue]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } // 需要Prettier的配置文件 } \ No newline at end of file diff --git a/package.json b/package.json index d51c0b93..a12b5d35 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "view-ui-plus": "^1.3.7", "vite-svg-loader": "^5.1.0", "vue": "^3.2.25", + "vue-cropper": "^1.1.4", "vue-i18n": "9.0.0", "vue-masonry": "^0.16.0", "vue-router": "^4.0.16", diff --git a/src/components/cropperDialog.vue b/src/components/cropperDialog.vue new file mode 100644 index 00000000..826ae03d --- /dev/null +++ b/src/components/cropperDialog.vue @@ -0,0 +1,290 @@ + + + + 图片加载中... + + 裁剪比例 + + 自由 + + 1:1 + + + + 2:3 + + + + + 3:2 + + + + + 4:3 + + + + + 3:4 + + + + + 16:9 + + + + + 9:16 + + + + 当前尺寸 + + + X + + + + + + + + + + + + + + 预览 + + + + + + + + diff --git a/src/components/cropperImg.vue b/src/components/cropperImg.vue new file mode 100644 index 00000000..2aa5d802 --- /dev/null +++ b/src/components/cropperImg.vue @@ -0,0 +1,89 @@ + + + + {{ $t('cropperImg') }} + + + + + + + diff --git a/src/language/zh.json b/src/language/zh.json index 628272d3..143fc750 100644 --- a/src/language/zh.json +++ b/src/language/zh.json @@ -91,6 +91,7 @@ }, "select_json": "选择JSON文件", "repleaceImg": "替换图片", + "cropperImg": "裁剪图片", "createClip": "添加裁切", "removeClip": "移除裁切", "polygonClip": "多边形", @@ -258,4 +259,4 @@ }, "mine": "我的", "batch": "批量" -} +} \ No newline at end of file diff --git a/src/views/home/index.vue b/src/views/home/index.vue index b53039c2..910b711c 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -125,6 +125,8 @@ + + @@ -210,6 +212,7 @@ import material from '@/components/material.vue'; import bgBar from '@/components/bgBar.vue'; import setSize from '@/components/setSize.vue'; import replaceImg from '@/components/replaceImg.vue'; +import cropperImg from '@/components/cropperImg.vue'; import filters from '@/components/filters.vue'; import imgStroke from '@/components/imgStroke.vue'; // import elementData from '@/components/elementData.vue'; @@ -451,6 +454,7 @@ provide('canvasEditor', canvasEditor); width: 380px; } } + // 右侧容器 .right-bar { width: 304px; @@ -507,6 +511,7 @@ provide('canvasEditor', canvasEditor); border-radius: 4px; display: flex; align-items: center; + .ivu-tooltip { text-align: center; flex: 1; @@ -539,11 +544,13 @@ provide('canvasEditor', canvasEditor); .right { display: flex; align-items: center; + img { display: block; margin-right: 10px; } } + .home, .ivu-layout { height: 100vh; @@ -556,6 +563,7 @@ provide('canvasEditor', canvasEditor); .canvas-box { position: relative; } + // 画布内阴影 .inside-shadow { position: absolute; @@ -591,10 +599,12 @@ provide('canvasEditor', canvasEditor); .ivu-menu-light.ivu-menu-vertical .ivu-menu-item-active:not(.ivu-menu-submenu) { background: none; } + // 标尺 .switch { margin-right: 10px; } + // 网格背景 .design-stage-grid { --offsetX: 0px;