Skip to content

Commit 796eff7

Browse files
feat: tool
1 parent f21d301 commit 796eff7

File tree

19 files changed

+217
-97
lines changed

19 files changed

+217
-97
lines changed

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"element-plus": "^2.9.7",
2020
"nprogress": "^0.2.0",
2121
"pinia": "^3.0.1",
22+
"use-element-plus-theme": "^0.0.5",
2223
"vue": "^3.5.13",
2324
"vue-codemirror": "^6.1.1",
2425
"vue-i18n": "^11.1.3",

ui/src/assets/node/icon_tool.svg

Lines changed: 3 additions & 0 deletions
Loading

ui/src/components/app-icon/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,31 @@ export const iconMap: any = {
117117
])
118118
},
119119
},
120+
'app-folder': {
121+
iconReader: () => {
122+
return h('i', [
123+
h(
124+
'svg',
125+
{
126+
style: { height: '100%', width: '100%' },
127+
viewBox: '0 0 1024 1024',
128+
version: '1.1',
129+
xmlns: 'http://www.w3.org/2000/svg',
130+
},
131+
[
132+
h('path', {
133+
d: 'M42.666667 170.666667a42.666667 42.666667 0 0 1 42.666666-42.666667h357.632a42.666667 42.666667 0 0 1 38.144 23.594667L512 213.333333h426.666667a42.666667 42.666667 0 0 1 42.666666 42.666667v597.333333a42.666667 42.666667 0 0 1-42.666666 42.666667H85.333333a42.666667 42.666667 0 0 1-42.666666-42.666667V170.666667z',
134+
fill: '#FFA53D',
135+
}),
136+
h('path', {
137+
d: 'M42.666667 256a42.666667 42.666667 0 0 1 42.666666-42.666667h853.333334a42.666667 42.666667 0 0 1 42.666666 42.666667v597.333333a42.666667 42.666667 0 0 1-42.666666 42.666667H85.333333a42.666667 42.666667 0 0 1-42.666666-42.666667V256z',
138+
fill: '#FFC60A',
139+
}),
140+
],
141+
),
142+
])
143+
},
144+
},
120145
// 动态加载的图标
121146
...dynamicIcons,
122147
}
Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,72 @@
11
<template>
2-
<el-tree
3-
style="max-width: 600px"
4-
:data="data"
5-
:props="defaultProps"
6-
@node-click="handleNodeClick"
7-
/>
2+
<div>
3+
<el-input
4+
v-model="filterText"
5+
:placeholder="$t('common.search')"
6+
prefix-icon="Search"
7+
clearable
8+
class="p-8"
9+
/>
10+
<el-tree
11+
ref="treeRef"
12+
:data="data"
13+
:props="defaultProps"
14+
@node-click="handleNodeClick"
15+
:filter-node-method="filterNode"
16+
:default-expanded-keys="[currentNodeKey]"
17+
:current-node-key="currentNodeKey"
18+
highlight-current
19+
node-key="id"
20+
>
21+
<template #default="{ node, data }">
22+
<div class="custom-tree-node flex align-center">
23+
<AppIcon iconName="app-folder" style="font-size: 16px"></AppIcon>
24+
<span class="ml-8" >{{ node.label }}</span>
25+
</div>
26+
</template>
27+
</el-tree>
28+
</div>
829
</template>
930

1031
<script lang="ts" setup>
32+
import { ref, watch } from 'vue'
33+
import type { TreeInstance } from 'element-plus'
1134
defineOptions({ name: 'FolderTree' })
1235
const props = defineProps({
1336
data: {
1437
type: Array,
1538
default: () => [],
1639
},
40+
currentNodeKey: {
41+
type: String,
42+
default: 'root',
43+
},
1744
})
1845
interface Tree {
1946
name: string
2047
children?: Tree[]
2148
}
2249
23-
const handleNodeClick = (data: Tree) => {
24-
console.log(data)
25-
}
26-
2750
const defaultProps = {
2851
children: 'children',
2952
label: 'name',
3053
}
54+
55+
const emit = defineEmits(['handleNodeClick'])
56+
57+
const treeRef = ref<TreeInstance>()
58+
const filterText = ref('')
59+
60+
watch(filterText, (val) => {
61+
treeRef.value!.filter(val)
62+
})
63+
64+
const filterNode = (value: string, data: Tree) => {
65+
if (!value) return true
66+
return data.name.includes(value)
67+
}
68+
69+
const handleNodeClick = (data: Tree) => {
70+
emit('handleNodeClick', data)
71+
}
3172
</script>

