Skip to content

Commit

Permalink
fix(水印): 解决登录成功后水印不更新问题
Browse files Browse the repository at this point in the history
  • Loading branch information
committed Aug 22, 2024
1 parent c83ef9f commit 8160353
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import { Local, Session } from '/@/utils/storage';
import mittBus from '/@/utils/mitt';
import setIntroduction from '/@/utils/setIconfont';
provide('onWartermarkChange', () => {
if (settingRef.value) {
settingRef.value.onWartermarkChange();
}
});
// 引入组件
const LockScreen = defineAsyncComponent(() => import('/@/layout/lockScreen/index.vue'));
const Setings = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/setings.vue'));
Expand Down
1 change: 1 addition & 0 deletions src/layout/navBars/breadcrumb/setings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ onUnmounted(() => {
// 暴露变量
defineExpose({
openDrawer,
onWartermarkChange,
});
</script>

Expand Down
3 changes: 3 additions & 0 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const Password = defineAsyncComponent(() => import('./component/password.vue'));
const Mobile = defineAsyncComponent(() => import('./component/mobile.vue'));
const Register = defineAsyncComponent(() => import('./component/register.vue'));
const onWartermarkChange = inject<() => void>('onWartermarkChange');
// 定义变量内容
const storesThemeConfig = useThemeConfig();
const { themeConfig } = storeToRefs(storesThemeConfig);
Expand All @@ -71,6 +72,8 @@ const signInSuccess = async () => {
useMessage().wraning('抱歉,您没有登录权限');
Session.clear();
} else {
// 重新加载水印
onWartermarkChange && onWartermarkChange()
// 初始化登录成功时间问候语
let currentTimeInfo = formatAxis(new Date());
if (route.query?.redirect) {
Expand Down

0 comments on commit 8160353

Please sign in to comment.