diff --git a/apps/frontend/public/images/customer/inside-kv.jpg b/apps/frontend/public/images/customer/inside-kv.jpg new file mode 100644 index 00000000..fe1066fb Binary files /dev/null and b/apps/frontend/public/images/customer/inside-kv.jpg differ diff --git a/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx b/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx index 46a35955..f7e305b9 100644 --- a/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx +++ b/apps/frontend/src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx @@ -4,9 +4,8 @@ import { LoadingOutlined, QrcodeOutlined, ReloadOutlined, - SafetyCertificateOutlined, } from '@ant-design/icons' -import { App, Alert, Button, Image, Input, Modal, Select, Space, Spin, Tabs } from 'antd' +import { App, Alert, Button, Image, Input, Modal, Select, Space, Spin } from 'antd' import QRCode from 'qrcode' import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react' import { useParams } from 'react-router' @@ -88,7 +87,6 @@ export default function CustomerFulfillmentPage() { [selectedTaskId, tasks], ) const isWeibo = selectedTask?.platform === 'weibo' - const isHuya = selectedTask?.platform === 'huya' const load = useCallback( async (silent = false) => { @@ -876,15 +874,22 @@ export default function CustomerFulfillmentPage() { !selectedTask.customerGameRoleName), ) - const huyaLoginForm = ( + const renderLoginForm = (options: { + platformLabel: string + mobilePlaceholder: string + codePlaceholder: string + submitText: string + afterMobile?: ReactNode + footerNote?: ReactNode + }) => (
-

请使用你的「虎牙」账号登录

+

请使用你的「{options.platformLabel}」账号登录

