add tool view
This commit is contained in:
parent
31eaeb6ef8
commit
f5def6df67
@ -14,6 +14,10 @@ import {
|
|||||||
GoldOutlined,
|
GoldOutlined,
|
||||||
GoldFilled,
|
GoldFilled,
|
||||||
BugOutlined,
|
BugOutlined,
|
||||||
|
ProjectFilled,
|
||||||
|
ProjectOutlined,
|
||||||
|
StarFilled,
|
||||||
|
StarOutlined,
|
||||||
} from '@ant-design/icons-vue'
|
} from '@ant-design/icons-vue'
|
||||||
import { themeConfig } from '@/assets/theme'
|
import { themeConfig } from '@/assets/theme'
|
||||||
import { useConfigStore } from '@/stores/config'
|
import { useConfigStore } from '@/stores/config'
|
||||||
@ -73,12 +77,19 @@ console.log(route)
|
|||||||
<div class="nav">
|
<div class="nav">
|
||||||
<RouterLink to="/chat" class="nav-item" active-class="active">
|
<RouterLink to="/chat" class="nav-item" active-class="active">
|
||||||
<component class="icon" :is="route.path === '/chat' ? MessageFilled : MessageOutlined" />
|
<component class="icon" :is="route.path === '/chat' ? MessageFilled : MessageOutlined" />
|
||||||
|
<span class="text">对话</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<RouterLink to="/database" class="nav-item" active-class="active">
|
<RouterLink to="/database" class="nav-item" active-class="active">
|
||||||
<component class="icon" :is="route.path.startsWith('/database') ? DatabaseFilled : DatabaseOutlined" />
|
<component class="icon" :is="route.path.startsWith('/database') ? DatabaseFilled : DatabaseOutlined" />
|
||||||
|
<span class="text">知识</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<RouterLink to="/graph" class="nav-item" active-class="active">
|
<RouterLink to="/graph" class="nav-item" active-class="active">
|
||||||
<component class="icon" :is="route.path.startsWith('/graph') ? GoldFilled: GoldOutlined" />
|
<component class="icon" :is="route.path.startsWith('/graph') ? ProjectFilled: ProjectOutlined" />
|
||||||
|
<span class="text">图谱</span>
|
||||||
|
</RouterLink>
|
||||||
|
<RouterLink to="/tools" class="nav-item" active-class="active">
|
||||||
|
<component class="icon" :is="route.path.startsWith('/tools') ? StarFilled: StarOutlined" />
|
||||||
|
<span class="text">工具</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
<div class="fill" style="flex-grow: 1;"></div>
|
<div class="fill" style="flex-grow: 1;"></div>
|
||||||
@ -97,10 +108,11 @@ console.log(route)
|
|||||||
<RouterLink to="/setting" class="nav-item" active-class="active">设置</RouterLink>
|
<RouterLink to="/setting" class="nav-item" active-class="active">设置</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
<a-config-provider :theme="themeConfig">
|
<a-config-provider :theme="themeConfig">
|
||||||
<router-view v-slot="{ Component }" id="app-router-view">
|
<router-view v-slot="{ Component, route }" id="app-router-view">
|
||||||
<keep-alive>
|
<keep-alive v-if="route.meta.keepAlive !== false">
|
||||||
<component :is="Component" />
|
<component :is="Component" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
|
<component :is="Component" v-else />
|
||||||
</router-view>
|
</router-view>
|
||||||
</a-config-provider>
|
</a-config-provider>
|
||||||
</div>
|
</div>
|
||||||
@ -139,6 +151,7 @@ console.log(route)
|
|||||||
div.header, #app-router-view {
|
div.header, #app-router-view {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app-router-view {
|
#app-router-view {
|
||||||
@ -152,15 +165,15 @@ div.header, #app-router-view {
|
|||||||
flex: 0 0 70px;
|
flex: 0 0 70px;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: var(--main-light-3);
|
background-color: var(--main-light-4);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 70px;
|
width: 74px;
|
||||||
border-right: 1px solid var(--main-light-3);
|
border-right: 1px solid var(--main-light-3);
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin: 18px 0 35px 0;
|
margin: 18px 0 18px 0;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -177,24 +190,50 @@ div.header, #app-router-view {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
padding: 8px 16px;
|
display: flex;
|
||||||
border: none;
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 56px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-top: 10px;
|
||||||
|
border: 1px solid transparent;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: #222;
|
color: #222;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
transition: background-color 0.2s ease-in-out;
|
transition: background-color 0.2s ease-in-out;
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.github {
|
||||||
|
padding: 10px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.setting {
|
||||||
|
padding: 16px 12px;
|
||||||
|
width: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: var(--main-600);
|
color: var(--main-600);
|
||||||
background-color: rgba( 0, 93, 125, 0.1);
|
background-color: rgba(255, 255, 255, 0.8);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.05);
|
||||||
|
border: 1px solid white;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba( 0, 93, 125, 0.1);
|
background-color: rgba(255, 255, 255, 0.8);
|
||||||
cursor: pointer;
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 4px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
103
web/src/views/ToolsView.vue
Normal file
103
web/src/views/ToolsView.vue
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tools-container layout-container">
|
||||||
|
<HeaderComponent
|
||||||
|
title="工具箱"
|
||||||
|
description="这里展示了各种可用的工具。点击查看详情。"
|
||||||
|
>
|
||||||
|
</HeaderComponent>
|
||||||
|
|
||||||
|
<div class="tools-grid">
|
||||||
|
<div v-for="tool in tools" :key="tool.id" class="tool-card" @click="navigateToTool(tool.id)">
|
||||||
|
<div class="tool-icon">
|
||||||
|
<component :is="tool.icon" />
|
||||||
|
</div>
|
||||||
|
<div class="tool-info">
|
||||||
|
<h3>{{ tool.name }}</h3>
|
||||||
|
<p>{{ tool.description }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { CalculatorOutlined, FileSearchOutlined, TranslationOutlined } from '@ant-design/icons-vue';
|
||||||
|
import HeaderComponent from '@/components/HeaderComponent.vue';
|
||||||
|
import { Button as AButton } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const tools = ref([
|
||||||
|
{
|
||||||
|
id: 'calculator',
|
||||||
|
name: '计算器',
|
||||||
|
description: '进行各种数学计算',
|
||||||
|
icon: CalculatorOutlined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'file-analyzer',
|
||||||
|
name: '文件分析器',
|
||||||
|
description: '分析各种文件的内容和结构',
|
||||||
|
icon: FileSearchOutlined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'translator',
|
||||||
|
name: '翻译工具',
|
||||||
|
description: '在不同语言之间进行翻译',
|
||||||
|
icon: TranslationOutlined,
|
||||||
|
},
|
||||||
|
// 可以继续添加更多工具...
|
||||||
|
]);
|
||||||
|
|
||||||
|
const navigateToTool = (toolId) => {
|
||||||
|
router.push({ name: 'ToolsComponent', params: { id: toolId } });
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.tools-container {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tools-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-icon {
|
||||||
|
font-size: 24px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-info {
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
color: #666;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user