个人管理后台样式调整、风格统一
This commit is contained in:
1 parent
7eed474125
commit
3062ade15f
4 files changed
+612
-180
No files matched your search
Vendored
+2
-2
@@ -10,8 +10,8 @@
|
|||||||
<meta name="apple-mobile-web-app-title" content="AI工作台" />
|
<meta name="apple-mobile-web-app-title" content="AI工作台" />
|
||||||
<link rel="manifest" href="/manifest.webmanifest" />
|
<link rel="manifest" href="/manifest.webmanifest" />
|
||||||
<title>AI工作台</title>
|
<title>AI工作台</title>
|
||||||
<script type="module" crossorigin src="/assets/index-B0RZ7Ems.js"></script>
|
<script type="module" crossorigin src="/assets/index-uH1T_5lG.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-Ck6nsfgg.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-CeYjUdzN.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>␍
|
<div id="app"></div>␍
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
export const config = {
|
export const config = {
|
||||||
appTitle: 'AI工作台',
|
appTitle: 'AI工作台',
|
||||||
auth: {
|
auth: {
|
||||||
// Login mode switch:
|
// Login mode switch:
|
||||||
// - 'casdoor': submit username/password to backend Casdoor password-login API.
|
// - 'casdoor': submit username/password to backend Casdoor password-login API.
|
||||||
// - 'password': submit to legacy local /api/user/login.
|
// - 'password': submit to legacy local /api/user/login.
|
||||||
loginMode: 'casdoor',
|
loginMode: 'password',
|
||||||
casdoor: {
|
casdoor: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
authorizeApi: '/api/user/casdoor/authorize-url',
|
authorizeApi: '/api/user/casdoor/authorize-url',
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ const handleLogout = () => {
|
|||||||
router.push('/');
|
router.push('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleVoiceFeatureClick = () => {
|
||||||
|
showMessageDialog('info', '该功能正在开发中');
|
||||||
|
};
|
||||||
|
|
||||||
const stripReasoningPrelude = (text: string) => {
|
const stripReasoningPrelude = (text: string) => {
|
||||||
if (!text) return '';
|
if (!text) return '';
|
||||||
let cleaned = text
|
let cleaned = text
|
||||||
@@ -1008,7 +1012,7 @@ const showChatRating = ref(false);
|
|||||||
<PanelLeftOpen class="h-5 w-5" />
|
<PanelLeftOpen class="h-5 w-5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="mb-4 flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-purple-500 to-indigo-500 text-white shadow-sm">
|
<div class="mb-4 flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-white shadow-sm shadow-brand-500/25">
|
||||||
<Sparkles class="h-5 w-5" />
|
<Sparkles class="h-5 w-5" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1018,7 +1022,7 @@ const showChatRating = ref(false);
|
|||||||
|
|
||||||
<div class="mt-auto flex flex-col items-center gap-6 pb-2 text-slate-400">
|
<div class="mt-auto flex flex-col items-center gap-6 pb-2 text-slate-400">
|
||||||
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Sparkles class="h-5 w-5" /></button>
|
<button class="transition-colors hover:text-slate-600 dark:hover:text-slate-200"><Sparkles class="h-5 w-5" /></button>
|
||||||
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-purple-600 text-sm font-bold text-white shadow-sm">
|
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20">
|
||||||
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||||
</div>
|
</div>
|
||||||
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" title="意见反馈"><Mail class="h-5 w-5" /></button>
|
<button @click="showGeneralFeedbackDialog = true" class="transition-colors hover:text-slate-600 dark:hover:text-slate-200" title="意见反馈"><Mail class="h-5 w-5" /></button>
|
||||||
@@ -1030,7 +1034,7 @@ const showChatRating = ref(false);
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="flex items-center justify-between p-4">
|
<div class="flex items-center justify-between p-4">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<div class="flex h-8 w-8 items-center justify-center rounded bg-gradient-to-br from-purple-500 to-indigo-500 text-sm font-bold text-white shadow-sm">AI</div>
|
<div class="flex h-8 w-8 items-center justify-center rounded-xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-sm font-bold text-white shadow-sm shadow-brand-500/25">AI</div>
|
||||||
<span class="font-bold text-slate-800 dark:text-slate-100">Hxops Alagent</span>
|
<span class="font-bold text-slate-800 dark:text-slate-100">Hxops Alagent</span>
|
||||||
</div>
|
</div>
|
||||||
<button @click="isSidebarCollapsed = true" class="text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
<button @click="isSidebarCollapsed = true" class="text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
||||||
@@ -1058,12 +1062,12 @@ const showChatRating = ref(false);
|
|||||||
v-for="item in history"
|
v-for="item in history"
|
||||||
:key="item.conversation_id"
|
:key="item.conversation_id"
|
||||||
class="group relative flex w-full items-center justify-between rounded-lg transition-colors"
|
class="group relative flex w-full items-center justify-between rounded-lg transition-colors"
|
||||||
:class="conversationId === item.conversation_id ? 'bg-blue-50 dark:bg-blue-900/20' : 'hover:bg-slate-50 dark:hover:bg-slate-800/50'"
|
:class="conversationId === item.conversation_id ? 'bg-brand-50 dark:bg-brand-900/20' : 'hover:bg-slate-50 dark:hover:bg-slate-800/50'"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="flex-1 truncate px-3 py-2.5 text-left text-sm pr-8"
|
class="flex-1 truncate px-3 py-2.5 text-left text-sm pr-8"
|
||||||
:class="conversationId === item.conversation_id
|
:class="conversationId === item.conversation_id
|
||||||
? 'font-medium text-blue-600 dark:text-blue-400'
|
? 'font-medium text-brand-700 dark:text-brand-300'
|
||||||
: 'text-slate-600 dark:text-slate-300'"
|
: 'text-slate-600 dark:text-slate-300'"
|
||||||
@click="loadConversation(item.conversation_id); isSidebarOpen = false;"
|
@click="loadConversation(item.conversation_id); isSidebarOpen = false;"
|
||||||
>
|
>
|
||||||
@@ -1082,30 +1086,30 @@ const showChatRating = ref(false);
|
|||||||
|
|
||||||
<div class="mt-auto flex flex-col p-4">
|
<div class="mt-auto flex flex-col p-4">
|
||||||
<!-- Ad Card -->
|
<!-- Ad Card -->
|
||||||
<div class="mb-4 rounded-2xl bg-purple-50 p-4 dark:bg-purple-900/20">
|
<div class="mb-4 rounded-2xl border border-brand-100 bg-brand-50/70 p-4 dark:border-brand-500/20 dark:bg-brand-900/10">
|
||||||
<div class="mb-2 flex items-center gap-1 font-bold text-purple-700 dark:text-purple-400">
|
<div class="mb-2 flex items-center gap-1 font-bold text-brand-700 dark:text-brand-300">
|
||||||
<Crown class="h-4 w-4" /> 专业版
|
<Crown class="h-4 w-4" /> 专业版
|
||||||
</div>
|
</div>
|
||||||
<ul class="mb-3 space-y-1 text-[11px] text-slate-600 dark:text-slate-300">
|
<ul class="mb-3 space-y-1 text-[11px] text-slate-600 dark:text-slate-300">
|
||||||
<li class="flex items-center gap-1.5"><div class="h-1 w-1 rounded-full bg-purple-400"></div> 统一Agent知识库入口</li>
|
<li class="flex items-center gap-1.5"><div class="h-1 w-1 rounded-full bg-brand-400"></div> 统一Agent知识库入口</li>
|
||||||
<li class="flex items-center gap-1.5"><div class="h-1 w-1 rounded-full bg-purple-400"></div> 优化Chat界面及交互</li>
|
<li class="flex items-center gap-1.5"><div class="h-1 w-1 rounded-full bg-brand-400"></div> 优化Chat界面及交互</li>
|
||||||
<li class="flex items-center gap-1.5"><div class="h-1 w-1 rounded-full bg-purple-400"></div> 修改文档预览bug等</li>
|
<li class="flex items-center gap-1.5"><div class="h-1 w-1 rounded-full bg-brand-400"></div> 修改文档预览bug等</li>
|
||||||
</ul>
|
</ul>
|
||||||
<button class="w-full rounded-xl bg-slate-900 py-2 text-xs font-medium text-white shadow-md transition-colors hover:bg-slate-800 dark:bg-white dark:text-slate-900 dark:hover:bg-slate-200">
|
<button class="w-full rounded-xl bg-brand-600 py-2 text-xs font-medium text-white shadow-md shadow-brand-500/20 transition-colors hover:bg-brand-700 dark:bg-brand-500 dark:hover:bg-brand-400">
|
||||||
🚀 升级说明
|
🚀 升级说明
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Bottom Icons -->
|
<!-- Bottom Icons -->
|
||||||
<div class="flex items-center justify-between text-slate-400 relative" ref="userMenuRef">
|
<div class="flex items-center justify-between text-slate-400 relative" ref="userMenuRef">
|
||||||
<button @click="showUserDropdown = !showUserDropdown" class="flex h-8 w-8 items-center justify-center rounded-full bg-purple-600 text-sm font-bold text-white shadow-sm hover:bg-purple-700 transition-colors">
|
<button @click="showUserDropdown = !showUserDropdown" class="flex h-8 w-8 items-center justify-center rounded-full bg-brand-600 text-sm font-bold text-white shadow-sm shadow-brand-500/20 hover:bg-brand-700 transition-colors">
|
||||||
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
{{ (currentUser?.username || 'I').charAt(0).toUpperCase() }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- User Dropdown Menu -->
|
<!-- User Dropdown Menu -->
|
||||||
<div v-if="showUserDropdown" class="absolute bottom-full left-0 mb-2 w-56 bg-white dark:bg-slate-900 rounded-xl shadow-xl border border-slate-100 dark:border-slate-700 py-1 z-50 animate-fade-in">
|
<div v-if="showUserDropdown" class="absolute bottom-full left-0 mb-2 w-56 bg-white dark:bg-slate-900 rounded-xl shadow-xl border border-slate-100 dark:border-slate-700 py-1 z-50 animate-fade-in">
|
||||||
<div class="px-4 py-3 border-b border-slate-50 dark:border-slate-700 flex items-center gap-3">
|
<div class="px-4 py-3 border-b border-slate-50 dark:border-slate-700 flex items-center gap-3">
|
||||||
<div class="w-10 h-10 bg-purple-600 rounded-full flex items-center justify-center text-white font-bold text-lg shrink-0 shadow-sm">
|
<div class="w-10 h-10 bg-brand-600 rounded-full flex items-center justify-center text-white font-bold text-lg shrink-0 shadow-sm shadow-brand-500/20">
|
||||||
{{ (currentUser?.username || 'U').charAt(0).toUpperCase() }}
|
{{ (currentUser?.username || 'U').charAt(0).toUpperCase() }}
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-hidden">
|
<div class="overflow-hidden">
|
||||||
@@ -1135,7 +1139,7 @@ const showChatRating = ref(false);
|
|||||||
<div class="relative z-10 flex h-full w-full flex-1 flex-col overflow-hidden bg-white dark:bg-slate-950">
|
<div class="relative z-10 flex h-full w-full flex-1 flex-col overflow-hidden bg-white dark:bg-slate-950">
|
||||||
|
|
||||||
<div v-if="!currentAgent" class="flex flex-1 flex-col items-center justify-center space-y-4">
|
<div v-if="!currentAgent" class="flex flex-1 flex-col items-center justify-center space-y-4">
|
||||||
<Loader2 class="h-10 w-10 animate-spin text-cyan-500" />
|
<Loader2 class="h-10 w-10 animate-spin text-brand-500" />
|
||||||
<p class="text-sm animate-pulse text-slate-500 dark:text-slate-300">{{ $t('chat.loadingAgent') }}</p>
|
<p class="text-sm animate-pulse text-slate-500 dark:text-slate-300">{{ $t('chat.loadingAgent') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1155,7 +1159,7 @@ const showChatRating = ref(false);
|
|||||||
:class="messages.length === 0 ? 'overflow-hidden md:overflow-y-auto' : 'space-y-2 overflow-y-auto scrollbar-thin md:space-y-6'"
|
:class="messages.length === 0 ? 'overflow-hidden md:overflow-y-auto' : 'space-y-2 overflow-y-auto scrollbar-thin md:space-y-6'"
|
||||||
>
|
>
|
||||||
<div v-if="messages.length === 0" class="flex h-full flex-col items-center justify-center py-2 md:pb-16">
|
<div v-if="messages.length === 0" class="flex h-full flex-col items-center justify-center py-2 md:pb-16">
|
||||||
<div class="mb-6 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-purple-400 to-indigo-500 text-2xl font-bold text-white shadow-lg shadow-purple-500/20">
|
<div class="mb-6 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-2xl font-bold text-white shadow-lg shadow-brand-500/20">
|
||||||
AI
|
AI
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">我今天可以怎么帮助你?</h2>
|
<h2 class="text-center text-xl font-medium text-slate-800 dark:text-slate-100 md:text-2xl">我今天可以怎么帮助你?</h2>
|
||||||
@@ -1168,7 +1172,7 @@ const showChatRating = ref(false);
|
|||||||
:class="msg.role === 'user' ? 'justify-end' : 'justify-start'"
|
:class="msg.role === 'user' ? 'justify-end' : 'justify-start'"
|
||||||
>
|
>
|
||||||
<!-- AI Avatar -->
|
<!-- AI Avatar -->
|
||||||
<div v-if="msg.role === 'assistant'" class="mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-purple-400 to-indigo-500 text-white shadow-sm">
|
<div v-if="msg.role === 'assistant'" class="mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-white shadow-sm shadow-brand-500/20">
|
||||||
<Sparkles class="h-4 w-4" />
|
<Sparkles class="h-4 w-4" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1179,8 +1183,8 @@ const showChatRating = ref(false);
|
|||||||
<div
|
<div
|
||||||
class="text-[15px] leading-relaxed"
|
class="text-[15px] leading-relaxed"
|
||||||
:class="msg.role === 'user'
|
:class="msg.role === 'user'
|
||||||
? 'rounded-2xl rounded-tr-sm bg-[#165DFF] px-5 py-2.5 text-white shadow-sm'
|
? 'rounded-2xl rounded-tr-sm bg-brand-600 px-5 py-2.5 text-white shadow-sm shadow-brand-500/15'
|
||||||
: 'w-full rounded-2xl border border-slate-100 bg-white px-6 py-4 shadow-sm dark:border-slate-800 dark:bg-slate-900 dark:text-slate-100'"
|
: 'w-full rounded-2xl border border-slate-200 bg-white px-6 py-4 shadow-sm dark:border-slate-800 dark:bg-slate-900 dark:text-slate-100'"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="msg.role === 'user'"
|
v-if="msg.role === 'user'"
|
||||||
@@ -1287,7 +1291,7 @@ const showChatRating = ref(false);
|
|||||||
<button
|
<button
|
||||||
@click="submitLeaveForm(msg)"
|
@click="submitLeaveForm(msg)"
|
||||||
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
|
:disabled="getLeaveFormPayload(msg)?.submitting || getLeaveFormPayload(msg)?.confirmationGenerated"
|
||||||
class="rounded-xl bg-[#165DFF] px-4 py-2 text-sm font-medium text-white transition hover:bg-[#0E4FD2] disabled:cursor-not-allowed disabled:opacity-60"
|
class="rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||||
>
|
>
|
||||||
{{ getLeaveFormPayload(msg)?.submitting ? '提交中...' : '提交' }}
|
{{ getLeaveFormPayload(msg)?.submitting ? '提交中...' : '提交' }}
|
||||||
</button>
|
</button>
|
||||||
@@ -1355,7 +1359,7 @@ const showChatRating = ref(false);
|
|||||||
v-for="(file, linkIndex) in getMessageLinks(msg)"
|
v-for="(file, linkIndex) in getMessageLinks(msg)"
|
||||||
:key="`src-link-top-${linkIndex}-${file.url}`"
|
:key="`src-link-top-${linkIndex}-${file.url}`"
|
||||||
@click="openPreview(file)"
|
@click="openPreview(file)"
|
||||||
class="break-all rounded-lg border border-cyan-200 bg-cyan-50 px-2.5 py-1.5 text-xs text-cyan-700 transition-colors hover:bg-cyan-100 dark:border-cyan-500/30 dark:bg-cyan-500/10 dark:text-cyan-200 dark:hover:bg-cyan-500/20"
|
class="break-all rounded-lg border border-brand-200 bg-brand-50 px-2.5 py-1.5 text-xs text-brand-700 transition-colors hover:bg-brand-100 dark:border-brand-500/30 dark:bg-brand-500/10 dark:text-brand-200 dark:hover:bg-brand-500/20"
|
||||||
>
|
>
|
||||||
{{ file.name }}
|
{{ file.name }}
|
||||||
</button>
|
</button>
|
||||||
@@ -1455,7 +1459,7 @@ const showChatRating = ref(false);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- User Avatar -->
|
<!-- User Avatar -->
|
||||||
<div v-if="msg.role === 'user'" class="mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-purple-600 text-white shadow-sm">
|
<div v-if="msg.role === 'user'" class="mt-1 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-brand-600 text-white shadow-sm shadow-brand-500/20">
|
||||||
<User class="h-4 w-4" />
|
<User class="h-4 w-4" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1463,14 +1467,14 @@ const showChatRating = ref(false);
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div v-if="shouldShowThinkingBubble" class="mx-auto flex max-w-5xl gap-4">
|
<div v-if="shouldShowThinkingBubble" class="mx-auto flex max-w-5xl gap-4">
|
||||||
<div class="mt-1 flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500 to-blue-600 shadow-md shadow-cyan-500/30">
|
<div class="mt-1 flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 shadow-md shadow-brand-500/25">
|
||||||
<Bot class="h-5 w-5 text-white" />
|
<Bot class="h-5 w-5 text-white" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-3 rounded-2xl rounded-tl-md border border-slate-200 bg-white/95 px-5 py-3 shadow-md dark:border-slate-700 dark:bg-slate-900/85">
|
<div class="flex items-center gap-3 rounded-2xl rounded-tl-md border border-slate-200 bg-white/95 px-5 py-3 shadow-md dark:border-slate-700 dark:bg-slate-900/85">
|
||||||
<div class="flex gap-1">
|
<div class="flex gap-1">
|
||||||
<span class="h-2 w-2 animate-bounce rounded-full bg-cyan-400"></span>
|
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400"></span>
|
||||||
<span class="h-2 w-2 animate-bounce rounded-full bg-cyan-400 delay-75"></span>
|
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400 delay-75"></span>
|
||||||
<span class="h-2 w-2 animate-bounce rounded-full bg-cyan-400 delay-150"></span>
|
<span class="h-2 w-2 animate-bounce rounded-full bg-brand-400 delay-150"></span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-sm font-medium text-slate-500 dark:text-slate-300">{{ $t('chat.thinking') }}</span>
|
<span class="text-sm font-medium text-slate-500 dark:text-slate-300">{{ $t('chat.thinking') }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -1496,7 +1500,12 @@ const showChatRating = ref(false);
|
|||||||
|
|
||||||
<div class="mt-2 flex items-center justify-between px-2 pb-1">
|
<div class="mt-2 flex items-center justify-between px-2 pb-1">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<button class="text-slate-400 transition-colors hover:text-slate-600 dark:hover:text-slate-200">
|
<button
|
||||||
|
@click="handleVoiceFeatureClick"
|
||||||
|
type="button"
|
||||||
|
title="语音功能"
|
||||||
|
class="text-slate-400 transition-colors hover:text-brand-600 dark:hover:text-brand-300"
|
||||||
|
>
|
||||||
<Mic class="h-5 w-5" />
|
<Mic class="h-5 w-5" />
|
||||||
</button>
|
</button>
|
||||||
<div class="relative" ref="kbMenuRef">
|
<div class="relative" ref="kbMenuRef">
|
||||||
@@ -1504,7 +1513,7 @@ const showChatRating = ref(false);
|
|||||||
@click="showKbDropdown = !showKbDropdown"
|
@click="showKbDropdown = !showKbDropdown"
|
||||||
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||||
>
|
>
|
||||||
<Database class="h-3.5 w-3.5 text-blue-500" />
|
<Database class="h-3.5 w-3.5 text-brand-500" />
|
||||||
{{ selectedKb }} <ChevronDown class="h-3 w-3" />
|
{{ selectedKb }} <ChevronDown class="h-3 w-3" />
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
@@ -1516,7 +1525,7 @@ const showChatRating = ref(false);
|
|||||||
:key="option"
|
:key="option"
|
||||||
@click="selectedKb = option; showKbDropdown = false"
|
@click="selectedKb = option; showKbDropdown = false"
|
||||||
class="flex w-full items-center justify-between px-3 py-2 text-xs text-slate-700 transition-colors hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-800"
|
class="flex w-full items-center justify-between px-3 py-2 text-xs text-slate-700 transition-colors hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||||
:class="{ 'font-bold text-blue-600 dark:text-blue-400': selectedKb === option }"
|
:class="{ 'font-bold text-brand-700 dark:text-brand-300': selectedKb === option }"
|
||||||
>
|
>
|
||||||
{{ option }}
|
{{ option }}
|
||||||
<Check v-if="selectedKb === option" class="h-3.5 w-3.5" />
|
<Check v-if="selectedKb === option" class="h-3.5 w-3.5" />
|
||||||
@@ -1527,14 +1536,17 @@ const showChatRating = ref(false);
|
|||||||
@click="toggleBrowserPanel"
|
@click="toggleBrowserPanel"
|
||||||
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
class="flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||||
>
|
>
|
||||||
<Globe class="h-3.5 w-3.5 text-emerald-500" />
|
<Globe class="h-3.5 w-3.5 text-brand-500" />
|
||||||
{{ browserPanelOpen ? '收起浏览器' : '打开浏览器' }}
|
{{ browserPanelOpen ? '收起浏览器' : '打开浏览器' }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@click="handleSend"
|
@click="handleSend"
|
||||||
:disabled="!input.trim() || isThinking"
|
:disabled="!input.trim() || isThinking"
|
||||||
class="flex h-8 w-8 items-center justify-center rounded-full bg-slate-100 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-600 disabled:opacity-50 dark:bg-slate-800 dark:hover:bg-slate-700"
|
class="flex h-10 w-10 items-center justify-center rounded-full border shadow-sm transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50"
|
||||||
|
:class="!input.trim() || isThinking
|
||||||
|
? 'border-slate-200 bg-slate-100 text-slate-400 dark:border-slate-700 dark:bg-slate-800'
|
||||||
|
: 'border-brand-500 bg-brand-500 text-white shadow-[0_0_0_4px_rgba(59,130,246,0.18)] hover:scale-105 hover:bg-brand-600 hover:shadow-[0_0_0_6px_rgba(59,130,246,0.24)] active:scale-95'"
|
||||||
>
|
>
|
||||||
<Send class="h-4 w-4" />
|
<Send class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
@@ -1560,7 +1572,7 @@ const showChatRating = ref(false);
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors"
|
class="absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors"
|
||||||
:class="isBrowserResizing ? 'bg-emerald-500' : 'bg-slate-200 dark:bg-slate-800'"
|
:class="isBrowserResizing ? 'bg-brand-500' : 'bg-slate-200 dark:bg-slate-800'"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1571,7 +1583,7 @@ const showChatRating = ref(false);
|
|||||||
>
|
>
|
||||||
<div class="flex items-center justify-between border-b border-slate-200 px-4 py-3 dark:border-slate-800">
|
<div class="flex items-center justify-between border-b border-slate-200 px-4 py-3 dark:border-slate-800">
|
||||||
<div class="flex items-center gap-2 text-sm font-semibold text-slate-700 dark:text-slate-100">
|
<div class="flex items-center gap-2 text-sm font-semibold text-slate-700 dark:text-slate-100">
|
||||||
<Globe class="h-4 w-4 text-emerald-500" />
|
<Globe class="h-4 w-4 text-brand-500" />
|
||||||
浏览器
|
浏览器
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@@ -1588,12 +1600,12 @@ const showChatRating = ref(false);
|
|||||||
v-model="browserDraftUrl"
|
v-model="browserDraftUrl"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="输入网址,例如 https://example.com"
|
placeholder="输入网址,例如 https://example.com"
|
||||||
class="flex-1 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-800 outline-none transition focus:border-emerald-400 focus:bg-white dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:focus:bg-slate-950"
|
class="flex-1 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-800 outline-none transition focus:border-brand-400 focus:bg-white dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:focus:bg-slate-950"
|
||||||
@keydown="handleBrowserUrlEnter"
|
@keydown="handleBrowserUrlEnter"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
@click="loadBrowserPage"
|
@click="loadBrowserPage"
|
||||||
class="rounded-xl bg-emerald-600 px-3 py-2 text-xs font-medium text-white transition-colors hover:bg-emerald-500"
|
class="rounded-xl bg-brand-600 px-3 py-2 text-xs font-medium text-white transition-colors hover:bg-brand-500"
|
||||||
>
|
>
|
||||||
打开
|
打开
|
||||||
</button>
|
</button>
|
||||||
@@ -1618,7 +1630,7 @@ const showChatRating = ref(false);
|
|||||||
v-if="!browserCurrentUrl"
|
v-if="!browserCurrentUrl"
|
||||||
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-slate-500 dark:text-slate-400"
|
class="flex h-full flex-col items-center justify-center gap-3 px-8 text-center text-sm text-slate-500 dark:text-slate-400"
|
||||||
>
|
>
|
||||||
<Globe class="h-8 w-8 text-emerald-500" />
|
<Globe class="h-8 w-8 text-brand-500" />
|
||||||
<div>在这里直接打开网页,边聊天边查看内容。</div>
|
<div>在这里直接打开网页,边聊天边查看内容。</div>
|
||||||
<div class="text-xs">支持输入 `https://`、`localhost` 或内网 IP 地址。</div>
|
<div class="text-xs">支持输入 `https://`、`localhost` 或内网 IP 地址。</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
* 文件用途:用户工作台,支持自定义布局、收藏、嵌入 Agent
|
* 文件用途:用户工作台,支持自定义布局、收藏、嵌入 Agent
|
||||||
* 引用文件:vue, vue-router, lucide-vue-next, 后端 /api/user 接口
|
* 引用文件:vue, vue-router, lucide-vue-next, 后端 /api/user 接口
|
||||||
*/
|
*/
|
||||||
import { ref, onMounted, onBeforeUnmount, computed, watch } from 'vue';
|
import { ref, onMounted, computed, watch, nextTick } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { config } from '../config';
|
import { config } from '../config';
|
||||||
|
import { useTheme } from '../composables/useTheme';
|
||||||
|
import type { ThemePreference } from '../composables/useTheme';
|
||||||
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
|
import ThemeToggleButton from '../components/ThemeToggleButton.vue';
|
||||||
import DeleteConfirmDialog from '../components/DeleteConfirmDialog.vue';
|
import DeleteConfirmDialog from '../components/DeleteConfirmDialog.vue';
|
||||||
import GeneralFeedbackDialog from '../components/GeneralFeedbackDialog.vue';
|
import GeneralFeedbackDialog from '../components/GeneralFeedbackDialog.vue';
|
||||||
@@ -33,7 +35,13 @@ import {
|
|||||||
Bot,
|
Bot,
|
||||||
Lock,
|
Lock,
|
||||||
User,
|
User,
|
||||||
|
Mail,
|
||||||
|
Building,
|
||||||
|
CreditCard,
|
||||||
|
Globe,
|
||||||
LogOut,
|
LogOut,
|
||||||
|
Save,
|
||||||
|
Palette,
|
||||||
Megaphone,
|
Megaphone,
|
||||||
X,
|
X,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
@@ -43,6 +51,7 @@ import {
|
|||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const { showMessageDialog } = useGlobalMessageDialog();
|
const { showMessageDialog } = useGlobalMessageDialog();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { setThemePreference } = useTheme();
|
||||||
|
|
||||||
const loadLanguagePreference = () => {
|
const loadLanguagePreference = () => {
|
||||||
const storedLang = localStorage.getItem('hxops_lang');
|
const storedLang = localStorage.getItem('hxops_lang');
|
||||||
@@ -104,6 +113,19 @@ interface WecomBindPromptState {
|
|||||||
error: string;
|
error: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ProfileForm {
|
||||||
|
id: number;
|
||||||
|
username: string;
|
||||||
|
real_name: string;
|
||||||
|
email: string;
|
||||||
|
phone_number: string;
|
||||||
|
department: string;
|
||||||
|
role: string;
|
||||||
|
employee_id: string;
|
||||||
|
language: string;
|
||||||
|
theme_preference: ThemePreference;
|
||||||
|
}
|
||||||
|
|
||||||
// State
|
// State
|
||||||
const isLoading = ref(true);
|
const isLoading = ref(true);
|
||||||
const currentUser = ref<{ id: number; username: string; role: string; default_agent_id?: number | null } | null>(null);
|
const currentUser = ref<{ id: number; username: string; role: string; default_agent_id?: number | null } | null>(null);
|
||||||
@@ -696,20 +718,53 @@ const handleRegister = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Header Dropdown State
|
const activeSidebarItem = ref<'profile' | 'applications' | 'feedback' | 'updates'>('applications');
|
||||||
const showUserDropdown = ref(false);
|
const isProfileLoading = ref(false);
|
||||||
const userMenuRef = ref<HTMLElement | null>(null);
|
const isProfileSaving = ref(false);
|
||||||
|
const isProfileEditing = ref(false);
|
||||||
|
const showPasswordModal = ref(false);
|
||||||
|
const profileUser = ref<ProfileForm>({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
real_name: '',
|
||||||
|
email: '',
|
||||||
|
phone_number: '',
|
||||||
|
department: '',
|
||||||
|
role: '',
|
||||||
|
employee_id: '',
|
||||||
|
language: 'zh-CN',
|
||||||
|
theme_preference: 'system' as ThemePreference,
|
||||||
|
});
|
||||||
|
const originalProfile = ref<ProfileForm | null>(null);
|
||||||
|
const passwordForm = ref({
|
||||||
|
current: '',
|
||||||
|
new: '',
|
||||||
|
confirm: '',
|
||||||
|
});
|
||||||
|
|
||||||
const handleDocumentPointerDown = (event: MouseEvent | TouchEvent) => {
|
const themeOptions: Array<{ value: ThemePreference; label: () => string }> = [
|
||||||
if (!showUserDropdown.value) return;
|
{ value: 'light', label: () => t('theme.light') || 'Light' },
|
||||||
const target = event.target as Node | null;
|
{ value: 'dark', label: () => t('theme.dark') || 'Dark' },
|
||||||
if (!target) return;
|
{ value: 'system', label: () => t('theme.system') || 'Follow System' },
|
||||||
if (userMenuRef.value?.contains(target)) return;
|
];
|
||||||
showUserDropdown.value = false;
|
|
||||||
};
|
const hasProfileUnsavedChanges = computed(() => {
|
||||||
|
if (!originalProfile.value) return false;
|
||||||
|
return (
|
||||||
|
profileUser.value.real_name !== originalProfile.value.real_name ||
|
||||||
|
profileUser.value.phone_number !== originalProfile.value.phone_number ||
|
||||||
|
profileUser.value.language !== originalProfile.value.language ||
|
||||||
|
profileUser.value.theme_preference !== originalProfile.value.theme_preference ||
|
||||||
|
profileUser.value.email !== originalProfile.value.email ||
|
||||||
|
profileUser.value.employee_id !== originalProfile.value.employee_id ||
|
||||||
|
profileUser.value.department !== originalProfile.value.department
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
localStorage.removeItem('hxops_user');
|
localStorage.removeItem('hxops_user');
|
||||||
|
sessionStorage.removeItem('hxops_user');
|
||||||
|
sessionStorage.removeItem('hxops_wecom_state');
|
||||||
currentUser.value = null;
|
currentUser.value = null;
|
||||||
agents.value = [];
|
agents.value = [];
|
||||||
quickQuestions.value = [];
|
quickQuestions.value = [];
|
||||||
@@ -720,8 +775,171 @@ const handleLogout = () => {
|
|||||||
router.push('/');
|
router.push('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToProfile = () => {
|
const captureOriginalProfile = () => {
|
||||||
router.push('/profile');
|
originalProfile.value = { ...profileUser.value };
|
||||||
|
};
|
||||||
|
|
||||||
|
const parseErrorMessage = async (res: Response) => {
|
||||||
|
try {
|
||||||
|
const data = await res.json();
|
||||||
|
return data?.error || data?.message || '';
|
||||||
|
} catch {
|
||||||
|
try {
|
||||||
|
return await res.text();
|
||||||
|
} catch {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchProfile = async () => {
|
||||||
|
isProfileLoading.value = true;
|
||||||
|
try {
|
||||||
|
const res = await fetch('/api/user/profile', { headers: getAuthHeaders() });
|
||||||
|
if (!res.ok) {
|
||||||
|
showMessageDialog('error', '加载个人中心失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = await res.json();
|
||||||
|
profileUser.value = { ...profileUser.value, ...data };
|
||||||
|
if (data.language) locale.value = data.language;
|
||||||
|
if (data.theme_preference) setThemePreference(data.theme_preference);
|
||||||
|
captureOriginalProfile();
|
||||||
|
isProfileEditing.value = false;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
showMessageDialog('error', '加载个人中心失败');
|
||||||
|
} finally {
|
||||||
|
isProfileLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const navigateToProfile = async () => {
|
||||||
|
activeSidebarItem.value = 'profile';
|
||||||
|
if (!profileUser.value.id) {
|
||||||
|
await fetchProfile();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const startProfileEditing = () => {
|
||||||
|
isProfileEditing.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const cancelProfileEditing = () => {
|
||||||
|
if (originalProfile.value) {
|
||||||
|
profileUser.value = { ...originalProfile.value };
|
||||||
|
locale.value = profileUser.value.language;
|
||||||
|
setThemePreference(profileUser.value.theme_preference);
|
||||||
|
}
|
||||||
|
isProfileEditing.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveProfile = async () => {
|
||||||
|
if (!hasProfileUnsavedChanges.value) {
|
||||||
|
isProfileEditing.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
real_name: profileUser.value.real_name,
|
||||||
|
phone_number: profileUser.value.phone_number,
|
||||||
|
language: profileUser.value.language,
|
||||||
|
theme_preference: profileUser.value.theme_preference,
|
||||||
|
email: profileUser.value.email,
|
||||||
|
employee_id: profileUser.value.employee_id,
|
||||||
|
department: profileUser.value.department,
|
||||||
|
};
|
||||||
|
|
||||||
|
locale.value = profileUser.value.language;
|
||||||
|
setThemePreference(profileUser.value.theme_preference);
|
||||||
|
|
||||||
|
try {
|
||||||
|
isProfileSaving.value = true;
|
||||||
|
const res = await fetch('/api/user/profile', {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
const message = await parseErrorMessage(res);
|
||||||
|
showMessageDialog('error', message || '保存个人资料失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showMessageDialog('success', '个人资料已保存');
|
||||||
|
captureOriginalProfile();
|
||||||
|
isProfileEditing.value = false;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
showMessageDialog('error', '保存个人资料失败');
|
||||||
|
} finally {
|
||||||
|
isProfileSaving.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleChangePassword = async () => {
|
||||||
|
if (passwordForm.value.new !== passwordForm.value.confirm) {
|
||||||
|
showMessageDialog('warning', t('profile.passwordMismatch') || 'Passwords do not match');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await fetch('/api/user/change-password', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||||
|
body: JSON.stringify({
|
||||||
|
current_password: passwordForm.value.current,
|
||||||
|
new_password: passwordForm.value.new,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
if (!res.ok) {
|
||||||
|
showMessageDialog('error', data.error || '修改密码失败');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showMessageDialog('success', t('profile.passwordChanged') || 'Password changed successfully');
|
||||||
|
passwordForm.value = { current: '', new: '', confirm: '' };
|
||||||
|
showPasswordModal.value = false;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
showMessageDialog('error', '修改密码失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const openGeneralFeedback = () => {
|
||||||
|
activeSidebarItem.value = 'feedback';
|
||||||
|
showGeneralFeedbackDialog.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const openWorkspaceSection = async (
|
||||||
|
sectionId: 'announcements' | 'favorites' | 'all_agents',
|
||||||
|
sidebarItem: 'applications' | 'updates',
|
||||||
|
) => {
|
||||||
|
activeSidebarItem.value = sidebarItem;
|
||||||
|
const targetSection = layoutSections.value.find((section) => section.id === sectionId);
|
||||||
|
if (targetSection) {
|
||||||
|
targetSection.collapsed = false;
|
||||||
|
}
|
||||||
|
await nextTick();
|
||||||
|
document.getElementById(`workspace-section-${sectionId}`)?.scrollIntoView({
|
||||||
|
behavior: 'smooth',
|
||||||
|
block: 'start',
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const navigateToApplications = () => openWorkspaceSection('favorites', 'applications');
|
||||||
|
|
||||||
|
const navigateToUpdates = () => openWorkspaceSection('announcements', 'updates');
|
||||||
|
|
||||||
|
const navigateToGeneralChat = () => {
|
||||||
|
router.push(`/chat/${DEFAULT_POST_LOGIN_AGENT_ID}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const openAdminPanel = () => {
|
||||||
|
window.location.assign('http://localhost:8881/admin');
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToChat = (id: number) => {
|
const navigateToChat = (id: number) => {
|
||||||
@@ -915,8 +1133,6 @@ const openAnnouncement = (ann: Announcement) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
document.addEventListener('mousedown', handleDocumentPointerDown);
|
|
||||||
document.addEventListener('touchstart', handleDocumentPointerDown, { passive: true });
|
|
||||||
loadLanguagePreference();
|
loadLanguagePreference();
|
||||||
fetchAnnouncements();
|
fetchAnnouncements();
|
||||||
const handledCasdoor = await tryCasdoorCallbackLogin();
|
const handledCasdoor = await tryCasdoorCallbackLogin();
|
||||||
@@ -936,11 +1152,6 @@ onMounted(async () => {
|
|||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
|
||||||
document.removeEventListener('mousedown', handleDocumentPointerDown);
|
|
||||||
document.removeEventListener('touchstart', handleDocumentPointerDown);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -956,83 +1167,10 @@ onBeforeUnmount(() => {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Header (Logged In) -->
|
<main
|
||||||
<header v-if="isLoggedIn" class="sticky top-0 z-30 bg-white/80 dark:bg-slate-900/80 backdrop-blur-md border-b border-gray-100 dark:border-slate-700 page-shell-mobile py-2.5 md:py-4 section-gap-mobile transition-all duration-300">
|
class="mx-auto"
|
||||||
<div class="max-w-7xl mx-auto flex flex-wrap md:flex-nowrap justify-between items-start md:items-center gap-2 md:gap-4">
|
:class="isLoggedIn ? 'max-w-none min-h-screen px-0 py-0' : 'max-w-7xl page-shell-mobile pb-12'"
|
||||||
<div class="flex items-center gap-2 md:gap-3 min-w-0 flex-1">
|
>
|
||||||
<div class="w-8 h-8 md:w-10 md:h-10 bg-gradient-to-br from-brand-500 to-brand-700 rounded-xl flex items-center justify-center text-white shadow-lg shadow-brand-500/30 shrink-0">
|
|
||||||
<Bot class="w-4 h-4 md:w-6 md:h-6" />
|
|
||||||
</div>
|
|
||||||
<div class="min-w-0">
|
|
||||||
<h1 class="text-lg md:text-xl font-bold text-[#1b2b49] dark:text-slate-100 tracking-tight leading-tight truncate">
|
|
||||||
{{ $t('workspace.brandTitle') }}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center gap-2 md:gap-4 shrink-0">
|
|
||||||
<!-- Keep header actions minimal on mobile; language switch is in the profile dropdown. -->
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<button
|
|
||||||
@click="showGeneralFeedbackDialog = true"
|
|
||||||
class="inline-flex items-center gap-1 rounded-xl border border-[#8cbce8] bg-[#eef6ff] px-2 py-1.5 text-[11px] font-semibold text-[#2f73b2] transition-colors hover:bg-[#e3f1ff] md:px-3 md:py-2 md:text-xs"
|
|
||||||
>
|
|
||||||
{{ '\u610f\u89c1\u53cd\u9988' }}
|
|
||||||
</button>
|
|
||||||
<ThemeToggleButton />
|
|
||||||
</div>
|
|
||||||
<!-- User Profile Dropdown -->
|
|
||||||
<div ref="userMenuRef" class="relative">
|
|
||||||
<button @click="showUserDropdown = !showUserDropdown" class="flex items-center gap-2 md:gap-3 pl-2 md:pl-3 pr-1.5 md:pr-2 py-1 md:py-1.5 rounded-full hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors border border-transparent hover:border-slate-200 dark:hover:border-slate-700">
|
|
||||||
<div class="text-right hidden sm:block">
|
|
||||||
<div class="text-sm font-bold text-slate-900 dark:text-slate-100 leading-tight">{{ currentUser?.username }}</div>
|
|
||||||
<div class="text-[10px] font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wide">{{ currentUser?.role }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="w-8 h-8 md:w-9 md:h-9 bg-brand-100 rounded-full flex items-center justify-center text-brand-600 font-bold border-2 border-white shadow-sm">
|
|
||||||
{{ (currentUser?.username || 'U').charAt(0).toUpperCase() }}
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Dropdown Menu -->
|
|
||||||
<div v-if="showUserDropdown"
|
|
||||||
class="absolute right-0 top-full mt-2 w-56 bg-white dark:bg-slate-900 rounded-xl shadow-xl border border-slate-100 dark:border-slate-700 py-1 z-50 animate-fade-in">
|
|
||||||
<div class="px-4 py-3 border-b border-slate-50 dark:border-slate-700 md:hidden">
|
|
||||||
<div class="text-sm font-bold text-slate-900 dark:text-slate-100">{{ currentUser?.username }}</div>
|
|
||||||
<div class="text-xs text-slate-500 dark:text-slate-400">{{ currentUser?.role }}</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button @click="navigateToProfile" class="w-full text-left px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-brand-600 flex items-center gap-2">
|
|
||||||
<User class="w-4 h-4" />
|
|
||||||
{{ $t('profile.title') }}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button v-if="currentUser?.role === 'admin'" @click="router.push('/admin')" class="w-full text-left px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-brand-600 flex items-center gap-2">
|
|
||||||
<Settings class="w-4 h-4" />
|
|
||||||
{{ $t('admin.title') }}
|
|
||||||
</button>
|
|
||||||
<div class="px-4 pt-2 pb-3 border-t border-slate-50 dark:border-slate-700 mt-1">
|
|
||||||
<label class="block text-[11px] font-semibold text-slate-500 dark:text-slate-400 mb-1.5 uppercase tracking-wide">{{ $t('workspace.languageLabel') }}</label>
|
|
||||||
<select v-model="locale" class="w-full bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 text-xs font-medium text-slate-700 dark:text-slate-300 rounded-lg px-2.5 py-2 outline-none focus:ring-2 focus:ring-brand-500/20 focus:border-brand-500">
|
|
||||||
<option value="en">English</option>
|
|
||||||
<option value="zh-CN">简体中文</option>
|
|
||||||
<option value="zh-TW">繁體中文</option>
|
|
||||||
<option value="th">ไทย</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="border-t border-slate-50 dark:border-slate-700 my-1"></div>
|
|
||||||
|
|
||||||
<button @click="handleLogout" class="w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-red-50 flex items-center gap-2">
|
|
||||||
<LogOut class="w-4 h-4" />
|
|
||||||
{{ $t('workspace.logout') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main class="max-w-7xl mx-auto page-shell-mobile pb-12">
|
|
||||||
<div v-if="isLoading" class="animate-pulse space-y-8">
|
<div v-if="isLoading" class="animate-pulse space-y-8">
|
||||||
<div class="h-48 bg-gray-200 rounded-2xl"></div>
|
<div class="h-48 bg-gray-200 rounded-2xl"></div>
|
||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||||
@@ -1163,54 +1301,300 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Logged In Layout -->
|
<!-- Logged In Layout -->
|
||||||
<div v-else class="space-y-8 animate-fade-in">
|
<div v-else class="grid min-h-screen gap-0 lg:grid-cols-[232px_minmax(0,1fr)] animate-fade-in">
|
||||||
<div v-if="wecomEntryHint" class="rounded-xl border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-700">
|
<aside class="lg:sticky lg:top-0 lg:h-screen">
|
||||||
{{ wecomEntryHint }}
|
<div class="flex h-full flex-col border-r border-slate-200 bg-white px-5 py-6 shadow-sm">
|
||||||
</div>
|
<div class="border-b border-slate-100 pb-6">
|
||||||
<!-- Draggable Sections -->
|
<div class="flex items-center gap-3">
|
||||||
<div
|
<div class="flex h-12 w-12 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 via-brand-600 to-purple-600 text-white shadow-lg shadow-brand-500/25">
|
||||||
v-for="(section, index) in layoutSections"
|
<Bot class="h-6 w-6" />
|
||||||
:key="section.id"
|
</div>
|
||||||
class="bg-transparent md:bg-white dark:md:bg-slate-900 md:rounded-3xl md:border md:border-slate-100 dark:md:border-slate-700 md:p-8 md:shadow-soft relative group transition-all"
|
<div class="min-w-0">
|
||||||
:class="{ 'opacity-50 border-brand-300 border-dashed': draggedSectionIndex === index }"
|
<div class="text-2xl font-extrabold tracking-tight text-[#14213d]">Hxops</div>
|
||||||
draggable="true"
|
<div class="truncate text-xs font-medium text-slate-400">
|
||||||
@dragstart="onDragStart(index)"
|
{{ currentUser?.username }} / {{ currentUser?.role }}
|
||||||
@dragover="onDragOver"
|
</div>
|
||||||
@drop="onDrop(index)"
|
</div>
|
||||||
>
|
</div>
|
||||||
<!-- Drag Handle -->
|
|
||||||
<div class="absolute left-2 top-8 cursor-move opacity-0 group-hover:opacity-100 p-2 text-slate-300 hover:text-slate-500 transition-opacity hidden md:block">
|
|
||||||
<GripVertical class="w-5 h-5" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Section Content -->
|
|
||||||
<div class="md:pl-6">
|
|
||||||
<!-- Header -->
|
|
||||||
<div class="flex justify-between items-center mb-6">
|
|
||||||
<h2 class="text-lg md:text-xl font-semibold text-[#1b2b49] dark:text-slate-100 flex items-center gap-2.5 cursor-pointer select-none" @click="toggleSectionCollapse(section)">
|
|
||||||
<div class="p-2 rounded-lg" :class="{
|
|
||||||
'bg-emerald-50 text-emerald-600': section.id === 'announcements',
|
|
||||||
'bg-yellow-50 text-yellow-600': section.id === 'favorites',
|
|
||||||
'bg-brand-50 text-brand-600': section.id === 'quick_questions',
|
|
||||||
'bg-purple-50 text-purple-600': section.id === 'embedded',
|
|
||||||
'bg-slate-100 text-slate-600': section.id === 'all_agents'
|
|
||||||
}">
|
|
||||||
<component :is="section.id === 'announcements' ? Megaphone : (section.id === 'favorites' ? Star : (section.id === 'embedded' ? Bot : LayoutGrid))" class="w-5 h-5" />
|
|
||||||
</div>
|
|
||||||
{{ $t(getSectionTitleKey(section.id)) }}
|
|
||||||
<component :is="section.collapsed ? ChevronDown : ChevronUp" class="w-4 h-4 text-slate-400" />
|
|
||||||
</h2>
|
|
||||||
<!-- Actions for Quick Questions -->
|
|
||||||
<button v-if="section.id === 'quick_questions' && !isAddingQuestion && !section.collapsed" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50">
|
|
||||||
<Plus class="w-4 h-4" /> {{ $t('workspace.quickQuestions.add') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-show="!section.collapsed" class="animate-fade-in">
|
<div class="flex-1 py-6">
|
||||||
|
<div class="space-y-2">
|
||||||
|
<button
|
||||||
|
@click="navigateToProfile"
|
||||||
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
|
||||||
|
:class="activeSidebarItem === 'profile' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
|
||||||
|
>
|
||||||
|
<User class="h-4 w-4" />
|
||||||
|
<span>个人中心</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="navigateToApplications"
|
||||||
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
|
||||||
|
:class="activeSidebarItem === 'applications' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
|
||||||
|
>
|
||||||
|
<LayoutGrid class="h-4 w-4" />
|
||||||
|
<span>应用管理</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="openGeneralFeedback"
|
||||||
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
|
||||||
|
:class="activeSidebarItem === 'feedback' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
|
||||||
|
>
|
||||||
|
<Edit class="h-4 w-4" />
|
||||||
|
<span>意见反馈</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="navigateToUpdates"
|
||||||
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium transition-all"
|
||||||
|
:class="activeSidebarItem === 'updates' ? 'bg-brand-50 text-brand-700 shadow-sm' : 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'"
|
||||||
|
>
|
||||||
|
<Megaphone class="h-4 w-4" />
|
||||||
|
<span>最近更新</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="border-t border-slate-100 pt-6">
|
||||||
|
<div class="space-y-2">
|
||||||
|
<button
|
||||||
|
@click="navigateToGeneralChat"
|
||||||
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
|
||||||
|
>
|
||||||
|
<Bot class="h-4 w-4" />
|
||||||
|
<span>返回聊天</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="openAdminPanel"
|
||||||
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
|
||||||
|
>
|
||||||
|
<Settings class="h-4 w-4" />
|
||||||
|
<span>管理后台</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="handleLogout"
|
||||||
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-red-500 transition-all hover:bg-red-50 hover:text-red-600"
|
||||||
|
>
|
||||||
|
<LogOut class="h-4 w-4" />
|
||||||
|
<span>退出登录</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="space-y-6">
|
||||||
|
<div class="rounded-3xl border border-slate-200 bg-white px-6 py-6 shadow-sm md:px-8">
|
||||||
|
<div class="flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between">
|
||||||
|
<div class="flex flex-1 flex-col gap-6 sm:flex-row sm:items-center sm:justify-start">
|
||||||
|
<div class="flex h-24 w-24 shrink-0 items-center justify-center rounded-full bg-brand-100 text-4xl font-bold text-brand-600">
|
||||||
|
{{ (profileUser.real_name || profileUser.username || 'U').charAt(0).toUpperCase() }}
|
||||||
|
</div>
|
||||||
|
<div class="grid flex-1 grid-cols-1 gap-x-12 gap-y-3 text-left sm:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<div class="text-lg font-semibold text-slate-900">{{ profileUser.username || '-' }}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="text-lg font-semibold text-slate-900">{{ profileUser.employee_id || '-' }}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="text-lg font-semibold text-slate-900">{{ profileUser.department || '-' }}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="text-lg font-semibold text-slate-900">
|
||||||
|
{{ profileUser.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<div class="break-all text-lg font-semibold text-slate-900">{{ profileUser.email || '-' }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button @click="showPasswordModal = true" class="btn-primary shrink-0 self-start px-6 py-3 text-base lg:ml-6">
|
||||||
|
修改密码
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-6">
|
||||||
|
<div class="rounded-3xl border border-slate-200 bg-white p-8 shadow-sm">
|
||||||
|
<div class="mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||||
|
<div>
|
||||||
|
<h3 class="flex items-center gap-3 text-3xl font-bold text-slate-900">
|
||||||
|
<User class="h-6 w-6 text-brand-500" />
|
||||||
|
基本信息
|
||||||
|
</h3>
|
||||||
|
<p class="mt-2 text-sm text-slate-500">
|
||||||
|
{{ isProfileEditing ? '可直接修改并保存个人资料' : '切换到编辑模式以更新个人资料' }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<button v-if="!isProfileEditing" @click="startProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
|
||||||
|
编辑
|
||||||
|
</button>
|
||||||
|
<template v-else>
|
||||||
|
<button @click="cancelProfileEditing" class="btn-secondary px-5 py-2.5 text-sm">
|
||||||
|
{{ $t('profile.cancel') || 'Cancel' }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="saveProfile"
|
||||||
|
:disabled="isProfileSaving || !hasProfileUnsavedChanges"
|
||||||
|
class="btn-primary px-5 py-2.5 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
|
>
|
||||||
|
<Save class="w-4 h-4" />
|
||||||
|
<span>{{ isProfileSaving ? '保存中...' : '保存' }}</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-1 gap-5 md:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
|
||||||
|
<User class="h-4 w-4" /> 用户名
|
||||||
|
</label>
|
||||||
|
<div class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700">
|
||||||
|
{{ profileUser.username || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
|
||||||
|
<CreditCard class="h-4 w-4" /> 工号
|
||||||
|
</label>
|
||||||
|
<input v-if="isProfileEditing" v-model="profileUser.employee_id" type="text" class="input-field h-[58px]" />
|
||||||
|
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700">
|
||||||
|
{{ profileUser.employee_id || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
|
||||||
|
<User class="h-4 w-4" /> 真实姓名
|
||||||
|
</label>
|
||||||
|
<input v-if="isProfileEditing" v-model="profileUser.real_name" type="text" class="input-field h-[58px]" />
|
||||||
|
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700">
|
||||||
|
{{ profileUser.real_name || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
|
||||||
|
<Building class="h-4 w-4" /> 部门
|
||||||
|
</label>
|
||||||
|
<input v-if="isProfileEditing" v-model="profileUser.department" type="text" class="input-field h-[58px]" />
|
||||||
|
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700">
|
||||||
|
{{ profileUser.department || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
|
||||||
|
<Mail class="h-4 w-4" /> 邮箱
|
||||||
|
</label>
|
||||||
|
<input v-if="isProfileEditing" v-model="profileUser.email" type="email" class="input-field h-[58px]" />
|
||||||
|
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700">
|
||||||
|
{{ profileUser.email || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 flex items-center gap-2 text-sm font-medium text-slate-500">
|
||||||
|
<Globe class="h-4 w-4" /> 手机号
|
||||||
|
</label>
|
||||||
|
<input v-if="isProfileEditing" v-model="profileUser.phone_number" type="text" class="input-field h-[58px]" />
|
||||||
|
<div v-else class="rounded-2xl border border-slate-200 bg-slate-50 px-4 py-4 text-lg font-medium text-slate-700">
|
||||||
|
{{ profileUser.phone_number || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="rounded-3xl border border-slate-200 bg-white p-8 shadow-sm">
|
||||||
|
<h3 class="mb-6 flex items-center gap-3 text-2xl font-bold text-slate-900">
|
||||||
|
<Palette class="h-5 w-5 text-brand-500" />
|
||||||
|
偏好设置
|
||||||
|
</h3>
|
||||||
|
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 block text-sm font-medium text-slate-500">语言</label>
|
||||||
|
<select v-model="profileUser.language" :disabled="!isProfileEditing" class="input-field h-[58px]">
|
||||||
|
<option value="en">English</option>
|
||||||
|
<option value="zh-CN">简体中文</option>
|
||||||
|
<option value="zh-TW">繁體中文</option>
|
||||||
|
<option value="th">ไทย</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-2 block text-sm font-medium text-slate-500">主题</label>
|
||||||
|
<div class="grid grid-cols-3 gap-2">
|
||||||
|
<button
|
||||||
|
v-for="item in themeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
type="button"
|
||||||
|
:disabled="!isProfileEditing"
|
||||||
|
@click="profileUser.theme_preference = item.value"
|
||||||
|
class="rounded-xl border px-3 py-3 text-sm font-medium transition-colors"
|
||||||
|
:class="profileUser.theme_preference === item.value
|
||||||
|
? 'border-brand-500 bg-brand-50 text-brand-700'
|
||||||
|
: 'border-slate-200 bg-white text-slate-600'"
|
||||||
|
>
|
||||||
|
{{ item.label() }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<div v-if="wecomEntryHint" class="rounded-2xl border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-700">
|
||||||
|
{{ wecomEntryHint }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-for="(section, index) in layoutSections"
|
||||||
|
:id="`workspace-section-${section.id}`"
|
||||||
|
:key="section.id"
|
||||||
|
class="bg-transparent md:bg-white dark:md:bg-slate-900 md:rounded-3xl md:border md:border-slate-100 dark:md:border-slate-700 md:p-8 md:shadow-soft relative group transition-all scroll-mt-6"
|
||||||
|
:class="{ 'opacity-50 border-brand-300 border-dashed': draggedSectionIndex === index }"
|
||||||
|
draggable="true"
|
||||||
|
@dragstart="onDragStart(index)"
|
||||||
|
@dragover="onDragOver"
|
||||||
|
@drop="onDrop(index)"
|
||||||
|
>
|
||||||
|
<div class="absolute left-2 top-8 cursor-move opacity-0 group-hover:opacity-100 p-2 text-slate-300 hover:text-slate-500 transition-opacity hidden md:block">
|
||||||
|
<GripVertical class="w-5 h-5" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md:pl-6">
|
||||||
|
<div class="flex justify-between items-center mb-6">
|
||||||
|
<h2 class="text-lg md:text-xl font-semibold text-[#1b2b49] dark:text-slate-100 flex items-center gap-2.5 cursor-pointer select-none" @click="toggleSectionCollapse(section)">
|
||||||
|
<div class="p-2 rounded-lg" :class="{
|
||||||
|
'bg-emerald-50 text-emerald-600': section.id === 'announcements',
|
||||||
|
'bg-yellow-50 text-yellow-600': section.id === 'favorites',
|
||||||
|
'bg-brand-50 text-brand-600': section.id === 'quick_questions',
|
||||||
|
'bg-purple-50 text-purple-600': section.id === 'embedded',
|
||||||
|
'bg-slate-100 text-slate-600': section.id === 'all_agents'
|
||||||
|
}">
|
||||||
|
<component :is="section.id === 'announcements' ? Megaphone : (section.id === 'favorites' ? Star : (section.id === 'embedded' ? Bot : LayoutGrid))" class="w-5 h-5" />
|
||||||
|
</div>
|
||||||
|
{{ $t(getSectionTitleKey(section.id)) }}
|
||||||
|
<component :is="section.collapsed ? ChevronDown : ChevronUp" class="w-4 h-4 text-slate-400" />
|
||||||
|
</h2>
|
||||||
|
<button v-if="section.id === 'quick_questions' && !isAddingQuestion && !section.collapsed" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50">
|
||||||
|
<Plus class="w-4 h-4" /> {{ $t('workspace.quickQuestions.add') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-show="!section.collapsed" class="animate-fade-in">
|
||||||
<!-- Content: Announcements -->
|
<!-- Content: Announcements -->
|
||||||
<div v-if="section.id === 'announcements'">
|
<div v-if="section.id === 'announcements'">
|
||||||
<div v-if="announcements.length === 0" class="text-slate-400 text-sm italic py-8 text-center bg-slate-50 rounded-xl border border-dashed border-slate-200">{{ $t('workspace.announcements.noData') }}</div>
|
<div v-if="announcements.length === 0" class="text-slate-400 text-sm italic py-8 text-center bg-slate-50 rounded-xl border border-dashed border-slate-200">{{ $t('workspace.announcements.noData') }}</div>
|
||||||
@@ -1343,9 +1727,11 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<!-- Forgot Password Modal -->
|
<!-- 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">
|
<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">
|
||||||
@@ -1467,6 +1853,40 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="showPasswordModal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4">
|
||||||
|
<div class="w-full max-w-md rounded-3xl border border-slate-200 bg-white p-6 shadow-2xl">
|
||||||
|
<div class="mb-6 flex items-center justify-between">
|
||||||
|
<h3 class="text-lg font-bold text-slate-900">{{ $t('profile.changePassword') || 'Change Password' }}</h3>
|
||||||
|
<button @click="showPasswordModal = false" class="rounded-full p-1 text-slate-500 transition-colors hover:bg-slate-100">
|
||||||
|
<X class="w-5 h-5" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form @submit.prevent="handleChangePassword" class="space-y-4">
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-medium text-slate-500 uppercase">{{ $t('profile.currentPassword') || 'Current Password' }}</label>
|
||||||
|
<input v-model="passwordForm.current" type="password" class="input-field mt-1" required />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-medium text-slate-500 uppercase">{{ $t('profile.newPassword') || 'New Password' }}</label>
|
||||||
|
<input v-model="passwordForm.new" type="password" class="input-field mt-1" required />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-medium text-slate-500 uppercase">{{ $t('profile.confirmPassword') || 'Confirm Password' }}</label>
|
||||||
|
<input v-model="passwordForm.confirm" type="password" class="input-field mt-1" required />
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-3 pt-2">
|
||||||
|
<button type="button" @click="showPasswordModal = false" class="btn-secondary flex-1 py-2">
|
||||||
|
{{ $t('profile.cancel') || 'Cancel' }}
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn-primary flex-1 py-2">
|
||||||
|
{{ $t('profile.changePassword') || 'Update' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Register Modal -->
|
<!-- Register Modal -->
|
||||||
<div v-if="showRegisterModal" 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">
|
<div v-if="showRegisterModal" 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