-
2.env
-
BINpublic/favicon.ico
-
4public/index.html
-
BINpublic/logo192.png
-
BINpublic/logo512.png
-
BINsrc/assets/logo.png
-
BINsrc/assets/nft/1.jpg
-
BINsrc/assets/nft/2.jpg
-
15src/components/ProductItem.tsx
-
18src/hooks/useRouter.ts
-
4src/index.tsx
-
34src/pages/home/index.tsx
-
2src/pages/recharge/index.tsx
-
8src/pages/share/index.tsx
-
6src/pages/team/index.tsx
-
5src/router/layout/Navbar.tsx
-
28src/router/layout/index.tsx
-
48src/router/layout/ui.tsx
-
4src/router/routes.tsx
-
3src/styles/components.scss
-
1src/styles/home.scss
-
7src/styles/layout.scss
Before Width: 192 | Height: 192 | Size: 5.2 KiB After Width: 192 | Height: 192 | Size: 4.5 KiB |
Before Width: 512 | Height: 512 | Size: 9.4 KiB After Width: 512 | Height: 512 | Size: 13 KiB |
After Width: 512 | Height: 512 | Size: 13 KiB |
After Width: 1080 | Height: 1528 | Size: 175 KiB |
After Width: 966 | Height: 745 | Size: 136 KiB |
@ -1,13 +1,27 @@ |
|||||
import { useLocation, useNavigate } from "react-router-dom"; |
import { useLocation, useNavigate } from "react-router-dom"; |
||||
|
import store from "~/store"; |
||||
|
|
||||
export const useRouter = () => { |
export const useRouter = () => { |
||||
|
|
||||
const navigate = useNavigate(); |
const navigate = useNavigate(); |
||||
const location = useLocation(); |
const location = useLocation(); |
||||
|
|
||||
const push = (path: any, state?: any, replace?: boolean) => { |
const push = (path: any, state?: any, replace?: boolean) => { |
||||
|
|
||||
|
const whites = [ |
||||
|
"/", |
||||
|
"/product", |
||||
|
"/share", |
||||
|
"/personal", |
||||
|
"/detail", |
||||
|
'/noShare' |
||||
|
]; |
||||
|
|
||||
|
if (!store.state.token && !whites.includes(path) && typeof path === 'string') { |
||||
|
store.setVisibleUnLogin(true) |
||||
|
return |
||||
|
} |
||||
navigate(path, { state, replace: replace || false }); |
navigate(path, { state, replace: replace || false }); |
||||
}; |
}; |
||||
|
|
||||
return { push, location } |
|
||||
|
return { push, location }; |
||||
}; |
}; |