feat(douyu): 绑定后自动收起领取二维码
This commit is contained in:
@@ -64,6 +64,7 @@ export default function DouyuFulfillmentPage() {
|
||||
const [platform, setPlatform] = useState<DouyuCustomerPlatform>('wechat')
|
||||
const [system, setSystem] = useState<DouyuCustomerSystem>('android')
|
||||
const [qrImage, setQrImage] = useState('')
|
||||
const [bindingQrExpanded, setBindingQrExpanded] = useState(false)
|
||||
const [nowMs, setNowMs] = useState(0)
|
||||
const autoStartRef = useRef('')
|
||||
|
||||
@@ -138,6 +139,10 @@ export default function DouyuFulfillmentPage() {
|
||||
}).then(setQrImage)
|
||||
}, [live?.qrUrl])
|
||||
|
||||
useEffect(() => {
|
||||
setBindingQrExpanded(false)
|
||||
}, [live?.bindConfirmed, live?.bindReadyForConfirm, live?.qrUrl])
|
||||
|
||||
useEffect(() => {
|
||||
const tick = () => setNowMs(Date.now())
|
||||
tick()
|
||||
@@ -172,6 +177,17 @@ export default function DouyuFulfillmentPage() {
|
||||
if (!expiresAt || Number.isNaN(expiresAt)) return 0
|
||||
return Math.max(0, Math.floor((expiresAt - nowMs) / 1000))
|
||||
}, [live?.qrExpiresAt, nowMs])
|
||||
const canRevealBindingQr = Boolean(
|
||||
live?.qrUrl && (live.bindReadyForConfirm || live.bindConfirmed),
|
||||
)
|
||||
const showBindingQr = Boolean(live?.qrUrl && (!canRevealBindingQr || bindingQrExpanded))
|
||||
const bindingDescription =
|
||||
live?.message ||
|
||||
(live?.bindReadyForConfirm
|
||||
? '已识别游戏角色,请核对并确认绑定。'
|
||||
: live?.bindConfirmed
|
||||
? '角色绑定已完成,等待运营处理。'
|
||||
: '请使用微信扫描下方二维码,按提示选择和平精英角色。二维码仅用于本次订单。')
|
||||
|
||||
async function submitProfile() {
|
||||
if (!roleName.trim()) {
|
||||
@@ -334,12 +350,19 @@ export default function DouyuFulfillmentPage() {
|
||||
type={live?.bindConfirmed ? 'success' : 'info'}
|
||||
showIcon
|
||||
message={STATUS_LABELS[task.status] || '等待处理'}
|
||||
description={
|
||||
live?.message ||
|
||||
'请使用微信扫描下方二维码,按提示选择和平精英角色。二维码仅用于本次订单。'
|
||||
}
|
||||
description={bindingDescription}
|
||||
/>
|
||||
|
||||
{canRevealBindingQr ? (
|
||||
<Button
|
||||
className="customer-binding-qr-toggle"
|
||||
icon={<QrcodeOutlined />}
|
||||
onClick={() => setBindingQrExpanded((current) => !current)}
|
||||
>
|
||||
{bindingQrExpanded ? '收起绑定二维码' : '查看绑定二维码'}
|
||||
</Button>
|
||||
) : null}
|
||||
|
||||
{!live?.qrUrl && task.status !== 'completed' ? (
|
||||
<div className="customer-binding-qr-card">
|
||||
<h3>游戏角色绑定二维码</h3>
|
||||
@@ -360,7 +383,7 @@ export default function DouyuFulfillmentPage() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{live?.qrUrl && !live.bindConfirmed ? (
|
||||
{live?.qrUrl && showBindingQr ? (
|
||||
<div className="customer-binding-qr-card">
|
||||
<h3>游戏角色绑定二维码</h3>
|
||||
<div className="customer-binding-qr-code">
|
||||
|
||||
@@ -2957,6 +2957,25 @@
|
||||
background: #343c4a;
|
||||
}
|
||||
|
||||
.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn {
|
||||
align-self: flex-end;
|
||||
height: 34px;
|
||||
padding-inline: 12px;
|
||||
color: #b8c1cf;
|
||||
border-color: #3f495a;
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
font-size: 13px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:hover,
|
||||
.customer-auth-page.is-douyu .customer-binding-qr-toggle.ant-btn:focus-visible {
|
||||
color: #fff;
|
||||
border-color: #64748b;
|
||||
background: #2a313d;
|
||||
}
|
||||
|
||||
.customer-auth-page.is-douyu .customer-auth-hero {
|
||||
min-height: 148px;
|
||||
align-items: flex-start;
|
||||
|
||||
Reference in New Issue
Block a user