refactor(antdv-next): 将message组件调用统一改为window.message

将项目中直接导入的antdv-next的message组件调用改为通过window.message调用,提升代码一致性
移除不再需要的message组件导入
新增api-switch组件用于统一处理状态切换逻辑
This commit is contained in:
dap
2026-01-15 09:35:54 +08:00
parent 2312f438ac
commit ee1b37c787
23 changed files with 211 additions and 90 deletions

View File

@@ -9,7 +9,7 @@ import { AuthenticationCodeLogin, z } from '@vben/common-ui';
import { DEFAULT_TENANT_ID } from '@vben/constants';
import { $t } from '@vben/locales';
import { Alert, message } from 'antdv-next';
import { Alert } from 'antdv-next';
import { tenantList } from '#/api';
import { sendSmsCode } from '#/api/core/captcha';
@@ -96,7 +96,7 @@ const formSchema = computed((): VbenFormSchema[] => {
}
// 调用接口发送
await sendSmsCode(value);
message.success('验证码发送成功');
window.message.success('验证码发送成功');
},
};
},

View File

@@ -5,8 +5,6 @@ import { computed, ref } from 'vue';
import { ProfilePasswordSetting, z } from '@vben/common-ui';
import { message } from 'antdv-next';
const profilePasswordSettingRef = ref();
const formSchema = computed((): VbenFormSchema[] => {
@@ -53,7 +51,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit() {
message.success('密码修改成功');
window.message.success('密码修改成功');
}
</script>
<template>

View File

@@ -9,7 +9,7 @@ import { preferences } from '@vben/preferences';
import { useAccessStore } from '@vben/stores';
import { cn } from '@vben/utils';
import { message, Spin } from 'antdv-next';
import { Spin } from 'antdv-next';
import { authCallback } from '#/api';
import { useAuthStore } from '#/store';
@@ -49,7 +49,7 @@ onMounted(async () => {
(item) => item.source === source,
);
if (!currentClient) {
message.error({ content: `未找到${source}平台` });
window.message.error({ content: `未找到${source}平台` });
return;
}
const data: AuthApi.OAuthLoginParams = {
@@ -62,14 +62,14 @@ onMounted(async () => {
// 没有token为登录 有token是授权
if (accessStore.accessToken) {
await authCallback(data);
message.success(`${source}授权成功`);
window.message.success(`${source}授权成功`);
setTimeout(() => {
router.push(preferences.app.defaultHomePath);
}, 1500);
} else {
// 这里内部已经做了跳转到首页的操作
await authStore.authLogin(data as any);
message.success(`${source}登录成功`);
window.message.success(`${source}登录成功`);
}
} catch (error) {
console.error(error);