|
|
@ -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 ( |
|
|
|
<div className="home"> |
|
|
|
<div className='fz-20 mt-2 plr-2'>發行搶購</div> |
|
|
|
{issueNft.length > 0 && <div className='fz-20 mt-2 plr-3'>發行搶購</div>} |
|
|
|
<div className='row-between mt-2 plr-5px'> |
|
|
|
<div> |
|
|
|
<i className='iconfont icon-arrow-left-bold fz-wb-550 fz-24' onClick={() => { |
|
|
@ -42,7 +42,7 @@ const Home = () => { |
|
|
|
<div className='mt-5px'>{item.name}</div> |
|
|
|
<div className='mt-5px fz-12'> |
|
|
|
<div className='row-between'> |
|
|
|
<div className='tag'>{item.symbol} {item.price}</div> |
|
|
|
<div className={`tag ${item.symbol}-bg`}>{item.symbol} {item.price}</div> |
|
|
|
<div className='row-center right-box'> |
|
|
|
<img src={item.cast_url} className='avatar-img' alt="" /> |
|
|
|
</div> |
|
|
@ -81,56 +81,67 @@ const Home = () => { |
|
|
|
<div className='plr-3 fz-20 mt-2'>拍賣趨勢</div> |
|
|
|
<div className='mt-2 row-items swiper'> |
|
|
|
{ |
|
|
|
auctionNft.map((item, index) => ( |
|
|
|
<div |
|
|
|
key={index} |
|
|
|
className={`swiper-item ${index === 0 ? 'ml-3' : 'ml-1'} ${index === auctionNft.length - 1 && 'mr-3'}`} |
|
|
|
> |
|
|
|
<img src={item.url} alt="" className='swiper-img' onClick={() => push('/detail', { id: item.id, type: item.type })} /> |
|
|
|
<div className='cover-box' > |
|
|
|
<div className='cover-box-item p-1 fz-12'> |
|
|
|
<div> |
|
|
|
<div>{item.name}</div> |
|
|
|
<div className='row-items mt-2px'> |
|
|
|
<div className='flex-1'> |
|
|
|
<div className='fz-8 fz-wb-550'>鑄造者</div> |
|
|
|
<div className='user-tag row-items mt-2px'> |
|
|
|
<img src={item.cast_url} alt="" /> |
|
|
|
<div className='flex-1 ml-5px text-overflow'>{item.cast_name}</div> |
|
|
|
auctionNft.length <= 0 ? |
|
|
|
Array.from({ length: 2 }).map((_, index) => ( |
|
|
|
<div key={index} className={`${index === 0 ? 'ml-3' : 'ml-1 mr-3'}`}> |
|
|
|
<AuctionNotOpen /> |
|
|
|
</div> |
|
|
|
)) : auctionNft.map((item, index) => ( |
|
|
|
<div |
|
|
|
key={index} |
|
|
|
className={`swiper-item ${index === 0 ? 'ml-3' : 'ml-1'} ${index === auctionNft.length - 1 && 'mr-3'}`} |
|
|
|
> |
|
|
|
<img src={item.url} alt="" className='swiper-img' onClick={() => push('/detail', { id: item.id, type: item.type })} /> |
|
|
|
<div className='cover-box' > |
|
|
|
<div className='cover-box-item p-1 fz-12'> |
|
|
|
<div> |
|
|
|
<div>{item.name}</div> |
|
|
|
<div className='row-items mt-2px'> |
|
|
|
<div className='flex-1'> |
|
|
|
<div className='fz-8 fz-wb-550'>鑄造者</div> |
|
|
|
<div className='user-tag row-items mt-2px'> |
|
|
|
<img src={item.cast_url} alt="" /> |
|
|
|
<div className='flex-1 ml-5px text-overflow'>{item.cast_name}</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className='flex-1'> |
|
|
|
<div className='fz-8 fz-wb-550'>售賣者</div> |
|
|
|
<div className='user-tag row-items mt-2px'> |
|
|
|
<img src={item.sell_url} alt="" /> |
|
|
|
<div className='flex-1 ml-5px text-overflow'>{item.sell_name}</div> |
|
|
|
<div className='flex-1'> |
|
|
|
<div className='fz-8 fz-wb-550'>售賣者</div> |
|
|
|
<div className='user-tag row-items mt-2px'> |
|
|
|
<img src={item.sell_url} alt="" /> |
|
|
|
<div className='flex-1 ml-5px text-overflow'>{item.sell_name}</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className='row-between'> |
|
|
|
<Button className='button' round onClick={() => push('/detail', { id: item.id, type: item.type })}> |
|
|
|
<div className='fz-wb-550'>出價</div> |
|
|
|
</Button> |
|
|
|
<i className={`
|
|
|
|
<div className='row-between'> |
|
|
|
<Button className='button' round onClick={() => push('/detail', { id: item.id, type: item.type })}> |
|
|
|
<div className='fz-wb-550'>出價</div> |
|
|
|
</Button> |
|
|
|
<i className={`
|
|
|
|
iconfont icon-daohangshoucangyishoucang fz-18 ${like.isLike(item.id, likeNft) ? 'like-text' : 'sub-text'} |
|
|
|
`} onClick={() => like.setLike(item.id)} />
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)) |
|
|
|
)) |
|
|
|
} |
|
|
|
</div> |
|
|
|
<div className='plr-3 fz-20 mt-2'>售賣市場</div> |
|
|
|
<div className='plr-3'> |
|
|
|
<div className='row-between flex-wrap'> |
|
|
|
{ |
|
|
|
sellNft.map((item, index) => ( |
|
|
|
<div key={index} onClick={() => push('/detail', { id: item.id, type: item.type })}> |
|
|
|
<ProductItem data={item} /> |
|
|
|
</div> |
|
|
|
)) |
|
|
|
sellNft.length <= 0 ? |
|
|
|
Array.from({ length: 2 }).map((_, index) => ( |
|
|
|
<div key={index}> |
|
|
|
<NotOpenProductItem /> |
|
|
|
</div> |
|
|
|
)) |
|
|
|
: sellNft.map((item, index) => ( |
|
|
|
<div key={index} onClick={() => push('/detail', { id: item.id, type: item.type })}> |
|
|
|
<ProductItem data={item} /> |
|
|
|
</div> |
|
|
|
)) |
|
|
|
} |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -139,4 +150,17 @@ const Home = () => { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
const AuctionNotOpen = () => ( |
|
|
|
<div |
|
|
|
className={`swiper-item }`} |
|
|
|
> |
|
|
|
<img src={require('~/assets/nft/1.jpg')} alt="" className='swiper-img' /> |
|
|
|
<div className='cover-box' > |
|
|
|
<div className='cover-box-item p-1 fz-12' style={{ justifyContent: 'center', alignItems: 'center' }}> |
|
|
|
<div className='sub-text fz-20'>暫未開放</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
|
|
|
|
export default observer(Home) |