移除复制地址按钮;扫码登录成功返回上一页
This commit is contained in:
@@ -24,12 +24,22 @@ function QrLoginClient() {
|
|||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setMessage(res.ok ? '确认成功,请回到电视查看。' : data.error || '确认失败');
|
if (res.ok) {
|
||||||
|
setMessage('确认成功,正在返回上一页...');
|
||||||
|
window.setTimeout(() => {
|
||||||
|
window.history.back();
|
||||||
|
}, 700);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setMessage(data.error || '确认失败');
|
||||||
};
|
};
|
||||||
|
|
||||||
const cancel = async () => {
|
const cancel = async () => {
|
||||||
await fetch('/api/auth/qr/cancel', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ token }) });
|
await fetch('/api/auth/qr/cancel', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ token }) });
|
||||||
setMessage('已取消本次电视登录。');
|
setMessage('已取消本次电视登录,正在返回上一页...');
|
||||||
|
window.setTimeout(() => {
|
||||||
|
window.history.back();
|
||||||
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+1
-27
@@ -3,7 +3,6 @@
|
|||||||
import {
|
import {
|
||||||
BadgeCheck,
|
BadgeCheck,
|
||||||
Clock3,
|
Clock3,
|
||||||
Copy,
|
|
||||||
Loader2,
|
Loader2,
|
||||||
LogOut,
|
LogOut,
|
||||||
Menu,
|
Menu,
|
||||||
@@ -88,7 +87,6 @@ export default function TVMePage() {
|
|||||||
const [loggingOut, setLoggingOut] = useState(false);
|
const [loggingOut, setLoggingOut] = useState(false);
|
||||||
const [error, setError] = useState('');
|
const [error, setError] = useState('');
|
||||||
const [localRemoteUrl, setLocalRemoteUrl] = useState('');
|
const [localRemoteUrl, setLocalRemoteUrl] = useState('');
|
||||||
const [copyStatus, setCopyStatus] = useState('');
|
|
||||||
const [upDownAction, setUpDownAction] = useState<TVPlayerUpDownAction>(
|
const [upDownAction, setUpDownAction] = useState<TVPlayerUpDownAction>(
|
||||||
DEFAULT_TV_PLAYER_UP_DOWN_ACTION
|
DEFAULT_TV_PLAYER_UP_DOWN_ACTION
|
||||||
);
|
);
|
||||||
@@ -182,16 +180,7 @@ export default function TVMePage() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const copyLocalRemoteUrl = async () => {
|
|
||||||
if (!localRemoteUrl) return;
|
|
||||||
try {
|
|
||||||
await navigator.clipboard?.writeText(localRemoteUrl);
|
|
||||||
setCopyStatus('已复制');
|
|
||||||
} catch {
|
|
||||||
setCopyStatus('请手动输入电视上的地址');
|
|
||||||
}
|
|
||||||
window.setTimeout(() => setCopyStatus(''), 2200);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!ready || !authInfo) {
|
if (!ready || !authInfo) {
|
||||||
return (
|
return (
|
||||||
@@ -313,21 +302,6 @@ export default function TVMePage() {
|
|||||||
<div className='mt-2 break-all font-mono text-lg font-black text-white'>
|
<div className='mt-2 break-all font-mono text-lg font-black text-white'>
|
||||||
{localRemoteUrl}
|
{localRemoteUrl}
|
||||||
</div>
|
</div>
|
||||||
<div className='mt-5 flex flex-wrap gap-3'>
|
|
||||||
<button
|
|
||||||
type='button'
|
|
||||||
onClick={copyLocalRemoteUrl}
|
|
||||||
className='tv-focusable inline-flex cursor-pointer items-center justify-center gap-2 rounded-2xl bg-white/10 px-5 py-4 text-lg font-black text-white outline-none transition hover:bg-white/15 focus:ring-4 focus:ring-indigo-300'
|
|
||||||
>
|
|
||||||
<Copy className='h-6 w-6' />
|
|
||||||
复制地址
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{copyStatus && (
|
|
||||||
<div className='mt-3 text-base font-bold text-emerald-200'>
|
|
||||||
{copyStatus}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className='mt-6 rounded-3xl border border-amber-300/20 bg-amber-400/10 p-5 text-lg leading-relaxed text-amber-100'>
|
<div className='mt-6 rounded-3xl border border-amber-300/20 bg-amber-400/10 p-5 text-lg leading-relaxed text-amber-100'>
|
||||||
|
|||||||
Reference in New Issue
Block a user