移动端适配问题bug修复
This commit is contained in:
1 parent
4b5eaf4644
commit
ddc461f548
5 files changed
+62
-503
No files matched your search
@@ -5,7 +5,7 @@
|
||||
* 引用文件:vue, vue-router, lucide-vue-next, 后端 /api/user 接口
|
||||
*/
|
||||
import { ref, onMounted, computed, watch, nextTick } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { config } from '../config';
|
||||
import { useTheme } from '../composables/useTheme';
|
||||
@@ -48,7 +48,8 @@ import {
|
||||
Megaphone,
|
||||
X,
|
||||
ChevronDown,
|
||||
ChevronUp
|
||||
ChevronUp,
|
||||
MessageCircle
|
||||
} from 'lucide-vue-next';
|
||||
|
||||
import KbWorkspaceView from './KbWorkspaceView.vue';
|
||||
@@ -58,6 +59,7 @@ import { Clock, Download, Search, RefreshCw } from 'lucide-vue-next';
|
||||
const { t, locale } = useI18n();
|
||||
const { showMessageDialog } = useGlobalMessageDialog();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { setThemePreference, appliedTheme } = useTheme();
|
||||
const { isMobile } = useIsMobile();
|
||||
const loginBackgroundStyle = {
|
||||
@@ -812,6 +814,30 @@ const hasProfileUnsavedChanges = computed(() => {
|
||||
);
|
||||
});
|
||||
|
||||
const mobileTabActive = computed({
|
||||
get: () => {
|
||||
if (activeSidebarItem.value === 'profile') return 'profile';
|
||||
if (activeSidebarItem.value === 'feedback') return 'feedback';
|
||||
return 'applications';
|
||||
},
|
||||
set: (tab: string) => {
|
||||
if (tab === 'profile') {
|
||||
activeSidebarItem.value = 'profile';
|
||||
if (!profileUser.value.id) fetchProfile();
|
||||
} else if (tab === 'feedback') {
|
||||
activeSidebarItem.value = 'feedback';
|
||||
} else {
|
||||
activeSidebarItem.value = 'applications';
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const mobileTabTitle = computed(() => {
|
||||
if (mobileTabActive.value === 'profile') return '我的';
|
||||
if (mobileTabActive.value === 'feedback') return '意见反馈';
|
||||
return '应用管理';
|
||||
});
|
||||
|
||||
const handleLogout = () => {
|
||||
localStorage.removeItem('hxops_user');
|
||||
sessionStorage.removeItem('hxops_user');
|
||||
@@ -1304,6 +1330,14 @@ onMounted(async () => {
|
||||
if (currentUser.value && currentUser.value.role !== 'guest') {
|
||||
await fetchHome();
|
||||
await handleWecomDeeplinkContext();
|
||||
const viewParam = route.query.view as string;
|
||||
const validViews: string[] = ['profile', 'applications', 'feedback', 'updates', 'knowledge_base', 'schedule_runs'];
|
||||
if (viewParam && validViews.includes(viewParam)) {
|
||||
activeSidebarItem.value = viewParam as typeof activeSidebarItem.value;
|
||||
if (viewParam === 'profile' && !profileUser.value.id) {
|
||||
await fetchProfile();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await fetchPublicAgents();
|
||||
isLoading.value = false;
|
||||
@@ -1471,12 +1505,9 @@ onMounted(async () => {
|
||||
<div v-else class="min-h-screen animate-fade-in">
|
||||
<header v-if="isMobile" class="sticky top-0 z-30 flex items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-slate-800 dark:bg-slate-950">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20">AI</div>
|
||||
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">和信AI</span>
|
||||
<button @click="router.push('/chat/16')" class="flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-xs font-bold text-white shadow-sm shadow-brand-500/20" title="返回聊天">AI</button>
|
||||
<span class="text-sm font-semibold text-slate-800 dark:text-slate-100">{{ mobileTabTitle }}</span>
|
||||
</div>
|
||||
<button @click="router.push('/profile')" class="flex h-9 w-9 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800" title="个人设置">
|
||||
<User class="h-5 w-5" />
|
||||
</button>
|
||||
</header>
|
||||
<div class="grid min-h-screen gap-0 lg:grid-cols-[232px_minmax(0,1fr)]">
|
||||
<aside v-if="!isMobile" class="lg:sticky lg:top-0 lg:h-screen">
|
||||
@@ -1577,7 +1608,7 @@ onMounted(async () => {
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<section class="min-w-0 space-y-6 bg-gray-50 px-4 py-6 md:px-6 md:py-8 lg:px-8">
|
||||
<section class="min-w-0 space-y-6 bg-gray-50 px-4 py-6 md:px-6 md:py-8 lg:px-8" :class="isMobile ? 'pb-20' : ''">
|
||||
<template v-if="activeSidebarItem === 'profile'">
|
||||
<div v-if="isProfileLoading" class="flex justify-center py-20">
|
||||
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-brand-600"></div>
|
||||
@@ -2032,6 +2063,25 @@ onMounted(async () => {
|
||||
</template>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<nav v-if="isMobile" class="fixed bottom-0 left-0 right-0 z-40 border-t border-slate-200 bg-white dark:border-slate-800 dark:bg-slate-950 safe-bottom">
|
||||
<div class="flex h-14 items-center justify-around">
|
||||
<button
|
||||
v-for="tab in [
|
||||
{ key: 'applications', icon: LayoutGrid, label: '应用管理' },
|
||||
{ key: 'feedback', icon: MessageCircle, label: '意见反馈' },
|
||||
{ key: 'profile', icon: User, label: '我的' },
|
||||
]"
|
||||
:key="tab.key"
|
||||
@click="mobileTabActive = tab.key"
|
||||
class="flex flex-1 flex-col items-center justify-center gap-0.5 py-1 transition-colors"
|
||||
:class="mobileTabActive === tab.key ? 'text-brand-600 dark:text-brand-400' : 'text-slate-400 dark:text-slate-500'"
|
||||
>
|
||||
<component :is="tab.icon" class="h-5 w-5" />
|
||||
<span class="text-[10px] font-medium">{{ tab.label }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- Forgot Password Modal -->
|
||||
<div v-if="showForgotPasswordModal" class="fixed inset-0 bg-slate-900/40 dark:bg-slate-950/70 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
|
||||
|
||||
Reference in new issue
Block a user