fix:跳转mobile
This commit is contained in:
parent
5639c6e0f0
commit
7c5ddacbaa
|
@ -44,9 +44,10 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
# 第二个页面的配置
|
# 第二个页面的配置
|
||||||
location /mobile {
|
location ^~ /mobile/ {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html index.htm;
|
||||||
|
try_files $uri $uri.html $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ^~ /todo-server/ {
|
location ^~ /todo-server/ {
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
import { useRouter} from "next/navigation";
|
import { useRouter} from "next/navigation";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {useEffect} from "react";
|
import {useEffect} from "react";
|
||||||
|
import { isMobile } from 'react-device-detect';
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const {replace} = useRouter();
|
const {replace} = useRouter();
|
||||||
useEffect(()=>{
|
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')
|
dayjs.locale('zh-cn')
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -53,7 +53,7 @@ export default function Page() {
|
||||||
})
|
})
|
||||||
localStorage.setItem('platform-security', captchaLoginSuccess.token)
|
localStorage.setItem('platform-security', captchaLoginSuccess.token)
|
||||||
if (isMobile){
|
if (isMobile){
|
||||||
router.push('/mobile/listTask')
|
window.location.href = '/mobile'
|
||||||
}else {
|
}else {
|
||||||
router.push('/task/project')
|
router.push('/task/project')
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ export default function Page() {
|
||||||
Cookies.set('platform-security', response.data.data, { expires: 7 });
|
Cookies.set('platform-security', response.data.data, { expires: 7 });
|
||||||
// 登录成功,跳转到首页或者回调
|
// 登录成功,跳转到首页或者回调
|
||||||
if (isMobile){
|
if (isMobile){
|
||||||
router.push('/mobile/listTask')
|
window.location.href = '/mobile'
|
||||||
}else {
|
}else {
|
||||||
router.push('/task/project')
|
router.push('/task/project')
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ export default function Page() {
|
||||||
Cookies.set('platform-security', response.data.data, { expires: 7 });
|
Cookies.set('platform-security', response.data.data, { expires: 7 });
|
||||||
// 登录成功,跳转到首页或者回调
|
// 登录成功,跳转到首页或者回调
|
||||||
if (isMobile){
|
if (isMobile){
|
||||||
router.push('/mobile/listTask')
|
window.location.href = '/mobile'
|
||||||
}else {
|
}else {
|
||||||
router.push('/task/project')
|
router.push('/task/project')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue