diff --git a/.env b/.env index cd3cba2..f4aea65 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:30305/#/' +REACT_APP_SHARE_LINK='http://14.29.101.215:30306/#/' REACT_APP_SIGN_KEY='9527nft9527_@fsdgfsx' \ No newline at end of file diff --git a/src/components/ProductInfo.tsx b/src/components/ProductInfo.tsx index 02917c3..8e40633 100644 --- a/src/components/ProductInfo.tsx +++ b/src/components/ProductInfo.tsx @@ -21,6 +21,7 @@ const ProductInfo = (props: ProductInfoProps) => { const { likeNft, userInfo } = store.state const { setLike, isLike } = useLike() const [visible, setVisible] = useState(false) + const [visibleTime, setVisibleTime] = useState(false) const share = () => { const pathname = `${process.env.REACT_APP_SHARE_LINK}detail?id=${data.id}&type=${data.type}` @@ -61,21 +62,23 @@ const ProductInfo = (props: ProductInfoProps) => { - {data.type === 1 &&
- + {data.type === 1 && !visibleTime &&
+ setVisibleTime(true)} />
} - {data.type === 3 &&
- + {data.type === 3 && !visibleTime &&
+ setVisibleTime(true)} />
} {data.type !== 0 &&
- setLike(data.id)} /> - + {data.type !== 3 && setLike(data.id)} />} +
}
{data.name}
+
{data.symbol} {toThousands(data.price)}
+
toShare('cast')}> -
铸造者
+
鑄造者
{data.cast_name}
@@ -88,7 +91,7 @@ const ProductInfo = (props: ProductInfoProps) => {
) : (
toShare('sell')}> -
售卖者
+
售賣者
{data.sell_name}
diff --git a/src/hooks/useCopy.ts b/src/hooks/useCopy.ts index 80b2af3..580f32c 100644 --- a/src/hooks/useCopy.ts +++ b/src/hooks/useCopy.ts @@ -5,7 +5,7 @@ const useCopyLink = () => { const copyVal = (address: any) => { copy(address, () => { - Toast.success('复制成功'); + Toast.success('複製成功'); }) }; diff --git a/src/hooks/useNotify.ts b/src/hooks/useNotify.ts index 9d8ab34..83a7438 100644 --- a/src/hooks/useNotify.ts +++ b/src/hooks/useNotify.ts @@ -5,7 +5,6 @@ import { MessageType } from "~/types/store"; import signGenerator from "~/utils/sign/sign"; const useNotify = (path: string, isNotity: boolean) => { - console.log(isNotity); const baseUrl = `${process.env.REACT_APP_WS_URL}/api/v1/${path}`; const ws = useRef(null); @@ -33,7 +32,7 @@ const useNotify = (path: string, isNotity: boolean) => { let message = JSON.parse(event.data) as MessageType; let item = filterMessage.current.find((v) => v.id === message.id); if (item) return; - filterMessage.current.push(message); + filterMessage.current.unshift(message); setMessages((_) => [...filterMessage.current]); // 如果打開了消息列表,則推送直接設置為已讀 if (isNotity) { diff --git a/src/pages/detail/AuctionNFT.tsx b/src/pages/detail/AuctionNFT.tsx index 04b68b8..3b2c52d 100644 --- a/src/pages/detail/AuctionNFT.tsx +++ b/src/pages/detail/AuctionNFT.tsx @@ -1,4 +1,4 @@ -import { useMemo, useState } from "react" +import { useEffect, useMemo, useState } from "react" import { Button, Toast } from "react-vant" import { buy_nft } from "~/api" import Modal from "~/components/Modal" @@ -29,6 +29,10 @@ const AuctionNFT = (props: AuctionNFTProps) => { setVisible(true) } + useEffect(() => { + !visible && setMarkupCount(0) + }, [visible]) + const confirm = async () => { setVisible(false) const params = { diff --git a/src/pages/detail/BuyNft.tsx b/src/pages/detail/BuyNft.tsx index aef7360..3b5f982 100644 --- a/src/pages/detail/BuyNft.tsx +++ b/src/pages/detail/BuyNft.tsx @@ -7,6 +7,7 @@ import { observer } from 'mobx-react' import store from '~/store' import { toThousands } from '~/utils' import { buy_nft } from '~/api' +import { useRouter } from '~/hooks/useRouter' interface BuyNftProps { data: MarketNFTData @@ -15,6 +16,7 @@ interface BuyNftProps { const BuyNft = (props: BuyNftProps) => { const { data } = props + const { push } = useRouter() const { userInfo, token } = store.state const [buyVisible, setBuyVisible] = useState(false) const [successVisible, setSuccessVisible] = useState(false) @@ -41,15 +43,16 @@ const BuyNft = (props: BuyNftProps) => { } const res: any = await buy_nft(params) if (res && res.code === 0) { - setSuccessVisible(true) store.getMyNft("myNft") store.getMarketNft("sellNft") store.getUserInfo() + store.setBuyNFTSuccessVisible(true, data.name) + push('/share', null, true) } } return ( -
+
{/* Buy Modal */} {
您將以 {toThousands(data.price)} {data.symbol}
購買一張 "{data.name}" NFT
- +
- {/* success */} - -
-
- -
-
恭喜購買成功
-
{data.name}
-
-
+
) } diff --git a/src/pages/detail/IssuanceRushNFT.tsx b/src/pages/detail/IssuanceRushNFT.tsx index 7d6f1be..ad20e30 100644 --- a/src/pages/detail/IssuanceRushNFT.tsx +++ b/src/pages/detail/IssuanceRushNFT.tsx @@ -2,6 +2,7 @@ import { useMemo, useState } from "react" import { Button, CountDown } from "react-vant" import { buy_nft } from "~/api" import Modal from "~/components/Modal" +import { useRouter } from "~/hooks/useRouter" import store from "~/store" import '~/styles/detail.scss' import { MarketNFTData } from "~/types/store" @@ -16,6 +17,7 @@ interface IssuanceRushNFTProps { const IssuanceRushNFT = (props: IssuanceRushNFTProps) => { const { data, getData } = props + const { push } = useRouter() const [isBuy, setIsBuy] = useState(false) const [buyVisible, setBuyVisible] = useState(false) const [successVisible, setSuccessVisible] = useState(false) @@ -33,21 +35,16 @@ const IssuanceRushNFT = (props: IssuanceRushNFTProps) => { } const res: any = await buy_nft(params) if (res && res.code === 0) { - setSuccessVisible(true) - getData() store.getMyNft("myNft") store.getMarketNft("issueNft") store.getUserInfo() + store.setBuyNFTSuccessVisible(true, data.name) + push('/share', null, true) } } return (
-
NFT説明:
-
{data.illustrate}
-
- -
+
diff --git a/src/pages/detail/OnShelvesNFT.tsx b/src/pages/detail/OnShelvesNFT.tsx index c6ac68c..8c966a8 100644 --- a/src/pages/detail/OnShelvesNFT.tsx +++ b/src/pages/detail/OnShelvesNFT.tsx @@ -88,8 +88,6 @@ const OnShelvesNFT = (props: OnShelvesNFTProps) => { symbols.map(item => (
{ setCurrentSymbol(item) - console.log(currentSymbol); - }}>
{item}
diff --git a/src/pages/detail/index.tsx b/src/pages/detail/index.tsx index 340885c..1aaa2df 100644 --- a/src/pages/detail/index.tsx +++ b/src/pages/detail/index.tsx @@ -47,17 +47,12 @@ const Detail = () => { const renderItem = () => { // type為 0 時 顯示NFT屬性 - if (product.type === 0) { + if (product.type === 0 && product.sell_id === userInfo.id) { return ( - <> -
- -
- {/* 屬於自己時顯示上架 */} - {product.sell_id === userInfo.id && } - + ) } + // 如果type為2時 并且不屬於自己時 顯示購買 if (product.type === 2 && product.sell_id !== userInfo.id) { return @@ -118,7 +113,16 @@ const Detail = () => {
- {renderItem()} +
+
NFT説明:
+
{product.illustrate}
+
+
+ +
+
+ {renderItem()} +
) } diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index 60ed584..7231fa6 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -3,7 +3,6 @@ import ProductItem from '~/components/ProductItem' import { useRouter } from '~/hooks/useRouter' import { Button, CountDown, Swiper, SwiperInstance } from 'react-vant' import { useEffect, useRef } from 'react' -import { getTime, splitAddress } from '~/utils' import { observer } from 'mobx-react' import store from '~/store' import useLike from '~/hooks/useLike' @@ -33,7 +32,7 @@ const Home = () => {
{ - issueNft.map(item => ( + issueNft.map((item, index) => (
push('/detail', { id: item.id, type: item.type })}>
@@ -49,12 +48,18 @@ const Home = () => {
-
-
即將發售
-
- -
-
+ { + item.isTime ? ( +
售賣中
+ ) : ( +
+
即將發售
+
+ store.updateIssueNftIsTime(index)} /> +
+
+ ) + }
{item.cast_name}
diff --git a/src/pages/no-share/index.tsx b/src/pages/no-share/index.tsx index acf2c5a..4d10fe3 100644 --- a/src/pages/no-share/index.tsx +++ b/src/pages/no-share/index.tsx @@ -47,11 +47,11 @@ const NoShare = () => {
{userInfo.sell || 0}
-
售卖作品
+
售賣作品
{userInfo.auction || 0}
-
拍卖作品
+
拍賣作品
{toFixed2(userInfo.income, 2)} FIL
diff --git a/src/pages/personal/AccountAssetsCard.tsx b/src/pages/personal/AccountAssetsCard.tsx index ee033f2..8d298f7 100644 --- a/src/pages/personal/AccountAssetsCard.tsx +++ b/src/pages/personal/AccountAssetsCard.tsx @@ -11,15 +11,15 @@ const AccountAssetsCard = () => { const { userInfo } = store.state const balanceList = useMemo(() => [ - { title: 'USDT资产', value: userInfo.balance_Usdt || 0, symbol: 'USDT' }, - { title: 'FIL资产', value: userInfo.balance_fil || 0, symbol: 'FIL' }, + { title: 'USDT資產', value: userInfo.balance_Usdt || 0, symbol: 'USDT' }, + { title: '資產', value: userInfo.balance_fil || 0, symbol: 'FIL' }, ], [userInfo]); const menu = useMemo(() => [ { title: '充值', icon: require('~/assets/recharge.png'), path: '/recharge' }, - { title: '提现', icon: require('~/assets/withdraw.png'), path: '/withdraw' }, - { title: '账单', icon: require('~/assets/record.png'), path: '/record' }, - { title: '团队', icon: require('~/assets/team.png'), path: '/team' }, + { title: '提現', icon: require('~/assets/withdraw.png'), path: '/withdraw' }, + { title: '賬單', icon: require('~/assets/record.png'), path: '/record' }, + { title: '團隊', icon: require('~/assets/team.png'), path: '/team' }, ], []); return ( @@ -27,7 +27,7 @@ const AccountAssetsCard = () => {
-
总资产估值
+
總資產估值
{toThousands(userInfo.total)} USDT
diff --git a/src/pages/personal/index.tsx b/src/pages/personal/index.tsx index eab0fc9..01260c4 100644 --- a/src/pages/personal/index.tsx +++ b/src/pages/personal/index.tsx @@ -17,10 +17,10 @@ const Personal = () => {
-
资产
+
資產
-
名称
+
名稱
可用
diff --git a/src/pages/product/index.tsx b/src/pages/product/index.tsx index 252ad21..4128690 100644 --- a/src/pages/product/index.tsx +++ b/src/pages/product/index.tsx @@ -15,14 +15,20 @@ const Product = () => { const { push } = useRouter() const [nftList, setNftList] = useState([] as MarketNFTData[]) const [loading, setLoading] = useState(false) + const [isSearch, setIsSearch] = useState(false) const onChange = (e: any) => { searchNft(e.target.value) } const searchNft = debounce(async (value: string) => { - if (!value) return setNftList([]) + if (!value) { + setNftList([]) + setIsSearch(false) + return + } setLoading(true) + setIsSearch(true) const res: any = await search_nft(value) setLoading(false) if (res && res.code === 0 && res.data) { @@ -47,7 +53,9 @@ const Product = () => { ) }
-
{nftList.length}個結果
+ { + isSearch &&
{nftList.length}個結果
+ }
{ @@ -60,7 +68,7 @@ const Product = () => {
-
推荐
+
推薦
{ rmdNft.map((item, index) => ( diff --git a/src/pages/record/index.tsx b/src/pages/record/index.tsx index 0f3bbbc..ccacf5d 100644 --- a/src/pages/record/index.tsx +++ b/src/pages/record/index.tsx @@ -14,9 +14,8 @@ const Record = () => { const { token } = store.state; const { push, location } = useRouter() - console.log(location); - const recordTabs = useMemo(() => ['充值', '提现', '收益'], []); + const recordTabs = useMemo(() => ['充值', '提現', '收益'], []); const [recordIndex, setRecordIndex] = useState(location.state ? location.state.index : 0); const { copyVal } = useCopyLink(); const [query, setQuery] = useState([ @@ -78,7 +77,7 @@ const Record = () => { return (
{ - if (list.length <= 0 || Object.keys(list).length <= 0) return ; + if (list.length <= 0 || Object.keys(list).length <= 0) return ; return ( - getData()} errorText="请求失败,点击重新加载" offset={10}> + getData()} errorText="請求失敗,點擊重新加載" offset={10}> { list.map((item) => ( @@ -155,16 +154,16 @@ const RechargeRecord = ( const WithdrawRecord = ({ list, finished, getData, copy }: ChildProps) => { - if (list.length <= 0 || Object.keys(list).length <= 0) return ; + if (list.length <= 0 || Object.keys(list).length <= 0) return ; return ( - getData()} errorText="请求失败,点击重新加载" offset={10}> + getData()} errorText="請求失敗,點擊重新加載" offset={10}> { list.map((item, index) => (
-
提现
+
提現
{getTime(item.time * 1000)}
交易哈希:{item.tx_hash && splitAddress(item.tx_hash, 8)} @@ -191,10 +190,10 @@ const WithdrawRecord = ({ list, finished, getData, copy }: ChildProps) => { const TransferRecord = ({ list, finished, getData }: ChildProps) => { - if (list.length <= 0 || Object.keys(list).length <= 0) return ; + if (list.length <= 0 || Object.keys(list).length <= 0) return ; return ( - getData()} errorText="请求失败,点击重新加载" offset={10}> + getData()} errorText="請求失敗,點擊重新加載" offset={10}> { list.map((item, index) => ( diff --git a/src/pages/share/index.tsx b/src/pages/share/index.tsx index 64830a0..86ae4c6 100644 --- a/src/pages/share/index.tsx +++ b/src/pages/share/index.tsx @@ -129,20 +129,20 @@ const Share = () => {
) : ( -
未登录
+
未登錄
) }
-
{userInfo.show === 2 ? '开放我的艺术页面' : '隐藏我的艺术页面'}
+
{userInfo.show === 2 ? '開放我的藝術頁面' : '隱藏我的藝術頁面'}
{userInfo.sell}
-
售卖作品
+
售賣作品
{userInfo.auction}
-
拍卖作品
+
拍賣作品
{toFixed2(userInfo.income, 2)} FIL
@@ -195,8 +195,8 @@ const Share = () => { >
-
从手机相册选择
-
保存图片
+
從手機相冊選擇
+
保存圖片
取消
diff --git a/src/pages/team/index.tsx b/src/pages/team/index.tsx index a4b1927..5e942ae 100644 --- a/src/pages/team/index.tsx +++ b/src/pages/team/index.tsx @@ -69,7 +69,6 @@ const Team = () => { setCardState([...cardState]) setAddress(res.data.address) } - console.log(res); } token && getData() diff --git a/src/pages/withdraw/index.tsx b/src/pages/withdraw/index.tsx index cfb9124..47534f0 100644 --- a/src/pages/withdraw/index.tsx +++ b/src/pages/withdraw/index.tsx @@ -17,8 +17,7 @@ const Recharge = () => { const inputRef = useRef(null); const currentCoin = useMemo(() => coinList[coinIndex], [coinIndex, coinList]) const [loading, setLoading] = useState(false); - console.log(currentCoin); - + const withdraw = async () => { const amount = inputRef.current?.value const balance = currentCoin.balance @@ -34,6 +33,7 @@ const Recharge = () => { amount }); if (res.code === 0 || res.code === 101) { + store.getUserInfo() res.code === 0 && Toast.success('提交成功'); setTimeout(() => { push('/record', { index: 1 }, true) @@ -47,7 +47,7 @@ const Recharge = () => { return (
- +
{
-
提现地址
+
提現地址
{walletAddress}
@@ -81,19 +81,21 @@ const Recharge = () => {
{currentCoin && currentCoin.symbol}
-
最大
+
{ + inputRef.current && (inputRef.current.value = currentCoin.balance) + }}>ALL
-
可用余额:{currentCoin ? currentCoin.balance : 0} {currentCoin && currentCoin.symbol}
+
可用餘額:{currentCoin ? currentCoin.balance : 0} {currentCoin && currentCoin.symbol}
-
手续费
+
手續費
{currentCoin ? currentCoin.withdraw_fee : 0} {currentCoin && currentCoin.symbol}
- +
diff --git a/src/router/layout/Navbar.tsx b/src/router/layout/Navbar.tsx index fb682af..db5c16d 100644 --- a/src/router/layout/Navbar.tsx +++ b/src/router/layout/Navbar.tsx @@ -22,7 +22,6 @@ const Navbar = (props: NavbarProps) => { const msgCount = useMemo(() => { // status 1.未讀 2.已讀 let list = messages.filter(v => v.status === 1) - console.log(list); return list.length }, [messages]) diff --git a/src/router/layout/index.tsx b/src/router/layout/index.tsx index 1527042..255afad 100644 --- a/src/router/layout/index.tsx +++ b/src/router/layout/index.tsx @@ -12,6 +12,7 @@ import useNotify from '~/hooks/useNotify'; import { ethers } from 'ethers'; import { bind_rmd } from '~/api'; import { AlreadyBind, BindRmd, BindSuccess, DefaultBind, UnLogin, VaildLink } from './ui'; +import Modal from '~/components/Modal'; const LayoutRouter = () => { @@ -129,6 +130,21 @@ const LayoutRouter = () => { />
+ {/* success */} + store.setBuyNFTSuccessVisible(false)} + showConfirmButton + title='' + > +
+
+ +
+
恭喜購買成功
+
{store.state.buyNFTSuccessName}
+
+
{/* 無效鏈接 */} {visibleVaildLink && } {/* 已經綁定 */} diff --git a/src/store/index.ts b/src/store/index.ts index ca13d0c..6e629d8 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -14,6 +14,8 @@ class AppStore implements Store { coinList: [] as CoinList[], userInfo: {} as UserInfo, visibleUnLogin: false, + buyNFTSuccessVisible: false, + buyNFTSuccessName: "", likeNft: [] as MarketNFTData[], //喜歡的NFT myNft: [] as MarketNFTData[], //我的NFT auctionNft: [] as MarketNFTData[], //拍賣NFT @@ -124,6 +126,19 @@ class AppStore implements Store { this.state[key] = res.data; } } + + updateIssueNftIsTime(index: number) { + this.state.issueNft[index].isTime = true; + } + + setBuyNFTSuccessVisible(bool: boolean, name?: string) { + this.state.buyNFTSuccessVisible = bool; + if (bool && name) { + this.state.buyNFTSuccessName = name; + } else { + this.state.buyNFTSuccessName = ""; + } + } } const store = new AppStore(); diff --git a/src/styles/detail.scss b/src/styles/detail.scss index b391b37..1cc931d 100644 --- a/src/styles/detail.scss +++ b/src/styles/detail.scss @@ -6,12 +6,7 @@ } .buy-nft{ - .success-img{ - width: 125px; - height: 140px; - object-fit: cover; - } - + .tag-mark{ width: 90px; height: 35px; diff --git a/src/styles/layout.scss b/src/styles/layout.scss index e736b6f..d073cf8 100644 --- a/src/styles/layout.scss +++ b/src/styles/layout.scss @@ -71,6 +71,14 @@ } .ui{ + + .success-img{ + width: 125px; + height: 140px; + object-fit: cover; + } + + .unlogin-box{ width: 100%; height: 32px; diff --git a/src/styles/share.scss b/src/styles/share.scss index 7c906ac..cac4242 100644 --- a/src/styles/share.scss +++ b/src/styles/share.scss @@ -22,8 +22,11 @@ bottom: -71px; .img{ - @include img-size(142px,142px); + width: 142px; + height: 142px; border-radius: 71px; + overflow: hidden; + object-fit:cover; } } } diff --git a/src/types/store.d.ts b/src/types/store.d.ts index 7526b42..d15430d 100644 --- a/src/types/store.d.ts +++ b/src/types/store.d.ts @@ -68,6 +68,7 @@ interface MarketNFTData { current_number: number; remain_quantity: number; illustrate: string; + isTime: boolean; } interface InviteRecordData {