import IP from '@/assets/icons/svg/ip.svg'; import Lottie from '@/components/lottie/lottie'; import { useRouter } from 'expo-router'; import * as SecureStore from 'expo-secure-store'; import { useTranslation } from 'react-i18next'; import { Platform, Text, TouchableOpacity, View } from 'react-native'; export default function HomeScreen() { const router = useRouter(); const { t } = useTranslation(); let token; return ( {/* 标题区域 */} {t('auth.welcomeAwaken.awaken', { ns: 'login' })} {"\n"} {t('auth.welcomeAwaken.your', { ns: 'login' })} {"\n"} {t('auth.welcomeAwaken.pm', { ns: 'login' })} {t('auth.welcomeAwaken.slogan', { ns: 'login' })} {/* Memo 形象区域 */} {/* 如果是web端,使用静态ip形象,否则使用lottie */} {Platform.OS === 'web' ? : } {/* 介绍文本 */} {t('auth.welcomeAwaken.gallery', { ns: 'login' })} {"\n"} {t('auth.welcomeAwaken.back', { ns: 'login' })} {/* 唤醒按钮 */} { // 判断是否有用户信息,有的话直接到usermessage页面 没有到登录页 if (Platform.OS === 'web') { token = localStorage.getItem('token') || ""; } else { token = await SecureStore.getItemAsync('token') || ""; } console.log("token111111111", token); if (token) { router.push('/ask') } else { router.push('/login') } }} activeOpacity={0.8} > {t('auth.welcomeAwaken.awake', { ns: 'login' })} ); }