refactor: 大规模代码整理与功能优化

1. 重构后端API路由、CRUD与模块结构,整合日志管理,移除废弃demo代码
2. 优化前端组件类型定义、样式与路由配置,修复权限判断逻辑
3. 调整默认排序规则、滚动条样式与工具类函数,更新依赖与配置文件
4. 修复多处类型不匹配与默认值问题,完善表单与菜单验证逻辑
This commit is contained in:
zhangtao
2026-06-17 01:56:31 +08:00
parent 17b3cd0a4c
commit 73f2823692
500 changed files with 40763 additions and 26616 deletions
@@ -121,14 +121,18 @@ defineOptions({ name: "AuthTopBar" });
const DEFAULT_APP_VERSION = "3.0.0";
const props = defineProps<{
interface Props {
/** 登录区表单水平对齐;未传入时不展示布局切换 */
panelAlign?: LoginPanelAlign | null;
}>();
}
const emit = defineEmits<{
const props = withDefaults(defineProps<Props>(), {});
interface Emits {
"update:panelAlign": [value: LoginPanelAlign];
}>();
}
const emit = defineEmits<Emits>();
const layoutAlignOptions: {
value: LoginPanelAlign;
@@ -51,8 +51,7 @@
show-password
clearable
:placeholder="$t('login.placeholder.password')"
@keyup="checkCapsLock"
@keyup.enter="$emit('submit')"
@keyup="onPasswordKeyup"
>
<template #prefix>
<ElIcon><Lock /></ElIcon>
@@ -179,7 +178,9 @@ import type { Account, AccountKey } from "@views/module_system/auth/login/types"
const loginForm = defineModel<LoginFormData>("loginForm", { required: true });
defineProps<{
defineOptions({ name: "FaLoginAccountForm" });
interface Props {
rules: FormRules;
captchaState: CaptchaInfo;
codeLoading: boolean;
@@ -189,12 +190,14 @@ defineProps<{
isDark: boolean;
dragVerifyTextColor: string;
loading: boolean;
}>();
}
withDefaults(defineProps<Props>(), {});
const isPassing = defineModel<boolean>("isPassing", { required: true });
const isClickPass = defineModel<boolean>("isClickPass", { required: true });
defineEmits<{
interface Emits {
submit: [];
setupAccount: [key: AccountKey];
getCaptcha: [];
@@ -203,15 +206,20 @@ defineEmits<{
forget: [];
register: [];
oauth: [provider: "wechat" | "qq" | "github" | "gitee"];
}>();
}
const emit = defineEmits<Emits>();
const formRef = ref();
const dragVerifyRef = ref<{ reset?: () => void } | null>(null);
const isCapsLock = ref(false);
function checkCapsLock(event: KeyboardEvent) {
function onPasswordKeyup(event: KeyboardEvent) {
if (event instanceof KeyboardEvent) {
isCapsLock.value = event.getModifierState("CapsLock");
if (event.key === "Enter") {
emit("submit");
}
}
}
@@ -16,8 +16,20 @@
</template>
<script setup lang="ts">
defineProps<{ hint: string; linkText: string }>();
defineEmits<{ link: [] }>();
defineOptions({ name: "FaLoginAuthLinkRow" });
interface Props {
hint: string;
linkText: string;
}
withDefaults(defineProps<Props>(), {});
interface Emits {
link: [];
}
defineEmits<Emits>();
</script>
<style scoped lang="scss">
@@ -17,13 +17,12 @@ import loginIcon from "@fa_imgs/background.svg";
defineOptions({ name: "LoginCenterBackdrop" });
withDefaults(
defineProps<{
/** 铺满视口并置于底层(与固定顶栏配合) */
viewportFixed?: boolean;
}>(),
{ viewportFixed: false }
);
interface Props {
/** 铺满视口并置于底层(与固定顶栏配合) */
viewportFixed?: boolean;
}
withDefaults(defineProps<Props>(), { viewportFixed: false });
</script>
<style scoped lang="scss">
@@ -33,7 +33,6 @@
clearable
:placeholder="$t('login.placeholder.password')"
@keyup="checkCapsLock"
@keyup.enter="$emit('submit')"
>
<template #prefix>
<ElIcon><Lock /></ElIcon>
@@ -52,7 +51,6 @@
clearable
:placeholder="$t('login.message.password.confirm')"
@keyup="checkCapsLock"
@keyup.enter="$emit('submit')"
>
<template #prefix>
<ElIcon><Lock /></ElIcon>
@@ -88,13 +86,22 @@ import type { FormRules } from "element-plus";
const forgetForm = defineModel<ForgetPasswordForm>("forgetForm", { required: true });
defineProps<{
defineOptions({ name: "FaLoginForgetPanel" });
interface Props {
forgetRules: FormRules<ForgetPasswordForm>;
formKey: number | string;
forgetLoading: boolean;
}>();
}
defineEmits<{ submit: []; toLogin: [] }>();
withDefaults(defineProps<Props>(), {});
interface Emits {
submit: [];
toLogin: [];
}
const emit = defineEmits<Emits>();
const formRef = ref();
const isCapsLock = ref(false);
@@ -102,6 +109,9 @@ const isCapsLock = ref(false);
function checkCapsLock(event: KeyboardEvent) {
if (event instanceof KeyboardEvent) {
isCapsLock.value = event.getModifierState("CapsLock");
if (event.key === "Enter") {
emit("submit");
}
}
}
@@ -93,11 +93,18 @@ import loginIcon from "@fa_imgs/background.svg";
import { useConfigStore } from "@stores";
import { themeAnimation } from "@utils";
defineProps<{
defineOptions({ name: "FaLoginLeftView" });
interface Props {
hideContent?: boolean;
/** 顶栏已展示 Logo/标题/版本时隐藏左侧重复顶栏 */
hideTopBranding?: boolean;
}>();
}
withDefaults(defineProps<Props>(), {
hideContent: false,
hideTopBranding: false,
});
const configStore = useConfigStore();
@@ -78,7 +78,14 @@
import { Iphone } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
defineEmits<{ back: []; register: [] }>();
defineOptions({ name: "FaLoginMobilePanel" });
interface Emits {
back: [];
register: [];
}
defineEmits<Emits>();
const { t } = useI18n();
@@ -37,7 +37,14 @@
import QrcodeVue from "qrcode.vue";
import type { Level, RenderAs } from "qrcode.vue";
defineEmits<{ back: []; register: [] }>();
defineOptions({ name: "FaLoginQrPanel" });
interface Emits {
back: [];
register: [];
}
defineEmits<Emits>();
/** 集中配置 + H 级纠错 + SVG(矢量清晰、易对齐容器) */
const qrCodeRenderOptions: {
@@ -32,7 +32,6 @@
clearable
:placeholder="$t('login.placeholder.password')"
@keyup="checkCapsLock"
@keyup.enter="$emit('submit')"
>
<template #prefix>
<ElIcon><Lock /></ElIcon>
@@ -51,7 +50,6 @@
clearable
:placeholder="$t('login.message.password.confirm')"
@keyup="checkCapsLock"
@keyup.enter="$emit('submit')"
>
<template #prefix>
<ElIcon><Lock /></ElIcon>
@@ -104,18 +102,27 @@ import type { FormRules } from "element-plus";
const registerForm = defineModel<RegisterForm>("registerForm", { required: true });
defineProps<{
defineOptions({ name: "FaLoginRegisterPanel" });
interface Props {
registerRules: FormRules<RegisterForm>;
formKey: number | string;
registerLoading: boolean;
userAgreementHref: string;
}>();
}
withDefaults(defineProps<Props>(), {});
const registerAgreementReadModel = defineModel<boolean>("registerAgreementRead", {
required: true,
});
defineEmits<{ submit: []; toLogin: [] }>();
interface Emits {
submit: [];
toLogin: [];
}
const emit = defineEmits<Emits>();
const formRef = ref();
const isCapsLock = ref(false);
@@ -123,6 +130,9 @@ const isCapsLock = ref(false);
function checkCapsLock(event: KeyboardEvent) {
if (event instanceof KeyboardEvent) {
isCapsLock.value = event.getModifierState("CapsLock");
if (event.key === "Enter") {
emit("submit");
}
}
}
@@ -29,7 +29,13 @@
<script setup lang="ts">
import type { OAuthProvider } from "@/api/module_system/auth";
defineEmits<{ oauth: [provider: OAuthProvider] }>();
defineOptions({ name: "FaLoginThirdPartySection" });
interface Emits {
oauth: [provider: OAuthProvider];
}
defineEmits<Emits>();
const { t } = useI18n();
@@ -30,7 +30,7 @@ defineSlots<{
buttons?: () => void;
}>();
interface ResultPageProps {
interface Props {
/** 成功/失败 */
type: "success" | "fail";
/** 标题 */
@@ -41,7 +41,7 @@ interface ResultPageProps {
iconCode: string;
}
withDefaults(defineProps<ResultPageProps>(), {
withDefaults(defineProps<Props>(), {
type: "success",
title: "",
message: "",