Skip to content

Commit

Permalink
fix: 修复配置水印触发清除问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wuchenguang1998 committed May 2, 2024
1 parent a103186 commit 3062e51
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/components/waterMark.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@
{{ $t('waterMark.text') }}
</Button>

<Modal
v-model="showWaterMadal"
:title="$t('waterMark.modalTitle')"
:cancel-text="`${$t('cleanUp')}${$t('waterMark.text')}`"
@on-ok="onModalOk"
@on-cancel="onCleanUpWaterMark"
>
<div class="setting-item">
<Modal v-model="showWaterMadal" :title="$t('waterMark.modalTitle')">
<div class="setting-item required">
<span class="mr-10px">{{ $t('waterMark.setting.name') }}</span>
<Input
class="w-320"
Expand Down Expand Up @@ -71,6 +65,12 @@
</RadioGroup>
</div>
</div>
<template #footer>
<Button type="text" @click="onCleanUpWaterMark">
{{ `${$t('cleanUp')}${$t('waterMark.text')}` }}
</Button>
<Button type="primary" @click="onModalOk">确定</Button>
</template>
</Modal>
</template>

Expand Down Expand Up @@ -122,13 +122,15 @@ const onCleanUpWaterMark = () => {
waterMarkState.position = POSITION.lt;
waterMarkState.isRotate = 0;
canvasEditor.clearWaterMMatk();
showWaterMadal.value = false;
};

const onModalOk = async () => {
if (!waterMarkState.text) return Message.warning('水印名字不能为空');
const ops: IDrawOps = cloneDeep(waterMarkState);
ops.isRotate = !!ops.isRotate; // 转为对应类型 后续再统一处理类型
await canvasEditor.drawWaterMark(ops);
showWaterMadal.value = false;
// onMadalCancel();
};

Expand All @@ -155,6 +157,14 @@ const addWaterMark = debounce(function () {
justify-content: flex-start;
align-items: center;
margin-bottom: 10px;
position: relative;
&.required::before {
content: '*';
color: red;
position: absolute;
top: 3px;
left: -6px;
}
}
.font-selector {
:deep(.ivu-select-item) {
Expand Down

0 comments on commit 3062e51

Please sign in to comment.