Skip to content

Commit

Permalink
!89 修改水印更新通知发起时机
Browse files Browse the repository at this point in the history
Merge pull request !89 from wen/dev
  • Loading branch information
lltx authored and gitee-org committed Aug 26, 2024
2 parents c177c1b + 52a1b54 commit e98e24e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
7 changes: 1 addition & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ onMounted(() => {
mittBus.on('openSetingsDrawer', () => {
settingRef.value.openDrawer();
});
// 监听登录成功后重新加载水印
mittBus.on('updateWartermark', () => {
settingRef.value.onWartermarkChange();
});
// 获取缓存中的布局配置
if (Local.get('themeConfig')) {
storesThemeConfig.setThemeConfig({ themeConfig: Local.get('themeConfig') });
Expand All @@ -73,10 +69,9 @@ onMounted(() => {
}
});
});
// 页面销毁时,关闭监听布局配置/i18n监听/更新水印
// 页面销毁时,关闭监听布局配置/i18n监听
onUnmounted(() => {
mittBus.off('openSetingsDrawer', () => {});
mittBus.off('updateWartermark', () => {});
});
// 监听路由的变化,设置网站标题
watch(
Expand Down
6 changes: 5 additions & 1 deletion src/layout/navBars/breadcrumb/setings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ onMounted(() => {
initLayoutChangeFun();
state.isMobile = other.isMobile();
});
// 监听登录成功后重新加载水印
mittBus.on('updateWartermark', () => {
onWartermarkChange();
});
setTimeout(() => {
// 默认样式
onColorPickerChange();
Expand All @@ -673,12 +677,12 @@ onMounted(() => {
});
onUnmounted(() => {
mittBus.off('layoutMobileResize', () => {});
mittBus.off('updateWartermark', () => {});
});
// 暴露变量
defineExpose({
openDrawer,
onWartermarkChange,
});
</script>

Expand Down
3 changes: 3 additions & 0 deletions src/stores/userInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Session } from '/@/utils/storage';
import { getUserInfo, login, loginByMobile, loginBySocial, refreshTokenApi } from '/@/api/login/index';
import other from '/@/utils/other';
import { useMessage } from '/@/hooks/message';
import mittBus from '/@/utils/mitt';

/**
* @function useUserInfo
Expand Down Expand Up @@ -130,6 +131,8 @@ export const useUserInfo = defineStore('userInfo', {
authBtnList: res.data.permissions,
};
this.userInfos = userInfo;
// 重新加载水印
mittBus.emit('updateWartermark');
});
},
},
Expand Down
3 changes: 0 additions & 3 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { formatAxis } from '/@/utils/formatTime';
import { useMessage } from '/@/hooks/message';
import { Session } from '/@/utils/storage';
import { initBackEndControlRoutes } from '/@/router/backEnd';
import mittBus from '/@/utils/mitt';
// 引入组件
const Password = defineAsyncComponent(() => import('./component/password.vue'));
Expand Down Expand Up @@ -72,8 +71,6 @@ const signInSuccess = async () => {
useMessage().wraning('抱歉,您没有登录权限');
Session.clear();
} else {
// 重新加载水印
mittBus.emit('updateWartermark');
// 初始化登录成功时间问候语
let currentTimeInfo = formatAxis(new Date());
if (route.query?.redirect) {
Expand Down

0 comments on commit e98e24e

Please sign in to comment.