mirror of
https://github.com/Tencent/WeKnora.git
synced 2025-11-25 03:15:00 +08:00
fix(frontend): Fix Login Direct Page
This commit is contained in:
@@ -78,12 +78,30 @@
|
||||
<!-- 下半部分:账户信息、系统设置、退出登录 -->
|
||||
<div class="menu_bottom">
|
||||
<div class="menu_box" v-for="(item, index) in bottomMenuItems" :key="'bottom-' + index">
|
||||
<div @click="handleMenuClick(item.path)"
|
||||
<div v-if="item.path === 'logout'">
|
||||
<t-popconfirm
|
||||
content="确定要退出登录吗?"
|
||||
@confirm="handleLogout"
|
||||
placement="top"
|
||||
:show-arrow="true"
|
||||
>
|
||||
<div @mouseenter="mouseenteMenu(item.path)" @mouseleave="mouseleaveMenu(item.path)"
|
||||
:class="['menu_item', 'logout-item']">
|
||||
<div class="menu_item-box">
|
||||
<div class="menu_icon">
|
||||
<img class="icon" :src="getImgSrc(logoutIcon)" alt="">
|
||||
</div>
|
||||
<span class="menu_title">{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</t-popconfirm>
|
||||
</div>
|
||||
<div v-else @click="handleMenuClick(item.path)"
|
||||
@mouseenter="mouseenteMenu(item.path)" @mouseleave="mouseleaveMenu(item.path)"
|
||||
:class="['menu_item', item.childrenPath && item.childrenPath == currentpath ? 'menu_item_c_active' : (item.path == currentpath) ? 'menu_item_active' : '']">
|
||||
<div class="menu_item-box">
|
||||
<div class="menu_icon">
|
||||
<img class="icon" :src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'logout' ? logoutIcon : item.icon == 'tenant' ? tenantIcon : prefixIcon)" alt="">
|
||||
<img class="icon" :src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'tenant' ? tenantIcon : prefixIcon)" alt="">
|
||||
</div>
|
||||
<span class="menu_title">{{ item.path === 'knowledge-bases' && kbMenuItem ? kbMenuItem.title : item.title }}</span>
|
||||
</div>
|
||||
@@ -444,9 +462,14 @@ const handleMenuClick = async (path: string) => {
|
||||
} else {
|
||||
router.push('/platform/knowledge-bases')
|
||||
}
|
||||
} else {
|
||||
gotopage(path)
|
||||
}
|
||||
} else {
|
||||
gotopage(path)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理退出登录确认
|
||||
const handleLogout = () => {
|
||||
gotopage('logout')
|
||||
}
|
||||
|
||||
const getCurrentKbId = async (): Promise<string | null> => {
|
||||
@@ -914,4 +937,48 @@ watch(() => route.params.kbId, () => {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 退出登录确认框样式
|
||||
:deep(.t-popconfirm) {
|
||||
.t-popconfirm__content {
|
||||
background: #fff;
|
||||
border: 1px solid #e7e7e7;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
padding: 12px 16px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.t-popconfirm__arrow {
|
||||
border-bottom-color: #e7e7e7;
|
||||
}
|
||||
|
||||
.t-popconfirm__arrow::after {
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
.t-popconfirm__buttons {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.t-button--variant-outline {
|
||||
border-color: #d9d9d9;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.t-button--theme-danger {
|
||||
background-color: #ff4d4f;
|
||||
border-color: #ff4d4f;
|
||||
}
|
||||
|
||||
.t-button--theme-danger:hover {
|
||||
background-color: #ff7875;
|
||||
border-color: #ff7875;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -25,7 +25,7 @@ const router = createRouter({
|
||||
{
|
||||
path: "/platform",
|
||||
name: "Platform",
|
||||
redirect: "/platform/knowledgeBase",
|
||||
redirect: "/platform/knowledge-bases",
|
||||
component: () => import("../views/platform/index.vue"),
|
||||
meta: { requiresInit: true, requiresAuth: true },
|
||||
children: [
|
||||
@@ -79,7 +79,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (to.meta.requiresAuth === false || to.meta.requiresInit === false) {
|
||||
// 如果已登录用户访问登录页面,重定向到知识库列表页面
|
||||
if (to.path === '/login' && authStore.isLoggedIn) {
|
||||
next('/platform/knowledgeBase')
|
||||
next('/platform/knowledge-bases')
|
||||
return
|
||||
}
|
||||
next()
|
||||
|
||||
@@ -274,7 +274,7 @@ const handleLogin = async () => {
|
||||
|
||||
// 等待状态更新完成后再跳转
|
||||
await nextTick()
|
||||
router.replace('/platform/knowledgeBase')
|
||||
router.replace('/platform/knowledge-bases')
|
||||
} else {
|
||||
MessagePlugin.error(response.message || '登录失败,请检查邮箱或密码')
|
||||
}
|
||||
|
||||
@@ -1246,7 +1246,11 @@ const loadCurrentConfig = async () => {
|
||||
}
|
||||
|
||||
// 根据是否为知识库设置模式选择不同的API
|
||||
const config = await getCurrentConfigByKB(currentKbId.value);
|
||||
if (props.isKbSettings && !currentKbId.value) {
|
||||
console.error('知识库设置模式下缺少知识库ID');
|
||||
return;
|
||||
}
|
||||
const config = await getCurrentConfigByKB(currentKbId.value!);
|
||||
|
||||
// 设置hasFiles状态
|
||||
hasFiles.value = config.hasFiles || false;
|
||||
@@ -1643,6 +1647,16 @@ onUnmounted(() => {
|
||||
watch(() => formData.llm.source, () => onModelSourceChange('llm'));
|
||||
watch(() => formData.embedding.source, () => onModelSourceChange('embedding'));
|
||||
|
||||
// 监听路由参数变化,当知识库ID变化时重新加载配置
|
||||
watch(() => route.params.kbId, async (newKbId, oldKbId) => {
|
||||
// 只有在知识库设置模式下且ID确实发生变化时才重新加载
|
||||
if (props.isKbSettings && newKbId && newKbId !== oldKbId) {
|
||||
console.log('知识库ID变化,重新加载配置:', { oldKbId, newKbId });
|
||||
await loadCurrentConfig();
|
||||
await checkAllConfiguredModels();
|
||||
}
|
||||
}, { immediate: false });
|
||||
|
||||
// 添加缺失的函数
|
||||
const onRerankChange = () => {
|
||||
console.log('Rerank enabled:', formData.rerank.enabled);
|
||||
@@ -1963,7 +1977,12 @@ const handleSubmit = async () => {
|
||||
}
|
||||
|
||||
// 根据是否为知识库设置模式选择不同的API
|
||||
const result = await initializeSystemByKB(currentKbId.value, formData);
|
||||
if (props.isKbSettings && !currentKbId.value) {
|
||||
console.error('知识库设置模式下缺少知识库ID');
|
||||
MessagePlugin.error('知识库ID缺失,无法保存配置');
|
||||
return;
|
||||
}
|
||||
const result = await initializeSystemByKB(currentKbId.value!, formData);
|
||||
|
||||
if (result.success) {
|
||||
MessagePlugin.success(props.isKbSettings ? '知识库设置更新成功' : (isUpdateMode.value ? '配置更新成功' : '系统初始化完成'));
|
||||
|
||||
@@ -38,7 +38,7 @@ const drop = (event) => {
|
||||
if (fileEntry) {
|
||||
fileEntry.file((file: file) => {
|
||||
requestMethod(file, uploadInput)
|
||||
router.push('/platform/knowledgeBase?upload=true')
|
||||
router.push('/platform/knowledge-bases?upload=true')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user