Skip to content

Commit d36543d

Browse files
fix: layout
1 parent 5bb8384 commit d36543d

27 files changed

Lines changed: 846 additions & 1252 deletions

File tree

‎ui/src/api/API_README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ src/api/
6969
`import WorkspaceApi from '@/api/admin/system/workspace'`;System 登录设置使用
7070
`import AuthSettingApi from '@/api/admin/system/settings/auth-setting'`。
7171

72+
### 当前账号密码
73+
74+
`admin/auth/current-user.ts` 的 `postCurrentUserPassword` 向 `/user/current/reset_password`
75+
提交 RSA 加密的 `{ encryptedData }`。头像菜单的 `layout/avatar-dropdown/ChangePasswordDialog.vue`
76+
负责新密码与确认密码校验、加密和提交,成功后清除本地登录凭据并跳转登录页。
77+
7278
### 四类特殊资源 API
7379

7480
`application`、`knowledge`、`model`、`tool` 是需要同时考虑 Workspace、System 资源管理和

‎ui/src/api/admin/auth/current-user.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/** 提供 Admin 登录后的当前用户接口。 */
22

3-
import { get } from '../core/request'
3+
import { get, post } from '../core/request'
44
import type { ListItem } from '@/api/types'
5+
import type { PasswordRequest } from '../core/types'
56
import type { CurrentUserInfo } from './types'
67

78
/** 获取当前登录用户、权限、语言及可用工作空间。 */
@@ -19,4 +20,9 @@ const getCurrentUserRoleList = () => {
1920
return get<ListItem[]>('/role_list/current_user')
2021
}
2122

22-
export default { getCurrentUserInfo, getCurrentUserRoleList, getCurrentUserWorkspaceList }
23+
/** 修改当前登录用户的密码,成功后当前登录凭据失效。 */
24+
const postCurrentUserPassword = (password: PasswordRequest) => {
25+
return post<PasswordRequest, boolean>('/user/current/reset_password', password)
26+
}
27+
28+
export default { postCurrentUserPassword, getCurrentUserInfo, getCurrentUserRoleList, getCurrentUserWorkspaceList }

‎ui/src/api/admin/auth/login.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ const getCaptcha = (username?: string) => {
2323
return get<CaptchaResponse>('/user/captcha', { username })
2424
}
2525

26+
27+
2628
export default { getCaptcha, postLdapLogin, postLogin, postLogout }

‎ui/src/api/admin/auth/types.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** Admin 认证 API 及其 Store 消费方共同使用的类型。 */
22

3-
import type { LoginMethod, QrCodeConfig, ListItem } from '@/api/types'
3+
import type { LoginMethod, QrCodeConfig, WorkspaceItem } from '@/api/types'
44

