Skip to content

Commit da10a49

Browse files
committed
feat(user): user manage
1 parent 2966dc5 commit da10a49

File tree

11 files changed

+209
-55
lines changed

11 files changed

+209
-55
lines changed

frontend/src/assets/svg/icon-member-default.svg

Lines changed: 4 additions & 4 deletions
Loading
2.12 KB
Loading

frontend/src/components/layout/LayoutDsl.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,21 @@ import icon_moments_categories_outlined from '@/assets/svg/icon_moments-categori
99
import icon_side_fold_outlined from '@/assets/svg/icon_side-fold_outlined.svg'
1010
import icon_side_expand_outlined from '@/assets/svg/icon_side-expand_outlined.svg'
1111
import { useRouter } from 'vue-router'
12+
import { useEmitt } from '@/utils/useEmitt'
13+
1214
const router = useRouter()
1315
const collapse = ref(false)
14-
16+
const handleCollapseChange = (val: any = true) => {
17+
collapse.value = val
18+
}
19+
useEmitt({
20+
name: 'collapse-change',
21+
callback: handleCollapseChange,
22+
})
1523
const handleFoldExpand = () => {
1624
collapse.value = !collapse.value
1725
}
26+
1827
const toWorkspace = () => {
1928
router.push('/')
2029
}
@@ -32,7 +41,7 @@ const toWorkspace = () => {
3241
<el-icon size="16">
3342
<icon_moments_categories_outlined></icon_moments_categories_outlined>
3443
</el-icon>
35-
{{ collapse ? '' : '返回工作空间' }}
44+
{{ collapse ? '' : $t('workspace.return_to_workspace') }}
3645
</div>
3746
<div class="personal-info">
3847
<Person :collapse="collapse"></Person>
@@ -82,8 +91,6 @@ const toWorkspace = () => {
8291
line-height: 22px;
8392
width: calc(100% - 32px);
8493
.back-to_workspace {
85-
background-color: #1f23290a;
86-
border: 1px solid #d0d3d6;
8794
display: flex;
8895
align-items: center;
8996
justify-content: center;

frontend/src/components/layout/Person.vue

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<script lang="ts" setup>
22
import { ref } from 'vue'
3-
import Default_avatar from '@/assets/svg/icon-member-default.svg'
3+
import Default_avatar from '@/assets/workspace/default_avatar.png'
44
import icon_admin_outlined from '@/assets/svg/icon_admin_outlined.svg'
55
import icon_maybe_outlined from '@/assets/svg/icon-maybe_outlined.svg'
66
import icon_key_outlined from '@/assets/svg/icon-key_outlined.svg'
77
import icon_translate_outlined from '@/assets/svg/icon_translate_outlined.svg'
88
import icon_logout_outlined from '@/assets/svg/icon_logout_outlined.svg'
99
import icon_right_outlined from '@/assets/svg/icon_right_outlined.svg'
1010
import icon_done_outlined from '@/assets/svg/icon_done_outlined.svg'
11+
import { useI18n } from 'vue-i18n'
1112
1213
defineProps({
1314
collapse: { type: [Boolean], required: true },
1415
})
1516
17+
const { t } = useI18n()
1618
const name = ref('飞小致')
1719
const currentLanguage = ref('zh-CN')
1820
const emit = defineEmits(['selectPerson'])
@@ -22,11 +24,11 @@ const languageList = [
2224
value: 'en',
2325
},
2426
{
25-
name: '简体中文',
27+
name: t('common.simplified_chinese'),
2628
value: 'zh-CN',
2729
},
2830
{
29-
name: '繁體中文',
31+
name: t('common.traditional_chinese'),
3032
value: 'zh-CN',
3133
},
3234
]
@@ -43,40 +45,36 @@ const handleDefaultLanguageChange = (item: any) => {
4345
<el-popover popper-class="system-person" :placement="collapse ? 'right' : 'top'">
4446
<template #reference>
4547
<button class="person" :class="collapse && 'collapse'">
46-
<el-icon size="32" class="default-avatar">
47-
<Default_avatar></Default_avatar>
48-
</el-icon>
48+
<img class="default-avatar" :src="Default_avatar" width="32px" height="32px" />
4949
<span v-if="!collapse" class="name">{{ name }}</span>
5050
</button></template
5151
>
5252
<div class="popover">
5353
<div class="popover-content">
5454
<div class="info">
55-
<el-icon style="transform: scale(1.25)" size="32">
56-
<Default_avatar></Default_avatar>
57-
</el-icon>
55+
<img :src="Default_avatar" width="40px" height="40px" />
5856
<div class="top">{{ name }}</div>
5957
<div class="bottom">feixaozhi</div>
6058
</div>
6159
<div class="popover-item" @click="handlePersonChange">
6260
<el-icon size="16">
6361
<icon_admin_outlined></icon_admin_outlined>
6462
</el-icon>
65-
<div class="datasource-name">系统管理</div>
63+
<div class="datasource-name">{{ $t('common.system_manage') }}</div>
6664
</div>
6765
<div class="popover-item">
6866
<el-icon size="16">
6967
<icon_key_outlined></icon_key_outlined>
7068
</el-icon>
71-
<div class="datasource-name">修改密码</div>
69+
<div class="datasource-name">{{ $t('user.change_password') }}</div>
7270
</div>
7371
<el-popover :teleported="false" popper-class="system-language" placement="right">
7472
<template #reference>
7573
<div class="popover-item">
7674
<el-icon size="16">
7775
<icon_translate_outlined></icon_translate_outlined>
7876
</el-icon>
79-
<div class="datasource-name">语言</div>
77+
<div class="datasource-name">{{ $t('common.language') }}</div>
8078
<el-icon style="transform: scale(1.33)" class="right" size="16">
8179
<icon_right_outlined></icon_right_outlined>
8280
</el-icon>
@@ -102,13 +100,13 @@ const handleDefaultLanguageChange = (item: any) => {
102100
<el-icon size="16">
103101
<icon_maybe_outlined></icon_maybe_outlined>
104102
</el-icon>
105-
<div class="datasource-name">帮助</div>
103+
<div class="datasource-name">{{ $t('common.help') }}</div>
106104
</div>
107105
<div class="popover-item mr4">
108106
<el-icon size="16">
109107
<icon_logout_outlined></icon_logout_outlined>
110108
</el-icon>
111-
<div class="datasource-name">退出登录</div>
109+
<div class="datasource-name">{{ $t('common.logout') }}</div>
112110
</div>
113111
</div>
114112
</div>
@@ -117,7 +115,6 @@ const handleDefaultLanguageChange = (item: any) => {
117115

118116
<style lang="less" scoped>
119117
.person {
120-
border-radius: 6px;
121118
padding: 0 8px;
122119
display: flex;
123120
align-items: center;
@@ -126,6 +123,7 @@ const handleDefaultLanguageChange = (item: any) => {
126123
height: 40px;
127124
border: none;
128125
background-color: transparent;
126+
position: relative;
129127
130128
&.collapse {
131129
min-width: 48px;
@@ -149,15 +147,28 @@ const handleDefaultLanguageChange = (item: any) => {
149147
margin-left: 8px;
150148
}
151149
150+
&::after {
151+
content: '';
152+
position: absolute;
153+
top: 50%;
154+
left: 50%;
155+
transform: translate(-50%, -50%);
156+
width: 100%;
157+
height: 100%;
158+
border-radius: 6px;
159+
}
160+
152161
&:hover,
153-
&:active {
154-
background: #1f23291a;
155-
border: 1px solid #1f23291a;
162+
&:focus {
163+
&::after {
164+
background: #1f23291a;
165+
}
156166
}
157167
158168
&:active {
159-
background: #1f232926;
160-
border: 1px solid #1f23291a;
169+
&::after {
170+
background: #1f232926;
171+
}
161172
}
162173
}
163174
</style>
@@ -195,9 +206,9 @@ const handleDefaultLanguageChange = (item: any) => {
195206
height: 62px;
196207
padding: 8px;
197208
198-
.ed-icon {
199-
margin: 6px 8px 0 7px;
209+
img {
200210
float: left;
211+
margin: 3px 8px 0 7px;
201212
}
202213
203214
.top {

frontend/src/components/layout/Workspace.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ const handleDefaultWorkspaceChange = (item: any) => {
103103
104104
&.collapse {
105105
width: 40px;
106+
background: none;
107+
border: none;
106108
}
107109
108110
.name {

frontend/src/i18n/en.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
"logout": "Logout",
2020
"result_count": "result",
2121
"clear_filter": "Clear conditions",
22-
"reset": "Reset"
22+
"reset": "Reset",
23+
"simplified_chinese": "Simplified Chinese",
24+
"traditional_chinese": "Traditional Chinese",
25+
"help": "Help",
26+
"language": "Language"
2327
},
2428
"dashboard": {
2529
"length_1_64_characters": "Name field length must be 1-64 characters",
@@ -270,7 +274,12 @@
270274
"selected_2_people": "Selected: {msg} people",
271275
"clear": "Clear",
272276
"historical_dialogue": "No historical dialogue",
273-
"rename_a_workspace" : "Rename a workspace"
277+
"rename_a_workspace": "Rename a workspace",
278+
"return_to_workspace": "Return to workspace",
279+
"there_are": "There are",
280+
"2_dashboards": "{msg} dashboards",
281+
"smart_data_centers": "{msg} smart data centers",
282+
"confirm_to_delete": "This data source is in use. Deleting it will cause these resources to not work properly. Confirm to delete?"
274283
},
275284
"chat": {
276285
"chart_type": {

frontend/src/i18n/zh-CN.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
"logout": "退出登录",
2020
"result_count": "个结果",
2121
"clear_filter": "清空条件",
22-
"reset": "重置"
22+
"reset": "重置",
23+
"simplified_chinese": "简体中文",
24+
"traditional_chinese": "繁體中文",
25+
"help": "帮助",
26+
"language": "语言"
2327
},
2428
"dashboard": {
2529
"length_1_64_characters": "名称字段长度1-64个字符",
@@ -273,7 +277,12 @@
273277
"selected_2_people": "已选:{msg} 人",
274278
"clear": "清空",
275279
"historical_dialogue": "暂无历史对话",
276-
"rename_a_workspace" : "重命名工作空间"
280+
"rename_a_workspace": "重命名工作空间",
281+
"return_to_workspace": "返回工作空间",
282+
"there_are": "",
283+
"2_dashboards": "{msg} 个仪表板",
284+
"smart_data_centers": "{msg} 个智能问数",
285+
"confirm_to_delete": "正在使用此数据源,删除后会导致这些资源无法正常使用,确认删除?"
277286
},
278287
"chat": {
279288
"chart_type": {

frontend/src/views/ds/DataTable.vue

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,17 @@ const changeStatus = (row: any) => {
165165
})
166166
})
167167
}
168+
169+
const emits = defineEmits(['back'])
170+
const back = () => {
171+
emits('back')
172+
}
168173
</script>
169174

170175
<template>
171176
<div class="data-table no-padding">
172177
<div class="info">
173-
{{ $t('ds.title') }}
178+
<el-button text @click="back">{{ $t('ds.title') }}</el-button>
174179
<el-icon size="12">
175180
<icon_right_outlined></icon_right_outlined>
176181
</el-icon>
@@ -354,8 +359,24 @@ const changeStatus = (row: any) => {
354359
color: #646a73;
355360
border-bottom: 1px solid #1f232926;
356361
362+
.ed-button {
363+
height: 22px;
364+
line-height: 22px;
365+
color: #646a73;
366+
367+
&:hover {
368+
background: #1cba901a;
369+
color: #1cba90;
370+
}
371+
&:active {
372+
color: #189e7a;
373+
background: #1cba9033;
374+
}
375+
}
376+
357377
.name {
358378
color: #1f2329;
379+
margin-left: 4px;
359380
}
360381
}
361382
.content {

0 commit comments

Comments
 (0)