style(semi-auto): 微博客户页增加背景图并调整订单信息卡

This commit is contained in:
2026-11-17 12:36:29 +08:00
parent 72cca72ae5
commit 57e082d0eb
4 changed files with 204 additions and 106 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

@@ -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
}) => (
<div className="customer-login-form">
<p className="customer-login-hint">请使用你的「虎牙」账号登录</p>
<p className="customer-login-hint">请使用你的「{options.platformLabel}」账号登录</p>
<div className="customer-login-mobile-row">
<Input
className="customer-login-mobile"
value={mobile}
onChange={(event) => setMobile(event.target.value)}
placeholder="请输入号码"
placeholder={options.mobilePlaceholder}
inputMode="numeric"
maxLength={11}
/>
@@ -897,11 +902,12 @@ export default function CustomerFulfillmentPage() {
{smsCountdown > 0 ? `${smsCountdown}s` : '获取验证码'}
</Button>
</div>
{options.afterMobile}
<Input
className="customer-login-code-input"
value={smsCode}
onChange={(event) => 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}
</Button>
<Button
block
@@ -926,9 +932,17 @@ export default function CustomerFulfillmentPage() {
>
改用二维码登录
</Button>
{options.footerNote}
</div>
)
const huyaLoginForm = renderLoginForm({
platformLabel: '虎牙',
mobilePlaceholder: '请输入号码',
codePlaceholder: '6 位验证码',
submitText: '登录',
})
if (loading) {
return (
<CustomerAuthFrame title="正在读取订单信息">
@@ -1018,92 +1032,24 @@ export default function CustomerFulfillmentPage() {
selectedTask?.loginStatus === 'expired' ||
(loginQrVisible && loginMode === 'sms') ? (
<section className="customer-auth-section">
{isWeibo ? (
<Tabs
className="customer-auth-tabs"
activeKey={loginMode}
onChange={(key) => setLoginMode(key as 'sms' | 'qr')}
items={[
{
key: 'sms',
label: '手机号登录',
children: (
<div className="customer-auth-form">
<div className="customer-auth-field customer-auth-phone-field">
<span className="customer-auth-country-prefix">+86</span>
<Input
value={mobile}
onChange={(event) => setMobile(event.target.value)}
placeholder={`请输入${isHuya ? '虎牙' : '微博'}绑定手机号`}
maxLength={11}
inputMode="numeric"
/>
<Button
className="customer-auth-send-code"
type="primary"
loading={smsSending}
disabled={smsCountdown > 0}
onClick={() => void handleSendSms()}
>
{smsCountdown > 0 ? `${smsCountdown}s` : '发送验证码'}
</Button>
</div>
{isWeibo && smsMfaRequired ? (
<div className="customer-auth-note">
请在安全验证弹窗中完成验证,通过后会继续发送短信验证码。
</div>
) : null}
<div className="customer-auth-field customer-auth-code-field">
<Input
value={smsCode}
onChange={(event) => setSmsCode(event.target.value)}
placeholder="请输入短信验证码"
maxLength={8}
prefix={<SafetyCertificateOutlined />}
onPressEnter={() => void handleLoginSms()}
/>
<Button
type="primary"
className="customer-auth-code-submit"
loading={smsLogging}
onClick={() => void handleLoginSms()}
>
登录{isHuya ? '虎牙' : '微博'}
</Button>
</div>
{isWeibo ? (
<span className="customer-auth-form-hint">
如安全验证弹窗未出现,请检查浏览器是否拦截脚本。
</span>
) : null}
</div>
),
},
{
key: 'qr',
label: '扫码登录',
children: (
<div className="customer-auth-form">
<p className="customer-auth-form-copy">
{config.loginInstructions ||
`点击下方按钮后,使用${isHuya ? '虎牙' : '微博'} App 扫码并确认登录。`}
</p>
<Button
type="primary"
size="large"
block
onClick={() => void handleStartLogin()}
>
获取登录二维码
</Button>
</div>
),
},
]}
/>
) : (
huyaLoginForm
)}
{isWeibo
? renderLoginForm({
platformLabel: '微博',
mobilePlaceholder: '请输入微博绑定手机号',
codePlaceholder: '请输入短信验证码',
submitText: '登录微博',
afterMobile: smsMfaRequired ? (
<div className="customer-auth-note">
请在安全验证弹窗中完成验证,通过后会继续发送短信验证码。
</div>
) : null,
footerNote: (
<span className="customer-auth-form-hint">
如安全验证弹窗未出现,请检查浏览器是否拦截脚本。
</span>
),
})
: huyaLoginForm}
</section>
) : null}
@@ -1148,16 +1094,14 @@ export default function CustomerFulfillmentPage() {
>
重新获取二维码
</Button>
{isWeibo ? null : (
<Button
block
size="large"
className="customer-login-alt"
onClick={() => setLoginMode('sms')}
>
改用手机号登录
</Button>
)}
<Button
block
size="large"
className="customer-login-alt"
onClick={() => setLoginMode('sms')}
>
改用手机号登录
</Button>
</div>
</section>
) : null}
@@ -1713,6 +1657,31 @@ function CustomerAuthFrame(input: {
}
function CustomerOrderCard({ task }: { task: CustomerSemiAutoTask }) {
if (task.platform === 'weibo') {
return (
<section className="customer-order-card">
<h3>订单信息</h3>
<div>
<span>订单号</span>
<strong>{task.orderNo}</strong>
</div>
<div>
<span>商品</span>
<strong>
{task.productName || task.skuName} × {task.quantity}
</strong>
</div>
<div>
<span>平台</span>
<strong>{task.platformLabel || '微博'}</strong>
</div>
<div>
<span>状态</span>
<strong className="customer-order-status">{task.displayStatus.label}</strong>
</div>
</section>
)
}
const zone = task.customerServerZone
? /区$/.test(task.customerServerZone)
? task.customerServerZone
+73 -2
View File
@@ -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;
@@ -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('<span>订单号</span>'))
assert.ok(weiboBranch.includes('<span>商品</span>'))
assert.ok(weiboBranch.includes('<span>平台</span>'))
assert.ok(weiboBranch.includes('<span>状态</span>'))
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'))
})