From 0ee332fcb6ac459fd7fb359686a516f4fe5b7502 Mon Sep 17 00:00:00 2001 From: WangHui <1143481437@qq.com> Date: Thu, 15 Oct 2026 17:59:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E7=99=BB=E5=BD=95=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=A2=9E=E5=8A=A0=E5=85=91=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +- .env.production | 1 + .env.test | 1 + package-lock.json | 2 +- src/apis/auth.ts | 46 ++ src/apis/fund.ts | 15 + src/assets/less/Header/header.less | 19 +- src/assets/less/Login/Login.less | 106 ++-- src/components/Header/Header.vue | 44 +- src/components/left/Menu.vue | 11 + src/router/index.ts | 12 + src/store/LoginStore.ts | 69 ++- src/types/auth.ts | 71 +++ src/types/fund.ts | 39 ++ src/utlis/request.ts | 36 +- src/views/Profile/Profile.vue | 583 ++++++++++++++++++++ src/views/Redeem/Redeem.vue | 244 +++++++++ src/views/login/Login.vue | 849 ++++++++++++++++++++++------- src/vite-env.d.ts | 9 + vite.config.ts | 15 +- 20 files changed, 1877 insertions(+), 298 deletions(-) create mode 100644 src/apis/auth.ts create mode 100644 src/apis/fund.ts create mode 100644 src/types/auth.ts create mode 100644 src/types/fund.ts create mode 100644 src/views/Profile/Profile.vue create mode 100644 src/views/Redeem/Redeem.vue diff --git a/.env.development b/.env.development index 4a49885..12fc63f 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,2 @@ -VITE_API_BASE_URL=https://token.opencomputing.cn +VITE_API_BASE_URL=http://192.168.31.127:5004 +VITE_PLATFORM_NAME=yuanjing diff --git a/.env.production b/.env.production index 4a49885..36bc8fd 100644 --- a/.env.production +++ b/.env.production @@ -1 +1,2 @@ VITE_API_BASE_URL=https://token.opencomputing.cn +VITE_PLATFORM_NAME=yuanjing diff --git a/.env.test b/.env.test index e616685..a3a9eeb 100644 --- a/.env.test +++ b/.env.test @@ -1 +1,2 @@ VITE_API_BASE_URL=https://tokentest.opencomputing.cn +VITE_PLATFORM_NAME=yuanjing diff --git a/package-lock.json b/package-lock.json index c752507..832ac3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "vue-waterfall-plugin-next": "^3.0.1" }, "devDependencies": { - "@types/node": "^25.9.2", + "@types/node": "^25.4.0", "@types/swiper": "^6.0.0", "@vitejs/plugin-vue": "^5.2.3", "@vue/tsconfig": "^0.7.0", diff --git a/src/apis/auth.ts b/src/apis/auth.ts new file mode 100644 index 0000000..197a067 --- /dev/null +++ b/src/apis/auth.ts @@ -0,0 +1,46 @@ +import { get, post, PUT } from '@/utlis/request'; +import type { + RVO, + LoginBO, + LoginVO, + SmsSendCodeBO, + SmsLoginBO, + SmsResetPasswordBO, + UserInfoVO, + UserCreateBO, + UserUpdateBO, +} from '@/types/auth'; + +// ===== 认证 ===== + +/** 用户名密码登录 */ +export const authLogin = (data: LoginBO) => + post, LoginBO>('/v1/auth/login', data); + +/** 发送手机号验证码 */ +export const authSendSmsCode = (data: SmsSendCodeBO) => + post, SmsSendCodeBO>('/v1/auth/sms/send_code', data); + +/** 手机号验证码登录 */ +export const authSmsLogin = (data: SmsLoginBO) => + post, SmsLoginBO>('/v1/auth/sms/login', data); + +/** 手机号验证码重置密码 */ +export const authSmsResetPassword = (data: SmsResetPasswordBO) => + post, SmsResetPasswordBO>('/v1/auth/sms/reset_password', data); + +/** 退出登录 */ +export const authLogout = () => get, undefined>('/v1/auth/logout'); + +// ===== 用户 ===== + +/** 获取当前登录用户信息 */ +export const getUserInfo = () => get, undefined>('/v1/user/get_info'); + +/** 创建用户(注册) */ +export const createUser = (data: UserCreateBO) => + post, UserCreateBO>('/v1/user/security/create', data); + +/** 更新用户信息 */ +export const updateUser = (data: UserUpdateBO) => + PUT, UserUpdateBO>('/v1/user/update', data); diff --git a/src/apis/fund.ts b/src/apis/fund.ts new file mode 100644 index 0000000..86d3a91 --- /dev/null +++ b/src/apis/fund.ts @@ -0,0 +1,15 @@ +import { get, post } from '@/utlis/request'; +import type { RVO } from '@/types/auth'; +import type { ActivateCodeBO, ActivateResultVO, FundAccountVO } from '@/types/fund'; + +// ===== 兑换码 ===== + +/** 激活兑换码 */ +export const activateRedeemCode = (data: ActivateCodeBO) => + post, ActivateCodeBO>('/v1/redeem-code/activate', data); + +// ===== 资金账户 ===== + +/** 查询资金账户余额 */ +export const getFundBalance = () => + get, undefined>('/v1/fund/balance'); diff --git a/src/assets/less/Header/header.less b/src/assets/less/Header/header.less index 0f20176..027353c 100644 --- a/src/assets/less/Header/header.less +++ b/src/assets/less/Header/header.less @@ -325,18 +325,26 @@ .dropdown-item { display: flex; align-items: center; + gap: 8px; padding: 12px 16px; + font-size: 14px; color: #fff; transition: all 0.2s ease; cursor: pointer; + .item-icon { + width: 16px; + height: 16px; + flex-shrink: 0; + color: rgba(255, 255, 255, 0.8); + } + &:hover { background: rgba(255, 255, 255, 0.05); } &.user-id { justify-content: space-between; - font-size: 14px; .item-label { color: rgba(255, 255, 255, 0.7); @@ -350,15 +358,6 @@ } &.logout { - gap: 8px; - font-size: 14px; - - .item-icon { - width: 16px; - height: 16px; - color: rgba(255, 255, 255, 0.8); - } - &:hover { color: #ff6b6b; diff --git a/src/assets/less/Login/Login.less b/src/assets/less/Login/Login.less index 0ee5e3c..18e0dc4 100644 --- a/src/assets/less/Login/Login.less +++ b/src/assets/less/Login/Login.less @@ -89,7 +89,6 @@ } .captcha-wrapper { - margin-top: 16px; display: flex; gap: 12px; @@ -144,40 +143,79 @@ padding: 14px 0; } +/* 登录方式 Tab 切换 */ +.login-tabs { + display: flex; + gap: 8px; + margin-bottom: 22px; + padding: 4px; + background: rgba(255, 255, 255, 0.12); + border-radius: 12px; + border: 1px solid rgba(255, 255, 255, 0.18); +} + +.login-tab { + flex: 1; + padding: 8px 0; + background: transparent; + border: none; + border-radius: 8px; + color: rgba(255, 255, 255, 0.7); + font-size: 14px; + cursor: pointer; + transition: all 0.25s ease; + letter-spacing: 1px; + + &:hover { + color: #fff; + } + + &.active { + background: rgba(255, 255, 255, 0.25); + color: #fff; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); + } +} + +/* 账密登录额外行:忘记密码链接 */ +.login-extra { + display: flex; + justify-content: space-between; + align-items: center; + margin: -6px 0 4px; + font-size: 13px; + + &--right { + justify-content: flex-end; + } +} + +/* 链接按钮 */ +.link-btn { + color: #fff; + cursor: pointer; + font-size: 13px; + text-decoration: none; + transition: all 0.2s; + border-bottom: 1px solid transparent; + + &:hover { + color: #fff; + border-bottom-color: rgba(255, 255, 255, 0.6); + } +} + +/* 切换模式(注册 / 返回登录) */ +.login-switch-mode { + text-align: center; + font-size: 13px; + color: rgba(255, 255, 255, 0.75); + margin-top: 16px; +} + .form-bottom { text-align: center; font-size: 12px; - margin-top: 20%; -} - -/* 账号选择弹窗样式 */ -.account-list { - .account-item { - display: flex; - justify-content: space-between; - align-items: center; - padding: 16px; - border-bottom: 1px solid #f0f0f0; - - &:last-child { - border-bottom: none; - } - - .account-info { - .account-name { - font-size: 16px; - font-weight: 500; - margin-bottom: 4px; - } - - .account-phone { - font-size: 14px; - color: #909399; - } - } - - &:hover { - background-color: #f5f7fa; - } - } + margin-top: 24px; + color: rgba(255, 255, 255, 0.7); } \ No newline at end of file diff --git a/src/components/Header/Header.vue b/src/components/Header/Header.vue index 93719ad..ebf9ac5 100644 --- a/src/components/Header/Header.vue +++ b/src/components/Header/Header.vue @@ -12,7 +12,8 @@ + + + + diff --git a/src/views/Redeem/Redeem.vue b/src/views/Redeem/Redeem.vue new file mode 100644 index 0000000..ee03235 --- /dev/null +++ b/src/views/Redeem/Redeem.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/src/views/login/Login.vue b/src/views/login/Login.vue index 47ae9da..165937c 100644 --- a/src/views/login/Login.vue +++ b/src/views/login/Login.vue @@ -15,248 +15,705 @@
-
-

欢迎来到元境

- 元启万象,境由心生 -
-
- - - - - \ No newline at end of file + diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 323c78a..78e43f7 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,5 +1,14 @@ /// +interface ImportMetaEnv { + readonly VITE_API_BASE_URL: string + readonly VITE_PLATFORM_NAME: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +} + declare module '*.vue' { import type { DefineComponent } from 'vue' const component: DefineComponent<{}, {}, any> diff --git a/vite.config.ts b/vite.config.ts index bb53fec..970aef5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -17,7 +17,7 @@ export default defineConfig(({ mode }) => { } }, server: { - host: 'localhost', + host: '0.0.0.0', port: 5173, // 配置代理解决跨域问题 proxy: { @@ -30,9 +30,18 @@ export default defineConfig(({ mode }) => { target: apiBaseURL, changeOrigin: true, rewrite: (path) => path.replace(/^\/token/, ''), - - } + }, + // 新增:元境 /v1 接口代理(auth/user 等) + '/v1': { + target: apiBaseURL, + changeOrigin: true, + }, + // 兼容旧的 /rbac 接口(图片/视频生成) + '/rbac': { + target: apiBaseURL, + changeOrigin: true, + }, } }, // optimizeDeps: {