From 4318f73bd3133598083a84acfe973cbd191fa724 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Wed, 19 Jun 2024 10:55:25 +0800 Subject: [PATCH] fix --- src/components/img-upload/Cropper.vue | 163 +++-- src/components/modules/content.vue | 130 ++-- src/components/modules/module.vue | 287 +++----- src/pages/article/add/index.vue | 969 +++++++++----------------- src/pages/column/add/index.vue | 2 +- src/setting.js | 91 ++- 6 files changed, 579 insertions(+), 1063 deletions(-) diff --git a/src/components/img-upload/Cropper.vue b/src/components/img-upload/Cropper.vue index b2d12ed..754e269 100644 --- a/src/components/img-upload/Cropper.vue +++ b/src/components/img-upload/Cropper.vue @@ -3,31 +3,18 @@
- +
-
- + :style="{ 'width': '500px', 'height': '400px', 'overflow': 'hidden', 'margin': '0 25px', 'display': 'flex', 'align-items': 'center' }"> +
+
@@ -41,10 +28,7 @@
-->
- + 上传
@@ -56,7 +40,7 @@ import { VueCropper } from 'vue-cropper' -import { compress, compressAccurately } from 'image-conversion' +import { compress, compressAccurately, canvastoDataURL } from 'image-conversion' export default { components: { VueCropper @@ -95,7 +79,11 @@ export default { autoCropHeight: { type: Number, default: 124 - } + }, + dataType: { + type: String, + default: 'form' + }, }, data () { return { @@ -114,6 +102,7 @@ export default { fixedNumber: [1, 0.26], // 截图框比例 (默认:[1:1]) enlarge: 1 }, + imgType: this.dataType === 'form' ? 'image/png' : 'image/jpeg', isDisabled: false } }, @@ -147,9 +136,13 @@ export default { const that = this if (type === 'blob') { this.$refs.cropper.getCropBlob(data => { - // compress(data, 1).then(res => { - that.$emit('upload', data) - // }) + compress(data, { + size: 100, + quality: 0.9, + type: this.imgType + }).then(res => { + that.$emit('upload', res) + }) }) } else { this.$refs.cropper.getCropData(data => { @@ -162,81 +155,81 @@ export default { diff --git a/src/components/modules/content.vue b/src/components/modules/content.vue index 211f488..b2af1ac 100644 --- a/src/components/modules/content.vue +++ b/src/components/modules/content.vue @@ -1,117 +1,64 @@ @@ -292,11 +239,12 @@ export default { \ No newline at end of file diff --git a/src/components/modules/module.vue b/src/components/modules/module.vue index 5a11daa..4847c6f 100644 --- a/src/components/modules/module.vue +++ b/src/components/modules/module.vue @@ -3,40 +3,22 @@ - + - - - - -
- - -
+ + + + +
+ + +

上传图片

-
+

只支持.jpg,.png格式

- + 上传视频 -
+

请上传大小1G以内的视频

- + 上传资源 - +
-
- +
+ 设置链接
- + - - - - + + + + - - + + - + - 默认读取关联栏目 + 默认读取关联栏目
- - + +
- + 取消 - 确定 + 确定 - - - + + + - - + +
@@ -650,11 +528,12 @@ export default { \ No newline at end of file diff --git a/src/pages/article/add/index.vue b/src/pages/article/add/index.vue index c928a68..4ef5400 100644 --- a/src/pages/article/add/index.vue +++ b/src/pages/article/add/index.vue @@ -1,159 +1,90 @@