优化:优化设置表单控件尺寸大小的写法
This commit is contained in:
parent
6d72537125
commit
db345664a3
@ -7,6 +7,7 @@
|
|||||||
:model="form"
|
:model="form"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
|
size="large"
|
||||||
class="login-form"
|
class="login-form"
|
||||||
@submit="handleLogin"
|
@submit="handleLogin"
|
||||||
>
|
>
|
||||||
@ -15,7 +16,6 @@
|
|||||||
v-model="form.username"
|
v-model="form.username"
|
||||||
:placeholder="$t('login.form.placeholder.username')"
|
:placeholder="$t('login.form.placeholder.username')"
|
||||||
max-length="50"
|
max-length="50"
|
||||||
size="large"
|
|
||||||
>
|
>
|
||||||
<template #prefix><icon-user /></template>
|
<template #prefix><icon-user /></template>
|
||||||
</a-input>
|
</a-input>
|
||||||
@ -26,7 +26,6 @@
|
|||||||
:placeholder="$t('login.form.placeholder.password')"
|
:placeholder="$t('login.form.placeholder.password')"
|
||||||
max-length="32"
|
max-length="32"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
>
|
>
|
||||||
<template #prefix><icon-lock /></template>
|
<template #prefix><icon-lock /></template>
|
||||||
</a-input-password>
|
</a-input-password>
|
||||||
@ -36,12 +35,15 @@
|
|||||||
v-model="form.captcha"
|
v-model="form.captcha"
|
||||||
:placeholder="$t('login.form.placeholder.captcha')"
|
:placeholder="$t('login.form.placeholder.captcha')"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
style="width: 63%"
|
style="width: 63%"
|
||||||
>
|
>
|
||||||
<template #prefix><icon-check-circle /></template>
|
<template #prefix><icon-check-circle /></template>
|
||||||
</a-input>
|
</a-input>
|
||||||
<img :src="captchaImgBase64" :alt="$t('login.form.captcha')" @click="getCaptcha">
|
<img
|
||||||
|
:src="captchaImgBase64"
|
||||||
|
:alt="$t('login.form.captcha')"
|
||||||
|
@click="getCaptcha"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-space :size="16" direction="vertical">
|
<a-space :size="16" direction="vertical">
|
||||||
<div class="login-form-remember-me">
|
<div class="login-form-remember-me">
|
||||||
@ -53,7 +55,12 @@
|
|||||||
{{ $t('login.form.rememberMe') }}
|
{{ $t('login.form.rememberMe') }}
|
||||||
</a-checkbox>
|
</a-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<a-button :loading="loading" type="primary" size="large" long html-type="submit">
|
<a-button
|
||||||
|
:loading="loading"
|
||||||
|
type="primary"
|
||||||
|
long
|
||||||
|
html-type="submit"
|
||||||
|
>
|
||||||
{{ $t('login.form.login') }}
|
{{ $t('login.form.login') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
@ -98,9 +105,15 @@
|
|||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
rules: computed((): Record<string, FieldRule[]> => {
|
rules: computed((): Record<string, FieldRule[]> => {
|
||||||
return {
|
return {
|
||||||
username: [{ required: true, message: t('login.form.error.required.username') }],
|
username: [
|
||||||
password: [{ required: true, message: t('login.form.error.required.password') }],
|
{ required: true, message: t('login.form.error.required.username') },
|
||||||
captcha: [{ required: true, message: t('login.form.error.required.captcha') }],
|
],
|
||||||
|
password: [
|
||||||
|
{ required: true, message: t('login.form.error.required.password') },
|
||||||
|
],
|
||||||
|
captcha: [
|
||||||
|
{ required: true, message: t('login.form.error.required.captcha') },
|
||||||
|
],
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@ -123,19 +136,24 @@
|
|||||||
* @param errors 表单验证错误
|
* @param errors 表单验证错误
|
||||||
* @param values 表单数据
|
* @param values 表单数据
|
||||||
*/
|
*/
|
||||||
const handleLogin = ({ errors, values, }: {
|
const handleLogin = ({
|
||||||
|
errors,
|
||||||
|
values,
|
||||||
|
}: {
|
||||||
errors: Record<string, ValidatedError> | undefined;
|
errors: Record<string, ValidatedError> | undefined;
|
||||||
values: Record<string, any>;
|
values: Record<string, any>;
|
||||||
}) => {
|
}) => {
|
||||||
if (loading.value) return;
|
if (loading.value) return;
|
||||||
if (!errors) {
|
if (!errors) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
loginStore.login({
|
loginStore
|
||||||
|
.login({
|
||||||
username: values.username,
|
username: values.username,
|
||||||
password: encryptByRsa(values.password) || '',
|
password: encryptByRsa(values.password) || '',
|
||||||
captcha: values.captcha,
|
captcha: values.captcha,
|
||||||
uuid: values.uuid
|
uuid: values.uuid,
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
const { redirect, ...othersQuery } = router.currentRoute.value.query;
|
const { redirect, ...othersQuery } = router.currentRoute.value.query;
|
||||||
router.push({
|
router.push({
|
||||||
name: (redirect as string) || 'Workplace',
|
name: (redirect as string) || 'Workplace',
|
||||||
@ -147,9 +165,11 @@
|
|||||||
const { username } = values;
|
const { username } = values;
|
||||||
loginConfig.value.username = rememberMe ? username : '';
|
loginConfig.value.username = rememberMe ? username : '';
|
||||||
proxy.$message.success(t('login.form.login.success'));
|
proxy.$message.success(t('login.form.login.success'));
|
||||||
}).catch(() => {
|
})
|
||||||
|
.catch(() => {
|
||||||
getCaptcha();
|
getCaptcha();
|
||||||
}).finally(() => {
|
})
|
||||||
|
.finally(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
v-model="queryParams.description"
|
v-model="queryParams.description"
|
||||||
placeholder="输入操作内容搜索"
|
placeholder="输入操作内容搜索"
|
||||||
allow-clear
|
allow-clear
|
||||||
style="width: 150px;"
|
style="width: 150px"
|
||||||
@press-enter="handleQuery"
|
@press-enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
:options="statusOptions"
|
:options="statusOptions"
|
||||||
placeholder="操作状态搜索"
|
placeholder="操作状态搜索"
|
||||||
allow-clear
|
allow-clear
|
||||||
style="width: 150px;"
|
style="width: 150px"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="createTime" hide-label>
|
<a-form-item field="createTime" hide-label>
|
||||||
@ -128,10 +128,12 @@
|
|||||||
*/
|
*/
|
||||||
const getList = (params: OperationLogParam = { ...queryParams.value }) => {
|
const getList = (params: OperationLogParam = { ...queryParams.value }) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listOperationLog(params).then((res) => {
|
listOperationLog(params)
|
||||||
|
.then((res) => {
|
||||||
operationLogList.value = res.data.list;
|
operationLogList.value = res.data.list;
|
||||||
total.value = res.data.total;
|
total.value = res.data.total;
|
||||||
}).finally(() => {
|
})
|
||||||
|
.finally(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -188,27 +188,18 @@
|
|||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
>
|
>
|
||||||
<a-form ref="formRef" :model="form" :rules="rules">
|
<a-form ref="formRef" :model="form" :rules="rules" size="large">
|
||||||
<a-form-item label="角色名称" field="roleName">
|
<a-form-item label="角色名称" field="roleName">
|
||||||
<a-input
|
<a-input v-model="form.roleName" placeholder="请输入角色名称" />
|
||||||
v-model="form.roleName"
|
|
||||||
placeholder="请输入角色名称"
|
|
||||||
size="large"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="角色编码" field="roleCode">
|
<a-form-item label="角色编码" field="roleCode">
|
||||||
<a-input
|
<a-input v-model="form.roleCode" placeholder="请输入角色编码" />
|
||||||
v-model="form.roleCode"
|
|
||||||
placeholder="请输入角色编码"
|
|
||||||
size="large"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="数据权限" field="dataScope">
|
<a-form-item label="数据权限" field="dataScope">
|
||||||
<a-select
|
<a-select
|
||||||
v-model="form.dataScope"
|
v-model="form.dataScope"
|
||||||
:options="dataScopeOptions"
|
:options="dataScopeOptions"
|
||||||
placeholder="请选择数据权限"
|
placeholder="请选择数据权限"
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
@ -226,7 +217,6 @@
|
|||||||
tree-check-strictly
|
tree-check-strictly
|
||||||
:filter-tree-node="filterDeptTree"
|
:filter-tree-node="filterDeptTree"
|
||||||
:fallback-option="false"
|
:fallback-option="false"
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="角色排序" field="roleSort">
|
<a-form-item label="角色排序" field="roleSort">
|
||||||
@ -235,7 +225,6 @@
|
|||||||
placeholder="请输入角色排序"
|
placeholder="请输入角色排序"
|
||||||
:min="1"
|
:min="1"
|
||||||
mode="button"
|
mode="button"
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="描述" field="description">
|
<a-form-item label="描述" field="description">
|
||||||
@ -247,7 +236,6 @@
|
|||||||
minRows: 3,
|
minRows: 3,
|
||||||
}"
|
}"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
@ -281,12 +269,8 @@
|
|||||||
<a-skeleton-line :rows="1" />
|
<a-skeleton-line :rows="1" />
|
||||||
</a-skeleton>
|
</a-skeleton>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<a-tag v-if="role.status === 1" color="green">
|
<a-tag v-if="role.status === 1" color="green">启用</a-tag>
|
||||||
<span class="circle pass"></span>启用
|
<a-tag v-else color="red">禁用</a-tag>
|
||||||
</a-tag>
|
|
||||||
<a-tag v-else color="red">
|
|
||||||
<span class="circle fail"></span>禁用
|
|
||||||
</a-tag>
|
|
||||||
</span>
|
</span>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item label="数据权限">
|
<a-descriptions-item label="数据权限">
|
||||||
@ -580,7 +564,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选
|
* 已选择的数据行发生改变时触发
|
||||||
*
|
*
|
||||||
* @param rowKeys ID 列表
|
* @param rowKeys ID 列表
|
||||||
*/
|
*/
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
:rules="rules"
|
:rules="rules"
|
||||||
:label-col-props="{ span: 8 }"
|
:label-col-props="{ span: 8 }"
|
||||||
:wrapper-col-props="{ span: 16 }"
|
:wrapper-col-props="{ span: 16 }"
|
||||||
|
size="large"
|
||||||
class="form"
|
class="form"
|
||||||
>
|
>
|
||||||
<a-form-item :label="$t('userCenter.basicInfo.form.label.username')" disabled>
|
<a-form-item :label="$t('userCenter.basicInfo.form.label.username')" disabled>
|
||||||
@ -12,14 +13,12 @@
|
|||||||
v-model="form.username"
|
v-model="form.username"
|
||||||
:placeholder="$t('userCenter.basicInfo.form.placeholder.username')"
|
:placeholder="$t('userCenter.basicInfo.form.placeholder.username')"
|
||||||
max-length="50"
|
max-length="50"
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label="$t('userCenter.basicInfo.form.label.nickname')" field="nickname">
|
<a-form-item :label="$t('userCenter.basicInfo.form.label.nickname')" field="nickname">
|
||||||
<a-input
|
<a-input
|
||||||
v-model="form.nickname"
|
v-model="form.nickname"
|
||||||
:placeholder="$t('userCenter.basicInfo.form.placeholder.nickname')"
|
:placeholder="$t('userCenter.basicInfo.form.placeholder.nickname')"
|
||||||
size="large"
|
|
||||||
max-length="32"
|
max-length="32"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@ -46,7 +45,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { getCurrentInstance, ref, toRefs, reactive, computed } from 'vue';
|
import { getCurrentInstance, ref, toRefs, reactive, computed } from 'vue';
|
||||||
import { FieldRule } from '@arco-design/web-vue';
|
import { FieldRule } from '@arco-design/web-vue';
|
||||||
import { BasicInfoModel, updateBasicInfo } from "@/api/system/user-center";
|
import { BasicInfoModel, updateBasicInfo } from '@/api/system/user-center';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useLoginStore } from '@/store';
|
import { useLoginStore } from '@/store';
|
||||||
|
|
||||||
@ -66,8 +65,18 @@
|
|||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
rules: computed((): Record<string, FieldRule[]> => {
|
rules: computed((): Record<string, FieldRule[]> => {
|
||||||
return {
|
return {
|
||||||
username: [{ required: true, message: t('userCenter.basicInfo.form.error.required.username') }],
|
username: [
|
||||||
nickname: [{ required: true, message: t('userCenter.basicInfo.form.error.required.nickname') }],
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('userCenter.basicInfo.form.error.required.username'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
nickname: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('userCenter.basicInfo.form.error.required.nickname'),
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@ -84,10 +93,12 @@
|
|||||||
updateBasicInfo({
|
updateBasicInfo({
|
||||||
nickname: form.value.nickname,
|
nickname: form.value.nickname,
|
||||||
gender: form.value.gender,
|
gender: form.value.gender,
|
||||||
}).then((res) => {
|
})
|
||||||
|
.then((res) => {
|
||||||
loginStore.getInfo();
|
loginStore.getInfo();
|
||||||
proxy.$message.success(t('userCenter.basicInfo.form.save.success'));
|
proxy.$message.success(t('userCenter.basicInfo.form.save.success'));
|
||||||
}).finally(() => {
|
})
|
||||||
|
.finally(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,12 @@
|
|||||||
@ok="handleUpdate"
|
@ok="handleUpdate"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
>
|
>
|
||||||
<a-form ref="formRef" :model="form" :rules="rules">
|
<a-form ref="formRef" :model="form" :rules="rules" size="large">
|
||||||
<a-form-item :label="$t('userCenter.securitySettings.updateEmail.form.label.newEmail')" field="newEmail">
|
<a-form-item :label="$t('userCenter.securitySettings.updateEmail.form.label.newEmail')" field="newEmail">
|
||||||
<a-input
|
<a-input
|
||||||
v-model="form.newEmail"
|
v-model="form.newEmail"
|
||||||
:placeholder="$t('userCenter.securitySettings.updateEmail.form.placeholder.newEmail')"
|
:placeholder="$t('userCenter.securitySettings.updateEmail.form.placeholder.newEmail')"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label="$t('userCenter.securitySettings.updateEmail.form.label.captcha')" field="captcha">
|
<a-form-item :label="$t('userCenter.securitySettings.updateEmail.form.label.captcha')" field="captcha">
|
||||||
@ -44,13 +43,11 @@
|
|||||||
:placeholder="$t('userCenter.securitySettings.updateEmail.form.placeholder.captcha')"
|
:placeholder="$t('userCenter.securitySettings.updateEmail.form.placeholder.captcha')"
|
||||||
max-length="6"
|
max-length="6"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
style="width: 80%"
|
style="width: 80%"
|
||||||
/>
|
/>
|
||||||
<a-button
|
<a-button
|
||||||
:loading="captchaLoading"
|
:loading="captchaLoading"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="large"
|
|
||||||
:disabled="captchaDisable"
|
:disabled="captchaDisable"
|
||||||
class="captcha-btn"
|
class="captcha-btn"
|
||||||
@click="handleSendCaptcha"
|
@click="handleSendCaptcha"
|
||||||
@ -64,7 +61,6 @@
|
|||||||
:placeholder="$t('userCenter.securitySettings.updateEmail.form.placeholder.currentPassword')"
|
:placeholder="$t('userCenter.securitySettings.updateEmail.form.placeholder.currentPassword')"
|
||||||
max-length="32"
|
max-length="32"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
@ -29,14 +29,13 @@
|
|||||||
@ok="handleUpdate"
|
@ok="handleUpdate"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
>
|
>
|
||||||
<a-form ref="formRef" :model="form" :rules="rules">
|
<a-form ref="formRef" :model="form" :rules="rules" size="large">
|
||||||
<a-form-item :label="$t('userCenter.securitySettings.updatePwd.form.label.oldPassword')" field="oldPassword">
|
<a-form-item :label="$t('userCenter.securitySettings.updatePwd.form.label.oldPassword')" field="oldPassword">
|
||||||
<a-input-password
|
<a-input-password
|
||||||
v-model="form.oldPassword"
|
v-model="form.oldPassword"
|
||||||
:placeholder="$t('userCenter.securitySettings.updatePwd.form.placeholder.oldPassword')"
|
:placeholder="$t('userCenter.securitySettings.updatePwd.form.placeholder.oldPassword')"
|
||||||
max-length="32"
|
max-length="32"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label="$t('userCenter.securitySettings.updatePwd.form.label.newPassword')" field="newPassword">
|
<a-form-item :label="$t('userCenter.securitySettings.updatePwd.form.label.newPassword')" field="newPassword">
|
||||||
@ -45,7 +44,6 @@
|
|||||||
:placeholder="$t('userCenter.securitySettings.updatePwd.form.placeholder.newPassword')"
|
:placeholder="$t('userCenter.securitySettings.updatePwd.form.placeholder.newPassword')"
|
||||||
max-length="32"
|
max-length="32"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label="$t('userCenter.securitySettings.updatePwd.form.label.rePassword')" field="rePassword">
|
<a-form-item :label="$t('userCenter.securitySettings.updatePwd.form.label.rePassword')" field="rePassword">
|
||||||
@ -54,7 +52,6 @@
|
|||||||
:placeholder="$t('userCenter.securitySettings.updatePwd.form.placeholder.rePassword')"
|
:placeholder="$t('userCenter.securitySettings.updatePwd.form.placeholder.rePassword')"
|
||||||
max-length="32"
|
max-length="32"
|
||||||
allow-clear
|
allow-clear
|
||||||
size="large"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
Loading…
Reference in New Issue
Block a user