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