fixed: 新密码不如入不提示的问题.
This commit is contained in:
@@ -110,6 +110,10 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
.arco-dropdown-option-content {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.arco-drawer-container.drawer-body-padding-0 {
|
||||
.arco-drawer-body {
|
||||
padding: 0 !important;
|
||||
|
||||
@@ -152,18 +152,18 @@
|
||||
{{ nickname }}
|
||||
</a-avatar>
|
||||
<template #content>
|
||||
<!-- 用户信息 -->
|
||||
<!-- 个人中心 -->
|
||||
<a-doption>
|
||||
<a-space @click="$router.push({ name: 'Info' })">
|
||||
<a-space @click="$router.push({ name: 'userMine' })">
|
||||
<icon-user />
|
||||
<span>用户中心</span>
|
||||
<span>个人中心</span>
|
||||
</a-space>
|
||||
</a-doption>
|
||||
<!-- 用户设置 -->
|
||||
<!-- 修改密码 -->
|
||||
<a-doption>
|
||||
<a-space @click="$router.push({ name: 'Setting' })">
|
||||
<icon-settings />
|
||||
<span>用户设置</span>
|
||||
<a-space @click="$router.push({ name: 'userMine' })">
|
||||
<icon-lock />
|
||||
<span>修改密码</span>
|
||||
</a-space>
|
||||
</a-doption>
|
||||
<!-- 退出登录 -->
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
<!-- 用户密码 -->
|
||||
<a-form-item field="password"
|
||||
label="用户密码"
|
||||
style="justify-content: space-between;">
|
||||
style="justify-content: space-between;"
|
||||
:rules="passwordRules">
|
||||
<a-input-password v-model="formModel.password"
|
||||
:disabled="!isAddHandle && !formModel.useNewPassword"
|
||||
:class="[isAddHandle ? 'password-input-full' : 'password-input']"
|
||||
@@ -65,7 +66,7 @@
|
||||
import useVisible from '@/hooks/visible';
|
||||
import formRules from '../types/form.rules';
|
||||
import { createHostIdentity, updateHostIdentity, HostIdentityUpdateRequest } from '@/api/asset/host-identity';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { FieldRule, Message } from '@arco-design/web-vue';
|
||||
import HostKeySelector from '@/components/asset/host-key/host-key-selector.vue';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
@@ -113,6 +114,20 @@
|
||||
|
||||
defineExpose({ openAdd, openUpdate });
|
||||
|
||||
// 密码验证
|
||||
const passwordRules = [{
|
||||
validator: (value, cb) => {
|
||||
if (value && value.length > 512) {
|
||||
cb('密码长度不能大于512位');
|
||||
return;
|
||||
}
|
||||
if (formModel.value.useNewPassword && !value) {
|
||||
cb('请输入密码');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}] as FieldRule[];
|
||||
|
||||
// 确定
|
||||
const handlerOk = async () => {
|
||||
setLoading(true);
|
||||
|
||||
@@ -16,13 +16,7 @@ export const username = [{
|
||||
message: '用户名长度不能大于128位'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const password = [{
|
||||
maxLength: 512,
|
||||
message: '用户密码长度不能大于512位'
|
||||
}] as FieldRule[];
|
||||
|
||||
export default {
|
||||
name,
|
||||
username,
|
||||
password,
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
<a-form-item v-if="!isViewHandler"
|
||||
field="password"
|
||||
label="密码"
|
||||
style="justify-content: space-between;">
|
||||
style="justify-content: space-between;"
|
||||
:rules="passwordRules">
|
||||
<a-input-password v-model="formModel.password"
|
||||
:disabled="!isAddHandle && !formModel.useNewPassword"
|
||||
:class="[isAddHandle ? 'password-input-full' : 'password-input']"
|
||||
@@ -93,7 +94,7 @@
|
||||
import useVisible from '@/hooks/visible';
|
||||
import formRules from '../types/form.rules';
|
||||
import { createHostKey, updateHostKey, getHostKey, HostKeyUpdateRequest } from '@/api/asset/host-key';
|
||||
import { FileItem, Message } from '@arco-design/web-vue';
|
||||
import { FieldRule, FileItem, Message } from '@arco-design/web-vue';
|
||||
import { readFileText } from '@/utils/file';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
@@ -165,6 +166,20 @@
|
||||
|
||||
defineExpose({ openAdd, openUpdate, openView });
|
||||
|
||||
// 密码验证
|
||||
const passwordRules = [{
|
||||
validator: (value, cb) => {
|
||||
if (value && value.length > 512) {
|
||||
cb('密码长度不能大于512位');
|
||||
return;
|
||||
}
|
||||
if (formModel.value.useNewPassword && !value) {
|
||||
cb('请输入密码');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}] as FieldRule[];
|
||||
|
||||
// 选择公钥文件
|
||||
const selectPublicFile = async (fileList: FileItem[]) => {
|
||||
formModel.value.publicKey = await readFileText(fileList[0].file as File);
|
||||
|
||||
@@ -13,13 +13,7 @@ export const privateKey = [{
|
||||
message: '请输入私钥文本'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const password = [{
|
||||
maxLength: 512,
|
||||
message: '密码长度不能大于512位'
|
||||
}] as FieldRule[];
|
||||
|
||||
export default {
|
||||
name,
|
||||
privateKey,
|
||||
password,
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
const { data } = await updateHostConfig({
|
||||
id: props?.content?.id,
|
||||
version: config.value.version,
|
||||
config: JSON.stringify(formModel)
|
||||
config: JSON.stringify(formModel.value)
|
||||
});
|
||||
config.value.version = data;
|
||||
setLoading(false);
|
||||
|
||||
@@ -105,25 +105,38 @@
|
||||
<template #status="{ record }">
|
||||
<a-space>
|
||||
<!-- 菜单状态 -->
|
||||
<a-popconfirm position="top"
|
||||
<a-popconfirm v-if="hasPermission('infra:system-menu:update-status')"
|
||||
position="top"
|
||||
type="warning"
|
||||
:content="`确定要将当前节点以及所有子节点改为${toggleEnumValue(record.status, MenuStatusEnum, 'label')}?`"
|
||||
@ok="updateStatus(record.id, toggleEnumValue(record.status, MenuStatusEnum))">
|
||||
<a-tag :color="getEnumValue(record.status, MenuStatusEnum,'color')" class="pointer">
|
||||
{{ getEnumValue(record.status, MenuStatusEnum) }}
|
||||
</a-tag>
|
||||
<a-tooltip content="点击切换状态">
|
||||
<a-tag :color="getEnumValue(record.status, MenuStatusEnum,'color')" class="pointer">
|
||||
{{ getEnumValue(record.status, MenuStatusEnum) }}
|
||||
</a-tag>
|
||||
</a-tooltip>
|
||||
</a-popconfirm>
|
||||
<a-tag v-else :color="getEnumValue(record.status, MenuStatusEnum,'color')">
|
||||
{{ getEnumValue(record.status, MenuStatusEnum) }}
|
||||
</a-tag>
|
||||
<!-- 显示状态 -->
|
||||
<a-popconfirm position="top"
|
||||
<a-popconfirm v-if="hasPermission('infra:system-menu:update-status')"
|
||||
position="top"
|
||||
type="warning"
|
||||
:content="`确定要将当前节点以及所有子节点改为${toggleEnumValue(record.visible, MenuVisibleEnum, 'label')}?`"
|
||||
@ok="updateVisible(record.id, toggleEnumValue(record.visible, MenuVisibleEnum))">
|
||||
<a-tag v-if="(record.visible || record.visible === 0) && record.type !== MenuTypeEnum.FUNCTION.value"
|
||||
:color="getEnumValue(record.visible, MenuVisibleEnum,'color')"
|
||||
class="pointer">
|
||||
{{ getEnumValue(record.visible, MenuVisibleEnum) }}
|
||||
</a-tag>
|
||||
<a-tooltip content="点击切换状态">
|
||||
<a-tag v-if="(record.visible || record.visible === 0) && record.type !== MenuTypeEnum.FUNCTION.value"
|
||||
:color="getEnumValue(record.visible, MenuVisibleEnum,'color')"
|
||||
class="pointer">
|
||||
{{ getEnumValue(record.visible, MenuVisibleEnum) }}
|
||||
</a-tag>
|
||||
</a-tooltip>
|
||||
</a-popconfirm>
|
||||
<a-tag v-else-if="(record.visible || record.visible === 0) && record.type !== MenuTypeEnum.FUNCTION.value"
|
||||
:color="getEnumValue(record.visible, MenuVisibleEnum,'color')">
|
||||
{{ getEnumValue(record.visible, MenuVisibleEnum) }}
|
||||
</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
@@ -176,8 +189,10 @@
|
||||
import columns from '../types/table.columns';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { useCacheStore } from '@/store';
|
||||
import usePermission from '@/hooks/permission';
|
||||
|
||||
const cacheStore = useCacheStore();
|
||||
const { hasPermission } = usePermission();
|
||||
|
||||
const formRef = ref();
|
||||
const formModel = reactive<MenuQueryRequest>({
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
}
|
||||
if (isAddHandle.value) {
|
||||
// 新增
|
||||
await createUser({ ...formModel, password: md5(formModel.value.password as string) });
|
||||
await createUser({ ...formModel.value, password: md5(formModel.value.password as string) });
|
||||
Message.success('创建成功');
|
||||
emits('added');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user