Allow browsing before mini login

This commit is contained in:
stu2not
2026-06-30 14:11:31 +08:00
parent be036ea7fe
commit ec390113ad
11 changed files with 436 additions and 53 deletions
+47
View File
@@ -25,6 +25,53 @@
overflow: hidden;
}
.guest-card {
margin: 0 24px;
padding: 44px 32px;
border-radius: 20px;
background: #FFFFFF;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
text-align: center;
}
.guest-card-icon {
display: block;
font-size: 56px;
line-height: 1;
}
.guest-card-title {
display: block;
margin-top: 18px;
font-size: 34px;
font-weight: 700;
color: #1A1A1A;
}
.guest-card-desc {
display: block;
margin-top: 14px;
font-size: 26px;
line-height: 1.6;
color: #666666;
}
.guest-card-btn {
display: flex;
align-items: center;
justify-content: center;
height: 84px;
margin-top: 30px;
border-radius: 16px;
background: #07C160;
}
.guest-card-btn-text {
font-size: 30px;
font-weight: 700;
color: #FFFFFF;
}
.conversation-item {
background: #FFFFFF;
border-radius: 20px;
+20 -2
View File
@@ -10,6 +10,7 @@ export default function Chat() {
const systemBanner = useSystemBanner()
const [conversations, setConversations] = useState<ChatConversation[]>([])
const [loading, setLoading] = useState(true)
const [isGuest, setIsGuest] = useState(false)
useDidShow(() => {
void loadConversations()
@@ -17,10 +18,13 @@ export default function Chat() {
const loadConversations = async () => {
if (!getToken()) {
Taro.reLaunch({ url: '/pages/login/index' })
setConversations([])
setIsGuest(true)
setLoading(false)
return
}
setIsGuest(false)
setLoading(true)
try {
const data = await getConversations()
@@ -55,13 +59,27 @@ export default function Chat() {
})
}
const handleGuestLogin = () => {
Taro.setStorageSync('postLoginRedirect', '/pages/chat/index')
Taro.navigateTo({ url: '/pages/login/index' })
}
return (
<View className='chat-page'>
<View className='page-header'>
<Text className='page-title'>玩伴</Text>
</View>
{loading ? (
{isGuest ? (
<View className='guest-card'>
<Text className='guest-card-icon'>💬</Text>
<Text className='guest-card-title'>亲子互动会话</Text>
<Text className='guest-card-desc'>绑定设备后,可以在这里查看孩子、家长和 AI 玩伴之间的消息记录。</Text>
<View className='guest-card-btn' onClick={handleGuestLogin}>
<Text className='guest-card-btn-text'>登录后查看</Text>
</View>
</View>
) : loading ? (
<View className='loading'>
<Text>加载中...</Text>
</View>