ui/src/components/logo/LogoFull.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<img v-if="user.themeInfo?.loginLogo" :src="fileURL" alt="" height="45px" class="mr-8" />
2+
<img v-if="theme.themeInfo?.loginLogo" :src="fileURL" alt="" height="45px" class="mr-8" />
33
<template v-else>
44
<svg
55
v-if="!isDefaultTheme"
@@ -66,20 +66,20 @@ defineOptions({ name: 'LogoFull' })
6666
defineProps({
6767
height: {
6868
type: String,
69-
default: '36px'
70-
}
69+
default: '36px',
70+
},
7171
})
72-
const { user } = useStore()
72+
const { theme } = useStore()
7373
const isDefaultTheme = computed(() => {
74-
return user.isDefaultTheme()
74+
return theme.isDefaultTheme()
7575
})
7676
7777
const fileURL = computed(() => {
78-
if (user.themeInfo) {
79-
if (typeof user.themeInfo?.loginLogo === 'string') {
80-
return user.themeInfo?.loginLogo
78+
if (theme.themeInfo) {
79+
if (typeof theme.themeInfo?.loginLogo === 'string') {
80+
return theme.themeInfo?.loginLogo
8181
} else {
82-
return URL.createObjectURL(user.themeInfo?.loginLogo)
82+
return URL.createObjectURL(theme.themeInfo?.loginLogo)
8383
}
8484
} else {
8585
return ''

ui/src/components/logo/LogoIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ defineProps({
4545
default: '36px'
4646
}
4747
})
48-
const { user } = useStore()
48+
const { theme } = useStore()
4949
const isDefaultTheme = computed(() => {
50-
return user.isDefaultTheme()
50+
return theme.isDefaultTheme()
5151
})
5252
</script>
5353
<style lang="scss" scoped>

ui/src/components/logo/SendIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ defineProps({
3030
default: '36px'
3131
}
3232
})
33-
const { user } = useStore()
33+
const { theme } = useStore()
3434
const isDefaultTheme = computed(() => {
35-
return user.isDefaultTheme()
35+
return theme.isDefaultTheme()
3636
})
3737
</script>
3838
<style lang="scss" scoped>

ui/src/layout/layout-header/avatar/AboutDialog.vue

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
</template>
1212
<div class="about-ui" v-loading="loading">
1313
<div class="flex">
14-
<span class="label">{{ $t('layout.about.authorize') }}</span><span>{{ licenseInfo?.corporation || '-' }}</span>
14+
<span class="label">{{ $t('layout.about.authorize') }}</span
15+
><span>{{ licenseInfo?.corporation || '-' }}</span>
1516
</div>
1617
<div class="flex">
1718
<span class="label">{{ $t('layout.about.expiredTime') }}</span>
@@ -24,16 +25,23 @@
2425
</div>
2526
<div class="flex">
2627
<span class="label">{{ $t('layout.about.edition.label') }}</span>
27-
<span>{{ user.showXpack() ? $t('layout.about.edition.professional') : $t('layout.about.edition.community') }}</span>
28+
<span>{{
29+
user.showXpack()
30+
? $t('layout.about.edition.professional')
31+
: $t('layout.about.edition.community')
32+
}}</span>
2833
</div>
2934
<div class="flex">
30-
<span class="label">{{ $t('layout.about.version') }}</span><span>{{ user.version }}</span>
35+
<span class="label">{{ $t('layout.about.version') }}</span
36+
><span>{{ user.version }}</span>
3137
</div>
3238
<div class="flex">
33-
<span class="label">{{ $t('layout.about.serialNo') }}</span><span>{{ licenseInfo?.serialNo || '-' }}</span>
39+
<span class="label">{{ $t('layout.about.serialNo') }}</span
40+
><span>{{ licenseInfo?.serialNo || '-' }}</span>
3441
</div>
3542
<div class="flex">
36-
<span class="label">{{ $t('layout.about.remark') }}</span><span>{{ licenseInfo?.remark || '-' }}</span>
43+
<span class="label">{{ $t('layout.about.remark') }}</span
44+
><span>{{ licenseInfo?.remark || '-' }}</span>
3745
</div>
3846
<div class="mt-16 flex align-center" v-if="user.showXpack()">
3947
<el-upload
@@ -44,7 +52,9 @@
4452
:on-change="onChange"
4553
v-hasPermission="new Role('ADMIN')"
4654
>
47-
<el-button class="border-primary mr-16">{{ $t('layout.about.update') }} License</el-button>
55+
<el-button class="border-primary mr-16"
56+
>{{ $t('layout.about.update') }} License</el-button
57+
>
4858
</el-upload>
4959
</div>
5060
</div>
@@ -59,9 +69,9 @@ import licenseApi from '@/api/license'
5969
import { fromNowDate } from '@/utils/time'
6070
import { Role } from '@/utils/permission/type'
6171
import useStore from '@/stores'
62-
const { user } = useStore()
72+
const { user, theme } = useStore()
6373
const isDefaultTheme = computed(() => {
64-
return user.isDefaultTheme()
74+
return theme.isDefaultTheme()
6575
})
6676
6777
const aboutDialogVisible = ref(false)

ui/src/layout/layout-header/avatar/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<el-avatar :size="30">
55
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
66
</el-avatar>
7-
<span class="ml-8">{{ user.userInfo?.username }}</span>
7+
<span class="ml-8 color-text-primary">{{ user.userInfo?.username }}</span>
88
<el-icon class="el-icon--right">
99
<CaretBottom />
1010
</el-icon>

ui/src/layout/layout-header/top-about/index.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,46 @@
44
effect="dark"
55
:content="$t('layout.github')"
66
placement="top"
7-
v-if="user.themeInfo?.showProject"
7+
v-if="theme.themeInfo?.showProject"
88
>
99
<AppIcon
1010
iconName="app-github"
1111
class="cursor color-secondary mr-8 ml-8"
1212
style="font-size: 20px"
13-
@click="toUrl(user.themeInfo?.projectUrl)"
13+
@click="toUrl(theme.themeInfo?.projectUrl)"
1414
></AppIcon>
1515
</el-tooltip>
1616
<el-tooltip
1717
effect="dark"
1818
:content="$t('layout.wiki')"
1919
placement="top"
20-
v-if="user.themeInfo?.showUserManual"
20+
v-if="theme.themeInfo?.showUserManual"
2121
>
2222
<AppIcon
2323
iconName="app-user-manual"
2424
class="cursor color-secondary mr-8 ml-8"
2525
style="font-size: 20px"
26-
@click="toUrl(user.themeInfo?.userManualUrl)"
26+
@click="toUrl(theme.themeInfo?.userManualUrl)"
2727
></AppIcon>
2828
</el-tooltip>
2929
<el-tooltip
3030
effect="dark"
3131
:content="$t('layout.forum')"
3232
placement="top"
33-
v-if="user.themeInfo?.showForum"
33+
v-if="theme.themeInfo?.showForum"
3434
>
3535
<AppIcon
3636
iconName="app-help"
3737
class="cursor color-secondary mr-16 ml-8"
3838
style="font-size: 20px"
39-
@click="toUrl(user.themeInfo?.forumUrl)"
39+
@click="toUrl(theme.themeInfo?.forumUrl)"
4040
></AppIcon>
4141
</el-tooltip>
4242
</div>
4343
</template>
4444
<script setup lang="ts">
4545
import useStore from '@/stores'
46-
const { user } = useStore()
46+
const { theme } = useStore()
4747
function toUrl(url: string) {
4848
window.open(url, '_blank')
4949
}

0 commit comments

Comments
 (0)