zhangchong 1 жил өмнө
parent
commit
46595f1aaa

+ 4 - 36
src/App.vue

@@ -19,15 +19,12 @@ import { useThemeConfig } from '@/stores/themeConfig';
 import other from '@/utils/other';
 import checkUpdate from '@/utils/checkUpdate';
 import mittBus from '@/utils/mitt';
-import { Session, Local, Cookie } from '@/utils/storage';
+import { Session, Local } from '@/utils/storage';
 import setIntroduction from '@/utils/setIconfont';
 import { loginPageInfo } from '@/api/login';
 import { getImageUrl } from '@/utils/tools';
 import { useKeepALiveNames } from '@/stores/keepAliveNames';
-import { busyOff, dutyOff } from '@/api/public/wex';
-import { ola } from '@/utils/ola_api';
-import signalR from '@/utils/signalR';
-import { useTelStatus } from '@/stores/telStatus';
+import { useUserInfo } from '@/stores/userInfo';
 // 引入组件
 const LockScreen = defineAsyncComponent(() => import('@/layout/lockScreen/index.vue'));
 const SetTings = defineAsyncComponent(() => import('@/layout/navBars/breadcrumb/setings.vue'));
@@ -40,6 +37,8 @@ const { themeConfig } = storeToRefs(storesThemeConfig);
 const storesKeepALiveNames = useKeepALiveNames();
 const storesTagsViewRoutes = useTagsViewRoutes();
 const { tagsViewRoutes } = storeToRefs(storesTagsViewRoutes);
+const userStore = useUserInfo();
+const { userInfos } = storeToRefs(userStore);
 
 // 设置锁屏时组件显示隐藏
 const setLockScreen = computed(() => {
@@ -86,33 +85,6 @@ onBeforeMount(async () => {
 	// 设置批量第三方 js
 	setIntroduction.jsCdn();
 });
-const logOut = async () => {
-	// 执行退出登录
-	await dutyOff(); // 呼叫中心签出
-	if (telStatusInfo.value.isRest === 'resting') {
-		// 小休中 结束小休(调用业务系统接口,统计需要)
-		await busyOff(); // 结束小休(调用业务系统接口,统计需要)
-	}
-	ola.logout(); // 呼叫中心退出登录
-	ola.close(); // 呼叫中心关闭
-	await signalR.leaveAllGroupAndStop(); // 退出所有组
-	// 重置所有状态
-	useTelStatusStore.resetState();
-	// 清除缓存/token等
-	Local.clear();
-	Session.clear();
-	Cookie.clear();
-};
-const beforeunloadHandler = (e: BeforeUnloadEvent) => {
-	e.returnValue = '确定离开页面吗?';
-	return ' ';
-};
-// 用户关闭标签页或者浏览器时
-const useTelStatusStore = useTelStatus();
-const { telStatusInfo } = storeToRefs(useTelStatusStore);
-const unloadHandler = async (e: Event) => {
-	await logOut();
-};
 // 页面加载时
 onMounted(() => {
 	nextTick(async () => {
@@ -153,8 +125,6 @@ onMounted(() => {
 			console.log(error);
 		}
 	});
-	window.addEventListener('beforeunload', (e) => beforeunloadHandler(e));
-	window.addEventListener('unload', (e) => unloadHandler(e));
 });
 // 清除缓存 name
 const clearCacheTagsView = async (routeName: string) => {
@@ -172,8 +142,6 @@ const clearCacheTagsView = async (routeName: string) => {
 onUnmounted(() => {
 	mittBus.off('openSetTingsDrawer', () => {});
 	mittBus.off('clearCache', () => {});
-	window.removeEventListener('beforeunload', (e) => beforeunloadHandler(e));
-	window.removeEventListener('unload', (e) => unloadHandler(e));
 });
 // 监听路由的变化,设置网站标题
 watch(

+ 0 - 4
src/layout/navBars/breadcrumb/user.vue

@@ -338,10 +338,6 @@ const onLogOut = () => {
 		})
 			.then(() => {
 				dutyOff(); // 呼叫中心签出
-				if (telStatusInfo.value.isRest === 'resting') {
-					// 小休中 结束小休(调用业务系统接口,统计需要)
-					busyOff(); // 结束小休(调用业务系统接口,统计需要)
-				}
 				setTimeout(() => {
 					ola.logout(); // 呼叫中心退出登录
 					ola.close(); // 呼叫中心关闭