feat(frontend): 登录页改深色科技底 + 左插画 / 右卡片
- LoginView 不再用 .bare-page / .bare-card,改为 .login-page(海军蓝渐变 + 淡网格 + 光晕, 装饰层 pointer-events: none,光斑用 overflow: hidden 裁掉避免撑出滚动条) - 左右分栏:左侧品牌区(标题 + 副标题 + 等距插画),右侧 400px 白卡 .login-card; ≤960px 隐藏品牌区、卡片回中间 - 新增 frontend/src/assets/login-hero.svg(手写等距插画:货架纸箱 / 摄像头 / 存证单据 / 扫码枪, 纯 SVG 无外链图片),带轻浮动动画,prefers-reduced-motion 下关闭 - 卡片标题跟着面板走(欢迎登录 / 注册账号 / 微信扫码登录),品牌名只留在左侧品牌区 - 登录/注册/扫码逻辑不变:.corner-toggle 折角切换、.panel-switch 同高布局、悬浮字段提示照旧 - 文档同步:README 的「登录页版面」约定改写为分栏结构,main.css 注释改为 .login-card 挂三角 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6f52613e5e
commit
2d117458a9
@ -93,8 +93,9 @@ packService/
|
||||
|
||||
- **登录 / 注册 / 找回密码 / 重置密码 / 扫码确认**这类「裸页」:居中卡片(`.bare-page` + `.bare-card`,宽 360px)。
|
||||
- ⚠️ 外层**不要用 `align-items: center`**:卡片比视口高时顶部会被裁掉且滚不上去 —— 用 `.bare-card { margin: auto }` 让它在容器里自己居中,`overflow-y: auto` 兜底;
|
||||
- ⚠️ **登录页是唯一例外**(见下一条):它自己画深色背景 + 左右分栏,用 `.login-page` / `.login-card`,不套 `.bare-page` / `.bare-card`;
|
||||
- **表单字段不用 `<label>`**(会把卡片撑高):字段名写进 `placeholder`,「必填 + 说明」用**悬浮气泡** `.field-plain > .tip`(`position: absolute` + `opacity/visibility`,hover 或聚焦时才显示,**不参与布局**,所以显不显示都不改变页面高度);
|
||||
- **登录页版面**:登录 ⇄ 注册用表单底部的**文字链接**互换(不放按钮);**扫码**面板由右上角三角形 `.corner-toggle` 切换,且**只在登录 ↔ 扫码之间**(**注册面板不显示三角**);三角形挂在**卡片**上(`.card.bare-card` 设 `position: relative` + `overflow: hidden`,让它的直角被卡片圆角裁掉),`.panel-switch.is-login` / `.is-wechat` 给 `padding-top: 18px` + `min-height: 282px`(卡片自身 padding 20 + 18 = 38,正好让开三角)→ 登录与扫码**同高、同位置**,来回切不跳;扫码面板只有二维码 + **「使用微信扫码登录」**一行字;
|
||||
- **登录页版面**:整页**深色科技底**(海军蓝渐变 + 淡网格 + 光晕,`LoginView` 的 `.login-page` / `.login-bg`,装饰层 `pointer-events: none`),**左右分栏**——左边品牌区(标题 + 副标题 + 等距插画 `frontend/src/assets/login-hero.svg`,宽度自适应、`max-width: 560px`),右边**白色卡片** `.login-card`(宽 400px,复用全局 `.card`);窄屏(`≤960px`)隐藏品牌区、卡片回中间;登录 ⇄ 注册用表单底部的**文字链接**互换(不放按钮);**扫码**面板由右上角三角形 `.corner-toggle` 切换,且**只在登录 ↔ 扫码之间**(**注册面板不显示三角**);三角形挂在**卡片**上(`.login-card` 设 `position: relative` + `overflow: hidden`,让它的直角被卡片圆角裁掉),`.panel-switch.is-login` / `.is-wechat` 给 `padding-top: 18px` + `min-height: 282px`(卡片自身 padding 20 + 18 = 38,正好让开三角)→ 登录与扫码**同高、同位置**,来回切不跳;卡片标题跟着面板走(`欢迎登录` / `注册账号` / `微信扫码登录`),品牌名只出现在左侧品牌区;扫码面板只有二维码 + **「使用微信扫码登录」**一行字;
|
||||
- 扫码面板**只放二维码 + 返回入口**,不要写说明文字;二维码是后端本地画的 SVG(登录页 `/api/wechat-gateway/qrcode.svg?state=…`,设备扫码登录 `/api/wechat/qrcode.svg?code=…`,**没有任何外链资源**);
|
||||
- 三角形只在自己那块折角区域可点(`clip-path` 把命中区一起裁了)→ 自动化点击要点在折角内(如 right-10 / top+10),点元素中心会落空;
|
||||
- **注册字段顺序固定**:用户名 → 邮箱 → 邮箱验证码(右侧「获取验证码」按钮,同一行 `.input-row`)→ 密码 → 重复密码;单列排布、没有步骤小标题、不收昵称/手机号;
|
||||
|
||||
102
frontend/src/assets/login-hero.svg
Normal file
102
frontend/src/assets/login-hero.svg
Normal file
@ -0,0 +1,102 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 520" fill="none" role="img">
|
||||
<defs>
|
||||
<radialGradient id="floorGlow" cx="50%" cy="50%" r="50%">
|
||||
<stop offset="0%" stop-color="#38bdf8" stop-opacity="0.30"/>
|
||||
<stop offset="60%" stop-color="#2563eb" stop-opacity="0.10"/>
|
||||
<stop offset="100%" stop-color="#0b1b3a" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<linearGradient id="camBody" x1="0" y1="0" x2="0.3" y2="1">
|
||||
<stop offset="0%" stop-color="#ffffff"/>
|
||||
<stop offset="55%" stop-color="#eaf1ff"/>
|
||||
<stop offset="100%" stop-color="#c7d8f6"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paper" x1="0" y1="0" x2="0.4" y2="1">
|
||||
<stop offset="0%" stop-color="#ffffff"/>
|
||||
<stop offset="100%" stop-color="#e3ecff"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="gunBody" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="#3b5480"/>
|
||||
<stop offset="100%" stop-color="#16233c"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="laser" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="#5eead4" stop-opacity="0"/>
|
||||
<stop offset="100%" stop-color="#34d399" stop-opacity="0.95"/>
|
||||
</linearGradient>
|
||||
<filter id="soft" x="-60%" y="-60%" width="220%" height="220%">
|
||||
<feGaussianBlur stdDeviation="7"/>
|
||||
</filter>
|
||||
<filter id="dotGlow" x="-80%" y="-80%" width="260%" height="260%">
|
||||
<feGaussianBlur stdDeviation="2.6" result="b"/>
|
||||
<feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
|
||||
</filter>
|
||||
</defs>
|
||||
<ellipse cx="336" cy="438" rx="215" ry="62" fill="url(#floorGlow)"/>
|
||||
<ellipse cx="336" cy="452" rx="150" ry="30" fill="#1d4ed8" opacity="0.20" filter="url(#soft)"/>
|
||||
<g stroke="#34d399" stroke-dasharray="5 7" stroke-linecap="round" fill="none">
|
||||
<path d="M188 196 C 236 232, 254 268, 288 292" stroke-width="2" opacity="0.55"/>
|
||||
<path d="M470 352 C 424 344, 396 322, 372 306" stroke-width="2" opacity="0.5"/>
|
||||
<path d="M452 176 C 424 196, 406 214, 388 232" stroke-width="2" opacity="0.45"/>
|
||||
</g>
|
||||
<g fill="#34d399" filter="url(#dotGlow)">
|
||||
<circle cx="188" cy="196" r="3.4"/><circle cx="372" cy="306" r="3.4"/><circle cx="452" cy="176" r="3.4"/>
|
||||
<circle cx="262" cy="264" r="2.4" opacity="0.8"/><circle cx="404" cy="330" r="2.4" opacity="0.8"/>
|
||||
</g>
|
||||
<g>
|
||||
<polygon points="336.00,264.00 341.33,267.08 336.00,270.16 330.67,267.08" fill="#6ea8ff"/><polygon points="341.33,267.08 336.00,270.16 336.00,438.16 341.33,435.08" fill="#3b78ec"/><polygon points="330.67,267.08 336.00,270.16 336.00,438.16 330.67,435.08" fill="#2a5cc9"/>
|
||||
<polygon points="336.00,429.76 485.37,516.00 418.45,554.64 269.07,468.40" fill="#3f7cf6"/><polygon points="485.37,516.00 418.45,554.64 418.45,560.24 485.37,521.60" fill="#2b5dd6"/><polygon points="269.07,468.40 418.45,554.64 418.45,560.24 269.07,474.00" fill="#1f47ab"/><polygon points="336.97,391.12 399.05,426.96 348.61,456.08 286.53,420.24" fill="#f4c98f"/><polygon points="399.05,426.96 348.61,456.08 348.61,504.24 399.05,475.12" fill="#dda86a"/><polygon points="286.53,420.24 348.61,456.08 348.61,504.24 286.53,468.40" fill="#c88f4e"/><polygon points="363.64,406.52 372.37,411.56 321.94,440.68 313.21,435.64" fill="#fff4e2" opacity="0.85"/><polygon points="385.47,451.17 362.19,464.61 362.19,476.17 385.47,462.73" fill="#efdcbe"/>
|
||||
<polygon points="336.00,373.76 485.37,460.00 418.45,498.64 269.07,412.40" fill="#3f7cf6"/><polygon points="485.37,460.00 418.45,498.64 418.45,504.24 485.37,465.60" fill="#2b5dd6"/><polygon points="269.07,412.40 418.45,498.64 418.45,504.24 269.07,418.00" fill="#1f47ab"/><polygon points="336.97,348.56 468.88,424.72 417.48,454.40 285.56,378.24" fill="#eec084"/><polygon points="468.88,424.72 417.48,454.40 417.48,489.12 468.88,459.44" fill="#d39c5c"/><polygon points="285.56,378.24 417.48,454.40 417.48,489.12 285.56,412.96" fill="#bb8043"/><polygon points="398.56,384.12 407.29,389.16 355.88,418.84 347.15,413.80" fill="#fff4e2" opacity="0.85"/><polygon points="455.30,444.36 431.05,458.36 431.05,466.70 455.30,452.70" fill="#efdcbe"/>
|
||||
<polygon points="336.00,317.76 485.37,404.00 418.45,442.64 269.07,356.40" fill="#3f7cf6"/><polygon points="485.37,404.00 418.45,442.64 418.45,448.24 485.37,409.60" fill="#2b5dd6"/><polygon points="269.07,356.40 418.45,442.64 418.45,448.24 269.07,362.00" fill="#1f47ab"/><polygon points="336.97,282.48 393.23,314.96 341.82,344.64 285.56,312.16" fill="#f7d3a0"/><polygon points="393.23,314.96 341.82,344.64 341.82,389.44 393.23,359.76" fill="#e0af74"/><polygon points="285.56,312.16 341.82,344.64 341.82,389.44 285.56,356.96" fill="#c89355"/><polygon points="360.73,296.20 369.46,301.24 318.06,330.92 309.33,325.88" fill="#fff4e2" opacity="0.85"/><polygon points="379.65,338.03 355.40,352.03 355.40,362.78 379.65,348.78" fill="#efdcbe"/>
|
||||
<polygon points="476.16,344.92 481.49,348.00 476.16,351.08 470.82,348.00" fill="#6ea8ff"/><polygon points="481.49,348.00 476.16,351.08 476.16,519.08 481.49,516.00" fill="#3b78ec"/><polygon points="470.82,348.00 476.16,351.08 476.16,519.08 470.82,516.00" fill="#2a5cc9"/>
|
||||
<polygon points="278.29,297.32 283.62,300.40 278.29,303.48 272.95,300.40" fill="#6ea8ff"/><polygon points="283.62,300.40 278.29,303.48 278.29,471.48 283.62,468.40" fill="#3b78ec"/><polygon points="272.95,300.40 278.29,303.48 278.29,471.48 272.95,468.40" fill="#2a5cc9"/>
|
||||
<polygon points="418.45,378.24 423.78,381.32 418.45,384.40 413.11,381.32" fill="#6ea8ff"/><polygon points="423.78,381.32 418.45,384.40 418.45,552.40 423.78,549.32" fill="#3b78ec"/><polygon points="413.11,381.32 418.45,384.40 418.45,552.40 413.11,549.32" fill="#2a5cc9"/>
|
||||
<polygon points="336.00,261.76 485.37,348.00 418.45,386.64 269.07,300.40" fill="#3f7cf6"/><polygon points="485.37,348.00 418.45,386.64 418.45,392.24 485.37,353.60" fill="#2b5dd6"/><polygon points="269.07,300.40 418.45,386.64 418.45,392.24 269.07,306.00" fill="#1f47ab"/>
|
||||
<polygon points="272.95,300.40 418.45,384.40 418.45,386.08 272.95,302.08" fill="#34d399" opacity="0.9"/>
|
||||
<polygon points="418.45,384.40 481.49,348.00 481.49,349.68 418.45,386.08" fill="#34d399" opacity="0.55"/>
|
||||
</g>
|
||||
<g transform="translate(96 96)">
|
||||
<ellipse cx="46" cy="42" rx="64" ry="58" fill="#1d4ed8" opacity="0.28" filter="url(#soft)"/>
|
||||
<path d="M18 30 L58 12" stroke="#94b8f2" stroke-width="7" stroke-linecap="round"/>
|
||||
<circle cx="18" cy="31" r="6" fill="#c7d8f6"/>
|
||||
<g transform="rotate(-14 60 44)">
|
||||
<rect x="26" y="24" width="76" height="42" rx="12" fill="url(#camBody)" stroke="#b9d0f4" stroke-width="1.2"/>
|
||||
<circle cx="96" cy="45" r="17" fill="#22335a"/>
|
||||
<circle cx="96" cy="45" r="12" fill="#0b1730"/>
|
||||
<circle cx="96" cy="45" r="7" fill="#38bdf8" opacity="0.85"/>
|
||||
<circle cx="91" cy="40" r="2.6" fill="#e0f2fe" opacity="0.9"/>
|
||||
<circle cx="34" cy="45" r="3.2" fill="#34d399"/>
|
||||
<rect x="38" y="34" width="16" height="3.4" rx="1.7" fill="#c2d4ef"/>
|
||||
<rect x="38" y="42" width="10" height="3" rx="1.5" fill="#d7e3f7"/>
|
||||
</g>
|
||||
</g>
|
||||
<g transform="translate(430 96) rotate(7)">
|
||||
<rect x="4" y="10" width="112" height="132" rx="14" fill="#1d4ed8" opacity="0.22" filter="url(#soft)"/>
|
||||
<rect x="0" y="0" width="112" height="132" rx="14" fill="url(#paper)" stroke="#cadbf7" stroke-width="1.2"/>
|
||||
<rect x="16" y="18" width="34" height="6" rx="3" fill="#8fb0e8"/>
|
||||
<rect x="16" y="34" width="80" height="5" rx="2.5" fill="#dbe6f8"/>
|
||||
<rect x="16" y="46" width="62" height="5" rx="2.5" fill="#dbe6f8"/>
|
||||
<rect x="16" y="64" width="80" height="34" rx="8" fill="#eef4ff"/>
|
||||
<path d="M24 90 L38 74 L50 86 L66 66" stroke="#34d399" stroke-width="3.4" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<rect x="16" y="108" width="48" height="5" rx="2.5" fill="#dbe6f8"/>
|
||||
<circle cx="95" cy="112" r="11" fill="#34d399"/>
|
||||
<path d="M89.5 112.5 L93.5 116.5 L101 108.5" stroke="#08381f" stroke-width="2.6" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</g>
|
||||
<g transform="translate(470 286) rotate(12)">
|
||||
<ellipse cx="22" cy="52" rx="56" ry="44" fill="#0ea5e9" opacity="0.20" filter="url(#soft)"/>
|
||||
<path d="M34 26 C 34 12, 46 4, 58 4 C 70 4, 82 12, 82 26 L 82 44 L 34 44 Z" fill="url(#gunBody)"/>
|
||||
<rect x="34" y="40" width="52" height="16" rx="7" fill="#22314f"/>
|
||||
<path d="M44 54 L 40 96 C 39 104, 45 108, 52 108 L 62 108 C 69 108, 74 103, 71 95 L 64 54 Z" fill="url(#gunBody)"/>
|
||||
<rect x="48" y="62" width="12" height="22" rx="6" fill="#0f1b31"/>
|
||||
<path d="M34 30 L 8 12" stroke="url(#laser)" stroke-width="3.6" stroke-linecap="round"/>
|
||||
<circle cx="8" cy="12" r="4" fill="#5eead4" filter="url(#dotGlow)"/>
|
||||
<rect x="78" y="16" width="10" height="4" rx="2" fill="#34d399"/>
|
||||
<path d="M50 22 L 70 22" stroke="#8fa6cc" stroke-width="2.6" stroke-linecap="round" opacity="0.75"/>
|
||||
</g>
|
||||
<g fill="#7dd3fc" opacity="0.75">
|
||||
<circle cx="232" cy="140" r="2.6"/>
|
||||
<circle cx="300" cy="112" r="2.0"/>
|
||||
<circle cx="556" cy="250" r="2.4"/>
|
||||
<circle cx="100" cy="300" r="2.2"/>
|
||||
<circle cx="588" cy="388" r="2.0"/>
|
||||
<circle cx="206" cy="372" r="1.8"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.7 KiB |
@ -144,7 +144,7 @@ select:focus {
|
||||
/* ---------------- 登录页的面板切换(账号密码 ↔ 微信扫码) ----------------
|
||||
· 面板都放在同一个 .panel-switch 容器里,靠 is-login / is-register / is-wechat 决定显示哪个;
|
||||
· 登录与扫码用 min-height 定成同高 → 切换时卡片高度/位置不变;
|
||||
· 右上角三角形 .corner-toggle 挂在**卡片**(.card.bare-card)上,不是在面板里:
|
||||
· 右上角三角形 .corner-toggle 挂在**卡片**(登录页的 `.login-card`)上,不是在面板里:
|
||||
它从卡片顶边算 38px 高,卡片自身 padding 20px,所以面板再留 18px(20+18=38)就不会被三角压住。 */
|
||||
.panel-switch {
|
||||
position: relative;
|
||||
|
||||
@ -3,7 +3,9 @@
|
||||
* 登录页:账号密码 / 注册(邮箱验证码)/ 微信扫码
|
||||
*
|
||||
* 版面按既定风格:
|
||||
* - 顶部「登录 / 注册」两个 tab 切换;
|
||||
* - 整页**深色科技背景**(海军蓝渐变 + 淡网格 + 光晕,`.login-bg` 只画背景、不接事件);
|
||||
* - 左侧品牌区(标题 + 副标题 + 等距插画 `assets/login-hero.svg`),右侧白色登录卡(`.login-card`);
|
||||
* - 窄屏(≤960px)隐藏品牌区,卡片回到居中;
|
||||
* - **扫码** 用右上角三角形 `.corner-toggle` 切换(挂在 `.panel-switch` 容器上,和输入框右边缘对齐);
|
||||
* - 登录与扫码面板定成**同高**,来回切卡片高度/位置不变;扫码面板只留二维码 + 返回入口,不放多余说明;
|
||||
* - 字段**不用 label**:字段名写进 placeholder,「必填 + 说明」用悬浮气泡(绝对定位,不占布局)。
|
||||
@ -12,6 +14,7 @@
|
||||
*/
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import heroUrl from '@/assets/login-hero.svg';
|
||||
import { api, ApiError } from '@/api/client';
|
||||
import { createWechatLoginQr, fetchWechatLoginStatus } from '@/api/web';
|
||||
import { setSession, type CurrentUser } from '@/composables/useAuth';
|
||||
@ -44,6 +47,11 @@ const paneClass = computed(() =>
|
||||
tab.value === 'wechat' ? 'is-wechat' : tab.value === 'register' ? 'is-register' : 'is-login',
|
||||
);
|
||||
|
||||
/** 卡片标题:品牌名已放到左侧品牌区,卡片里只留当前面板的名字 */
|
||||
const cardTitle = computed(() =>
|
||||
tab.value === 'wechat' ? '微信扫码登录' : tab.value === 'register' ? '注册账号' : '欢迎登录',
|
||||
);
|
||||
|
||||
function go() {
|
||||
const target = typeof route.query.redirect === 'string' ? route.query.redirect : '/';
|
||||
router.replace(target.startsWith('/') && !target.startsWith('//') ? target : '/');
|
||||
@ -228,108 +236,240 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bare-page">
|
||||
<div class="card bare-card">
|
||||
<div class="brand-line">云仓视频溯源系统</div>
|
||||
<div class="login-page">
|
||||
<!-- 纯装饰背景:渐变 + 网格 + 光晕,不接鼠标事件 -->
|
||||
<div class="login-bg" aria-hidden="true"></div>
|
||||
|
||||
<!-- 右上角三角形:挂在**卡片**上(`.card.bare-card` 是定位父级),只在「登录 ↔ 扫码」之间切;注册面板不显示它 -->
|
||||
<button
|
||||
v-if="tab === 'login'"
|
||||
class="corner-toggle"
|
||||
type="button"
|
||||
title="用微信扫码登录"
|
||||
aria-label="用微信扫码登录"
|
||||
@click="switchTab('wechat')"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h6v6H4V4zm10 0h6v6h-6V4zM4 14h6v6H4v-6zm9 1h2v2h-2v-2zm3 0h2v2h-2v-2zm-3 3h2v2h-2v-2zm3 0h2v2h-2v-2z"/></svg>
|
||||
</button>
|
||||
<button
|
||||
v-else-if="tab === 'wechat'"
|
||||
class="corner-toggle"
|
||||
type="button"
|
||||
title="返回账号密码登录"
|
||||
aria-label="返回账号密码登录"
|
||||
@click="switchTab('login')"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20h4v-4H4v4zm0-6h4v-4H4v4zm6 6h4v-4h-4v4zm-6-12h4V4H4v4zm6 0h4V4h-4v4zm6 12h4v-4h-4v4zm-5-1h8v2h-8v-2zm4-9h4V4h-4v4zm-9-1h10v2H6V9z"/></svg>
|
||||
</button>
|
||||
<div class="login-shell">
|
||||
<section class="brand-pane">
|
||||
<h1 class="brand-title">云仓视频溯源系统</h1>
|
||||
<p class="brand-sub">全链路打包视频存证,订单扫码溯源</p>
|
||||
<img class="brand-hero" :src="heroUrl" alt="仓库货架、摄像头与扫码设备示意图" />
|
||||
</section>
|
||||
|
||||
<div :class="['panel-switch', paneClass]">
|
||||
<!-- 账号密码 / 注册(两个面板用底部的文字链接互相切换,不放按钮) -->
|
||||
<div class="pane pane-account">
|
||||
<div v-if="error" class="alert alert-error">{{ error }}</div>
|
||||
<div v-if="ok" class="alert alert-ok">{{ ok }}</div>
|
||||
<section class="form-pane">
|
||||
<div class="card login-card">
|
||||
<h2 class="login-title">{{ cardTitle }}</h2>
|
||||
|
||||
<!-- 登录 -->
|
||||
<form v-if="tab === 'login'" @submit.prevent="doLogin">
|
||||
<div class="field-plain">
|
||||
<span class="tip">必填 · 用户名 / 手机号 / 邮箱都行</span>
|
||||
<input v-model="loginForm.account" autocomplete="username" placeholder="账号(用户名 / 手机号 / 邮箱)" />
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip">必填 · 密码</span>
|
||||
<input v-model="loginForm.password" type="password" autocomplete="current-password" placeholder="密码" />
|
||||
</div>
|
||||
<button class="btn btn-block" :disabled="busy">登录</button>
|
||||
<p class="hint center">
|
||||
<RouterLink :to="{ name: 'forgot' }">忘记密码?</RouterLink>
|
||||
<span class="sep">·</span>
|
||||
<a href="#" @click.prevent="switchTab('register')">注册账号</a>
|
||||
</p>
|
||||
</form>
|
||||
<!-- 右上角三角形:挂在**卡片**上(`.login-card` 是定位父级),只在「登录 ↔ 扫码」之间切;注册面板不显示它 -->
|
||||
<button
|
||||
v-if="tab === 'login'"
|
||||
class="corner-toggle"
|
||||
type="button"
|
||||
title="用微信扫码登录"
|
||||
aria-label="用微信扫码登录"
|
||||
@click="switchTab('wechat')"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h6v6H4V4zm10 0h6v6h-6V4zM4 14h6v6H4v-6zm9 1h2v2h-2v-2zm3 0h2v2h-2v-2zm-3 3h2v2h-2v-2zm3 0h2v2h-2v-2z"/></svg>
|
||||
</button>
|
||||
<button
|
||||
v-else-if="tab === 'wechat'"
|
||||
class="corner-toggle"
|
||||
type="button"
|
||||
title="返回账号密码登录"
|
||||
aria-label="返回账号密码登录"
|
||||
@click="switchTab('login')"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20h4v-4H4v4zm0-6h4v-4H4v4zm6 6h4v-4h-4v4zm-6-12h4V4H4v4zm6 0h4V4h-4v4zm6 12h4v-4h-4v4zm-5-1h8v2h-8v-2zm4-9h4V4h-4v4zm-9-1h10v2H6V9z"/></svg>
|
||||
</button>
|
||||
|
||||
<!-- 注册(字段顺序:用户名 → 邮箱 → 邮箱验证码 → 密码 → 重复密码) -->
|
||||
<form v-else @submit.prevent="doRegister">
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 3-32 位字母、数字或下划线</span>
|
||||
<input v-model="registerForm.username" autocomplete="username" placeholder="用户名" />
|
||||
<div :class="['panel-switch', paneClass]">
|
||||
<!-- 账号密码 / 注册(两个面板用底部的文字链接互相切换,不放按钮) -->
|
||||
<div class="pane pane-account">
|
||||
<div v-if="error" class="alert alert-error">{{ error }}</div>
|
||||
<div v-if="ok" class="alert alert-ok">{{ ok }}</div>
|
||||
|
||||
<!-- 登录 -->
|
||||
<form v-if="tab === 'login'" @submit.prevent="doLogin">
|
||||
<div class="field-plain">
|
||||
<span class="tip">必填 · 用户名 / 手机号 / 邮箱都行</span>
|
||||
<input v-model="loginForm.account" autocomplete="username" placeholder="账号(用户名 / 手机号 / 邮箱)" />
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip">必填 · 密码</span>
|
||||
<input v-model="loginForm.password" type="password" autocomplete="current-password" placeholder="密码" />
|
||||
</div>
|
||||
<button class="btn btn-block" :disabled="busy">登录</button>
|
||||
<p class="hint center">
|
||||
<RouterLink :to="{ name: 'forgot' }">忘记密码?</RouterLink>
|
||||
<span class="sep">·</span>
|
||||
<a href="#" @click.prevent="switchTab('register')">注册账号</a>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<!-- 注册(字段顺序:用户名 → 邮箱 → 邮箱验证码 → 密码 → 重复密码) -->
|
||||
<form v-else @submit.prevent="doRegister">
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 3-32 位字母、数字或下划线</span>
|
||||
<input v-model="registerForm.username" autocomplete="username" placeholder="用户名" />
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 用于接收验证码,也能当登录账号</span>
|
||||
<input v-model="registerForm.email" type="email" autocomplete="email" placeholder="邮箱" />
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 邮箱收到的 6 位验证码</span>
|
||||
<div class="input-row">
|
||||
<input v-model="registerForm.code" inputmode="numeric" placeholder="邮箱验证码" />
|
||||
<button class="btn btn-ghost" type="button" :disabled="busy" @click="sendCode">
|
||||
{{ codeSent ? '重新发送' : '获取验证码' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 至少 6 位</span>
|
||||
<input v-model="registerForm.password" type="password" autocomplete="new-password" placeholder="密码" />
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 再输一次密码</span>
|
||||
<input v-model="registerForm.confirmPassword" type="password" autocomplete="new-password" placeholder="重复密码" />
|
||||
</div>
|
||||
<button class="btn btn-block" :disabled="busy">注册并登录</button>
|
||||
<p class="hint center">
|
||||
已有账号?<a href="#" @click.prevent="switchTab('login')">直接登录</a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 用于接收验证码,也能当登录账号</span>
|
||||
<input v-model="registerForm.email" type="email" autocomplete="email" placeholder="邮箱" />
|
||||
|
||||
<!-- 扫码(二维码下方就一行:使用微信扫码登录) -->
|
||||
<div class="pane pane-wechat">
|
||||
<img v-if="qrUrl" class="qr-img" :src="qrUrl" width="160" height="160" alt="登录二维码" />
|
||||
<p v-else class="hint center">二维码生成中…</p>
|
||||
<p class="hint center qr-tip">使用微信扫码登录</p>
|
||||
<p v-if="qrTip" class="hint center">{{ qrTip }}</p>
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 邮箱收到的 6 位验证码</span>
|
||||
<div class="input-row">
|
||||
<input v-model="registerForm.code" inputmode="numeric" placeholder="邮箱验证码" />
|
||||
<button class="btn btn-ghost" type="button" :disabled="busy" @click="sendCode">
|
||||
{{ codeSent ? '重新发送' : '获取验证码' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 至少 6 位</span>
|
||||
<input v-model="registerForm.password" type="password" autocomplete="new-password" placeholder="密码" />
|
||||
</div>
|
||||
<div class="field-plain">
|
||||
<span class="tip"><span class="required">必填</span> · 再输一次密码</span>
|
||||
<input v-model="registerForm.confirmPassword" type="password" autocomplete="new-password" placeholder="重复密码" />
|
||||
</div>
|
||||
<button class="btn btn-block" :disabled="busy">注册并登录</button>
|
||||
<p class="hint center">
|
||||
已有账号?<a href="#" @click.prevent="switchTab('login')">直接登录</a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 扫码(二维码下方就一行:使用微信扫码登录) -->
|
||||
<div class="pane pane-wechat">
|
||||
<img v-if="qrUrl" class="qr-img" :src="qrUrl" width="160" height="160" alt="登录二维码" />
|
||||
<p v-else class="hint center">二维码生成中…</p>
|
||||
<p class="hint center qr-tip">使用微信扫码登录</p>
|
||||
<p v-if="qrTip" class="hint center">{{ qrTip }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.brand-line {
|
||||
/* ---------------- 整页:深色科技底 + 左「品牌区」/ 右「登录卡」 ---------------- */
|
||||
.login-page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
min-height: 100%;
|
||||
overflow: hidden auto; /* 卡片比视口高时纵向滚动,横向不要出滚动条 */
|
||||
color: #e7efff;
|
||||
background:
|
||||
radial-gradient(900px 640px at 16% 20%, rgba(37, 99, 235, 0.42), transparent 62%),
|
||||
radial-gradient(760px 560px at 84% 80%, rgba(14, 165, 233, 0.22), transparent 60%),
|
||||
radial-gradient(520px 420px at 58% 2%, rgba(52, 211, 153, 0.1), transparent 68%),
|
||||
linear-gradient(158deg, #0d2149 0%, #0a1731 48%, #061020 100%);
|
||||
}
|
||||
|
||||
/* 淡网格 + 光斑:纯装饰,不吃鼠标事件 */
|
||||
.login-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden; /* 光斑故意超出边界,裁掉,别撑出滚动条 */
|
||||
pointer-events: none;
|
||||
background-image:
|
||||
linear-gradient(rgba(125, 173, 255, 0.07) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(125, 173, 255, 0.07) 1px, transparent 1px);
|
||||
background-size: 56px 56px;
|
||||
-webkit-mask-image: radial-gradient(120% 120% at 50% 45%, #000 5%, transparent 78%);
|
||||
mask-image: radial-gradient(120% 120% at 50% 45%, #000 5%, transparent 78%);
|
||||
}
|
||||
|
||||
.login-bg::before,
|
||||
.login-bg::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 460px;
|
||||
height: 460px;
|
||||
border-radius: 50%;
|
||||
filter: blur(8px);
|
||||
}
|
||||
|
||||
.login-bg::before {
|
||||
top: -180px;
|
||||
right: -130px;
|
||||
background: radial-gradient(circle, rgba(56, 189, 248, 0.2), transparent 68%);
|
||||
}
|
||||
|
||||
.login-bg::after {
|
||||
bottom: -220px;
|
||||
left: -150px;
|
||||
background: radial-gradient(circle, rgba(52, 211, 153, 0.14), transparent 68%);
|
||||
}
|
||||
|
||||
.login-shell {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 48px;
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
margin: auto; /* 内容比视口矮时整体垂直居中 */
|
||||
padding: 48px 56px;
|
||||
}
|
||||
|
||||
.brand-pane {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.brand-title {
|
||||
margin: 0 0 10px;
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
color: #f2f7ff;
|
||||
text-shadow: 0 6px 24px rgba(56, 189, 248, 0.35);
|
||||
}
|
||||
|
||||
.brand-sub {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
color: #9fb8df;
|
||||
}
|
||||
|
||||
.brand-hero {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 560px;
|
||||
margin-top: 6px;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
animation: hero-float 9s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes hero-float {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
}
|
||||
|
||||
.form-pane {
|
||||
flex: 0 0 auto;
|
||||
width: 400px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* 卡片复用全局 .card(内边距 / 圆角 / 边框),这里只补定位与阴影 */
|
||||
.login-card {
|
||||
position: relative; /* 右上角三角的定位父级 */
|
||||
overflow: hidden; /* 让三角的直角被卡片圆角裁掉 */
|
||||
border-color: rgba(255, 255, 255, 0.65);
|
||||
border-radius: 16px;
|
||||
box-shadow:
|
||||
0 26px 60px rgba(3, 10, 26, 0.55),
|
||||
0 0 0 1px rgba(120, 170, 255, 0.16);
|
||||
}
|
||||
|
||||
.login-title {
|
||||
margin: 0 0 14px;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn-block {
|
||||
@ -365,4 +505,23 @@ onBeforeUnmount(() => {
|
||||
.qr-tip {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* 窄屏:品牌区太占地方,直接隐藏,卡片回中间 */
|
||||
@media (max-width: 960px) {
|
||||
.login-shell {
|
||||
justify-content: center;
|
||||
gap: 0;
|
||||
padding: 32px 20px;
|
||||
}
|
||||
|
||||
.brand-pane {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.brand-hero {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user