This commit is contained in:
shi
2025-11-15 16:40:35 +08:00
parent 40376baa79
commit 8701a06f34
10 changed files with 757 additions and 42 deletions

View File

@ -1,18 +1,79 @@
<template>
<div class="ueScreen">
<Header />
<Header :isFull="isFull" @changePage="handleChangePage" />
<div class="content_box">
<LeftPage class="left" />
<!-- <div>ue</div> -->
<RightPage class="right" />
<LeftPage class="left" :style="{ left: isHideOther ? '-25vw' : '0' }" />
<RightPage class="right" :style="{ right: isHideOther ? '-25vw' : '0' }" />
</div>
</div>
</template>
<script setup lang="ts">
declare var ue5: any;
import Header from './components/header.vue';
import LeftPage from './components/leftPage.vue';
import RightPage from './components/rightPage.vue';
import { getToken } from '@/utils/auth';
import { useUserStoreHook } from '@/store/modules/user';
import usePermissionStore from '@/store/modules/permission';
import to from 'await-to-js';
const userStore = useUserStoreHook();
const initDone = ref(false); // ✅ 控制页面是否渲染
const isHideOther = ref(false);
const isFull = ref(false);
/**
* 切换中心页面全屏
*/
const handleChangePage = () => {
if (isFull.value) {
isFull.value = false;
isHideOther.value = false;
} else {
isFull.value = true;
isHideOther.value = true;
ue5('openUEUI');
}
};
const silentLogin = async (isExpired = false) => {
const token = getToken();
if (token && !isExpired) return true;
try {
// 调用静默登录接口
await to(
userStore.login({
username: 'admin',
password: 'admin123',
tenantId: '000000',
clientId: undefined,
grantType: undefined
})
);
} catch (e) {
ElMessage.error('无法获取数据,请联系管理员');
return false;
}
await to(userStore.getInfo());
await usePermissionStore().generateRoutes();
return true;
};
// ✅ 页面初始化逻辑
const initPage = async () => {
const logged = await silentLogin();
if (!logged) return;
initDone.value = true; // ✅ 准备完成
};
onMounted(() => {
initPage();
window['silentLogin'] = silentLogin;
});
</script>
<style scoped lang="scss">
@ -32,12 +93,12 @@ $vh_base: 1080;
.ueScreen {
width: 100vw;
height: 100vh;
// background-color: rgba(4, 7, 17, 0.8);
background-image: url('@/assets/ueimg/bj.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
color: #fff;
overflow: hidden;
}
.content_box {
@ -52,6 +113,7 @@ $vh_base: 1080;
left: vw(20);
width: 25vw;
height: 100%;
transition: all 0.5s ease;
}
.right {
@ -60,5 +122,6 @@ $vh_base: 1080;
right: vw(20);
width: 25vw;
height: 100%;
transition: all 0.5s ease;
}
</style>