fix:跳转mobile

This commit is contained in:
1708-huayu 2025-01-14 19:49:19 +08:00
parent 5639c6e0f0
commit 7c5ddacbaa
3 changed files with 14 additions and 6 deletions

View File

@ -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/ {

View File

@ -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 (

View File

@ -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')
}