diff --git a/.commitlintrc.cjs b/.commitlintrc.cjs index 812e548..824ac04 100644 --- a/.commitlintrc.cjs +++ b/.commitlintrc.cjs @@ -1,5 +1,14 @@ // .commitlintrc.js /** @type {import('cz-git').UserConfig} */ +const fs = require("fs"); +const path = require("path"); + + +const scopes = fs + .readdirSync(path.resolve(__dirname, "src"), { withFileTypes: true }) + .filter(dirent => dirent.isDirectory()) + .map(dirent => dirent.name.replace(/s$/, "")); + module.exports = { extends: ['@commitlint/config-conventional'], rules: { @@ -27,48 +36,24 @@ module.exports = { confirmCommit: '是否提交或修改commit ? | Are you sure you want to proceed with the commit above?' }, types: [ - { value: 'feat', name: 'feat: 新增功能 | A new feature' }, - { value: 'fix', name: 'fix: 修复缺陷 | A bug fix' }, - { - value: 'docs', - name: 'docs: 文档更新 | Documentation only changes' - }, - { - value: 'style', - name: 'style: 代码格式 | Changes that do not affect the meaning of the code' - }, - { - value: 'refactor', - name: 'refactor: 代码重构 | A code change that neither fixes a bug nor adds a feature' - }, - { - value: 'perf', - name: 'perf: 性能提升 | A code change that improves performance' - }, - { - value: 'test', - name: 'test: 测试相关 | Adding missing tests or correcting existing tests' - }, - { - value: 'build', - name: 'build: 构建相关 | Changes that affect the build system or external dependencies' - }, - { - value: 'ci', - name: 'ci: 持续集成 | Changes to our CI configuration files and scripts' - }, - { value: 'revert', name: 'revert: 回退代码 | Revert to a commit' }, - { - value: 'chore', - name: 'chore: 其他修改 | Other changes that do not modify src or test files' - } + { value: 'feat', name: 'feat: 🚀 新增功能 | A new feature', emoji: "🚀" }, + { value: 'fix', name: 'fix: 🧩 修复缺陷 | A bug fix', emoji: "🧩" }, + { value: 'docs', name: 'docs: 📚 文档更新 | Documentation only changes', emoji: "📚" }, + { value: 'style', name: 'style: 🎨 代码格式 | Changes that do not affect the meaning of the code', emoji: "🎨" }, + { value: 'refactor', name: 'refactor: ♻️ 代码重构 | A code change that neither fixes a bug nor adds a feature', emoji: "♻️" }, + { value: 'perf', name: 'perf: ⚡️ 性能提升 | A code change that improves performance', emoji: "⚡️" }, + { value: 'test', name: 'test: ✅ 测试相关 | Adding missing tests or correcting existing tests', emoji: "✅" }, + { value: 'build', name: 'build: 📦️ 构建相关 | Changes that affect the build system or external dependencies', emoji: "📦️" }, + { value: 'ci', name: 'ci: 🎡 持续集成 | Changes to our CI configuration files and scripts', emoji: "🎡" }, + { value: 'revert', name: 'revert: ⏪️ 回退代码 | Revert to a commit', emoji: "⏪️" }, + { value: 'chore', name: 'chore: 🔨 其他修改 | Other changes that do not modify src or test files', emoji: "🔨" } ], - useEmoji: false, + useEmoji: true, emojiAlign: 'center', useAI: false, aiNumber: 1, themeColorCode: '', - scopes: [], + scopes: [...scopes], allowCustomScopes: true, allowEmptyScopes: true, customScopesAlign: 'bottom', diff --git a/.lintstagedrc b/.lintstagedrc index 19ec421..ae97a43 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -12,6 +12,11 @@ "*.vue": [ "prettier --write", "eslint --fix", + "stylelint --fix", + "git add" + ], + "*.{scss,less,styl,html}": [ + "stylelint --fix", "git add" ] } diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..b7eb686 --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,4 @@ +/dist/* +/public/* +public/* +stats.html diff --git a/.stylelintrc.cjs b/.stylelintrc.cjs new file mode 100644 index 0000000..4095486 --- /dev/null +++ b/.stylelintrc.cjs @@ -0,0 +1,40 @@ +// @see: https://stylelint.io + +module.exports = { + root: true, + // 继承某些已有的规则 + extends: [ + "stylelint-config-standard", // 配置 stylelint 拓展插件 + "stylelint-config-html/vue", // 配置 vue 中 template 样式格式化 + "stylelint-config-standard-scss", // 配置 stylelint scss 插件 + "stylelint-config-recommended-vue/scss", // 配置 vue 中 scss 样式格式化 + "stylelint-config-recess-order" // 配置 stylelint css 属性书写顺序插件, + ], + overrides: [ + // 扫描 .vue/html 文件中的 diff --git a/src/components/LoginDialog/components/FormLogin/AccountPassword.vue b/src/components/LoginDialog/components/FormLogin/AccountPassword.vue index ec1972e..7ffb74e 100644 --- a/src/components/LoginDialog/components/FormLogin/AccountPassword.vue +++ b/src/components/LoginDialog/components/FormLogin/AccountPassword.vue @@ -103,20 +103,18 @@ async function handleSubmit() { flex-direction: column; gap: 16px; } - .form-group { display: flex; - align-items: center; gap: 8px; + align-items: center; } - .login-btn { - margin-top: 24px; padding: 12px; - background: #409eff; + margin-top: 24px; color: white; + cursor: pointer; + background: #409eff; border: none; border-radius: 4px; - cursor: pointer; } diff --git a/src/components/LoginDialog/components/FormLogin/RegistrationForm.vue b/src/components/LoginDialog/components/FormLogin/RegistrationForm.vue index 1f68995..779379a 100644 --- a/src/components/LoginDialog/components/FormLogin/RegistrationForm.vue +++ b/src/components/LoginDialog/components/FormLogin/RegistrationForm.vue @@ -181,20 +181,18 @@ async function getEmailCode() { flex-direction: column; gap: 16px; } - .form-group { display: flex; - align-items: center; gap: 8px; + align-items: center; } - .login-btn { - margin-top: 24px; padding: 12px; - background: #409eff; + margin-top: 24px; color: white; + cursor: pointer; + background: #409eff; border: none; border-radius: 4px; - cursor: pointer; } diff --git a/src/components/LoginDialog/components/FormLogin/VerificationCode.vue b/src/components/LoginDialog/components/FormLogin/VerificationCode.vue index 1ccc256..a5fd438 100644 --- a/src/components/LoginDialog/components/FormLogin/VerificationCode.vue +++ b/src/components/LoginDialog/components/FormLogin/VerificationCode.vue @@ -27,20 +27,18 @@ flex-direction: column; gap: 16px; } - .form-group { display: flex; - align-items: center; gap: 8px; + align-items: center; } - .login-btn { - margin-top: 24px; padding: 12px; - background: #409eff; + margin-top: 24px; color: white; + cursor: pointer; + background: #409eff; border: none; border-radius: 4px; - cursor: pointer; } diff --git a/src/components/LoginDialog/components/QrCodeLogin/index.vue b/src/components/LoginDialog/components/QrCodeLogin/index.vue index b4176fc..b6aa27b 100644 --- a/src/components/LoginDialog/components/QrCodeLogin/index.vue +++ b/src/components/LoginDialog/components/QrCodeLogin/index.vue @@ -179,91 +179,78 @@ onBeforeUnmount(() => { .qr-wrapper { display: flex; flex-direction: column; - align-items: center; gap: 8px; - + align-items: center; .tip { font-size: 16px; font-weight: 500; color: #303133; } - .qr-img-wrapper { position: relative; width: 180px; height: 180px; - border-radius: 16px; - overflow: hidden; padding: 12px; + overflow: hidden; border: 1px solid #f0f2f5; - box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08); - + border-radius: 16px; + box-shadow: 0 2px 12px 0 rgb(0 0 0 / 8%); .qr-img { - width: 100%; - height: 100%; display: flex; align-items: center; justify-content: center; - + width: 100%; + height: 100%; .el-icon { font-size: 18px; color: #909399; } } - .expired-overlay, .scanned-overlay { position: absolute; top: 0; left: 0; - width: 100%; - height: 100%; display: flex; align-items: center; justify-content: center; + width: 100%; + height: 100%; border-radius: 16px; } - .expired-overlay { - background: hsla(0, 0%, 100%, 0.95); cursor: pointer; - + background: hsl(0deg 0% 100% / 95%); .expired-content { display: flex; flex-direction: column; gap: 8px; text-align: center; - .expired-text { font-size: 14px; color: #909399; } } } - .scanned-overlay { - background: hsla(120, 60%, 97%, 0.95); cursor: default; - + background: hsl(120deg 60% 97% / 95%); .scanned-content { display: flex; flex-direction: column; gap: 8px; align-items: center; - .success-icon { font-size: 18px; color: #67c23a; } - .scanned-text { display: flex; + gap: 8px; align-items: center; font-size: 14px; - gap: 8px; color: #606266; } - .countdown-text { font-size: 12px; color: #909399; diff --git a/src/components/LoginDialog/index.vue b/src/components/LoginDialog/index.vue index 135cd79..f55183d 100644 --- a/src/components/LoginDialog/index.vue +++ b/src/components/LoginDialog/index.vue @@ -113,16 +113,14 @@ function onAfterLeave() { /* 动画样式(仅作用于弹框) */ .dialog-zoom-enter-active, .dialog-zoom-leave-active { - transition: all 0.3s ease-in-out; transform-origin: center; + transition: all 0.3s ease-in-out; } - .dialog-zoom-enter-from, .dialog-zoom-leave-to { opacity: 0; transform: scale(0.8); } - .dialog-zoom-enter-to, .dialog-zoom-leave-from { opacity: 1; @@ -134,122 +132,107 @@ function onAfterLeave() { position: fixed; top: 0; left: 0; - width: 100vw; - height: 100vh; - background-color: rgba(0, 0, 0, 0.5); - backdrop-filter: blur(3px); z-index: 2000; display: flex; align-items: center; justify-content: center; + width: 100vw; + height: 100vh; overflow: hidden; user-select: none; + background-color: rgb(0 0 0 / 50%); opacity: 1; + backdrop-filter: blur(3px); transition: opacity 0.3s; } - .mask[hidden] { opacity: 0; } /* 对话框容器样式 */ .glass-dialog { + z-index: 1000; display: flex; width: fit-content; + max-width: 90%; height: var(--login-dialog-height); + padding: var(--login-dialog-padding); + overflow: hidden; background-color: #ffffff; border-radius: var(--login-dialog-border-radius); - overflow: hidden; - padding: var(--login-dialog-padding); - box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1); - z-index: 1000; - max-width: 90%; + box-shadow: 0 4px 24px rgb(0 0 0 / 10%); } /* 以下样式与原代码一致,未修改 */ .left-section { - width: calc(var(--login-dialog-width) / 2); display: flex; flex-direction: column; align-items: center; justify-content: center; + width: calc(var(--login-dialog-width) / 2); padding: var(--login-dialog-section-padding); - background: linear-gradient( - 233deg, - rgba(113, 161, 255, 0.6) 17.67%, - rgba(154, 219, 255, 0.6) 70.4% - ); + background: linear-gradient(233deg, rgb(113 161 255 / 60%) 17.67%, rgb(154 219 255 / 60%) 70.4%); } - .left-section .logo-wrap { display: flex; + gap: 8px; align-items: center; justify-content: center; margin-top: 24px; - gap: 8px; } - .left-section .logo-wrap .logo-img { width: 40px; height: 40px; - border-radius: 12px; padding: 4px; - box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08); - filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.1)); background: var(--login-dialog-logo-background); + border-radius: 12px; + box-shadow: 0 2px 12px 0 rgb(0 0 0 / 8%); + filter: drop-shadow(0 4px 4px rgb(0 0 0 / 10%)); } - .left-section .logo-wrap .logo-text { font-size: 16px; font-weight: 600; color: var(--login-dialog-logo-text-color); } - .left-section .ad-banner { position: relative; width: 100%; height: 100%; } - .left-section .ad-banner .svg-icon { position: absolute; width: 100%; height: 310px; } - .right-section { - width: calc(var(--login-dialog-width) / 2); position: relative; - padding: var(--login-dialog-section-padding); display: flex; flex-direction: column; + width: calc(var(--login-dialog-width) / 2); + padding: var(--login-dialog-section-padding); } - .right-section .content-wrapper { flex: 1; - overflow: hidden; padding: 8px 0; + overflow: hidden; } - .right-section .content-title { display: flex; + align-items: center; + justify-content: center; width: 100%; font-size: 20px; font-weight: 700; - align-items: center; - justify-content: center; } - .right-section .mode-toggle { position: absolute; top: 16px; right: 16px; - cursor: pointer; - color: var(--login-dialog-mode-toggle-color); - transition: color 0.3s; font-size: 24px; + color: var(--login-dialog-mode-toggle-color); + cursor: pointer; + transition: color 0.3s; } - .right-section .form-container, .right-section .qr-container { display: flex; @@ -259,48 +242,40 @@ function onAfterLeave() { width: 100%; height: 100%; } - .right-section .form-box { - justify-self: center; - align-self: center; - height: 100%; + place-self: center center; width: 260px; + height: 100%; padding: var(--login-dialog-section-padding); border-radius: var(--login-dialog-border-radius); } -@media (max-width: 800px) { +@media (width <= 800px) { .left-section { display: none !important; } - .glass-dialog { - padding: var(--login-dialog-padding); height: var(--login-dialog-height); + padding: var(--login-dialog-padding); } - .right-section { padding: calc(var(--login-dialog-section-padding) - 8px); } - .content-wrapper { padding: 4px 0; } } - .animate-up-down { - animation: upDown 5s linear 0ms infinite; + animation: up-down 5s linear 0ms infinite; } -@keyframes upDown { +@keyframes up-down { 0% { transform: translateY(0); } - 50% { transform: translateY(-20px); } - 100% { transform: translateY(0); } diff --git a/src/components/ModelSelect/index.vue b/src/components/ModelSelect/index.vue index 8d194f5..c7a7c0e 100644 --- a/src/components/ModelSelect/index.vue +++ b/src/components/ModelSelect/index.vue @@ -110,24 +110,20 @@ function handleClick(item: GetSessionListVO) { diff --git a/src/layouts/LayoutVertical/index.vue b/src/layouts/LayoutVertical/index.vue index df81726..03b382d 100644 --- a/src/layouts/LayoutVertical/index.vue +++ b/src/layouts/LayoutVertical/index.vue @@ -43,22 +43,19 @@ useWindowWidthObserver(); diff --git a/src/layouts/components/Header/components/CreateChat.vue b/src/layouts/components/Header/components/CreateChat.vue index 302ac2b..5ec8222 100644 --- a/src/layouts/components/Header/components/CreateChat.vue +++ b/src/layouts/components/Header/components/CreateChat.vue @@ -31,15 +31,14 @@ function handleCreatChat() { diff --git a/src/layouts/components/Header/index.vue b/src/layouts/components/Header/index.vue index 9bbe93b..fbc0066 100644 --- a/src/layouts/components/Header/index.vue +++ b/src/layouts/components/Header/index.vue @@ -79,14 +79,12 @@ onKeyStroke(event => event.ctrlKey && event.key.toLowerCase() === 'k', handleCtr diff --git a/src/pages/chat/index.vue b/src/pages/chat/index.vue index 88e831d..976c581 100644 --- a/src/pages/chat/index.vue +++ b/src/pages/chat/index.vue @@ -18,14 +18,14 @@ const sessionId = computed(() => route.params?.id); diff --git a/src/pages/chat/layouts/chatDefaul/index.vue b/src/pages/chat/layouts/chatDefaul/index.vue index 6c3c716..fa18ea2 100644 --- a/src/pages/chat/layouts/chatDefaul/index.vue +++ b/src/pages/chat/layouts/chatDefaul/index.vue @@ -108,13 +108,12 @@ watch( diff --git a/src/pages/error/403.vue b/src/pages/error/403.vue index 7fa5887..c23f68d 100644 --- a/src/pages/error/403.vue +++ b/src/pages/error/403.vue @@ -32,30 +32,25 @@ function handleHomePage() { #box { overflow: hidden; } - #banner { margin-top: 60px; background: url("@/assets/images/error/403.png") no-repeat; background-size: 100%; } - .elx-top { width: 600px; height: 400px; margin: 0 auto; } - .elx-bottom { height: 300px; margin-top: 20px; text-align: center; } - .elx-text1 { font-size: 46px; font-weight: bold; } - .elx-text2 { padding-top: 30px; font-family: YouYuan; diff --git a/src/pages/error/404.vue b/src/pages/error/404.vue index 2c45f72..8c9df3b 100644 --- a/src/pages/error/404.vue +++ b/src/pages/error/404.vue @@ -32,30 +32,25 @@ function handleHomePage() { #box { overflow: hidden; } - #banner { margin-top: 60px; background: url("@/assets/images/error/404.png") no-repeat; background-size: 100%; } - .elx-top { width: 600px; height: 400px; margin: 0 auto; } - .elx-bottom { height: 300px; margin-top: 20px; text-align: center; } - .elx-text1 { font-size: 46px; font-weight: bold; } - .elx-text2 { padding-top: 30px; font-family: YouYuan; diff --git a/types/components.d.ts b/types/components.d.ts index a0fadd3..f819d43 100644 --- a/types/components.d.ts +++ b/types/components.d.ts @@ -3,7 +3,7 @@ // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 // biome-ignore lint: disable -export {} +export {}; /* prettier-ignore */ declare module 'vue' { @@ -35,7 +35,7 @@ declare module 'vue' { VerificationCode: typeof import('./../src/components/LoginDialog/components/FormLogin/VerificationCode.vue')['default'] WelecomeText: typeof import('./../src/components/WelecomeText/index.vue')['default'] } - export interface ComponentCustomProperties { + export interface GlobalDirectives { vLoading: typeof import('element-plus/es')['ElLoadingDirective'] } } diff --git a/types/import_meta.d.ts b/types/import_meta.d.ts index 06bff7e..7ac8836 100644 --- a/types/import_meta.d.ts +++ b/types/import_meta.d.ts @@ -5,7 +5,6 @@ interface ImportMetaEnv { readonly VITE_WEB_TITLE_EN: string; readonly VITE_WEB_ENV: string; readonly VITE_WEB_BASE_API: string; - readonly VITE_BUILD_COMPRESS: string; readonly VITE_API_URL: string; }