diff --git a/.vscode/settings.json b/.vscode/settings.json index e655d767..507df255 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -63,19 +63,8 @@ "**/dist/**": true, "**/yarn.lock": true }, - "i18n-ally.keystyle": "nested", - "i18n-ally.sortKeys": true, - "i18n-ally.namespace": false, - "i18n-ally.pathMatcher": "{namespaces}/{locale}.{ext}", - "i18n-ally.enabledParsers": ["ts"], - "i18n-ally.sourceLanguage": "en", - "i18n-ally.displayLanguage": "zh-CN", - "i18n-ally.enabledFrameworks": [ - "vue", - "react" - ], "i18n-ally.localesPaths": [ - "src/lang" + "src/lang/package" ], "scss.lint.unknownAtRules": "ignore" } diff --git a/eslint.config.ts b/eslint.config.ts index 7e3fb4c4..20aade82 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -1,11 +1,16 @@ // https://eslint.org/docs/latest/use/configure/configuration-files-new +// 基础ESLint配置 import eslint from "@eslint/js"; -import pluginVue from "eslint-plugin-vue"; -import * as typescriptEslint from "typescript-eslint"; -import vueParser from "vue-eslint-parser"; import globals from "globals"; +// TypeScript支持 +import * as typescriptEslint from "typescript-eslint"; +// Vue支持 +import pluginVue from "eslint-plugin-vue"; +import vueParser from "vue-eslint-parser"; +// 代码风格与格式化 import configPrettier from "eslint-config-prettier"; +import prettierPlugin from "eslint-plugin-prettier"; // 解析自动导入配置 import fs from "node:fs"; @@ -132,6 +137,7 @@ export default [ sourceType: "module", parser: typescriptEslint.parser, extraFileExtensions: [".vue"], + tsconfigRootDir: __dirname, }, }, rules: { @@ -174,8 +180,10 @@ export default [ languageOptions: { parser: typescriptEslint.parser, parserOptions: { - project: true, - tsconfigRootDir: import.meta.dirname, + ecmaVersion: "latest", + sourceType: "module", + project: "./tsconfig.json", + tsconfigRootDir: __dirname, }, }, rules: { @@ -212,5 +220,15 @@ export default [ }, // Prettier 集成(必须放在最后) - configPrettier, + { + plugins: { + prettier: prettierPlugin, // 将 Prettier 的输出作为 ESLint 的问题来报告 + }, + rules: { + ...configPrettier.rules, + "prettier/prettier": ["error", {}, { usePrettierrc: true }], + "arrow-body-style": "off", + "prefer-arrow-callback": "off", + }, + }, ]; diff --git a/src/lang/index.ts b/src/lang/index.ts index 2a8685c4..436f1230 100644 --- a/src/lang/index.ts +++ b/src/lang/index.ts @@ -2,18 +2,14 @@ import type { App } from "vue"; import { createI18n } from "vue-i18n"; import { useAppStoreHook } from "@/store/modules/app-store"; // 本地语言包 -import enLocale from "./package/en"; -import zhCnLocale from "./package/zh-cn"; +import enLocale from "./package/en.json"; +import zhCnLocale from "./package/zh-cn.json"; const appStore = useAppStoreHook(); const messages = { - "zh-cn": { - ...zhCnLocale, - }, - en: { - ...enLocale, - }, + "zh-cn": zhCnLocale, + en: enLocale, }; const i18n = createI18n({ diff --git a/src/lang/package/en.json b/src/lang/package/en.json new file mode 100644 index 00000000..021e409f --- /dev/null +++ b/src/lang/package/en.json @@ -0,0 +1,91 @@ +{ + "route": { + "dashboard": "Dashboard", + "document": "Document" + }, + "login": { + "themeToggle": "Theme Switch", + "languageToggle": "Language Switch", + "dark": "Dark", + "light": "Light", + "username": "Username", + "password": "Password", + "login": "Login", + "captchaCode": "Verify Code", + "capsLock": "Caps Lock is On", + "rememberMe": "Remember Me", + "forgetPassword": "Forget Password?", + "message": { + "username": { + "required": "Please enter Username" + }, + "password": { + "required": "Please enter Password", + "min": "The password can not be less than 6 digits", + "confirm": "Please confirm the password again", + "inconformity": "The two password entries are inconsistent" + }, + "captchaCode": { + "required": "Please enter Verify Code" + } + }, + "otherLoginMethods": "Other", + "resetPassword": "Reset password", + "thinkOfPasswd": "Remember your password?", + "register": "Register account", + "agree": "I have read and agree to the", + "userAgreement": "User Agreement", + "haveAccount": "Already have an account?", + "noAccount": "Don't have an account?", + "quickFill": "Quick fill", + "reg": "Register" + }, + "navbar": { + "dashboard": "Dashboard", + "logout": "Logout", + "document": "Document", + "gitee": "Gitee", + "profile": "User Profile" + }, + "sizeSelect": { + "tooltip": "Layout Size", + "default": "Default", + "large": "Large", + "small": "Small", + "message": { + "success": "Switch Layout Size Successful!" + } + }, + "langSelect": { + "message": { + "success": "Switch Language Successful!" + } + }, + "settings": { + "project": "Project Settings", + "theme": "Theme", + "interface": "Interface", + "navigation": "Navigation", + "themeColor": "Theme Color", + "showTagsView": "Show Tags View", + "showAppLogo": "Show App Logo", + "sidebarColorScheme": "Sidebar Color Scheme", + "showWatermark": "Show Watermark", + "classicBlue": "Classic Blue", + "minimalWhite": "Minimal White", + "copyConfig": "Copy Config", + "resetConfig": "Reset Default", + "copySuccess": "Configuration copied to clipboard", + "resetSuccess": "Reset to default configuration", + "copyDescription": "Copy config will generate current settings code, reset will restore all settings to default", + "confirmReset": "Are you sure to reset all settings to default? This operation cannot be undone.", + "applyToFile": "Apply to File", + "onlyCopy": "Only Copy", + "leftLayout": "Left Mode", + "topLayout": "Top Mode", + "mixLayout": "Mix Mode", + "configManagement": "Config Management", + "copyConfigDescription": "Generate current settings code and copy to clipboard, then overwrite src/settings.ts file", + "resetConfigDescription": "Restore all settings to system default values" + } +} diff --git a/src/lang/package/en.ts b/src/lang/package/en.ts deleted file mode 100644 index 2a863c73..00000000 --- a/src/lang/package/en.ts +++ /dev/null @@ -1,96 +0,0 @@ -export default { - // 菜单国际化 - route: { - dashboard: "Dashboard", - document: "Document", - }, - // 登录页面国际化 - login: { - themeToggle: "Theme Switch", - languageToggle: "Language Switch", - dark: "Dark", - light: "Light", - username: "Username", - password: "Password", - login: "Login", - captchaCode: "Verify Code", - capsLock: "Caps Lock is On", - rememberMe: "Remember Me", - forgetPassword: "Forget Password?", - message: { - username: { - required: "Please enter Username", - }, - password: { - required: "Please enter Password", - min: "The password can not be less than 6 digits", - confirm: "Please confirm the password again", - inconformity: "The two password entries are inconsistent", - }, - captchaCode: { - required: "Please enter Verify Code", - }, - }, - otherLoginMethods: "Other", - resetPassword: "Reset password", - thinkOfPasswd: "Remember your password?", - register: "Register account", - agree: "I have read and agree to the", - userAgreement: "User Agreement", - haveAccount: "Already have an account?", - noAccount: "Don't have an account?", - quickFill: "Quick fill", - reg: "Register", - }, - // 导航栏国际化 - navbar: { - dashboard: "Dashboard", - logout: "Logout", - document: "Document", - gitee: "Gitee", - profile: "User Profile", - }, - sizeSelect: { - tooltip: "Layout Size", - default: "Default", - large: "Large", - small: "Small", - message: { - success: "Switch Layout Size Successful!", - }, - }, - langSelect: { - message: { - success: "Switch Language Successful!", - }, - }, - settings: { - project: "Project Settings", - theme: "Theme", - interface: "Interface", - navigation: "Navigation", - themeColor: "Theme Color", - showTagsView: "Show Tags View", - showAppLogo: "Show App Logo", - sidebarColorScheme: "Sidebar Color Scheme", - showWatermark: "Show Watermark", - classicBlue: "Classic Blue", - minimalWhite: "Minimal White", - copyConfig: "Copy Config", - resetConfig: "Reset Default", - copySuccess: "Configuration copied to clipboard", - resetSuccess: "Reset to default configuration", - copyDescription: - "Copy config will generate current settings code, reset will restore all settings to default", - confirmReset: "Are you sure to reset all settings to default? This operation cannot be undone.", - applyToFile: "Apply to File", - onlyCopy: "Only Copy", - leftLayout: "Left Mode", - topLayout: "Top Mode", - mixLayout: "Mix Mode", - configManagement: "Config Management", - copyConfigDescription: - "Generate current settings code and copy to clipboard, then overwrite src/settings.ts file", - resetConfigDescription: "Restore all settings to system default values", - }, -}; diff --git a/src/lang/package/zh-cn.json b/src/lang/package/zh-cn.json new file mode 100644 index 00000000..3346ce08 --- /dev/null +++ b/src/lang/package/zh-cn.json @@ -0,0 +1,94 @@ +{ + "route": { + "dashboard": "首页", + "document": "项目文档" + }, + "login": { + "themeToggle": "主题切换", + "languageToggle": "语言切换", + "dark": "暗黑", + "light": "明亮", + "username": "用户名", + "password": "密码", + "login": "登 录", + "captchaCode": "验证码", + "capsLock": "大写锁定已打开", + "rememberMe": "记住我", + "forgetPassword": "忘记密码?", + "message": { + "username": { + "required": "请输入用户名" + }, + "password": { + "required": "请输入密码", + "min": "密码不能少于6位", + "confirm": "请再次确认密码", + "inconformity": "两次密码输入不一致" + }, + "captchaCode": { + "required": "请输入验证码" + } + }, + "otherLoginMethods": "其他", + "resetPassword": "重置密码", + "thinkOfPasswd": "想起密码?", + "register": "注册账号", + "agree": "我已同意并阅读", + "userAgreement": "用户协议", + "haveAccount": "已有账号?", + "noAccount": "您没有账号?", + "quickFill": "快速填写", + "reg": "注 册" + }, + "navbar": { + "dashboard": "首页", + "logout": "退出登录", + "document": "项目文档", + "gitee": "项目地址", + "profile": "个人中心" + }, + "sizeSelect": { + "tooltip": "布局大小", + "default": "默认", + "large": "大型", + "small": "小型", + "message": { + "success": "切换布局大小成功!" + } + }, + "langSelect": { + "message": { + "success": "切换语言成功!" + } + }, + "settings": { + "project": "项目配置", + "theme": "主题设置", + "interface": "界面设置", + "navigation": "导航设置", + "themeColor": "主题颜色", + "themeColorTip": "主题颜色", + "darkMode": "暗黑模式", + "layoutSetting": "布局设置", + "sidebarColorScheme": "侧边栏配色", + "showTagsView": "显示页签", + "showAppLogo": "显示Logo", + "showWatermark": "显示水印", + "classicBlue": "经典蓝", + "minimalWhite": "极简白", + "copyConfig": "复制配置", + "resetConfig": "重置默认", + "copySuccess": "配置已复制到剪贴板", + "resetSuccess": "已重置为默认配置", + "copyDescription": "复制配置将生成当前设置的代码,重置将恢复所有设置为默认值", + "confirmReset": "确定要重置所有设置为默认值吗?此操作不可恢复。", + "applyToFile": "应用到文件", + "onlyCopy": "仅复制", + "leftLayout": "左侧模式", + "topLayout": "顶部模式", + "mixLayout": "混合模式", + "configManagement": "配置管理", + "copyConfigDescription": "生成当前设置的代码并复制到剪贴板,然后覆盖 src/settings.ts 文件", + "resetConfigDescription": "恢复所有设置为系统默认值" + } +} diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts deleted file mode 100644 index f1f9cb2e..00000000 --- a/src/lang/package/zh-cn.ts +++ /dev/null @@ -1,97 +0,0 @@ -export default { - // 菜单国际化 - route: { - dashboard: "首页", - document: "项目文档", - }, - // 登录页面国际化 - login: { - themeToggle: "主题切换", - languageToggle: "语言切换", - dark: "暗黑", - light: "明亮", - username: "用户名", - password: "密码", - login: "登 录", - captchaCode: "验证码", - capsLock: "大写锁定已打开", - rememberMe: "记住我", - forgetPassword: "忘记密码?", - message: { - username: { - required: "请输入用户名", - }, - password: { - required: "请输入密码", - min: "密码不能少于6位", - confirm: "请再次确认密码", - inconformity: "两次密码输入不一致", - }, - captchaCode: { - required: "请输入验证码", - }, - }, - otherLoginMethods: "其他", - resetPassword: "重置密码", - thinkOfPasswd: "想起密码?", - register: "注册账号", - agree: "我已同意并阅读", - userAgreement: "用户协议", - haveAccount: "已有账号?", - noAccount: "您没有账号?", - quickFill: "快速填写", - reg: "注 册", - }, - // 导航栏国际化 - navbar: { - dashboard: "首页", - logout: "退出登录", - document: "项目文档", - gitee: "项目地址", - profile: "个人中心", - }, - sizeSelect: { - tooltip: "布局大小", - default: "默认", - large: "大型", - small: "小型", - message: { - success: "切换布局大小成功!", - }, - }, - langSelect: { - message: { - success: "切换语言成功!", - }, - }, - settings: { - project: "项目配置", - theme: "主题设置", - interface: "界面设置", - navigation: "导航设置", - themeColor: "主题颜色", - themeColorTip: "主题颜色", - darkMode: "暗黑模式", - layoutSetting: "布局设置", - sidebarColorScheme: "侧边栏配色", - showTagsView: "显示页签", - showAppLogo: "显示Logo", - showWatermark: "显示水印", - classicBlue: "经典蓝", - minimalWhite: "极简白", - copyConfig: "复制配置", - resetConfig: "重置默认", - copySuccess: "配置已复制到剪贴板", - resetSuccess: "已重置为默认配置", - copyDescription: "复制配置将生成当前设置的代码,重置将恢复所有设置为默认值", - confirmReset: "确定要重置所有设置为默认值吗?此操作不可恢复。", - applyToFile: "应用到文件", - onlyCopy: "仅复制", - leftLayout: "左侧模式", - topLayout: "顶部模式", - mixLayout: "混合模式", - configManagement: "配置管理", - copyConfigDescription: "生成当前设置的代码并复制到剪贴板,然后覆盖 src/settings.ts 文件", - resetConfigDescription: "恢复所有设置为系统默认值", - }, -}; diff --git a/src/layouts/components/Settings/index.vue b/src/layouts/components/Settings/index.vue index 2ebb6bb5..7c26f240 100644 --- a/src/layouts/components/Settings/index.vue +++ b/src/layouts/components/Settings/index.vue @@ -107,40 +107,35 @@ -