fix(douyu): 移除领取页切换滑块动画

This commit is contained in:
yml
2026-11-18 11:00:28 +08:00
parent 1fe23f05b5
commit fcc66b2669
2 changed files with 55 additions and 48 deletions
@@ -5,7 +5,7 @@ import {
QrcodeOutlined,
ReloadOutlined,
} from '@ant-design/icons'
import { Alert, App, Button, Image, Input, Progress, Segmented, Space, Spin } from 'antd'
import { Alert, App, Button, Image, Input, Progress, Space, Spin } from 'antd'
import QRCode from 'qrcode'
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { useParams } from 'react-router'
@@ -290,20 +290,20 @@ export default function DouyuFulfillmentPage() {
</div>
<div className="customer-collect-body">
<label className="customer-collect-label">登录方式</label>
<Segmented
block
<ChoiceSwitch
ariaLabel="登录方式"
value={platform}
onChange={(value) => setPlatform(value as DouyuCustomerPlatform)}
onChange={setPlatform}
options={[
{ label: '微信', value: 'wechat' },
{ label: 'QQ', value: 'qq' },
]}
/>
<label className="customer-collect-label">设备系统</label>
<Segmented
block
<ChoiceSwitch
ariaLabel="设备系统"
value={system}
onChange={(value) => setSystem(value as DouyuCustomerSystem)}
onChange={setSystem}
options={[
{ label: '安卓', value: 'android' },
{ label: '苹果', value: 'ios' },
@@ -450,6 +450,33 @@ export default function DouyuFulfillmentPage() {
)
}
function ChoiceSwitch<T extends string>(input: {
value: T
options: ReadonlyArray<{ label: string; value: T }>
ariaLabel: string
onChange: (value: T) => void
}) {
return (
<div className="customer-choice-switch" role="radiogroup" aria-label={input.ariaLabel}>
{input.options.map((option) => {
const selected = input.value === option.value
return (
<button
key={option.value}
type="button"
role="radio"
aria-checked={selected}
className={`customer-choice-option${selected ? ' is-selected' : ''}`}
onClick={() => input.onChange(option.value)}
>
{option.label}
</button>
)
})}
</div>
)
}
function CustomerFrame({ title, children }: { title: string; children: ReactNode }) {
return (
<div className="customer-auth-page is-huya is-douyu">
+21 -41
View File
@@ -2978,66 +2978,46 @@
padding-top: 12px;
}
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented {
overflow: hidden;
.customer-choice-switch {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 4px;
padding: 4px;
overflow: hidden;
border: 1px solid #354052;
border-radius: 12px;
background: #171d27;
}
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-group {
overflow: hidden;
border-radius: 9px;
}
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item {
.customer-choice-option {
height: 48px;
min-width: 0;
padding: 0 12px;
color: #aeb8c8;
border: 0;
border-radius: 9px;
transition: color 140ms ease;
outline: none;
background: transparent;
font: inherit;
font-size: 15px;
cursor: pointer;
transition: color 100ms ease;
}
.customer-auth-page.is-douyu
.customer-collect-body
.ant-segmented-item:hover:not(.ant-segmented-item-selected) {
.customer-choice-option:hover {
color: #e2e8f0;
background: #242c39;
}
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item-selected {
.customer-choice-option.is-selected {
color: #fff;
background: #2f6fed;
box-shadow: none;
}
.customer-auth-page.is-douyu
.customer-collect-body
.ant-segmented-item-selected
.ant-segmented-item-label {
color: #fff;
font-weight: 700;
}
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb {
background: #2f6fed;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
backface-visibility: hidden;
transform: translateZ(0);
}
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb-motion-appear-active {
will-change: transform;
transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-item-label {
transition: color 140ms ease;
}
@media (prefers-reduced-motion: reduce) {
.customer-auth-page.is-douyu .customer-collect-body .ant-segmented-thumb-motion-appear-active {
transition: none !important;
}
.customer-choice-option:focus-visible {
outline: 2px solid #60a5fa;
outline-offset: 2px;
}
.customer-auth-page.is-douyu .customer-collect-submit.ant-btn {