feat: add success message

This commit is contained in:
chndfang 2025-06-16 00:24:11 +08:00
parent a60f428e19
commit 21225161da
3 changed files with 24 additions and 6 deletions

5
mocks/scene/pushById Normal file
View File

@ -0,0 +1,5 @@
{
"code": 200,
"success": true,
"message": "模拟提示"
}

View File

@ -450,14 +450,24 @@
background-color: none;
box-shadow: none !important;
& > .ant-message-error {
& > .ant-message-custom-content {
display: flex;
align-items: center;
padding: 8px 15px;
font: 400 14px/22px Roboto;
color: get-color(text1);
background-color: get-color(error_bg);
border: 1px solid get-color(error_border);
border-radius: 2px;
&.ant-message-success {
background-color: get-color(success_bg);
border: 1px solid get-color(success_border);
}
&.ant-message-error {
background-color: get-color(error_bg);
border: 1px solid get-color(error_border);
}
& > .anticon {
margin-inline-end: 10px;
}

View File

@ -2,7 +2,7 @@
import { getSceneById, pushSceneById } from '@api/scene';
import { EditorService } from '@core/editor.service';
import { decodeTextFile, downloadFile, selectFile, textToBlob } from '@core/utils';
import { Modal } from 'ant-design-vue';
import { message, Modal } from 'ant-design-vue';
import { computed, watch } from 'vue';
import { ref } from 'vue';
import { onMounted, provide, shallowRef } from 'vue';
@ -25,7 +25,10 @@ const readScene = async () => {
};
const pushScene = async () => {
await pushSceneById(props.id);
const res = await pushSceneById(props.id);
if (!res) return Promise.reject();
message.success(t('场景推送成功'));
return Promise.resolve();
};
//#endregion
@ -54,7 +57,7 @@ const toPush = () =>
centered: true,
cancelText: t('返回'),
okText: t('推送'),
onOk: () => pushScene(),
onOk: async () => await pushScene(),
});
const importScene = async () => {