Просмотр исходного кода

feat(login): 登录页按设计稿重构 —— Token 登录 / 灰底输入框 / 内嵌验证码按钮

- 快捷登录改为 Token 登录,文案与占位符同步
- 密码与 Token 输入框移除眼睛按钮
- 输入框统一灰底无边框 12px 圆角 56px 高(外层 shell,不改底座)
- 获取验证码改为输入框内右侧纯文字按钮
- 去掉「登录遇到问题?」(两端)
- 协议区改为「登录即代表同意」,agreed 默认 true
- 记录 18182795512 账号注销(会话删除 + 脱敏 + isDeleted)

Co-Authored-By: Claude Code <noreply@anthropic.com>
Huccct 6 часов назад
Родитель
Сommit
a234ee2a1b

+ 11 - 0
docs/00-tracking/操作追踪.md

@@ -10644,3 +10644,14 @@ Call log:
   - **踩坑**:CSS 注释里写反引号会把 `styles: [` 模板字符串提前闭合,导致「Failed to resolve styles」编译失败 —— 样式注释内禁用反引号。
   - 账号确认:18182795512 账号**未注销**,名下活跃容器 0,可重新试用/开通。
   - LiveService 两条测试失败经单跑确认(26/26 通过)系并行偶发,非功能问题。
+
+- 2026-12-04 02:00:00+08:00:**登录页按设计稿重构 + 账号注销**
+  - 账号:18182795512(wXuLfZrkgp)**已注销**——删除全部 _Session(立即无法登录)、清空业务数据、手机号脱敏为 `deleted-18182795512`、用户名改 `deleted_wXuLfZrkgp`、`isDeleted=true`,原手机号保留在 `deletedMobile` 便于回溯。
+  - 登录页(用户逐轮反馈):
+    - 「快捷登录」→「**Token 登录**」;标题/说明/占位符同步(「粘贴 Token,以 r: 开头」)
+    - 密码框、Token 框的**眼睛按钮全部移除**(用户裁决)
+    - 输入框改为参考稿样式:**灰底、无边框、12px 圆角、56px 高**(外层 `.input-shell` 包裹,不改底座)
+    - 「获取验证码」改为**无边框纯文字按钮**,内嵌在验证码输入框右侧(44px 点击区、悬停下划线)
+    - 去掉「**登录遇到问题?**」(两端)
+    - 协议区由「勾选框 + 已阅读并同意」改为「**登录即代表同意 用户协议 和 隐私政策**」,`agreed` 默认 true
+  - 说明:测试用例尚未同步(用户明确「不要测试」),下次集中清理。

+ 14 - 7
src/app/components/domain/login-assistance/login-assistance.ts

@@ -8,11 +8,17 @@ import { UiButton, UiCheckbox, UiModal } from '../../../ui';
   changeDetection: ChangeDetectionStrategy.OnPush,
   imports: [UiButton, UiCheckbox, UiModal],
   template: `
-    <div class="agreement">
-      <ui-checkbox [checked]="flow().agreed()" [disabled]="flow().working()"
-        (checkedChange)="flow().agreed.set($event)"><span class="agreement-label">已阅读并同意</span></ui-checkbox>
-      <span><button type="button" [disabled]="flow().working()" (click)="flow().openPanel('terms')">服务协议</button> 和 <button type="button" [disabled]="flow().working()" (click)="flow().openPanel('privacy')">隐私政策</button></span>
-    </div>
+    <!--
+      协议提示(2026-12-04 参照设计稿):由「勾选框 + 已阅读并同意」改为
+      「登录即代表同意 用户协议 和 隐私政策」,与参考稿一致;勾选态仍由 flow.agreed 维护,
+      登录前由 flow 自动置为同意,用户点协议链接仍可查看正文。
+    -->
+    <p class="agreement">
+      登录即代表同意
+      <button type="button" [disabled]="flow().working()" (click)="flow().openPanel('terms')">用户协议</button>
+      和
+      <button type="button" [disabled]="flow().working()" (click)="flow().openPanel('privacy')">隐私政策</button>
+    </p>
     <ui-modal [open]="flow().panel() !== null" [title]="title()" size="sm"
       (openChange)="!$event && flow().dismissPanel()">
       @if (flow().panel() === 'agreement') {
@@ -50,11 +56,12 @@ import { UiButton, UiCheckbox, UiModal } from '../../../ui';
       align-items: center;
       justify-content: center;
       gap: 0 var(--sp-1);
-      margin-top: 0;
+      margin: 0;
       padding-top: var(--sp-1);
       color: var(--muted);
-      font-size: var(--fs-13);
+      font-size: var(--fs-12);
       line-height: 1.7;
+      text-align: center;
     }
     .agreement span { min-width: 0; }
     .agreement-label { color: var(--muted); }

+ 6 - 1
src/app/core/login-flow.service.ts

@@ -26,7 +26,12 @@ export class LoginFlowService {
   readonly token = signal('');
   readonly showPassword = signal(false);
   readonly showToken = signal(false);
-  readonly agreed = signal(false);
+  /**
+   * 协议同意态(2026-12-04 用户裁决:界面改为「登录即代表同意 用户协议 和 隐私政策」)。
+   * 搭配界面文案,默认为 true —— 登录/发送验证码时不再弹协议确认框;
+   * 协议正文仍可通过链接打开查看。原实现要求用户先勾选,与「登录即代表同意」矛盾。
+   */
+  readonly agreed = signal(true);
   readonly error = signal<string | null>(null);
   readonly notice = signal<string | null>(null);
   readonly busy = signal(false);

+ 1 - 1
src/app/mobile/pages/login/login.ts

@@ -78,7 +78,7 @@ const BACK_HANDLER_ID = 'mobile-login';
             <button type="button" class="m-more" [disabled]="flow.working()" (click)="flow.switchStage('phone')">{{ flow.stage() === 'code' ? '返回修改手机号' : '使用手机验证码登录' }}</button>
           }
         </div>
-        <button type="button" class="m-more m-login-help" [disabled]="flow.working()" (click)="flow.openPanel('help')">登录遇到问题?</button>
+        <!-- 2026-12-04 用户裁决:去掉「登录遇到问题?」 -->
       </form>
     </main>
   `,

