- 在 ConfigProvider 中添加 autoInsertSpaceInButton属性以禁用自动插入空格 - 优化登录表单的样式和布局 - 改进注册表单的交互逻辑,增加密码验证和错误提示功能 - 调整注册表单的样式和结构,提高可读性和易用性
60 lines
1.3 KiB
Vue
60 lines
1.3 KiB
Vue
<template>
|
||
<ConfigProvider :autoInsertSpaceInButton="false" :locale="zhCN" :theme="redTheme">
|
||
<router-view v-if="$route.meta.withoutLayout" />
|
||
<LayoutBasic v-else />
|
||
</ConfigProvider>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { useUserStore } from '@/stores';
|
||
// import { useChatStore } from '@/stores/modules/chat';
|
||
|
||
import { initApp } from '@/utils/user';
|
||
import { useSidebarStore } from '@/stores/modules/side-bar';
|
||
|
||
import { ConfigProvider } from 'ant-design-vue';
|
||
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
||
import 'dayjs/locale/zh-cn';
|
||
|
||
const userStore = useUserStore();
|
||
// const route = useRoute();
|
||
const sidebarStore = useSidebarStore();
|
||
// const chatStore = useChatStore();
|
||
|
||
const redTheme = {
|
||
token: {
|
||
colorPrimary: '#6d4cfe', // 主色
|
||
colorLink: '#f5222d', // 链接色
|
||
},
|
||
};
|
||
|
||
const init = async () => {
|
||
const { isLogin } = userStore;
|
||
|
||
// 已开通
|
||
if (isLogin) {
|
||
await initApp();
|
||
} else {
|
||
sidebarStore.stopUnreadInfoPolling();
|
||
}
|
||
};
|
||
|
||
onMounted(() => {
|
||
init();
|
||
|
||
// 监听全局未处理错误
|
||
window.addEventListener('unhandledrejection', (event) => {
|
||
event.preventDefault();
|
||
console.log(event);
|
||
console.error(`发现catch报错:${event.reason}`);
|
||
});
|
||
});
|
||
onUnmounted(() => {
|
||
sidebarStore.stopUnreadInfoPolling();
|
||
});
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
@import './styles/index.scss';
|
||
</style>
|