Skip to content

Commit 81d9cc3

Browse files
committed
fix: style during password verification
1 parent 57b12a2 commit 81d9cc3

File tree

6 files changed

+45
-21
lines changed

6 files changed

+45
-21
lines changed

ui/src/api/type/role.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ interface FormItemModel {
6565
options?: { label: string, value: string }[]
6666
placeholder?: string
6767
multiple?: boolean
68+
clearableFunction?: (e: any) => boolean
6869
}
6970
}
7071

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

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,23 @@
1313
<div class="w-full p-8" style="box-sizing: border-box">
1414
<el-input v-model="filterText" :placeholder="$t('common.search')" prefix-icon="Search" clearable />
1515
</div>
16-
<el-dropdown-menu v-loading="loading">
17-
<el-dropdown-item v-for="item in filterData" :key="item.id"
18-
:class="`${item.id === currentWorkspace?.id ? 'active' : ''} flex-between`" @click="changeWorkspace(item)">
19-
<div class="flex align-center">
20-
<AppIcon class="mr-8" iconName="app-workspace" style="font-size: 16px"></AppIcon>
21-
<span class="ellipsis">
22-
{{ item.name }}
23-
</span>
24-
</div>
25-
<el-icon v-show="item.id === currentWorkspace?.id" class="ml-8" style="font-size: 16px; margin-right: 0">
26-
<Check />
27-
</el-icon>
28-
</el-dropdown-item>
29-
</el-dropdown-menu>
16+
<el-scrollbar max-height="300">
17+
<el-dropdown-menu v-loading="loading">
18+
<el-dropdown-item v-for="item in filterData" :key="item.id"
19+
:class="`${item.id === currentWorkspace?.id ? 'active' : ''} flex-between`" @click="changeWorkspace(item)">
20+
<div class="flex align-center">
21+
<AppIcon class="mr-8" iconName="app-workspace" style="font-size: 16px"></AppIcon>
22+
<span class="ellipsis">
23+
{{ item.name }}
24+
</span>
25+
</div>
26+
<el-icon v-show="item.id === currentWorkspace?.id" class="ml-8" style="font-size: 16px; margin-right: 0">
27+
<Check />
28+
</el-icon>
29+
</el-dropdown-item>
30+
</el-dropdown-menu>
31+
</el-scrollbar>
32+
<div class="no-data color-info" v-if="!filterData.length"> {{ $t('common.noData') }} </div>
3033
</template>
3134
</el-dropdown>
3235
</template>
@@ -74,6 +77,12 @@ watch([() => props.data, () => filterText.value], () => {
7477
max-height: 32px;
7578
}
7679
}
80+
81+
.no-data {
82+
text-align: center;
83+
padding-bottom: 16px;
84+
font-size: 14px;
85+
}
7786
</style>
7887
<style lang="scss">
7988
.workspace-dropdown-popper {

ui/src/views/chat/mobile/component/ChatHistoryDrawer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</el-scrollbar>
5656
</div>
5757
<div class="flex align-center user-info" @click="toUserCenter">
58-
<el-avatar :size="32" :class="`${!chatUser.chat_profile?.authentication ? 'cursor-default' : ''}`">
58+
<el-avatar :size="32" :class="`${!chatUser.chat_profile?.authentication || chatUser.chat_profile.authentication_type === 'password' ? 'cursor-default' : ''}`">
5959
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
6060
</el-avatar>
6161
<span v-if="chatUser.chat_profile?.authentication" class="ml-8 color-text-primary">
@@ -118,7 +118,7 @@ const mouseenter = (row: any) => {
118118
119119
const userCenterDrawerShow = ref(false)
120120
function toUserCenter() {
121-
if (!chatUser.chat_profile?.authentication) return
121+
if (!chatUser.chat_profile?.authentication || chatUser.chat_profile.authentication_type === 'password') return
122122
userCenterDrawerShow.value = true
123123
}
124124
</script>

ui/src/views/chat/pc/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
</div>
158158
</el-sub-menu>
159159

160-
<div v-if="!chatUser.chat_profile?.authentication" class="no-auth-avatar">
160+
<div v-if="!chatUser.chat_profile?.authentication || chatUser.chat_profile.authentication_type === 'password'" class="no-auth-avatar">
161161
<el-avatar :size="32">
162162
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
163163
</el-avatar>

ui/src/views/system/role/component/MemberFormContent.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<el-form-item v-for="model of props.models" :key="model.path" :prop="`[${index}].${model.path}`"
66
:rules="model.rules" :label="index === 0 && model.label ? model.label : ''" class="mr-8" style="flex: 1">
77
<el-select v-if="!model?.hidden?.(element)" v-model="element[model.path]"
8-
:placeholder="model.selectProps?.placeholder ?? $t('common.selectPlaceholder')" clearable filterable
8+
:placeholder="model.selectProps?.placeholder ?? $t('common.selectPlaceholder')" :clearable="model.selectProps?.clearableFunction?model.selectProps?.clearableFunction?.(element): true" filterable
99
multiple style="width: 100%" collapse-tags collapse-tags-tooltip v-bind="model.selectProps">
1010
<el-option v-for="opt in model.selectProps?.options" :key="opt.value" :label="opt.label"
1111
:value="opt.value" />
1212
</el-select>
1313
</el-form-item>
1414
<!-- 删除按钮 -->
15-
<el-button :disabled="props.keepOneLine && form.length === 1" @click="handleDelete(index)" text
16-
:style="{ 'margin-top': index === 0 && props.models.some((item) => item.label) ? '30px' : '' }">
15+
<el-button :disabled="props.keepOneLine && form.length === 1 || props.deleteButtonDisabled?.(element)" @click="handleDelete(index)" text
16+
:style="{ 'margin-top': index === 0 && props.models.some((item) => item.label) ? '32px' : '2px' }">
1717
<el-icon>
1818
<Delete />
1919
</el-icon>
@@ -39,6 +39,7 @@ const props = defineProps<{
3939
models: FormItemModel[];
4040
addText?: string;
4141
keepOneLine?: boolean; // 至少保留一行
42+
deleteButtonDisabled?: (model: any) => boolean
4243
}>()
4344
4445
const formRef = ref()

ui/src/views/system/user-manage/component/UserDrawer.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
<MemberFormContent ref="memberFormContentRef" :models="formItemModel" v-model:form="list"
5959
v-loading="memberFormContentLoading"
6060
keepOneLine
61-
:addText="$t('views.userManage.addRole')" v-if="user.isEE() || user.isPE()"/>
61+
:addText="$t('views.userManage.addRole')" v-if="user.isEE() || user.isPE()"
62+
:deleteButtonDisabled="deleteButtonDisabled"/>
6263
<template #footer>
6364
<el-button @click.prevent="visible = false"> {{ $t('common.cancel') }}</el-button>
6465
<el-button type="primary" @click="submit(userFormRef)" :loading="loading">
@@ -102,6 +103,14 @@ const roleFormItem = ref<FormItemModel[]>([]);
102103
const adminRoleList = ref<any[]>([])
103104
const workspaceFormItem = ref<FormItemModel[]>([])
104105
106+
function deleteButtonDisabled(element: any) {
107+
// 内置的admin
108+
if (userForm.value['id'] === 'f0dd8f71-e4ee-11ee-8c84-a8a1595801ab' && element.role_id === 'ADMIN') {
109+
return true
110+
}
111+
return false
112+
}
113+
105114
async function getRoleFormItem() {
106115
try {
107116
const res = await WorkspaceApi.getWorkspaceRoleList(memberFormContentLoading);
@@ -152,12 +161,16 @@ async function getWorkspaceFormItem() {
152161
},
153162
],
154163
selectProps: {
164+
// TODO
155165
options:
156166
res.data?.map((item) => ({
157167
label: item.name,
158168
value: item.id,
159169
})) || [],
160170
placeholder: `${t('common.selectPlaceholder')}${t('views.role.member.workspace')}`,
171+
clearableFunction: (e)=>{
172+
return !(userForm.value['id'] === 'f0dd8f71-e4ee-11ee-8c84-a8a1595801ab' && ['WORKSPACE_MANAGE', 'USER'].includes(e.role_id))
173+
}
161174
},
162175
},
163176
]

0 commit comments

Comments
 (0)