55
export interface CurrentUserInfo {
66
email: string
@@ -14,7 +14,7 @@ export interface CurrentUserInfo {
1414
role_name?: string[]
1515
source?: string
1616
username: string
17-
workspace_list?: ListItem[]
17+
workspace_list?: WorkspaceItem[]
1818
}
1919

2020
export interface LoginRequest {

‎ui/src/api/types/system-workspace.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ export interface WorkspaceItem {
33
name: string
44
id?: string
55
user_count?: number
6+
/** 当前用户在工作空间中的角色名称;普通工作空间列表可能不返回。 */
7+
role_name?: string[]
68
}
79

810
export interface CreateWorkspaceMemberPayload {

‎ui/src/assets/iconfont.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ui/src/components/COMPONENT_README.md‎

Lines changed: 200 additions & 1013 deletions
Large diffs are not rendered by default.

‎ui/src/components/business/workspace-dropdown/index.vue‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import MkFilterableDropdown from '@/components/mk-filterable-dropdown/index.vue'
55
66
defineOptions({ name: 'WorkspaceDropdown' })
77
8-
const props = defineProps<{ options: WorkspaceItem[] }>()
8+
const props = withDefaults(
9+
defineProps<{
10+
options: WorkspaceItem[]
11+
/** 是否显示工作空间角色标签 */
12+
showRoleTags?: boolean
13+
}>(),
14+
{ showRoleTags: false },
15+
)
916
const selectedWorkspaceId = defineModel<string>({ required: true })
1017
const emit = defineEmits<{ select: [option: WorkspaceItem] }>()
1118
</script>
@@ -18,6 +25,7 @@ const emit = defineEmits<{ select: [option: WorkspaceItem] }>()
1825
@select="emit('select', $event)"
1926
>
2027
<template #default="{ text }">
28+
<!-- 切换工作空间 -->
2129
<el-button text class="flex max-w-50 items-center gap-1 rounded-md px-2! py-[7px]! text-N900!">
2230
<MkIcon name="icon_moments-categories_outlined" class="mr-1" />
2331
<span class="min-w-0 flex-1 truncate" :title="text">{{ text }}</span>
@@ -26,10 +34,13 @@ const emit = defineEmits<{ select: [option: WorkspaceItem] }>()
2634
</template>
2735

2836
<template #option="{ option }">
29-
<div class="flex items-center gap-2">
30-
<MkIcon name="icon_moments-categories_outlined" />
31-
<span class="min-w-0 flex-1 truncate" :title="option.name">{{ option.name }}</span>
37+
<div class="flex min-w-0 flex-1 items-center gap-2">
38+
<MkIcon name="icon_moments-categories_outlined" class="shrink-0" />
39+
<span class="min-w-0 truncate" :title="option.name">{{ option.name }}</span>
40+
<MkTagGroup v-if="props.showRoleTags && option.role_name?.length" :tags="option.role_name" size="small" class="min-w-0 shrink-0" />
3241
</div>
3342
</template>
3443
</MkFilterableDropdown>
3544
</template>
45+
46+
<style scoped lang="scss"></style>

‎ui/src/components/global/mk-tag-group/index.vue‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script setup lang="ts">
2+
import type { TagProps } from 'element-plus'
3+
24
defineOptions({ name: 'MkTagGroup' })
35
46
withDefaults(
@@ -7,14 +9,18 @@ withDefaults(
79
popoverDisabled?: boolean
810
/** 标签文字 */
911
tags?: string[]
12+
/** 标签尺寸 */
13+
size?: TagProps['size']
14+
/** 首个标签的类型 */
15+
type?: TagProps['type']
1016
}>(),
11-
{ popoverDisabled: false, tags: () => [] },
17+
{ popoverDisabled: false, tags: () => [], type: 'info' },
1218
)
1319
</script>
1420

1521
<template>
1622
<span class="inline-flex items-center gap-1">
17-
<el-tag type="info" :title="tags?.[0]">
23+
<el-tag :type="type" :size="size" :title="tags?.[0]" :disable-transitions="true">
1824
{{ tags?.[0] }}
1925
</el-tag>
2026

@@ -24,13 +30,14 @@ withDefaults(
2430
popper-class="mk-tag-group__popper"
2531
trigger="hover"
2632
:popper-style="{ maxWidth: '250px', width: 'auto' }"
33+
:show-after="200"
2734
v-if="tags?.length > 1"
2835
>
2936
<template #reference>
30-
<el-tag type="info" class="cursor-pointer">+{{ tags.length - 1 }}</el-tag>
37+
<el-tag type="info" :size="size" class="cursor-pointer" :disable-transitions="true">+{{ tags.length - 1 }}</el-tag>
3138
</template>
3239
<div class="flex-wrap gap-2 px-4 py-3">
33-
<el-tag v-for="tag in tags.slice(1)" :key="tag" type="info" :title="tag">
40+
<el-tag v-for="tag in tags.slice(1)" :key="tag" type="info" :size="size" :title="tag" :disable-transitions="true">
3441
{{ tag }}
3542
</el-tag>
3643
</div>

‎ui/src/components/mk-filterable-dropdown/index.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ function handleItemClick(option: TOption) {
6868
<slot :selected-option="selectedOption" :text="selectedText" />
6969

7070
<template #dropdown>
71-
<div class="w-70 overflow-hidden rounded-md">
71+
<div class="min-w-70 max-w-80 overflow-hidden rounded-md">
7272
<div class="p-2 pb-1" @click.stop @keydown.stop>
7373
<MkSearchInput v-model="searchKeyword" />
7474
</div>
7575

76-
<el-scrollbar max-height="200px">
76+
<el-scrollbar max-height="220px">
7777
<div class="px-1">
7878
<MkDropdownMenu>
7979
<MkDropdownItem

0 commit comments

Comments
 (0)