diff --git a/.env b/.env index f4aea65..1d4e9cd 100644 --- a/.env +++ b/.env @@ -2,5 +2,5 @@ SKIP_PREFLIGHT_CHECK=true GENERATE_SOURCEMAP=false REACT_APP_BASE_URL='http://14.29.101.215:30307' REACT_APP_WS_URL='ws://14.29.101.215:30307' -REACT_APP_SHARE_LINK='http://14.29.101.215:30306/#/' +REACT_APP_SHARE_LINK='http://14.29.101.215:30306/#/?address=' REACT_APP_SIGN_KEY='9527nft9527_@fsdgfsx' \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico index a11777c..b649487 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html index 23fd73e..8ba7bd3 100644 --- a/public/index.html +++ b/public/index.html @@ -49,13 +49,13 @@
- +
-
Loading...
+
Loading...
diff --git a/public/logo192.png b/public/logo192.png index fc44b0a..c6a275f 100644 Binary files a/public/logo192.png and b/public/logo192.png differ diff --git a/public/logo512.png b/public/logo512.png index a4e47a6..243e4be 100644 Binary files a/public/logo512.png and b/public/logo512.png differ diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..243e4be Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/assets/nft/1.jpg b/src/assets/nft/1.jpg new file mode 100644 index 0000000..870c2ca Binary files /dev/null and b/src/assets/nft/1.jpg differ diff --git a/src/assets/nft/2.jpg b/src/assets/nft/2.jpg new file mode 100644 index 0000000..a30a67b Binary files /dev/null and b/src/assets/nft/2.jpg differ diff --git a/src/components/ProductItem.tsx b/src/components/ProductItem.tsx index c7c5705..8e8ca94 100644 --- a/src/components/ProductItem.tsx +++ b/src/components/ProductItem.tsx @@ -1,6 +1,6 @@ import '~/styles/components.scss' import { MarketNFTData } from '~/types/store' -import { splitAddress, toThousands } from '~/utils' +import { toThousands } from '~/utils' interface ProductItemProps { data: MarketNFTData @@ -28,4 +28,17 @@ const ProductItem = (props: ProductItemProps) => { ) } +export const NotOpenProductItem = () => { + + return ( +
+ + {/*
*/} +
+
暫未開放
+
+
+ ) +} + export default ProductItem \ No newline at end of file diff --git a/src/hooks/useRouter.ts b/src/hooks/useRouter.ts index 3bab94c..8132310 100644 --- a/src/hooks/useRouter.ts +++ b/src/hooks/useRouter.ts @@ -1,13 +1,27 @@ import { useLocation, useNavigate } from "react-router-dom"; +import store from "~/store"; export const useRouter = () => { - const navigate = useNavigate(); const location = useLocation(); 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 }); }; - return { push, location } -}; \ No newline at end of file + return { push, location }; +}; diff --git a/src/index.tsx b/src/index.tsx index 66ac3e0..525aa1f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -8,7 +8,7 @@ const root = ReactDOM.createRoot( ); root.render( - // - - // + + + ); \ No newline at end of file diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index 7231fa6..52f6a13 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -1,5 +1,5 @@ import '~/styles/home.scss' -import ProductItem from '~/components/ProductItem' +import ProductItem, { NotOpenProductItem } from '~/components/ProductItem' import { useRouter } from '~/hooks/useRouter' import { Button, CountDown, Swiper, SwiperInstance } from 'react-vant' import { useEffect, useRef } from 'react' @@ -22,7 +22,7 @@ const Home = () => { return (
-
發行搶購
+ {issueNft.length > 0 &&
發行搶購
}
{ @@ -42,7 +42,7 @@ const Home = () => {
{item.name}
-
{item.symbol} {item.price}
+
{item.symbol} {item.price}
@@ -81,56 +81,67 @@ const Home = () => {
拍賣趨勢
{ - auctionNft.map((item, index) => ( -
- push('/detail', { id: item.id, type: item.type })} /> -
-
-
-
{item.name}
-
-
-
鑄造者
-
- -
{item.cast_name}
+ auctionNft.length <= 0 ? + Array.from({ length: 2 }).map((_, index) => ( +
+ +
+ )) : auctionNft.map((item, index) => ( +
+ push('/detail', { id: item.id, type: item.type })} /> +
+
+
+
{item.name}
+
+
+
鑄造者
+
+ +
{item.cast_name}
+
-
-
-
售賣者
-
- -
{item.sell_name}
+
+
售賣者
+
+ +
{item.sell_name}
+
-
-
- - + + like.setLike(item.id)} /> +
-
- )) + )) }
售賣市場
{ - sellNft.map((item, index) => ( -
push('/detail', { id: item.id, type: item.type })}> - -
- )) + sellNft.length <= 0 ? + Array.from({ length: 2 }).map((_, index) => ( +
+ +
+ )) + : sellNft.map((item, index) => ( +
push('/detail', { id: item.id, type: item.type })}> + +
+ )) }
@@ -139,4 +150,17 @@ const Home = () => { ) } +const AuctionNotOpen = () => ( +
+ +
+
+
暫未開放
+
+
+
+) + export default observer(Home) \ No newline at end of file diff --git a/src/pages/recharge/index.tsx b/src/pages/recharge/index.tsx index 6462e28..411fa9a 100644 --- a/src/pages/recharge/index.tsx +++ b/src/pages/recharge/index.tsx @@ -180,7 +180,7 @@ const Recharge = () => { balance[currentCoin.symbol] && (inputRef.current!.value = balance[currentCoin.symbol]) }}>ALL
-
可用餘額:{currentCoin.symbol ? balance[currentCoin.symbol] : 0}
+
可用餘額:{currentCoin && currentCoin.symbol ? balance[currentCoin.symbol] : 0}
diff --git a/src/pages/share/index.tsx b/src/pages/share/index.tsx index 86ae4c6..ce6610f 100644 --- a/src/pages/share/index.tsx +++ b/src/pages/share/index.tsx @@ -132,16 +132,16 @@ const Share = () => {
未登錄
) } -
+ {token &&
{userInfo.show === 2 ? '開放我的藝術頁面' : '隱藏我的藝術頁面'}
-
+
}
-
{userInfo.sell}
+
{userInfo.sell || 0}
售賣作品
-
{userInfo.auction}
+
{userInfo.auction || 0}
拍賣作品
diff --git a/src/pages/team/index.tsx b/src/pages/team/index.tsx index 5e942ae..82b5213 100644 --- a/src/pages/team/index.tsx +++ b/src/pages/team/index.tsx @@ -62,7 +62,7 @@ const Team = () => { const getData = async () => { const res: any = await team_info() if (res && res.code === 0) { - cardState[0][0].value = res.data.inviti_address || '000000000000000' + cardState[0][0].value = res.data.inviti_address || '' cardState[1][0].value = res.data.award ? res.data.award + "U" : "0U" cardState[1][1].value = res.data.direct_count ? res.data.direct_count + '人' : '0人' cardState[1][2].value = res.data.indirect_count ? res.data.indirect_count + '人' : '0人' @@ -99,9 +99,9 @@ const Team = () => {
{item.title}
- {item.id === 1 ? splitAddress(item.value) : item.value} + {item.id === 1 ? item.value && splitAddress(item.value) || '-' : item.value} { - item.id === 1 && ( + item.id === 1 && item.value && ( copyVal(item.value)}> ) } diff --git a/src/router/layout/Navbar.tsx b/src/router/layout/Navbar.tsx index db5c16d..1366c9f 100644 --- a/src/router/layout/Navbar.tsx +++ b/src/router/layout/Navbar.tsx @@ -45,7 +45,10 @@ const Navbar = (props: NavbarProps) => { pathname === '/noShare' ? (
push(-1)}>
) : ( -
9527
+
+ +
{require('../../../package.json').name}
+
) }
diff --git a/src/router/layout/index.tsx b/src/router/layout/index.tsx index 255afad..4e7c8fb 100644 --- a/src/router/layout/index.tsx +++ b/src/router/layout/index.tsx @@ -13,6 +13,7 @@ import { ethers } from 'ethers'; import { bind_rmd } from '~/api'; import { AlreadyBind, BindRmd, BindSuccess, DefaultBind, UnLogin, VaildLink } from './ui'; import Modal from '~/components/Modal'; +import { Toast } from 'react-vant'; const LayoutRouter = () => { @@ -61,12 +62,19 @@ const LayoutRouter = () => { }, [token]) useEffect(() => { + // 0x2ADDed672bacEfe857a408B577CB7DF1f6687c07 const isModal = async () => { let user = userInfo - let isRouter = routes.find(v => v.path === location.pathname) - const address = location.pathname.substring(1, location.pathname.length) - if (isRouter) return + if (location.pathname !== '/') return + + const address = location.search.split('=')[1] + if (!address) return + + if (!token) { + store.setVisibleUnLogin(true) + return + } if (Object.keys(user).length <= 0) { const res: any = await store.getUserInfo() @@ -74,15 +82,23 @@ const LayoutRouter = () => { user = res } } + if (!ethers.utils.isAddress(address)) { // 无效的分享链接 setVisibleVaildLink(true) return } // 地址相同 - if (address.toLocaleLowerCase() === walletAddress.toLocaleLowerCase()) return - setShareAddress(address) + if (address.toLocaleLowerCase() === walletAddress.toLocaleLowerCase()) { + push('/', null, true) + Toast.fail({ + message: '不能綁定自己!', + duration: 2500 + }) + return + } // 绑定推荐人 + setShareAddress(address) if (!user.is_bound && ethers.utils.isAddress(address)) { setVisibleBindRmd(true) @@ -94,7 +110,7 @@ const LayoutRouter = () => { } } - token && isModal() + isModal() !token && setVisibleBindRmd(false) }, [token, walletAddress]) diff --git a/src/router/layout/ui.tsx b/src/router/layout/ui.tsx index 3230fac..b21d39f 100644 --- a/src/router/layout/ui.tsx +++ b/src/router/layout/ui.tsx @@ -10,35 +10,49 @@ interface UIProps { address?: string } -export const UnLogin = ({ visible, setVisible }: UIProps) => ( - -
-
訪問失敗
-
未檢測到錢包,請登錄錢包後重新點擊
-
-
-) +export const UnLogin = ({ visible, setVisible }: UIProps) => { + return ( + { + setVisible(false) + }} + setVisible={() => { + setVisible(false) + }} + visible={visible} + buttonText="關閉" + hiddenCloseIcon + > +
+
訪問失敗
+
未檢測到錢包,請登錄錢包後重新點擊
+
+
+ ) +} -export const VaildLink = ({ visible, setVisible }: UIProps) => ( - setVisible(false)} - setVisible={() => setVisible(false)} - visible={visible} - buttonText="關閉" - > -
-
綁定失敗
-
無效的分享鏈接
-
-
-) +export const VaildLink = ({ visible, setVisible }: UIProps) => { + return ( + { + setVisible(false) + }} + setVisible={() => { + setVisible(false) + }} + visible={visible} + hiddenCloseIcon + buttonText="關閉" + > +
+
綁定失敗
+
無效的分享鏈接
+
+
+ ) +} export const DefaultBind = ({ visible, setVisible, onClick }: UIProps) => { @@ -97,7 +111,6 @@ export const BindSuccess = ({ visible, setVisible, address }: UIProps) => { setVisible={setVisible} title="綁定推薦人" buttonClick={() => { - push('/', null, true) setVisible() push('/team') }} @@ -105,7 +118,9 @@ export const BindSuccess = ({ visible, setVisible, address }: UIProps) => { hiddenCloseIcon showCancelButton showCancelButtonText="關閉" - showCancelButtonClick={setVisible} + showCancelButtonClick={() => { + setVisible() + }} >
綁定成功
@@ -116,19 +131,24 @@ export const BindSuccess = ({ visible, setVisible, address }: UIProps) => { } -export const AlreadyBind = ({ visible, setVisible, onClick }: UIProps) => ( - onClick && onClick()} - setVisible={() => setVisible(false)} - visible={visible} - buttonText='查看綁定人' - showCancelButton - showCancelButtonClick={() => setVisible(false)} - > -
-
綁定失敗
-
該錢包已有推薦人,不可重複綁定推薦人
-
-
-) \ No newline at end of file +export const AlreadyBind = ({ visible, setVisible, onClick }: UIProps) => { + return ( + onClick && onClick()} + setVisible={() => setVisible()} + visible={visible} + buttonText='查看綁定人' + hiddenCloseIcon + showCancelButton + showCancelButtonClick={() => { + setVisible() + }} + > +
+
綁定失敗
+
該錢包已有推薦人,不可重複綁定推薦人
+
+
+ ) +} \ No newline at end of file diff --git a/src/router/routes.tsx b/src/router/routes.tsx index 1ef866c..a4c59cc 100644 --- a/src/router/routes.tsx +++ b/src/router/routes.tsx @@ -17,10 +17,6 @@ const routes = [ path: "/", element: }, - { - path: '/:id', - component: - }, { path: "/product", element: , diff --git a/src/styles/components.scss b/src/styles/components.scss index f2df7ba..fea5cce 100644 --- a/src/styles/components.scss +++ b/src/styles/components.scss @@ -56,7 +56,8 @@ align-items: center; .user-img{ - @include img-size(12px,12px) + @include img-size(12px,12px); + border-radius:12px } } } diff --git a/src/styles/home.scss b/src/styles/home.scss index af09baa..fbdc51b 100644 --- a/src/styles/home.scss +++ b/src/styles/home.scss @@ -22,7 +22,6 @@ height: 130px; .tag{ - background: $usdt-bg; color: $white; padding: 3px 15px; border-radius: 20px; @@ -85,7 +84,7 @@ display: flex; justify-content: space-between; flex-direction: column; - + .user-tag{ width: 90%; height: 16px; diff --git a/src/styles/layout.scss b/src/styles/layout.scss index d073cf8..04706de 100644 --- a/src/styles/layout.scss +++ b/src/styles/layout.scss @@ -17,6 +17,13 @@ border-radius: 3px; background-color: $red; } + + .logo{ + width: 20px; + height: 20px; + object-fit: cover; + } + } .header-block{