Skip to content

Commit 0ae489a

Browse files
feat: layout
1 parent 9f004de commit 0ae489a

File tree

30 files changed

+568
-38
lines changed

30 files changed

+568
-38
lines changed

ui/src/api/folder.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Result } from '@/request/Result'
2+
import { get, post, del, put } from '@/request/index'
3+
import { type Ref } from 'vue'
4+
import type { pageRequest } from '@/api/type/common'
5+
const prefix = '/workspace'
6+
7+
/**
8+
* 获得知识库文件夹列表
9+
* @params 参数
10+
* source : APPLICATION, KNOWLEDGE, TOOL
11+
* {
12+
* name: string}
13+
*/
14+
const getFolder: (
15+
wordspace_id: string,
16+
source: string,
17+
data?: any,
18+
loading?: Ref<boolean>,
19+
) => Promise<Result<Array<any>>> = (wordspace_id, source, data, loading) => {
20+
return get(`${prefix}/${wordspace_id}/${source}/folder`, data, loading)
21+
}
22+
23+
export default {
24+
getFolder,
25+
}

ui/src/api/knowledge/knowledge.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Result } from '@/request/Result'
2+
import { get, post, del, put } from '@/request/index'
3+
import { type Ref } from 'vue'
4+
import type { pageRequest } from '@/api/type/common'
5+
const prefix = '/workspace'
6+
7+
/**
8+
* 获得知识库文件夹列表
9+
* @params 参数
10+
* {folder_id: string,
11+
* name: string,
12+
* user_id: string,
13+
* desc: string,}
14+
*/
15+
const getKnowledgeByFolder: (
16+
wordspace_id: string,
17+
data?: any,
18+
loading?: Ref<boolean>,
19+
) => Promise<Result<Array<any>>> = (wordspace_id, data, loading) => {
20+
return get(`${prefix}/${wordspace_id}/knowledge`, data, loading)
21+
}
22+
23+
/**
24+
* 知识库列表
25+
* @param 参数
26+
* param {
27+
"folder_id": "string",
28+
"name": "string",
29+
"tool_type": "string",
30+
desc: string,
31+
}
32+
*/
33+
const getKnowledgeList: (
34+
wordspace_id: string,
35+
page: pageRequest,
36+
param?: any,
37+
loading?: Ref<boolean>,
38+
) => Promise<Result<any>> = (wordspace_id, page, param, loading) => {
39+
return get(
40+
`${prefix}/${wordspace_id}/knowledge/${page.current_page}/${page.page_size}`,
41+
param,
42+
loading,
43+
)
44+
}
45+
46+
export default {
47+
getKnowledgeByFolder,
48+
getKnowledgeList,
49+
}

ui/src/api/tool/tool.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Result } from '@/request/Result'
2+
import { get, post, del, put } from '@/request/index'
3+
import { type Ref } from 'vue'
4+
import type { pageRequest } from '@/api/type/common'
5+
const prefix = '/workspace'
6+
7+
/**
8+
* 获得工具文件夹列表
9+
* @params 参数 {folder_id: string}
10+
*/
11+
const getToolByFolder: (
12+
wordspace_id: string,
13+
data?: any,
14+
loading?: Ref<boolean>,
15+
) => Promise<Result<Array<any>>> = (wordspace_id, data, loading) => {
16+
return get(`${prefix}/${wordspace_id}/tool`, data, loading)
17+
}
18+
19+
/**
20+
* 工具列表
21+
* @param 参数
22+
* param {
23+
"folder_id": "string",
24+
"name": "string",
25+
"tool_type": "string",
26+
}
27+
*/
28+
const getToolList: (
29+
wordspace_id: string,
30+
page: pageRequest,
31+
param?: any,
32+
loading?: Ref<boolean>,
33+
) => Promise<Result<any>> = (wordspace_id, page, param, loading) => {
34+
return get(
35+
`${prefix}/${wordspace_id}/tool/${page.current_page}/${page.page_size}`,
36+
param,
37+
loading,
38+
)
39+
}
40+
41+
export default {
42+
getToolByFolder,
43+
getToolList,
44+
}
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 12 additions & 0 deletions
Loading