+ 13 - 34
src/app/pages/login/login-flow-pages.spec.ts

@@ -53,12 +53,13 @@ for (const page of pages) {
       expect(input('phone').getAttribute('autocomplete')).toBe('tel-national');
     });
 
-    it('账号密码页标题与说明正确,显隐不修改密码', () => {
+    it('账号密码页标题与说明正确,密码框不再有显隐按钮(2026-12-04 用户裁决)', () => {
       flow.switchStage('password'); render(); type('username', 'account'); type('password', ' pass word ');
       expect(fixture.nativeElement.textContent).toContain('账号密码登录');
       expect(input('password').type).toBe('password');
-      (fixture.nativeElement.querySelector('[aria-label="显示密码"]') as HTMLButtonElement).click(); render();
-      expect(input('password').type).toBe('text'); expect(flow.password()).toBe(' pass word ');
+      /* 用户裁决:密码/Token 输入框后面都不要眼睛按钮,避免误点与视觉杂乱 */
+      expect(fixture.nativeElement.querySelector('[aria-label="显示密码"]')).toBeNull();
+      expect(flow.password()).toBe(' pass word ');
       expect(input('password').autocomplete).toBe('current-password');
     });
 
@@ -71,41 +72,29 @@ for (const page of pages) {
     it('凭证默认隐藏,可显示;切换后清空', () => {
       flow.switchStage('token'); render(); type('token', 'r:visible-only-on-request');
       expect(input('token').type).toBe('password');
-      (fixture.nativeElement.querySelector('[aria-label="显示登录凭证"]') as HTMLButtonElement).click(); render();
-      expect(input('token').type).toBe('text');
+      /* 2026-12-04 用户裁决:Token 输入框同样不提供显隐按钮 */
+      expect(fixture.nativeElement.querySelector('[aria-label="显示登录凭证"]')).toBeNull();
       flow.switchStage('phone'); render(); expect(flow.token()).toBe(''); expect(flow.showToken()).toBeFalse();
     });
 
-    it('点协议有明确反馈,返回不丢输入,不冒充正式正文', () => {
-      type('phone', '13800000000'); button('服务协议').click(); render();
+    it('协议链接可打开正文,返回不丢输入(2026-12-04 改为「登录即代表同意」)', () => {
+      type('phone', '13800000000'); button('用户协议').click(); render();
       expect(fixture.nativeElement.querySelector('[role="dialog"]')).not.toBeNull();
       expect(fixture.nativeElement.textContent).toContain('正式正文暂未提供');
       button('返回').click(); render(); expect(input('phone').value).toBe('13800000000');
     });
 
-    it('协议确认后继续原发送动作,输入验证码可用', async () => {
+    it('登录即代表同意:发送验证码不再弹协议确认', async () => {
       type('phone', '13800000000'); await flow.sendCode(); render();
-      button('同意并继续').click(); await settle(); render();
+      expect(flow.panel()).toBeNull();
+      await settle(); render();
       expect(api.sendMobileCode).toHaveBeenCalledOnceWith('13800000000');
       expect(input('code')).not.toBeNull(); expect(input('code').autocomplete).toBe('one-time-code');
       expect(flow.countdown()).toBe(60);
     });
 
-    it('正文X关闭取消整个协议确认,可再次打开并继续', async () => {
-      type('phone', '13800000000'); await flow.sendCode(); render();
-      button('《服务协议》').click(); render();
-      await settle(); render();
-      const dialog = fixture.nativeElement.querySelector('[role="dialog"]') as HTMLElement;
-      expect(dialog.contains(document.activeElement)).toBeTrue();
-      (fixture.nativeElement.querySelector('[aria-label="关闭"]') as HTMLButtonElement).click(); render();
-      expect(flow.panel()).toBeNull(); expect(flow.agreed()).toBeFalse();
-      await flow.sendCode(); render(); expect(flow.panel()).toBe('agreement');
-      expect(fixture.nativeElement.querySelector('[role="dialog"]')).not.toBeNull();
-      expect(api.sendMobileCode).not.toHaveBeenCalled();
-    });
-
-    it('原生协议复选框的选择同步到共享流程', () => {
-      (fixture.nativeElement.querySelector('input[type="checkbox"]') as HTMLInputElement).click(); render();
+    it('协议默认即同意,未点链接也能直接登录', async () => {
+      flow.switchStage('password'); render(); type('username', 'account'); type('password', 'password');
       expect(flow.agreed()).toBeTrue();
     });
 
@@ -117,17 +106,7 @@ for (const page of pages) {
       expect(router.navigate).toHaveBeenCalledTimes(1);
     });
 
-    it('点“已阅读并同意”文字即可勾选,勾选区达到触控下限', () => {
-      const label = fixture.nativeElement.querySelector('.agreement ui-checkbox > label') as HTMLLabelElement;
-      expect(label.textContent).toContain('已阅读并同意');
-      (label.querySelector('.agreement-label') as HTMLElement).click(); render();
-      expect(flow.agreed()).toBeTrue();
-    });
 
-    it('登录帮助可打开、关闭,不进行请求', () => {
-      button('登录遇到问题?').click(); render(); expect(fixture.nativeElement.textContent).toContain('收不到验证码');
-      button('返回').click(); render(); expect(flow.panel()).toBeNull(); expect(api.sendMobileCode).not.toHaveBeenCalled();
-    });
   });
 }
 

+ 120 - 25
src/app/pages/login/login.ts

@@ -122,8 +122,8 @@ type LoginMethod = 'password' | 'mobile' | 'token';
     <ng-template #form>
       <header class="form-head">
         <p class="form-kicker">进入工作空间</p>
-        <h2>{{ method() === 'mobile' ? '欢迎回来' : method() === 'password' ? '账号密码登录' : '从已登录设备登录' }}</h2>
-        <p>{{ method() === 'mobile' ? '用手机号验证码继续你的工作' : method() === 'password' ? '使用已有账号和密码继续' : '粘贴从已登录设备复制的登录凭证' }}</p>
+        <h2>{{ method() === 'mobile' ? '欢迎回来' : method() === 'password' ? '账号密码登录' : 'Token 登录' }}</h2>
+        <p>{{ method() === 'mobile' ? '用手机号验证码继续你的工作' : method() === 'password' ? '使用已有账号和密码继续' : '粘贴以 r: 开头的登录 Token' }}</p>
       </header>
 
       <div class="mode-tabs">
@@ -152,7 +152,7 @@ type LoginMethod = 'password' | 'mobile' | 'token';
           [attr.aria-pressed]="method() === 'token'"
           (click)="switchMethod('token')"
         >
-          快捷登录
+          Token 登录
         </button>
       </div>
 
@@ -163,48 +163,53 @@ type LoginMethod = 'password' | 'mobile' | 'token';
         -->
         <label class="field">
           <span class="field-label">账号</span>
+          <div class="input-shell">
           <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="username"
             placeholder="请输入账号"
             [value]="username()"
             [invalid]="!!error() && !usernameValid()"
             (valueChange)="onUsername($event)"
           />
+        </div>
         </label>
         <label class="field">
           <span class="field-label">密码</span>
-          <div class="credential-row">
-            <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="password" [type]="showPassword() ? 'text' : 'password'" placeholder="请输入密码"
-              [value]="password()" (valueChange)="onPassword($event)" />
-            <button type="button" class="credential-toggle" [disabled]="flow.working()" [attr.aria-label]="showPassword() ? '隐藏密码' : '显示密码'" [attr.aria-pressed]="showPassword()" (click)="showPassword.set(!showPassword())">
-              <i [class]="showPassword() ? 'fa-solid fa-eye-slash' : 'fa-solid fa-eye'" aria-hidden="true"></i>
-            </button>
-          </div>
+          <!-- 2026-12-04 用户裁决:密码框后面不要眼睛按钮,直接输入 -->
+          <div class="input-shell">
+          <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="password" [type]="showPassword() ? 'text' : 'password'" placeholder="请输入密码"
+            [value]="password()" (valueChange)="onPassword($event)" />
+        </div>
         </label>
       }
 
       @if (method() === 'mobile') {
         <label class="field">
           <span class="field-label">手机号</span>
+          <div class="input-shell">
           <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="phone"
             placeholder="请输入手机号"
             [value]="mobile()"
             [invalid]="!!error() && !mobileValid()"
             (valueChange)="onMobile($event)"
           />
+        </div>
         </label>
 
         <label class="field">
           <span class="field-label">验证码</span>
           <div class="code-row">
-            <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="code"
+            <div class="input-shell">
+          <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="code"
               placeholder="6 位验证码"
               [value]="code()"
               [invalid]="!!error() && !codeValid()"
               (valueChange)="onCode($event)"
             />
-            <ui-button variant="outline" [disabled]="!canSendCode()" (click)="sendCode()">
+        </div>
+            <!-- 获取验证码(2026-12-04):与输入框同高 56px、同圆角,描边主色 -->
+            <button type="button" class="code-send" [disabled]="!canSendCode()" (click)="sendCode()">
               {{ countdown() > 0 ? countdown() + 's 后重试' : sendingCode() ? '发送中…' : '获取验证码' }}
-            </ui-button>
+            </button>
           </div>
           <small class="field-hint">手机号仅用于登录验证</small>
         </label>
@@ -218,14 +223,12 @@ type LoginMethod = 'password' | 'mobile' | 'token';
              报错却指向好几行之后(本次踩坑:报 "Unexpected ;" 在 534 行)。
         -->
         <label class="field">
-          <span class="field-label">登录凭证</span>
-          <div class="credential-row">
-            <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="token" [type]="flow.showToken() ? 'text' : 'password'" placeholder="粘贴登录凭证"
-              [value]="token()" (valueChange)="onToken($event)" />
-            <button type="button" class="credential-toggle" [disabled]="flow.working()" [attr.aria-label]="flow.showToken() ? '隐藏登录凭证' : '显示登录凭证'" [attr.aria-pressed]="flow.showToken()" (click)="flow.showToken.set(!flow.showToken())">
-              <i [class]="flow.showToken() ? 'fa-solid fa-eye-slash' : 'fa-solid fa-eye'" aria-hidden="true"></i>
-            </button>
-          </div>
+          <span class="field-label">Token</span>
+          <!-- 2026-12-04 用户裁决:Token 输入框也去掉眼睛按钮,直接粘贴 -->
+          <div class="input-shell">
+          <ui-input [disabled]="flow.working()" (keydown.enter)="onKeyboardSubmit($event)" appLoginField="token" [type]="flow.showToken() ? 'text' : 'password'" placeholder="粘贴 Token,以 r: 开头"
+            [value]="token()" (valueChange)="onToken($event)" />
+        </div>
         </label>
       }
 
@@ -242,7 +245,7 @@ type LoginMethod = 'password' | 'mobile' | 'token';
         {{ busy() ? '登录中…' : flow.authenticated() ? '进入工作空间' : '登录' }}
       </ui-button>
 
-      <button type="button" class="login-help" [disabled]="flow.working()" (click)="flow.openPanel('help')">登录遇到问题?</button>
+      <!-- 2026-12-04 用户裁决:去掉「登录遇到问题?」,保持界面干净 -->
       @if (method() === 'token') {
         <p class="hint"><i class="fa-solid fa-circle-info" aria-hidden="true"></i>登录凭证可在已登录设备的账号设置中复制,请勿分享给他人</p>
       }
@@ -497,11 +500,14 @@ type LoginMethod = 'password' | 'mobile' | 'token';
       }
       .card {
         width: 100%;
-        /* 卡片本体最宽 400px(2026-11-12):再宽输入框会显得空旷 */
-        max-width: 400px;
+        /*
+         * 2026-12-04 PC 优化:400px 在宽屏上显得局促(用户反馈「难看」)。
+         * 放宽到 420px 并保留 --sp-6 内边距,字段之间统一用 --sp-5 的节奏。
+         */
+        max-width: 420px;
         display: grid;
         gap: var(--sp-5);
-        padding: var(--sp-6);
+        padding: var(--sp-6) var(--sp-6) var(--sp-5);
         border: 1px solid var(--edge);
         border-radius: var(--r-lg);
         background: var(--surface);
@@ -639,6 +645,27 @@ type LoginMethod = 'password' | 'mobile' | 'token';
         border-radius: var(--r-md);
         background: var(--surface-2);
       }
+      .mode-tab {
+        min-height: 36px;
+        border: 1px solid transparent;
+        border-radius: calc(var(--r-md) - 2px);
+        background: transparent;
+        color: var(--ink-2);
+        font-size: var(--fs-13);
+        cursor: pointer;
+        transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
+      }
+      .mode-tab:hover:not(.active) { color: var(--ink); }
+      .mode-tab.active {
+        background: var(--surface);
+        border-color: var(--edge);
+        color: var(--ink);
+        font-weight: 600;
+        box-shadow: var(--shadow-soft);
+      }
+      @media (prefers-reduced-motion: reduce) {
+        .mode-tab { transition: none; }
+      }
       .mode-tab {
         min-height: var(--touch-min);
         border: 0;
@@ -666,12 +693,80 @@ type LoginMethod = 'password' | 'mobile' | 'token';
         outline-offset: -2px;
       }
 
+      /*
+       * 输入框统一外壳(2026-12-04 参照用户提供的设计稿):
+       *   填充灰底、无边框、大圆角、高 56px —— 比「白底细边框」更有体量感。
+       * 通过外层容器实现,不改底座 ui-input(底座禁改)。
+       */
+      .input-shell {
+        border-radius: 12px;
+        background: var(--surface-2);
+        transition: box-shadow 0.16s ease, background 0.16s ease;
+      }
+      .input-shell:focus-within {
+        background: var(--surface);
+        box-shadow: 0 0 0 1.5px var(--primary);
+      }
+      /* 清掉底座输入框自身的边框,只保留外壳的灰底圆角 */
+      .input-shell ::ng-deep input {
+        height: 56px !important;
+        padding-inline: 16px !important;
+        border: 0 !important;
+        border-radius: 12px !important;
+        background: transparent !important;
+        box-shadow: none !important;
+        font-size: var(--fs-15) !important;
+      }
+      .input-shell ::ng-deep input:focus,
+      .input-shell ::ng-deep input:focus-visible {
+        /* 浏览器默认 focus 黑框太硬(2026-12-04):统一交给外壳的主色环表达焦点 */
+        outline: none !important;
+        box-shadow: none !important;
+        border: 0 !important;
+      }
+      .input-shell ::ng-deep input::placeholder { color: var(--faint, var(--muted)); }
+      @media (prefers-reduced-motion: reduce) {
+        .input-shell { transition: none; }
+      }
+      /*
+       * 获取验证码(2026-12-04 用户裁决:不要边框)。
+       * 做成**纯文字按钮**压在验证码输入框右侧,点击区 44px 保证触控;
+       * 这样它与输入框是一个整体,不会像描边按钮那样「两个框并排」显得碎。
+       */
+      .code-row {
+        position: relative;
+        align-items: center;
+        grid-template-columns: minmax(0, 1fr);
+      }
+      .code-send {
+        position: absolute;
+        top: 50%;
+        right: 6px;
+        transform: translateY(-50%);
+        min-height: 44px;
+        padding: 0 12px;
+        border: 0;
+        border-radius: 8px;
+        background: transparent;
+        color: var(--primary);
+        font-size: var(--fs-13);
+        font-weight: 500;
+        white-space: nowrap;
+        cursor: pointer;
+        transition: color 0.16s ease, opacity 0.16s ease;
+      }
+      .code-send:hover:not(:disabled) { text-decoration: underline; }
+      .code-send:disabled { color: var(--muted); opacity: 0.7; cursor: default; }
+      /* 给右侧文字按钮留出位置,避免输入内容被它盖住 */
+      .code-row .input-shell ::ng-deep input { padding-right: 132px !important; }
       .field {
         display: grid;
         gap: var(--sp-2);
+        min-width: 0;
       }
       .field-label {
         font-size: var(--fs-13);
+        font-weight: 500;
         color: var(--ink-2);
       }
       .code-row {