chore(入口页面): 调整文件结构

This commit is contained in:
hzj 2025-11-21 11:50:22 +08:00
parent 17aca66489
commit b8cc5e3b4e
4 changed files with 52 additions and 29 deletions

View File

@ -7,13 +7,13 @@ const router = createRouter({
{
path: '/',
name: 'root',
component: () => import('../views/LoadingView.vue'),
component: () => import('../views/LandingPage/LoadingView.vue'),
meta: { requiresAuth: false, isPublic: true },
},
{
path: '/loading',
name: 'loading',
component: () => import('../views/LoadingView.vue'),
component: () => import('../views/LandingPage/LoadingView.vue'),
meta: { requiresAuth: false, isPublic: true },
},
{
@ -68,7 +68,7 @@ const router = createRouter({
{
path: '/about',
name: 'about',
component: () => import('../views/AboutView.vue'),
component: () => import('../views/LandingPage/AboutView.vue'),
},
{
path: '/host-setting',
@ -134,7 +134,7 @@ const router = createRouter({
{
path: '/not_app',
name: 'not-app',
component: () => import('../views/NotAppView.vue'),
component: () => import('../views/LandingPage/NotAppView.vue'),
meta: { requiresAuth: false },
},
// 404 页面

View File

@ -47,9 +47,15 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { isInApp, connectApplication, parseAccessOrigin, parseHeader, setHttpHeaders } from '../utils/appBridge.js'
import { appConnectionManager } from '../utils/appConnectionManager.js'
import {getDefaultPage} from "@/utils/permissionManager.js";
import {
isInApp,
connectApplication,
parseAccessOrigin,
parseHeader,
setHttpHeaders,
} from '@/utils/appBridge.js'
import { appConnectionManager } from '@/utils/appConnectionManager.js'
import { getDefaultPage } from '@/utils/permissionManager.js'
const router = useRouter()
@ -58,23 +64,23 @@ const checkShouldRedirect = () => {
const currentRoute = router.currentRoute.value
const currentPath = currentRoute.path
const routeName = currentRoute.name
console.log('Checking redirect conditions:', {
path: currentPath,
name: routeName,
url: window.location.href
url: window.location.href,
})
// 访loading
const isRootAccess = currentPath === '/' || routeName === 'root'
const isLoadingAccess = currentPath === '/loading' || routeName === 'loading'
console.log('Redirect decision:', {
isRootAccess,
isLoadingAccess,
shouldRedirect: isRootAccess || isLoadingAccess
shouldRedirect: isRootAccess || isLoadingAccess,
})
return isRootAccess || isLoadingAccess
}
@ -88,7 +94,7 @@ const loadingSteps = [
{ text: 'Connecting to server...', subText: 'Establishing secure connection', duration: 200 },
{ text: 'Loading user data...', subText: 'Retrieving your information', duration: 300 },
{ text: 'Setting up interface...', subText: 'Preparing your workspace', duration: 200 },
{ text: 'Almost ready...', subText: 'Finalizing setup', duration: 200 }
{ text: 'Almost ready...', subText: 'Finalizing setup', duration: 200 },
]
let currentStepIndex = 0
@ -100,7 +106,7 @@ const startLoading = async () => {
try {
//
const shouldRedirect = checkShouldRedirect()
if (!shouldRedirect) {
console.log('User accessed specific path directly, not performing redirect')
return
@ -119,7 +125,6 @@ const startLoading = async () => {
//
await navigateToTargetPage()
} catch (error) {
console.error('Loading failed:', error)
//
@ -153,7 +158,7 @@ const connectToApp = async () => {
const startProgressAnimation = () => {
let currentProgress = 0
const totalDuration = loadingSteps.reduce((sum, step) => sum + step.duration, 0)
const progressIncrement = 100 / totalDuration * 50 // 50ms
const progressIncrement = (100 / totalDuration) * 50 // 50ms
progressInterval = setInterval(() => {
currentProgress += progressIncrement
@ -184,7 +189,7 @@ const updateLoadingStep = () => {
//
const waitForLoadingComplete = () => {
return new Promise(resolve => {
return new Promise((resolve) => {
const totalTime = loadingSteps.reduce((sum, step) => sum + step.duration, 0)
setTimeout(resolve, totalTime)
})
@ -197,13 +202,18 @@ const navigateToTargetPage = async () => {
const currentRoute = router.currentRoute.value
const currentPath = currentRoute.path
const routeName = currentRoute.name
console.log('Current path:', currentPath)
console.log('Route name:', routeName)
// 访 ("/") loading
//
if (currentPath === '/' || routeName === 'root' || currentPath === '/loading' || routeName === 'loading') {
if (
currentPath === '/' ||
routeName === 'root' ||
currentPath === '/loading' ||
routeName === 'loading'
) {
console.log('Navigating to default page from root or loading')
router.replace(getDefaultPage())
} else {
@ -262,16 +272,20 @@ onUnmounted(() => {
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
animation: backgroundShift 10s ease-in-out infinite;
}
@keyframes backgroundShift {
0%, 100% { transform: translateX(0) translateY(0); }
50% { transform: translateX(-10px) translateY(-5px); }
0%,
100% {
transform: translateX(0) translateY(0);
}
50% {
transform: translateX(-10px) translateY(-5px);
}
}
.loading-content {
@ -297,8 +311,13 @@ onUnmounted(() => {
}
@keyframes logoFloat {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
}
.logo-icon {
@ -356,8 +375,12 @@ onUnmounted(() => {
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.loading-text {