diff --git a/docker/nginx.conf b/docker/nginx.conf index 5afcb53..cfed3c0 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -44,9 +44,10 @@ http { } # 第二个页面的配置 - location /mobile { + location ^~ /mobile/ { root /usr/share/nginx/html; - index index.html; + index index.html index.htm; + try_files $uri $uri.html $uri/ =404; } location ^~ /todo-server/ { diff --git a/src/app/page.tsx b/src/app/page.tsx index 97e6b88..0ea4f1f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,11 +2,18 @@ import { useRouter} from "next/navigation"; import dayjs from "dayjs"; import {useEffect} from "react"; +import { isMobile } from 'react-device-detect'; export default function Home() { const {replace} = useRouter(); useEffect(()=>{ - replace("/login") + if(localStorage.getItem('platform-security')){ + if (isMobile){ + window.location.href = 'http://www.huaruyu.com/mobile' + }else { + replace("/task/project") + } + } },[]) dayjs.locale('zh-cn') return ( diff --git a/src/ui/login/Page.tsx b/src/ui/login/Page.tsx index 9c3b7fa..9010129 100644 --- a/src/ui/login/Page.tsx +++ b/src/ui/login/Page.tsx @@ -53,7 +53,7 @@ export default function Page() { }) localStorage.setItem('platform-security', captchaLoginSuccess.token) if (isMobile){ - router.push('/mobile/listTask') + window.location.href = '/mobile' }else { router.push('/task/project') } @@ -116,7 +116,7 @@ export default function Page() { Cookies.set('platform-security', response.data.data, { expires: 7 }); // 登录成功,跳转到首页或者回调 if (isMobile){ - router.push('/mobile/listTask') + window.location.href = '/mobile' }else { router.push('/task/project') } @@ -147,7 +147,7 @@ export default function Page() { Cookies.set('platform-security', response.data.data, { expires: 7 }); // 登录成功,跳转到首页或者回调 if (isMobile){ - router.push('/mobile/listTask') + window.location.href = '/mobile' }else { router.push('/task/project') }