ui/src/components/card-box/index.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<div class="title flex align-center" :class="$slots.subTitle ? 'mt-4' : ''">
66
<slot name="icon">
77
<el-avatar v-if="showIcon" class="mr-12 avatar-blue" shape="square" :size="32">
8-
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
8+
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
99
</el-avatar>
1010
</slot>
1111
<div style="width: 90%">
1212
<slot name="title">
13-
<auto-tooltip :content="title" style="width: 65%; height: 22px">
13+
<div>
1414
{{ title }}
15-
</auto-tooltip>
15+
</div>
1616
</slot>
1717
<slot name="subTitle"> </slot>
1818
</div>
@@ -83,7 +83,6 @@ function subHoveredEnter() {
8383
margin-top: -10px;
8484
}
8585
.description {
86-
color: var(--app-text-color-secondary);
8786
line-height: 22px;
8887
font-weight: 400;
8988
.content {
@@ -97,10 +96,9 @@ function subHoveredEnter() {
9796
9897
.card-footer {
9998
position: absolute;
100-
bottom: 8px;
99+
bottom: 4px;
101100
left: 0;
102101
min-height: 30px;
103-
color: var(--app-text-color-secondary);
104102
font-weight: 400;
105103
padding: 0 16px;
106104
width: 100%;
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<template>
2+
<el-tree
3+
style="max-width: 600px"
4+
:data="data"
5+
:props="defaultProps"
6+
@node-click="handleNodeClick"
7+
/>
8+
</template>
9+
10+
<script lang="ts" setup>
11+
defineOptions({ name: 'FolderTree' })
12+
interface Tree {
13+
label: string
14+
children?: Tree[]
15+
}
16+
17+
const handleNodeClick = (data: Tree) => {
18+
console.log(data)
19+
}
20+
21+
const data: Tree[] = [
22+
{
23+
label: 'Level one 1',
24+
children: [
25+
{
26+
label: 'Level two 1-1',
27+
children: [
28+
{
29+
label: 'Level three 1-1-1',
30+
},
31+
],
32+
},
33+
],
34+
},
35+
{
36+
label: 'Level one 2',
37+
children: [
38+
{
39+
label: 'Level two 2-1',
40+
children: [
41+
{
42+
label: 'Level three 2-1-1',
43+
},
44+
],
45+
},
46+
{
47+
label: 'Level two 2-2',
48+
children: [
49+
{
50+
label: 'Level three 2-2-1',
51+
},
52+
],
53+
},
54+
],
55+
},
56+
{
57+
label: 'Level one 3',
58+
children: [
59+
{
60+
label: 'Level two 3-1',
61+
children: [
62+
{
63+
label: 'Level three 3-1-1',
64+
},
65+
],
66+
},
67+
{
68+
label: 'Level two 3-2',
69+
children: [
70+
{
71+
label: 'Level three 3-2-1',
72+
},
73+
],
74+
},
75+
],
76+
},
77+
]
78+
79+
const defaultProps = {
80+
children: 'children',
81+
label: 'label',
82+
}
83+
</script>

ui/src/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import AppIcon from './app-icon/AppIcon.vue'
77
import LayoutContainer from './layout-container/index.vue'
88
import ContentContainer from './layout-container/ContentContainer.vue'
99
import CardBox from './card-box/index.vue'
10+
import FolderTree from './folder-tree/index.vue'
1011
export default {
1112
install(app: App) {
1213
app.component('LogoFull', LogoFull)
@@ -17,5 +18,6 @@ export default {
1718
app.component('LayoutContainer', LayoutContainer)
1819
app.component('ContentContainer', ContentContainer)
1920
app.component('CardBox', CardBox)
21+
app.component('FolderTree', FolderTree)
2022
},
2123
}

ui/src/components/layout-container/ContentContainer.vue

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="content-container border-r-4">
2+
<div class="content-container border-r-4 p-16-24">
33
<div class="content-container__header flex align-center w-full" v-if="slots.header || header">
44
<slot name="backButton">
55
<back-button :to="backTo" v-if="showBack"></back-button>
@@ -8,11 +8,10 @@
88
<h4>{{ header }}</h4>
99
</slot>
1010
</div>
11-
<el-scrollbar>
12-
<div class="content-container__main">
13-
<slot></slot>
14-
</div>
15-
</el-scrollbar>
11+
12+
<div class="content-container__main">
13+
<slot></slot>
14+
</div>
1615
</div>
1716
</template>
1817

@@ -22,7 +21,7 @@ defineOptions({ name: 'ContentContainer' })
2221
const slots = useSlots()
2322
const props = defineProps({
2423
header: String || null,
25-
backTo: String
24+
backTo: String,
2625
})
2726
const showBack = computed(() => {
2827
const { backTo } = props
@@ -33,10 +32,9 @@ const showBack = computed(() => {
3332
<style lang="scss" scoped>
3433
.content-container {
3534
transition: 0.3s;
36-
padding: 0 var(--app-view-padding) var(--app-view-padding);
3735
.content-container__header {
3836
box-sizing: border-box;
39-
padding: 16px 0;
37+
padding: calc(var(--app-base-px) * 2) 0;
4038
flex-wrap: wrap;
4139
}
4240
.content-container__main {

0 commit comments

Comments
 (0)