fix: style during password verification

This commit is contained in:
teukkk 2025-07-08 16:39:31 +08:00
parent 57b12a20bc
commit 81d9cc3e3b
6 changed files with 45 additions and 21 deletions

View File

@ -65,6 +65,7 @@ interface FormItemModel {
options?: { label: string, value: string }[]
placeholder?: string
multiple?: boolean
clearableFunction?: (e: any) => boolean
}
}

View File

@ -13,20 +13,23 @@
<div class="w-full p-8" style="box-sizing: border-box">
<el-input v-model="filterText" :placeholder="$t('common.search')" prefix-icon="Search" clearable />
</div>
<el-dropdown-menu v-loading="loading">
<el-dropdown-item v-for="item in filterData" :key="item.id"
:class="`${item.id === currentWorkspace?.id ? 'active' : ''} flex-between`" @click="changeWorkspace(item)">
<div class="flex align-center">
<AppIcon class="mr-8" iconName="app-workspace" style="font-size: 16px"></AppIcon>
<span class="ellipsis">
{{ item.name }}
</span>
</div>
<el-icon v-show="item.id === currentWorkspace?.id" class="ml-8" style="font-size: 16px; margin-right: 0">
<Check />
</el-icon>
</el-dropdown-item>
</el-dropdown-menu>
<el-scrollbar max-height="300">
<el-dropdown-menu v-loading="loading">
<el-dropdown-item v-for="item in filterData" :key="item.id"
:class="`${item.id === currentWorkspace?.id ? 'active' : ''} flex-between`" @click="changeWorkspace(item)">
<div class="flex align-center">
<AppIcon class="mr-8" iconName="app-workspace" style="font-size: 16px"></AppIcon>
<span class="ellipsis">
{{ item.name }}
</span>
</div>
<el-icon v-show="item.id === currentWorkspace?.id" class="ml-8" style="font-size: 16px; margin-right: 0">
<Check />
</el-icon>
</el-dropdown-item>
</el-dropdown-menu>
</el-scrollbar>
<div class="no-data color-info" v-if="!filterData.length"> {{ $t('common.noData') }} </div>
</template>
</el-dropdown>
</template>
@ -74,6 +77,12 @@ watch([() => props.data, () => filterText.value], () => {
max-height: 32px;
}
}
.no-data {
text-align: center;
padding-bottom: 16px;
font-size: 14px;
}
</style>
<style lang="scss">
.workspace-dropdown-popper {

View File

@ -55,7 +55,7 @@
</el-scrollbar>
</div>
<div class="flex align-center user-info" @click="toUserCenter">
<el-avatar :size="32" :class="`${!chatUser.chat_profile?.authentication ? 'cursor-default' : ''}`">
<el-avatar :size="32" :class="`${!chatUser.chat_profile?.authentication || chatUser.chat_profile.authentication_type === 'password' ? 'cursor-default' : ''}`">
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
</el-avatar>
<span v-if="chatUser.chat_profile?.authentication" class="ml-8 color-text-primary">
@ -118,7 +118,7 @@ const mouseenter = (row: any) => {
const userCenterDrawerShow = ref(false)
function toUserCenter() {
if (!chatUser.chat_profile?.authentication) return
if (!chatUser.chat_profile?.authentication || chatUser.chat_profile.authentication_type === 'password') return
userCenterDrawerShow.value = true
}
</script>

View File

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

View File

@ -5,15 +5,15 @@
<el-form-item v-for="model of props.models" :key="model.path" :prop="`[${index}].${model.path}`"
:rules="model.rules" :label="index === 0 && model.label ? model.label : ''" class="mr-8" style="flex: 1">
<el-select v-if="!model?.hidden?.(element)" v-model="element[model.path]"
:placeholder="model.selectProps?.placeholder ?? $t('common.selectPlaceholder')" clearable filterable
:placeholder="model.selectProps?.placeholder ?? $t('common.selectPlaceholder')" :clearable="model.selectProps?.clearableFunction?model.selectProps?.clearableFunction?.(element): true" filterable
multiple style="width: 100%" collapse-tags collapse-tags-tooltip v-bind="model.selectProps">
<el-option v-for="opt in model.selectProps?.options" :key="opt.value" :label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
<!-- 删除按钮 -->
<el-button :disabled="props.keepOneLine && form.length === 1" @click="handleDelete(index)" text
:style="{ 'margin-top': index === 0 && props.models.some((item) => item.label) ? '30px' : '' }">
<el-button :disabled="props.keepOneLine && form.length === 1 || props.deleteButtonDisabled?.(element)" @click="handleDelete(index)" text
:style="{ 'margin-top': index === 0 && props.models.some((item) => item.label) ? '32px' : '2px' }">
<el-icon>
<Delete />
</el-icon>
@ -39,6 +39,7 @@ const props = defineProps<{
models: FormItemModel[];
addText?: string;
keepOneLine?: boolean; //
deleteButtonDisabled?: (model: any) => boolean
}>()
const formRef = ref()

View File

@ -58,7 +58,8 @@
<MemberFormContent ref="memberFormContentRef" :models="formItemModel" v-model:form="list"
v-loading="memberFormContentLoading"
keepOneLine
:addText="$t('views.userManage.addRole')" v-if="user.isEE() || user.isPE()"/>
:addText="$t('views.userManage.addRole')" v-if="user.isEE() || user.isPE()"
:deleteButtonDisabled="deleteButtonDisabled"/>
<template #footer>
<el-button @click.prevent="visible = false"> {{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="submit(userFormRef)" :loading="loading">
@ -102,6 +103,14 @@ const roleFormItem = ref<FormItemModel[]>([]);
const adminRoleList = ref<any[]>([])
const workspaceFormItem = ref<FormItemModel[]>([])
function deleteButtonDisabled(element: any) {
// admin
if (userForm.value['id'] === 'f0dd8f71-e4ee-11ee-8c84-a8a1595801ab' && element.role_id === 'ADMIN') {
return true
}
return false
}
async function getRoleFormItem() {
try {
const res = await WorkspaceApi.getWorkspaceRoleList(memberFormContentLoading);
@ -152,12 +161,16 @@ async function getWorkspaceFormItem() {
},
],
selectProps: {
// TODO
options:
res.data?.map((item) => ({
label: item.name,
value: item.id,
})) || [],
placeholder: `${t('common.selectPlaceholder')}${t('views.role.member.workspace')}`,
clearableFunction: (e)=>{
return !(userForm.value['id'] === 'f0dd8f71-e4ee-11ee-8c84-a8a1595801ab' && ['WORKSPACE_MANAGE', 'USER'].includes(e.role_id))
}
},
},
]