feat:重新上线登录测试版功能
This commit is contained in:
54
app/page.jsx
54
app/page.jsx
@@ -1232,7 +1232,7 @@ function CloudConfigModal({ onConfirm, onCancel, type = 'empty' }) {
|
|||||||
</div>
|
</div>
|
||||||
<p className="muted" style={{ marginBottom: 20, fontSize: '14px', lineHeight: '1.6' }}>
|
<p className="muted" style={{ marginBottom: 20, fontSize: '14px', lineHeight: '1.6' }}>
|
||||||
{isConflict
|
{isConflict
|
||||||
? '检测到本地配置比云端更新,请选择操作:'
|
? '检测到本地配置与云端不一致,请选择操作:'
|
||||||
: '是否将本地配置同步到云端?'}
|
: '是否将本地配置同步到云端?'}
|
||||||
</p>
|
</p>
|
||||||
<div className="row" style={{ flexDirection: 'column', gap: 12 }}>
|
<div className="row" style={{ flexDirection: 'column', gap: 12 }}>
|
||||||
@@ -1858,11 +1858,6 @@ export default function HomePage() {
|
|||||||
const [latestVersion, setLatestVersion] = useState('');
|
const [latestVersion, setLatestVersion] = useState('');
|
||||||
const [updateContent, setUpdateContent] = useState('');
|
const [updateContent, setUpdateContent] = useState('');
|
||||||
|
|
||||||
// FIXME 强制登出
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
handleLogout();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const checkUpdate = async () => {
|
const checkUpdate = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -3317,12 +3312,18 @@ export default function HomePage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data?.data && typeof data.data === 'object' && Object.keys(data.data).length > 0) {
|
if (data?.data && typeof data.data === 'object' && Object.keys(data.data).length > 0) {
|
||||||
const cloudTime = new Date(data.updated_at || 0).getTime();
|
const localPayload = collectLocalPayload();
|
||||||
const localTime = new Date(localStorage.getItem('localUpdatedAt') || 0).getTime();
|
const localComparable = getComparablePayload(localPayload);
|
||||||
|
const cloudComparable = getComparablePayload(data.data);
|
||||||
|
|
||||||
if (localTime > cloudTime + 2000) {
|
if (localComparable !== cloudComparable) {
|
||||||
setCloudConfigModal({ open: true, userId, type: 'conflict', cloudData: data.data });
|
const cloudTime = new Date(data.updated_at || 0).getTime();
|
||||||
return;
|
const localTime = new Date(localStorage.getItem('localUpdatedAt') || 0).getTime();
|
||||||
|
|
||||||
|
if (localTime > cloudTime + 2000) {
|
||||||
|
setCloudConfigModal({ open: true, userId, type: 'conflict', cloudData: data.data });
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await applyCloudConfig(data.data, data.updated_at);
|
await applyCloudConfig(data.data, data.updated_at);
|
||||||
@@ -3606,16 +3607,17 @@ export default function HomePage() {
|
|||||||
>
|
>
|
||||||
<RefreshIcon className={refreshing ? 'spin' : ''} width="18" height="18" />
|
<RefreshIcon className={refreshing ? 'spin' : ''} width="18" height="18" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
{/*<button*/}
|
||||||
className="icon-button"
|
{/* className="icon-button"*/}
|
||||||
aria-label="打开设置"
|
{/* aria-label="打开设置"*/}
|
||||||
onClick={() => setSettingsOpen(true)}
|
{/* onClick={() => setSettingsOpen(true)}*/}
|
||||||
title="设置"
|
{/* title="设置"*/}
|
||||||
>
|
{/* hidden*/}
|
||||||
<SettingsIcon width="18" height="18" />
|
{/*>*/}
|
||||||
</button>
|
{/* <SettingsIcon width="18" height="18" />*/}
|
||||||
|
{/*</button>*/}
|
||||||
{/* 用户菜单 */}
|
{/* 用户菜单 */}
|
||||||
<div className="user-menu-container" ref={userMenuRef} hidden>
|
<div className="user-menu-container" ref={userMenuRef}>
|
||||||
<button
|
<button
|
||||||
className={`icon-button user-menu-trigger ${user ? 'logged-in' : ''}`}
|
className={`icon-button user-menu-trigger ${user ? 'logged-in' : ''}`}
|
||||||
aria-label={user ? '用户菜单' : '登录'}
|
aria-label={user ? '用户菜单' : '登录'}
|
||||||
@@ -4914,6 +4916,18 @@ export default function HomePage() {
|
|||||||
|
|
||||||
<form onSubmit={handleSendOtp}>
|
<form onSubmit={handleSendOtp}>
|
||||||
<div className="form-group" style={{ marginBottom: 16 }}>
|
<div className="form-group" style={{ marginBottom: 16 }}>
|
||||||
|
<div style={{
|
||||||
|
marginBottom: 12,
|
||||||
|
padding: '8px 12px',
|
||||||
|
background: 'rgba(230, 162, 60, 0.1)',
|
||||||
|
border: '1px solid rgba(230, 162, 60, 0.2)',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '0.8rem',
|
||||||
|
color: '#e6a23c',
|
||||||
|
lineHeight: '1.4'
|
||||||
|
}}>
|
||||||
|
⚠️ 登录功能目前正在测试,使用过程中如遇到问题欢迎大家在 <a href="https://github.com/hzm0321/real-time-fund/issues" target="_blank" style={{ textDecoration: 'underline', color: 'inherit' }}>Github</a> 上反馈
|
||||||
|
</div>
|
||||||
<div className="muted" style={{ marginBottom: 8, fontSize: '0.8rem' }}>
|
<div className="muted" style={{ marginBottom: 8, fontSize: '0.8rem' }}>
|
||||||
请输入邮箱,我们将发送验证码到您的邮箱
|
请输入邮箱,我们将发送验证码到您的邮箱
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "real-time-fund",
|
"name": "real-time-fund",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
Reference in New Issue
Block a user