setMobile(event.target.value)} - placeholder="请输入号码" + placeholder={options.mobilePlaceholder} inputMode="numeric" maxLength={11} /> @@ -897,11 +902,12 @@ export default function CustomerFulfillmentPage() { {smsCountdown > 0 ? `${smsCountdown}s` : '获取验证码'}
+ {options.afterMobile} setSmsCode(event.target.value)} - placeholder="6 位验证码" + placeholder={options.codePlaceholder} maxLength={8} inputMode="numeric" onPressEnter={() => void handleLoginSms()} @@ -913,7 +919,7 @@ export default function CustomerFulfillmentPage() { loading={smsLogging} onClick={() => void handleLoginSms()} > - 登录 + {options.submitText} + {options.footerNote}
) + const huyaLoginForm = renderLoginForm({ + platformLabel: '虎牙', + mobilePlaceholder: '请输入号码', + codePlaceholder: '6 位验证码', + submitText: '登录', + }) + if (loading) { return ( @@ -1018,92 +1032,24 @@ export default function CustomerFulfillmentPage() { selectedTask?.loginStatus === 'expired' || (loginQrVisible && loginMode === 'sms') ? (
- {isWeibo ? ( - setLoginMode(key as 'sms' | 'qr')} - items={[ - { - key: 'sms', - label: '手机号登录', - children: ( -
-
- +86 - setMobile(event.target.value)} - placeholder={`请输入${isHuya ? '虎牙' : '微博'}绑定手机号`} - maxLength={11} - inputMode="numeric" - /> - -
- {isWeibo && smsMfaRequired ? ( -
- 请在安全验证弹窗中完成验证,通过后会继续发送短信验证码。 -
- ) : null} -
- setSmsCode(event.target.value)} - placeholder="请输入短信验证码" - maxLength={8} - prefix={} - onPressEnter={() => void handleLoginSms()} - /> - -
- {isWeibo ? ( - - 如安全验证弹窗未出现,请检查浏览器是否拦截脚本。 - - ) : null} -
- ), - }, - { - key: 'qr', - label: '扫码登录', - children: ( -
-

- {config.loginInstructions || - `点击下方按钮后,使用${isHuya ? '虎牙' : '微博'} App 扫码并确认登录。`} -

- -
- ), - }, - ]} - /> - ) : ( - huyaLoginForm - )} + {isWeibo + ? renderLoginForm({ + platformLabel: '微博', + mobilePlaceholder: '请输入微博绑定手机号', + codePlaceholder: '请输入短信验证码', + submitText: '登录微博', + afterMobile: smsMfaRequired ? ( +
+ 请在安全验证弹窗中完成验证,通过后会继续发送短信验证码。 +
+ ) : null, + footerNote: ( + + 如安全验证弹窗未出现,请检查浏览器是否拦截脚本。 + + ), + }) + : huyaLoginForm}
) : null} @@ -1148,16 +1094,14 @@ export default function CustomerFulfillmentPage() { > 重新获取二维码 - {isWeibo ? null : ( - - )} + ) : null} @@ -1713,6 +1657,31 @@ function CustomerAuthFrame(input: { } function CustomerOrderCard({ task }: { task: CustomerSemiAutoTask }) { + if (task.platform === 'weibo') { + return ( +
+

订单信息

+
+ 订单号 + {task.orderNo} +
+
+ 商品 + + {task.productName || task.skuName} × {task.quantity} + +
+
+ 平台 + {task.platformLabel || '微博'} +
+
+ 状态 + {task.displayStatus.label} +
+
+ ) + } const zone = task.customerServerZone ? /区$/.test(task.customerServerZone) ? task.customerServerZone diff --git a/apps/frontend/src/styles/client.css b/apps/frontend/src/styles/client.css index 43abfd1f..369281e0 100644 --- a/apps/frontend/src/styles/client.css +++ b/apps/frontend/src/styles/client.css @@ -1473,6 +1473,39 @@ background: none; } +/* 微博登录页顶部 KV:与资料页共用 inside-kv.jpg,叠加深色渐变保证标题可读。 */ +.customer-auth-page.is-weibo .customer-auth-hero { + min-height: 134px; + align-items: flex-start; + justify-content: flex-start; + padding: 26px 20px 20px; + background-color: #0b1220; + background-image: + linear-gradient(180deg, rgba(11, 18, 32, 0.12) 0%, rgba(11, 18, 32, 0.72) 72%, #232936 100%), + url('/images/customer/inside-kv.jpg'); + background-repeat: no-repeat; + background-position: center 38%; + background-size: cover; +} + +.customer-auth-page.is-weibo .customer-auth-brand { + width: 100%; + justify-content: flex-start; +} + +.customer-auth-page.is-weibo .customer-auth-brand h1 { + text-align: left; + text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72); +} + +@media (max-width: 640px) { + .customer-auth-page.is-weibo .customer-auth-hero { + min-height: 118px; + padding: 20px 16px 14px; + background-position: center 42%; + } +} + .customer-auth-brand { display: flex; align-items: center; @@ -2148,10 +2181,23 @@ color: #e5e7eb; } +/* 资料页顶部 KV:原图 https://game.gtimg.cn/images/gp/web201908/inside_kv.jpg(本地 1600×510 q82) */ .customer-collect-hero { - padding: 42px 20px 6px; + position: relative; + min-height: clamp(190px, 24vw, 240px); + display: flex; + align-items: flex-end; + justify-content: center; + padding: 0 20px 16px; + overflow: hidden; text-align: center; - background: linear-gradient(180deg, #0f1a2d, #0b1220); + background-color: #0b1220; + background-image: + linear-gradient(180deg, rgba(11, 18, 32, 0) 45%, rgba(11, 18, 32, 0.55) 72%, #0b1220 100%), + url('/images/customer/inside-kv.jpg'); + background-repeat: no-repeat; + background-position: center 38%; + background-size: cover; } .customer-collect-warning { @@ -2160,6 +2206,19 @@ color: #f87171; font-size: 17px; font-weight: 600; + text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); +} + +@media (max-width: 640px) { + .customer-collect-hero { + min-height: 180px; + padding: 0 16px 14px; + background-position: center 42%; + } + + .customer-collect-warning { + font-size: 15px; + } } .customer-collect-body { @@ -2480,6 +2539,18 @@ overflow-wrap: anywhere; } +.customer-order-card > div strong.customer-order-status { + flex: 0 0 auto; + padding: 3px 12px; + border: 1px solid rgba(96, 165, 250, 0.38); + border-radius: 999px; + color: #dbeafe; + font-size: 13px; + font-weight: 600; + text-align: center; + background: rgba(47, 111, 237, 0.28); +} + .customer-binding-stage { display: flex; flex-direction: column; diff --git a/apps/frontend/tests/customer-fulfillment-weibo-ui.test.ts b/apps/frontend/tests/customer-fulfillment-weibo-ui.test.ts new file mode 100644 index 00000000..b399112e --- /dev/null +++ b/apps/frontend/tests/customer-fulfillment-weibo-ui.test.ts @@ -0,0 +1,58 @@ +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import { dirname, join } from 'node:path' +import { fileURLToPath } from 'node:url' +import test from 'node:test' + +const source = readFileSync( + join( + dirname(fileURLToPath(import.meta.url)), + '../src/pages/customer-fulfillment/CustomerFulfillmentPage.tsx', + ), + 'utf8', +) +const styles = readFileSync( + join(dirname(fileURLToPath(import.meta.url)), '../src/styles/client.css'), + 'utf8', +) + +test('微博与虎牙共用同一套登录表单结构', () => { + assert.match(source, /const renderLoginForm = \(options: \{/) + assert.ok(source.includes("platformLabel: '虎牙'")) + assert.ok(source.includes("platformLabel: '微博'")) + assert.ok(!source.includes('customer-auth-tabs')) + assert.ok(!source.includes('SafetyCertificateOutlined')) +}) + +test('微博保留两种登录方式与全部原有提示', () => { + assert.ok(source.includes('改用二维码登录')) + assert.ok(source.includes('改用手机号登录')) + assert.ok(source.includes('smsMfaRequired')) + assert.ok(source.includes('如安全验证弹窗未出现')) + assert.ok(source.includes('CustomerPrivacyNote')) + assert.ok(source.includes('温馨提示:未成年人禁止下单')) +}) + +test('二维码切换与虎牙一致:直接切到扫码并发起登录', () => { + assert.ok(source.includes("setLoginMode('qr')")) + assert.ok(source.includes('void handleStartLogin()')) +}) + +test('微博订单卡只展示订单号/商品/平台/状态,不含游戏和角色名称', () => { + const weiboBranch = source.slice( + source.indexOf("if (task.platform === 'weibo')"), + source.indexOf('const zone = task.customerServerZone'), + ) + assert.ok(weiboBranch.includes('订单号')) + assert.ok(weiboBranch.includes('商品')) + assert.ok(weiboBranch.includes('平台')) + assert.ok(weiboBranch.includes('状态')) + assert.ok(!weiboBranch.includes('角色名称')) + assert.ok(!weiboBranch.includes('游戏名称')) +}) + +test('微博顶部使用 inside-kv 背景,虎牙保持纯色', () => { + assert.ok(styles.includes('.customer-auth-page.is-weibo .customer-auth-hero')) + assert.ok(styles.includes("url('/images/customer/inside-kv.jpg')")) + assert.ok(!styles.includes('.customer-auth-page.is-huya .customer-auth-hero')) +})