From 21a6cd97555f5440a04dcb9dfb01af63e8103d04 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 11 Jun 2026 10:38:23 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=8F=82=E8=B5=9B=E5=92=A8=E8=AF=A2?= =?UTF-8?q?=E7=94=B5=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/participantContact.ts | 16 +++++++++++++ src/styles/login-page-overrides.css | 31 +++++++++++++++++++++++++ src/views/ApplyFormView.vue | 35 +++++++++++++++++++++++++++++ src/views/LoginView.vue | 11 +++++++++ vite.config.ts | 2 +- 5 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 src/config/participantContact.ts diff --git a/src/config/participantContact.ts b/src/config/participantContact.ts new file mode 100644 index 0000000..325fa1d --- /dev/null +++ b/src/config/participantContact.ts @@ -0,0 +1,16 @@ +export interface ConsultPhone { + display: string + tel: string +} + +/** 选手端登录页 / 报名页展示的参赛咨询电话 */ +export const entryConsultPhones: ConsultPhone[] = [ + { display: '0512-66969167', tel: '051266969167' }, + { display: '0512-66969172', tel: '051266969172' }, +] + +/** 选手端登录页 / 报名页展示的技术咨询电话 */ +export const techConsultPhone: ConsultPhone = { + display: '18626298655', + tel: '18626298655', +} diff --git a/src/styles/login-page-overrides.css b/src/styles/login-page-overrides.css index 281d319..fee41e0 100644 --- a/src/styles/login-page-overrides.css +++ b/src/styles/login-page-overrides.css @@ -79,3 +79,34 @@ body.login-page-wls .login-page-wls__input.login-page-wls__input--error:focus { body.login-page-wls .login-page-wls__slogan.login-page-wls__slogan--error { color: #052d62; } + +body.login-page-wls .login-page-wls__contact { + display: grid; + gap: 0.45rem; + margin-top: 0.95rem; + padding-top: 0.9rem; + border-top: 1px solid rgba(5, 45, 98, 0.14); + color: #314158; + font-size: 0.92rem; + line-height: 1.35; +} + +body.login-page-wls .login-page-wls__contact-entry { + display: flex; + flex-wrap: wrap; + align-items: center; +} + +body.login-page-wls .login-page-wls__contact-label { + color: inherit; +} + +body.login-page-wls .login-page-wls__contact a { + color: inherit; + text-decoration: none; +} + +body.login-page-wls .login-page-wls__contact a:hover { + color: #052d62; + text-decoration: underline; +} diff --git a/src/views/ApplyFormView.vue b/src/views/ApplyFormView.vue index 6e3aa5e..6c8c330 100644 --- a/src/views/ApplyFormView.vue +++ b/src/views/ApplyFormView.vue @@ -22,6 +22,7 @@ import { participantApplyPageTitle, type BrandingForm, } from '../utils/competitionBranding' +import { entryConsultPhones, techConsultPhone } from '../config/participantContact' import { CONTEST_DEFAULT_FILE_EXTENSIONS, normalizeSignupSchema, @@ -1367,6 +1368,15 @@ onMounted(() => { {{ applicationStatusBody }} +
+ 参赛咨询: + {{ phone.display }} + 技术咨询:{{ techConsultPhone.display }} +
{ color: #42664f; } +.apply-contact-panel { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.45rem 1rem; + margin-bottom: 1rem; + padding: 0.72rem 0.9rem; + border: 1px solid #e4e9ef; + border-radius: 8px; + background: #fbfcfe; + color: #425466; + font-size: 0.9rem; + line-height: 1.4; +} + +.apply-contact-panel a { + color: inherit; + text-decoration: none; +} + +.apply-contact-panel a:hover { + color: #052d62; + text-decoration: underline; +} + .track-selected-note { display: block; margin-top: 0.35rem; diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index 20c5f84..3a72fd9 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -15,6 +15,7 @@ import { type BrandingForm, } from '../utils/competitionBranding' import { readPublicSourceCodeForAttribution } from '../utils/publicSource' +import { entryConsultPhones, techConsultPhone } from '../config/participantContact' import '../styles/prototype-styles.css' import '../styles/login-page-overrides.css' @@ -464,6 +465,16 @@ onUnmounted(() => { +
+ + 技术咨询:{{ techConsultPhone.display }} +

{{ apiHint }}

diff --git a/vite.config.ts b/vite.config.ts index 20f7f5e..d2c17dc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,7 +8,7 @@ import { viteStaticCopy } from 'vite-plugin-static-copy' import type { Plugin } from 'vite' const __dirname = path.dirname(fileURLToPath(import.meta.url)) -const laravelPublicAdmin = path.resolve(__dirname, '../backend/public/admin') +const laravelPublicAdmin = path.resolve(__dirname, '../xxfcyds2026-backend/public/admin') function spaHistoryFallback(): Plugin { const middleware = history({ index: '/index.html' }) From 6ae4048c721aee337f66e74fc933c45561827041 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 11 Jun 2026 11:00:40 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/admin/auth.ts | 22 +++- src/api/admin/types.ts | 6 + src/config/api.ts | 30 +++++ src/layouts/AdminLayout.vue | 171 ++++++++++++++++++++++++++++- src/router/index.ts | 17 ++- src/stores/adminAuth.ts | 57 +++++++++- src/views/admin/AdminLoginView.vue | 32 +++--- vite.config.ts | 4 +- 8 files changed, 313 insertions(+), 26 deletions(-) diff --git a/src/api/admin/auth.ts b/src/api/admin/auth.ts index ceb4147..8f4c083 100644 --- a/src/api/admin/auth.ts +++ b/src/api/admin/auth.ts @@ -1,5 +1,5 @@ import axios from 'axios' -import type { AdminLoginBody, AdminLoginResult } from './types' +import type { AdminChangePasswordBody, AdminLoginBody, AdminLoginResult } from './types' import { adminHttp } from './http' /** POST /auth/login — 与 `routes/api.php` 中 `v1/admin` 分组一致 */ @@ -41,3 +41,23 @@ function unwrapLogin(raw: unknown): AdminLoginResult { } throw new Error('登录响应无效') } + +/** PUT /auth/password */ +export async function changeAdminPassword(body: AdminChangePasswordBody): Promise { + try { + await adminHttp.put('/auth/password', body) + } catch (e) { + if (axios.isAxiosError(e)) { + const raw = e.response?.data + const d = raw && typeof raw === 'object' ? (raw as Record) : {} + const message = + (typeof d.message === 'string' ? d.message : '') || + (d.errors && typeof d.errors === 'object' + ? Object.values(d.errors as Record).flat().join('\n') + : '') || + e.message + throw new Error(message || '修改密码失败') + } + throw e + } +} diff --git a/src/api/admin/types.ts b/src/api/admin/types.ts index 8789a2a..26154d0 100644 --- a/src/api/admin/types.ts +++ b/src/api/admin/types.ts @@ -352,3 +352,9 @@ export interface AdminLoginResult { token: string user?: { id: number; name?: string; username?: string } } + +export interface AdminChangePasswordBody { + current_password: string + password: string + password_confirmation: string +} diff --git a/src/config/api.ts b/src/config/api.ts index af0f08e..4562d30 100644 --- a/src/config/api.ts +++ b/src/config/api.ts @@ -19,6 +19,9 @@ export const PARTICIPANT_COMPETITION_SLUG_KEY = 'cxxfds_participant_competition_ /** 管理端 Bearer Token(与选手端分离) */ export const ADMIN_TOKEN_KEY = 'cxxfds_admin_token' as const +/** 管理端登录用户摘要(username / name,用于顶栏展示) */ +export const ADMIN_USER_KEY = 'cxxfds_admin_user' as const + /** 当前选中赛事(顶栏切换器),仅存 id */ export const ADMIN_COMPETITION_ID_KEY = 'cxxfds_admin_competition_id' as const @@ -55,6 +58,33 @@ export function pathnameForAdminLogin(): string { return `${prefix}/admin/login` } +/** + * 本地开发(Vite base=/)时,将生产构建的 pathname(/admin/admin/...)折叠为 /admin/..., + * 避免登录后 redirect 落到无匹配路由的地址。 + */ +export function collapseDevAdminPath(path: string): string { + const baseUrl = import.meta.env.BASE_URL || '/' + if (baseUrl !== '/') return path + if (!path.startsWith('/admin/admin')) return path + const collapsed = path.replace(/^\/admin\/admin(?=\/|$)/, '/admin') + return collapsed || '/admin' +} + +/** 登录后 redirect 参数规整(去掉生产 base 前缀,并折叠 dev 下的 /admin/admin) */ +export function normalizeAdminRedirectPath(path: string): string { + const trimmed = path.trim() + if (!trimmed) return '' + + const baseUrl = import.meta.env.BASE_URL || '/' + const basePrefix = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl + + if (basePrefix && basePrefix !== '/' && trimmed.startsWith(`${basePrefix}/admin`)) { + return collapseDevAdminPath(trimmed.slice(basePrefix.length) || '/admin') + } + + return collapseDevAdminPath(trimmed) +} + /** 后端 API 根地址(无尾部斜杠)。本地开发/预览默认空字符串,走 Vite 代理的 `/api`,避免跨域。 */ export function getApiBase(): string { const fromEnv = import.meta.env.VITE_API_BASE as string | undefined diff --git a/src/layouts/AdminLayout.vue b/src/layouts/AdminLayout.vue index 726d52b..aa19fd5 100644 --- a/src/layouts/AdminLayout.vue +++ b/src/layouts/AdminLayout.vue @@ -1,9 +1,10 @@