hy-dispatch-ui-v3 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tailwind.css +59 -0
- package/es/components/appConfigProvider/appConfigProvider.vue.mjs +3 -3
- package/es/components/appConfirmDialog/appConfirmDialog.vue.mjs +3 -3
- package/es/components/appConfirmDialog/appConfirmMethod.mjs +13 -13
- package/es/components/appCutter/appCutter.vue.mjs +285 -0
- package/es/components/appCutter/index.mjs +6 -0
- package/es/components/appCutter/style/appCutter.scss +51 -0
- package/es/components/appDialog/appDialog.vue.mjs +205 -0
- package/es/components/appDialog/index.mjs +6 -0
- package/es/components/appDialog/style/appDialog.scss +0 -0
- package/es/components/appSearch/appSearch.vue.mjs +4 -8
- package/es/components/appTable/appTable.vue.mjs +4 -4
- package/es/components/appTable/js/useAppTable.mjs +4 -3
- package/es/components/index.mjs +2 -0
- package/es/hooks/useApi.mjs +6 -2
- package/es/hooks/useGlobalConfig.mjs +2 -2
- package/es/hooks/useLocale.mjs +14 -4
- package/es/hooks/useUserAvatarMap.mjs +6 -2
- package/es/index.mjs +4 -1
- package/es/locale/en.mjs +6 -1
- package/es/locale/zh_CN.mjs +8 -3
- package/es/utils/file.mjs +68 -0
- package/es/utils/index.mjs +2 -1
- package/es/utils/is.mjs +4 -1
- package/es/version.mjs +1 -1
- package/lib/components/appConfigProvider/appConfigProvider.vue.js +1 -1
- package/lib/components/appConfirmDialog/appConfirmDialog.vue.js +3 -3
- package/lib/components/appConfirmDialog/appConfirmMethod.js +13 -13
- package/lib/components/appCutter/appCutter.vue.js +289 -0
- package/lib/components/appCutter/index.js +11 -0
- package/lib/components/appCutter/style/appCutter.scss +51 -0
- package/lib/components/appDialog/appDialog.vue.js +209 -0
- package/lib/components/appDialog/index.js +11 -0
- package/lib/components/appDialog/style/appDialog.scss +0 -0
- package/lib/components/appSearch/appSearch.vue.js +4 -8
- package/lib/components/appTable/appTable.vue.js +26 -26
- package/lib/components/appTable/js/useAppTable.js +4 -3
- package/lib/components/index.js +26 -22
- package/lib/hooks/useApi.js +6 -2
- package/lib/hooks/useLocale.js +13 -3
- package/lib/hooks/useUserAvatarMap.js +6 -2
- package/lib/index.js +35 -22
- package/lib/locale/en.js +6 -1
- package/lib/locale/zh_CN.js +8 -3
- package/lib/utils/file.js +76 -0
- package/lib/utils/index.js +9 -0
- package/lib/utils/is.js +4 -0
- package/lib/version.js +1 -1
- package/package.json +2 -3
package/dist/tailwind.css
CHANGED
|
@@ -624,6 +624,10 @@ video {
|
|
|
624
624
|
left: 1rem;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
+
.right-4 {
|
|
628
|
+
right: 1rem;
|
|
629
|
+
}
|
|
630
|
+
|
|
627
631
|
.top-0 {
|
|
628
632
|
top: 0px;
|
|
629
633
|
}
|
|
@@ -692,6 +696,10 @@ video {
|
|
|
692
696
|
display: block;
|
|
693
697
|
}
|
|
694
698
|
|
|
699
|
+
.inline-block {
|
|
700
|
+
display: inline-block;
|
|
701
|
+
}
|
|
702
|
+
|
|
695
703
|
.inline {
|
|
696
704
|
display: inline;
|
|
697
705
|
}
|
|
@@ -716,6 +724,10 @@ video {
|
|
|
716
724
|
height: 0.75rem !important;
|
|
717
725
|
}
|
|
718
726
|
|
|
727
|
+
.\!h-\[20px\] {
|
|
728
|
+
height: 20px !important;
|
|
729
|
+
}
|
|
730
|
+
|
|
719
731
|
.\!h-\[46px\] {
|
|
720
732
|
height: 46px !important;
|
|
721
733
|
}
|
|
@@ -748,6 +760,10 @@ video {
|
|
|
748
760
|
height: 45px;
|
|
749
761
|
}
|
|
750
762
|
|
|
763
|
+
.h-\[500px\] {
|
|
764
|
+
height: 500px;
|
|
765
|
+
}
|
|
766
|
+
|
|
751
767
|
.h-full {
|
|
752
768
|
height: 100%;
|
|
753
769
|
}
|
|
@@ -764,6 +780,10 @@ video {
|
|
|
764
780
|
width: 0.75rem !important;
|
|
765
781
|
}
|
|
766
782
|
|
|
783
|
+
.\!w-\[20px\] {
|
|
784
|
+
width: 20px !important;
|
|
785
|
+
}
|
|
786
|
+
|
|
767
787
|
.\!w-\[46px\] {
|
|
768
788
|
width: 46px !important;
|
|
769
789
|
}
|
|
@@ -800,6 +820,10 @@ video {
|
|
|
800
820
|
width: 1px;
|
|
801
821
|
}
|
|
802
822
|
|
|
823
|
+
.\!min-w-\[120px\] {
|
|
824
|
+
min-width: 120px !important;
|
|
825
|
+
}
|
|
826
|
+
|
|
803
827
|
.max-w-\[300px\] {
|
|
804
828
|
max-width: 300px;
|
|
805
829
|
}
|
|
@@ -877,6 +901,10 @@ video {
|
|
|
877
901
|
align-items: center;
|
|
878
902
|
}
|
|
879
903
|
|
|
904
|
+
.\!justify-center {
|
|
905
|
+
justify-content: center !important;
|
|
906
|
+
}
|
|
907
|
+
|
|
880
908
|
.justify-center {
|
|
881
909
|
justify-content: center;
|
|
882
910
|
}
|
|
@@ -941,6 +969,10 @@ video {
|
|
|
941
969
|
border-width: 1px;
|
|
942
970
|
}
|
|
943
971
|
|
|
972
|
+
.border-0 {
|
|
973
|
+
border-width: 0px;
|
|
974
|
+
}
|
|
975
|
+
|
|
944
976
|
.border-b {
|
|
945
977
|
border-bottom-width: 1px;
|
|
946
978
|
}
|
|
@@ -953,6 +985,10 @@ video {
|
|
|
953
985
|
border-right-width: 1px;
|
|
954
986
|
}
|
|
955
987
|
|
|
988
|
+
.border-solid {
|
|
989
|
+
border-style: solid;
|
|
990
|
+
}
|
|
991
|
+
|
|
956
992
|
.\!border-border {
|
|
957
993
|
--tw-border-opacity: 1 !important;
|
|
958
994
|
border-color: rgb(var(--hy-border), var(--tw-border-opacity, 1)) !important;
|
|
@@ -963,6 +999,11 @@ video {
|
|
|
963
999
|
border-color: rgb(var(--hy-theme), var(--tw-border-opacity, 1)) !important;
|
|
964
1000
|
}
|
|
965
1001
|
|
|
1002
|
+
.border-background-3 {
|
|
1003
|
+
--tw-border-opacity: 1;
|
|
1004
|
+
border-color: rgb(var(--hy-background-3), var(--tw-border-opacity, 1));
|
|
1005
|
+
}
|
|
1006
|
+
|
|
966
1007
|
.border-border {
|
|
967
1008
|
--tw-border-opacity: 1;
|
|
968
1009
|
border-color: rgb(var(--hy-border), var(--tw-border-opacity, 1));
|
|
@@ -1000,6 +1041,10 @@ video {
|
|
|
1000
1041
|
padding: 0px !important;
|
|
1001
1042
|
}
|
|
1002
1043
|
|
|
1044
|
+
.p-6 {
|
|
1045
|
+
padding: 1.5rem;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1003
1048
|
.p-\[1px\] {
|
|
1004
1049
|
padding: 1px;
|
|
1005
1050
|
}
|
|
@@ -1038,6 +1083,11 @@ video {
|
|
|
1038
1083
|
padding-right: 6px;
|
|
1039
1084
|
}
|
|
1040
1085
|
|
|
1086
|
+
.py-\[10px\] {
|
|
1087
|
+
padding-top: 10px;
|
|
1088
|
+
padding-bottom: 10px;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1041
1091
|
.pb-1 {
|
|
1042
1092
|
padding-bottom: 0.25rem;
|
|
1043
1093
|
}
|
|
@@ -1094,6 +1144,10 @@ video {
|
|
|
1094
1144
|
padding-top: 0.625rem;
|
|
1095
1145
|
}
|
|
1096
1146
|
|
|
1147
|
+
.pt-5 {
|
|
1148
|
+
padding-top: 1.25rem;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1097
1151
|
.pt-\[11px\] {
|
|
1098
1152
|
padding-top: 11px;
|
|
1099
1153
|
}
|
|
@@ -1119,6 +1173,11 @@ video {
|
|
|
1119
1173
|
line-height: 1.5rem;
|
|
1120
1174
|
}
|
|
1121
1175
|
|
|
1176
|
+
.text-lg {
|
|
1177
|
+
font-size: 1.125rem;
|
|
1178
|
+
line-height: 1.75rem;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1122
1181
|
.text-sm {
|
|
1123
1182
|
font-size: 0.875rem;
|
|
1124
1183
|
line-height: 1.25rem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createBlock,
|
|
1
|
+
import { defineComponent, unref, computed, openBlock, createBlock, mergeProps, withCtx, renderSlot } from 'vue';
|
|
2
2
|
import { ElConfigProvider } from 'element-plus';
|
|
3
3
|
import * as ElementLocale from 'element-plus/es/locales.mjs';
|
|
4
|
-
import { provideGlobalConfig } from '../../hooks/useGlobalConfig.mjs';
|
|
4
|
+
import { provideGlobalConfig, useGlobalConfig } from '../../hooks/useGlobalConfig.mjs';
|
|
5
5
|
|
|
6
6
|
const __default__ = defineComponent({
|
|
7
7
|
name: "AppConfigProvider"
|
|
@@ -62,7 +62,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
62
62
|
},
|
|
63
63
|
setup(__props) {
|
|
64
64
|
const props = __props;
|
|
65
|
-
const globalConfig = provideGlobalConfig(props);
|
|
65
|
+
const globalConfig = provideGlobalConfig(props, null, !unref(useGlobalConfig()));
|
|
66
66
|
const config = computed(() => {
|
|
67
67
|
const { locale, api, userAvatarMap, ...config2 } = globalConfig.value;
|
|
68
68
|
return {
|
|
@@ -145,7 +145,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
145
145
|
createElementVNode(
|
|
146
146
|
"span",
|
|
147
147
|
{ class: "text-sm text-main font-bold" },
|
|
148
|
-
toDisplayString(__props.dialogTitle || unref(t)("
|
|
148
|
+
toDisplayString(__props.dialogTitle || unref(t)("dialog.prompt")),
|
|
149
149
|
1
|
|
150
150
|
/* TEXT */
|
|
151
151
|
),
|
|
@@ -212,7 +212,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
212
212
|
}, {
|
|
213
213
|
default: withCtx(() => [
|
|
214
214
|
createTextVNode(
|
|
215
|
-
toDisplayString(__props.cancelText || unref(t)("
|
|
215
|
+
toDisplayString(__props.cancelText || unref(t)("dialog.cancel")),
|
|
216
216
|
1
|
|
217
217
|
/* TEXT */
|
|
218
218
|
)
|
|
@@ -228,7 +228,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
228
228
|
}, {
|
|
229
229
|
default: withCtx(() => [
|
|
230
230
|
createTextVNode(
|
|
231
|
-
toDisplayString(__props.submitText || unref(t)("
|
|
231
|
+
toDisplayString(__props.submitText || unref(t)("dialog.confirm")),
|
|
232
232
|
1
|
|
233
233
|
/* TEXT */
|
|
234
234
|
)
|
|
@@ -2,8 +2,8 @@ import { unref, createVNode, render } from 'vue';
|
|
|
2
2
|
import { defaultAxios } from '../../hooks/useApi.mjs';
|
|
3
3
|
import { AppConfigProvider } from '../appConfigProvider/index.mjs';
|
|
4
4
|
import _sfc_main from './appConfirmDialog.vue.mjs';
|
|
5
|
-
import { useGlobalConfig } from '../../hooks/useGlobalConfig.mjs';
|
|
6
5
|
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
6
|
+
import { useGlobalConfig } from '../../hooks/useGlobalConfig.mjs';
|
|
7
7
|
|
|
8
8
|
function appConfirmMethod(config) {
|
|
9
9
|
let container = document.createDocumentFragment();
|
|
@@ -52,9 +52,9 @@ function appConfirmMethod(config) {
|
|
|
52
52
|
_sfc_main.tip = (props) => {
|
|
53
53
|
const { t } = useLocale();
|
|
54
54
|
return appConfirmMethod({
|
|
55
|
-
dialogTitle: t("
|
|
56
|
-
title: t("
|
|
57
|
-
content: t("
|
|
55
|
+
dialogTitle: t("dialog.prompt"),
|
|
56
|
+
title: t("dialog.prompt"),
|
|
57
|
+
content: t("dialog.content"),
|
|
58
58
|
showCancel: false,
|
|
59
59
|
...props
|
|
60
60
|
});
|
|
@@ -62,19 +62,19 @@ _sfc_main.tip = (props) => {
|
|
|
62
62
|
_sfc_main.confirm = (props) => {
|
|
63
63
|
const { t } = useLocale();
|
|
64
64
|
return appConfirmMethod({
|
|
65
|
-
dialogTitle: t("
|
|
66
|
-
title: t("
|
|
67
|
-
content: t("
|
|
65
|
+
dialogTitle: t("dialog.prompt"),
|
|
66
|
+
title: t("dialog.prompt"),
|
|
67
|
+
content: t("dialog.content"),
|
|
68
68
|
...props
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
_sfc_main.warning = (props) => {
|
|
72
72
|
const { t } = useLocale();
|
|
73
73
|
return appConfirmMethod({
|
|
74
|
-
dialogTitle: t("
|
|
75
|
-
title: t("
|
|
74
|
+
dialogTitle: t("dialog.riskWarning"),
|
|
75
|
+
title: t("dialog.prompt"),
|
|
76
76
|
titleClass: "text-warning",
|
|
77
|
-
content: t("
|
|
77
|
+
content: t("dialog.content"),
|
|
78
78
|
iconColor: "rgb(var(--hy-warning))",
|
|
79
79
|
...props
|
|
80
80
|
});
|
|
@@ -82,10 +82,10 @@ _sfc_main.warning = (props) => {
|
|
|
82
82
|
_sfc_main.danger = (props) => {
|
|
83
83
|
const { t } = useLocale();
|
|
84
84
|
return appConfirmMethod({
|
|
85
|
-
dialogTitle: t("
|
|
85
|
+
dialogTitle: t("dialog.dangerousOperation"),
|
|
86
86
|
titleClass: "text-danger",
|
|
87
|
-
title: t("
|
|
88
|
-
content: t("
|
|
87
|
+
title: t("dialog.prompt"),
|
|
88
|
+
content: t("dialog.content"),
|
|
89
89
|
submitType: "danger",
|
|
90
90
|
iconColor: "rgb(var(--hy-danger))",
|
|
91
91
|
...props
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { defineComponent, useModel, useTemplateRef, ref, computed, resolveComponent, openBlock, createElementBlock, withDirectives, createVNode, unref, withCtx, createElementVNode, renderSlot, normalizeStyle, createBlock, Fragment, createCommentVNode, toDisplayString, withModifiers, vShow, mergeProps, mergeModels } from 'vue';
|
|
2
|
+
import { VueCropper } from 'vue-cropper';
|
|
3
|
+
import { ElUpload, ElImage, ElIcon, ElMessage } from 'element-plus';
|
|
4
|
+
import { Delete } from '@element-plus/icons-vue';
|
|
5
|
+
import { AppDialog } from '../appDialog/index.mjs';
|
|
6
|
+
import { isFile } from '../../utils/is.mjs';
|
|
7
|
+
import { sizeToTextHandler, blobToDataURL, fileUpload } from '../../utils/file.mjs';
|
|
8
|
+
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
9
|
+
|
|
10
|
+
import "vue-cropper/dist/index.css";
|
|
11
|
+
|
|
12
|
+
import "./style/appCutter.scss";
|
|
13
|
+
|
|
14
|
+
const __default__ = defineComponent({
|
|
15
|
+
name: "AppCutter"
|
|
16
|
+
});
|
|
17
|
+
const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
18
|
+
props: /* @__PURE__ */ mergeModels({
|
|
19
|
+
dialogWidth: { type: [String, Number], default: 1e3 },
|
|
20
|
+
defaultImg: { type: String },
|
|
21
|
+
uploadText: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: () => {
|
|
24
|
+
const { t } = useLocale();
|
|
25
|
+
return t("cutter.uploadPicture");
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
showUpload: { type: Boolean, default: true },
|
|
29
|
+
showText: { type: Boolean, default: true },
|
|
30
|
+
showDelete: { type: Boolean, default: true },
|
|
31
|
+
maxSize: { type: Number, default: 1024 * 1024 * 2 },
|
|
32
|
+
accept: { type: String, default: "image/png,image/jpg,image/jpeg,image/gif" },
|
|
33
|
+
info: { type: Boolean, default: true },
|
|
34
|
+
outputSize: { type: Number, default: 1 },
|
|
35
|
+
outputType: { type: String, default: "jpeg" },
|
|
36
|
+
autoCrop: { type: Boolean, default: true },
|
|
37
|
+
autoCropWidth: { type: Number, default: 100 },
|
|
38
|
+
autoCropHeight: { type: Number, default: 100 },
|
|
39
|
+
fixedBox: { type: Boolean, default: false },
|
|
40
|
+
fixed: { type: Boolean, default: true },
|
|
41
|
+
fixedNumber: { type: Array },
|
|
42
|
+
full: { type: Boolean, default: true },
|
|
43
|
+
canMoveBox: { type: Boolean, default: false },
|
|
44
|
+
original: { type: Boolean, default: false },
|
|
45
|
+
centerBox: { type: Boolean, default: true },
|
|
46
|
+
infoTrue: { type: Boolean, default: false }
|
|
47
|
+
}, {
|
|
48
|
+
"modelValue": { type: String },
|
|
49
|
+
"modelModifiers": {}
|
|
50
|
+
}),
|
|
51
|
+
emits: /* @__PURE__ */ mergeModels(["confirm"], ["update:modelValue"]),
|
|
52
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
53
|
+
const props = __props;
|
|
54
|
+
const emits = __emit;
|
|
55
|
+
const { t } = useLocale();
|
|
56
|
+
const modelValue = useModel(__props, "modelValue");
|
|
57
|
+
const cropperRef = useTemplateRef("cropperRef");
|
|
58
|
+
const uploadRef = useTemplateRef("uploadRef");
|
|
59
|
+
const visible = ref(false);
|
|
60
|
+
const imgSrc = ref();
|
|
61
|
+
const fileInfo = ref({
|
|
62
|
+
name: "",
|
|
63
|
+
src: ""
|
|
64
|
+
});
|
|
65
|
+
const imageSrc = computed(() => imgSrc.value || props.defaultImg);
|
|
66
|
+
const options = computed(() => ({
|
|
67
|
+
info: props.info,
|
|
68
|
+
// 裁剪框的大小信息
|
|
69
|
+
outputSize: props.outputSize,
|
|
70
|
+
// 裁剪生成图片的质量
|
|
71
|
+
outputType: props.outputType,
|
|
72
|
+
// 裁剪生成图片的格式
|
|
73
|
+
canScale: props.canScale,
|
|
74
|
+
// 图片是否允许滚轮缩放
|
|
75
|
+
autoCrop: props.autoCrop,
|
|
76
|
+
// 是否默认生成截图框
|
|
77
|
+
autoCropWidth: props.autoCropWidth,
|
|
78
|
+
// 默认生成截图框宽度
|
|
79
|
+
autoCropHeight: props.autoCropHeight,
|
|
80
|
+
// 默认生成截图框高度
|
|
81
|
+
fixedBox: props.fixedBox,
|
|
82
|
+
// 固定截图框大小 不允许改变
|
|
83
|
+
fixed: props.fixed,
|
|
84
|
+
// 是否开启截图框宽高固定比例
|
|
85
|
+
fixedNumber: props.fixedNumber,
|
|
86
|
+
// 截图框的宽高比例
|
|
87
|
+
full: props.full,
|
|
88
|
+
// 是否输出原图比例的截图
|
|
89
|
+
canMoveBox: props.canMoveBox,
|
|
90
|
+
// 截图框能否拖动
|
|
91
|
+
original: props.original,
|
|
92
|
+
// 上传图片按照原始比例渲染
|
|
93
|
+
centerBox: props.centerBox,
|
|
94
|
+
// 截图框是否被限制在图片里面
|
|
95
|
+
infoTrue: props.infoTrue
|
|
96
|
+
// true 为展示真实输出图片宽高 false 展示看到的截图框宽高
|
|
97
|
+
}));
|
|
98
|
+
function openFilePicker(param, name = "img.png") {
|
|
99
|
+
if (typeof param === "string") {
|
|
100
|
+
openCutter(param, name);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (isFile(param)) {
|
|
104
|
+
beforeAvatarUpload(file);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
uploadRef.value.click();
|
|
108
|
+
}
|
|
109
|
+
async function beforeAvatarUpload(file2) {
|
|
110
|
+
const limit = file2.size < props.maxSize;
|
|
111
|
+
if (!limit) {
|
|
112
|
+
ElMessage.error(
|
|
113
|
+
t("cutter.uploadPictureLimit", [sizeToTextHandler(props.maxSize)])
|
|
114
|
+
);
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const result = await blobToDataURL(file2);
|
|
118
|
+
openCutter(result, file2.name);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
function openCutter(src, name) {
|
|
122
|
+
visible.value = true;
|
|
123
|
+
fileInfo.value.src = src;
|
|
124
|
+
fileInfo.value.name = name;
|
|
125
|
+
}
|
|
126
|
+
function onClearHandler() {
|
|
127
|
+
imgSrc.value = "";
|
|
128
|
+
modelValue.value = null;
|
|
129
|
+
fileInfo.value = {
|
|
130
|
+
name: "",
|
|
131
|
+
src: ""
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async function onSubmitHandler() {
|
|
135
|
+
return new Promise((resolve, reject) => {
|
|
136
|
+
cropperRef.value.getCropBlob(async (data) => {
|
|
137
|
+
var _a, _b;
|
|
138
|
+
data.name = fileInfo.value.name;
|
|
139
|
+
const res = await fileUpload(data).catch((res2) => {
|
|
140
|
+
ElMessage.error(res2.msg || res2);
|
|
141
|
+
reject();
|
|
142
|
+
});
|
|
143
|
+
if (res.code === 200) {
|
|
144
|
+
imgSrc.value = await blobToDataURL(data);
|
|
145
|
+
modelValue.value = ((_a = res.data) == null ? void 0 : _a.key) || ((_b = res.data) == null ? void 0 : _b.url) || res.data;
|
|
146
|
+
emits("confirm", res);
|
|
147
|
+
resolve();
|
|
148
|
+
} else {
|
|
149
|
+
ElMessage.error(res.msg || res);
|
|
150
|
+
reject();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
__expose({
|
|
156
|
+
open: openFilePicker,
|
|
157
|
+
clear: onClearHandler
|
|
158
|
+
});
|
|
159
|
+
return (_ctx, _cache) => {
|
|
160
|
+
const _component_User = resolveComponent("User");
|
|
161
|
+
return openBlock(), createElementBlock("div", { class: "inline-block" }, [
|
|
162
|
+
withDirectives(createVNode(
|
|
163
|
+
unref(ElUpload),
|
|
164
|
+
{
|
|
165
|
+
accept: ".png,.jpg,.gif,.jpeg",
|
|
166
|
+
"before-upload": beforeAvatarUpload,
|
|
167
|
+
action: "",
|
|
168
|
+
class: "upload_box",
|
|
169
|
+
"show-file-list": false
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
default: withCtx(() => [
|
|
173
|
+
createElementVNode(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
ref_key: "uploadRef",
|
|
177
|
+
ref: uploadRef,
|
|
178
|
+
class: "app-cutter-upload-box"
|
|
179
|
+
},
|
|
180
|
+
[
|
|
181
|
+
renderSlot(_ctx.$slots, "default", { src: imgSrc.value }, () => [
|
|
182
|
+
createElementVNode(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
class: "app-cutter-upload-card",
|
|
186
|
+
style: normalizeStyle({
|
|
187
|
+
width: `${__props.autoCropWidth}px`,
|
|
188
|
+
height: `${__props.autoCropHeight}px`
|
|
189
|
+
})
|
|
190
|
+
},
|
|
191
|
+
[
|
|
192
|
+
modelValue.value && imageSrc.value ? (openBlock(), createBlock(unref(ElImage), {
|
|
193
|
+
key: 0,
|
|
194
|
+
src: imageSrc.value,
|
|
195
|
+
style: normalizeStyle({
|
|
196
|
+
width: `${__props.autoCropWidth}px`,
|
|
197
|
+
height: `${__props.autoCropHeight}px`
|
|
198
|
+
})
|
|
199
|
+
}, null, 8, ["src", "style"])) : (openBlock(), createElementBlock(
|
|
200
|
+
Fragment,
|
|
201
|
+
{ key: 1 },
|
|
202
|
+
[
|
|
203
|
+
createCommentVNode(' <AppIcon\n v-else\n svg-name="emptyHead"\n style="width: 70px; height: 70px"\n /> '),
|
|
204
|
+
createVNode(unref(ElIcon), {
|
|
205
|
+
color: "rgb(var(--hy-auxiliary))",
|
|
206
|
+
size: "64"
|
|
207
|
+
}, {
|
|
208
|
+
default: withCtx(() => [
|
|
209
|
+
createVNode(_component_User)
|
|
210
|
+
]),
|
|
211
|
+
_: 1
|
|
212
|
+
/* STABLE */
|
|
213
|
+
})
|
|
214
|
+
],
|
|
215
|
+
2112
|
|
216
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
217
|
+
))
|
|
218
|
+
],
|
|
219
|
+
4
|
|
220
|
+
/* STYLE */
|
|
221
|
+
)
|
|
222
|
+
]),
|
|
223
|
+
__props.uploadText && __props.showText ? (openBlock(), createElementBlock(
|
|
224
|
+
"div",
|
|
225
|
+
{
|
|
226
|
+
key: 0,
|
|
227
|
+
class: "app-cutter-tip"
|
|
228
|
+
},
|
|
229
|
+
toDisplayString(__props.uploadText),
|
|
230
|
+
1
|
|
231
|
+
/* TEXT */
|
|
232
|
+
)) : createCommentVNode("v-if", true),
|
|
233
|
+
__props.showDelete ? withDirectives((openBlock(), createElementBlock("div", {
|
|
234
|
+
key: 1,
|
|
235
|
+
class: "app-cutter-delete",
|
|
236
|
+
onClick: withModifiers(($event) => onClearHandler(), ["stop"])
|
|
237
|
+
}, [
|
|
238
|
+
createCommentVNode(' <AppIcon svg-name="delete" /> '),
|
|
239
|
+
createVNode(unref(ElIcon), { color: "rgb(var(--hy-danger-2))" }, {
|
|
240
|
+
default: withCtx(() => [
|
|
241
|
+
createVNode(unref(Delete))
|
|
242
|
+
]),
|
|
243
|
+
_: 1
|
|
244
|
+
/* STABLE */
|
|
245
|
+
})
|
|
246
|
+
], 8, ["onClick"])), [
|
|
247
|
+
[vShow, modelValue.value]
|
|
248
|
+
]) : createCommentVNode("v-if", true)
|
|
249
|
+
],
|
|
250
|
+
512
|
|
251
|
+
/* NEED_PATCH */
|
|
252
|
+
)
|
|
253
|
+
]),
|
|
254
|
+
_: 3
|
|
255
|
+
/* FORWARDED */
|
|
256
|
+
},
|
|
257
|
+
512
|
|
258
|
+
/* NEED_PATCH */
|
|
259
|
+
), [
|
|
260
|
+
[vShow, __props.showUpload]
|
|
261
|
+
]),
|
|
262
|
+
createVNode(unref(AppDialog), {
|
|
263
|
+
modelValue: visible.value,
|
|
264
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
265
|
+
title: unref(t)("cutter.imageSegmentation"),
|
|
266
|
+
onSubmit: onSubmitHandler
|
|
267
|
+
}, {
|
|
268
|
+
default: withCtx(() => [
|
|
269
|
+
createElementVNode("div", { class: "h-[500px]" }, [
|
|
270
|
+
createVNode(unref(VueCropper), mergeProps({
|
|
271
|
+
ref_key: "cropperRef",
|
|
272
|
+
ref: cropperRef,
|
|
273
|
+
img: fileInfo.value.src
|
|
274
|
+
}, options.value), null, 16, ["img"])
|
|
275
|
+
])
|
|
276
|
+
]),
|
|
277
|
+
_: 1
|
|
278
|
+
/* STABLE */
|
|
279
|
+
}, 8, ["modelValue", "onUpdate:modelValue", "title"])
|
|
280
|
+
]);
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.app-cutter-upload-box {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
.app-cutter-delete {
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 23px;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
position: absolute;
|
|
13
|
+
bottom: -23px;
|
|
14
|
+
z-index: 3;
|
|
15
|
+
transition: all 0.3s;
|
|
16
|
+
background: rgba(0, 0, 0, 0.6);
|
|
17
|
+
}
|
|
18
|
+
.app-cutter-tip {
|
|
19
|
+
width: 100%;
|
|
20
|
+
position: absolute;
|
|
21
|
+
left: 50%;
|
|
22
|
+
top: 50%;
|
|
23
|
+
transform: translate(-50%, -50%);
|
|
24
|
+
z-index: 3;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
color: rgb(var(--hy-theme));
|
|
27
|
+
text-align: center;
|
|
28
|
+
user-select: none;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
transition: all 0.3s;
|
|
31
|
+
}
|
|
32
|
+
&:hover {
|
|
33
|
+
.app-cutter-delete {
|
|
34
|
+
bottom: 0;
|
|
35
|
+
}
|
|
36
|
+
.app-cutter-tip {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
.app-cutter-upload-card {
|
|
41
|
+
width: 70px;
|
|
42
|
+
height: 70px;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
border: 1px solid rgb(var(--hy-border));
|
|
47
|
+
border-radius: 4px;
|
|
48
|
+
background-color: rgb(var(--hy-background-2));
|
|
49
|
+
position: relative;
|
|
50
|
+
}
|
|
51
|
+
}
|