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 }[] options?: { label: string, value: string }[]
placeholder?: string placeholder?: string
multiple?: boolean multiple?: boolean
clearableFunction?: (e: any) => boolean
} }
} }

View File

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

View File

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

View File

@ -157,7 +157,7 @@
</div> </div>
</el-sub-menu> </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"> <el-avatar :size="32">
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" /> <img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
</el-avatar> </el-avatar>

View File

@ -5,15 +5,15 @@
<el-form-item v-for="model of props.models" :key="model.path" :prop="`[${index}].${model.path}`" <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"> :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]" <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"> 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" <el-option v-for="opt in model.selectProps?.options" :key="opt.value" :label="opt.label"
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 删除按钮 --> <!-- 删除按钮 -->
<el-button :disabled="props.keepOneLine && form.length === 1" @click="handleDelete(index)" text <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) ? '30px' : '' }"> :style="{ 'margin-top': index === 0 && props.models.some((item) => item.label) ? '32px' : '2px' }">
<el-icon> <el-icon>
<Delete /> <Delete />
</el-icon> </el-icon>
@ -39,6 +39,7 @@ const props = defineProps<{
models: FormItemModel[]; models: FormItemModel[];
addText?: string; addText?: string;
keepOneLine?: boolean; // keepOneLine?: boolean; //
deleteButtonDisabled?: (model: any) => boolean
}>() }>()
const formRef = ref() const formRef = ref()

View File

@ -58,7 +58,8 @@
<MemberFormContent ref="memberFormContentRef" :models="formItemModel" v-model:form="list" <MemberFormContent ref="memberFormContentRef" :models="formItemModel" v-model:form="list"
v-loading="memberFormContentLoading" v-loading="memberFormContentLoading"
keepOneLine 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> <template #footer>
<el-button @click.prevent="visible = false"> {{ $t('common.cancel') }}</el-button> <el-button @click.prevent="visible = false"> {{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="submit(userFormRef)" :loading="loading"> <el-button type="primary" @click="submit(userFormRef)" :loading="loading">
@ -102,6 +103,14 @@ const roleFormItem = ref<FormItemModel[]>([]);
const adminRoleList = ref<any[]>([]) const adminRoleList = ref<any[]>([])
const workspaceFormItem = ref<FormItemModel[]>([]) 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() { async function getRoleFormItem() {
try { try {
const res = await WorkspaceApi.getWorkspaceRoleList(memberFormContentLoading); const res = await WorkspaceApi.getWorkspaceRoleList(memberFormContentLoading);
@ -152,12 +161,16 @@ async function getWorkspaceFormItem() {
}, },
], ],
selectProps: { selectProps: {
// TODO
options: options:
res.data?.map((item) => ({ res.data?.map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,
})) || [], })) || [],
placeholder: `${t('common.selectPlaceholder')}${t('views.role.member.workspace')}`, 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))
}
}, },
}, },
] ]