Browse Source

commit

master
yyy9608 11 months ago
parent
commit
01d74f16f4
  1. 2
      src/components/ProductInfo.tsx
  2. 10
      src/components/ProductItem.tsx
  3. 22
      src/pages/home/index.tsx
  4. 13
      src/pages/personal/index.tsx
  5. 4
      src/pages/product/index.tsx
  6. 2
      src/pages/share/index.tsx
  7. 12
      src/styles/components.scss

2
src/components/ProductInfo.tsx

@ -6,7 +6,7 @@ import { useRouter } from '~/hooks/useRouter'
import store from '~/store' import store from '~/store'
import '~/styles/components.scss' import '~/styles/components.scss'
import { MarketNFTData } from '~/types/store' import { MarketNFTData } from '~/types/store'
import { getTime, toThousands } from '~/utils'
import { toThousands } from '~/utils'
import { copy } from '~/utils/copy' import { copy } from '~/utils/copy'
import Modal from './Modal' import Modal from './Modal'

10
src/components/ProductItem.tsx

@ -1,3 +1,5 @@
import { observer } from 'mobx-react'
import store from '~/store'
import '~/styles/components.scss' import '~/styles/components.scss'
import { MarketNFTData } from '~/types/store' import { MarketNFTData } from '~/types/store'
import { toThousands } from '~/utils' import { toThousands } from '~/utils'
@ -9,9 +11,15 @@ interface ProductItemProps {
const ProductItem = (props: ProductItemProps) => { const ProductItem = (props: ProductItemProps) => {
const { data } = props const { data } = props
const { userInfo } = store.state
return ( return (
<div className='product-item mt-2'> <div className='product-item mt-2'>
{
data.type !== 0 && data.sell_id === userInfo.id && (
<div className='sell-box row-center'>{data.type === 1 ? '拍賣中' : '售賣中'}</div>
)
}
<img src={data?.url} className='img' alt="" /> <img src={data?.url} className='img' alt="" />
{/* <div className='img'></div> */} {/* <div className='img'></div> */}
<div className='desc-box p-1'> <div className='desc-box p-1'>
@ -41,4 +49,4 @@ export const NotOpenProductItem = () => {
) )
} }
export default ProductItem
export default observer(ProductItem)

22
src/pages/home/index.tsx

@ -1,7 +1,7 @@
import '~/styles/home.scss' import '~/styles/home.scss'
import ProductItem, { NotOpenProductItem } from '~/components/ProductItem' import ProductItem, { NotOpenProductItem } from '~/components/ProductItem'
import { useRouter } from '~/hooks/useRouter' import { useRouter } from '~/hooks/useRouter'
import { Button, CountDown, Swiper, SwiperInstance } from 'react-vant'
import { Button, CountDown, PullRefresh, Swiper, SwiperInstance } from 'react-vant'
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
import { observer } from 'mobx-react' import { observer } from 'mobx-react'
import store from '~/store' import store from '~/store'
@ -14,13 +14,29 @@ const Home = () => {
const like = useLike() const like = useLike()
const swiperRef = useRef<SwiperInstance>(null) const swiperRef = useRef<SwiperInstance>(null)
useEffect(() => {
const onRefresh = () => {
return new Promise((resolve) => {
getData()
setTimeout(() => {
resolve(true)
},2000)
})
}
const getData = () => {
store.getMarketNft("sellNft") store.getMarketNft("sellNft")
store.getMarketNft("auctionNft") store.getMarketNft("auctionNft")
store.getMarketNft("issueNft") store.getMarketNft("issueNft")
}
useEffect(() => {
getData()
}, []) }, [])
return ( return (
<PullRefresh
onRefresh={onRefresh}
>
<div className="home"> <div className="home">
{issueNft.length > 0 && <div className='fz-20 mt-2 plr-3'></div>} {issueNft.length > 0 && <div className='fz-20 mt-2 plr-3'></div>}
<div className='row-between mt-2 plr-5px'> <div className='row-between mt-2 plr-5px'>
@ -147,6 +163,8 @@ const Home = () => {
</div> </div>
</div> </div>
</PullRefresh>
) )
} }

13
src/pages/personal/index.tsx

@ -1,5 +1,5 @@
import { observer } from 'mobx-react' import { observer } from 'mobx-react'
import { Divider } from 'react-vant'
import { Divider, PullRefresh } from 'react-vant'
import store from '~/store' import store from '~/store'
import '~/styles/personal.scss' import '~/styles/personal.scss'
import AccountAssetsCard from './AccountAssetsCard' import AccountAssetsCard from './AccountAssetsCard'
@ -8,7 +8,17 @@ const Personal = () => {
const { userInfo } = store.state const { userInfo } = store.state
const onRefresh = () => {
return new Promise((resolve) => {
store.getUserInfo()
setTimeout(() => {
resolve(true)
}, 2000)
})
}
return ( return (
<PullRefresh onRefresh={onRefresh}>
<div className='personal'> <div className='personal'>
<div className='plr-2 '> <div className='plr-2 '>
<div className='mt-3'> <div className='mt-3'>
@ -45,6 +55,7 @@ const Personal = () => {
</div> </div>
</div> </div>
</PullRefresh>
) )
} }

4
src/pages/product/index.tsx

@ -53,9 +53,7 @@ const Product = () => {
) )
} }
</div> </div>
{
isSearch && <div className='mt-2 fz-16 fz-wb-550'>{nftList.length}</div>
}
<div className='mt-2 fz-16 fz-wb-550' style={{ opacity: isSearch ? 1 : 0 }}>{nftList.length}</div>
<div className='box'> <div className='box'>
<div className='row-between flex-wrap'> <div className='row-between flex-wrap'>
{ {

2
src/pages/share/index.tsx

@ -1,5 +1,5 @@
import '~/styles/share.scss' import '~/styles/share.scss'
import { Popup, Tabs, Toast } from 'react-vant'
import { Popup, PullRefresh, Tabs, Toast } from 'react-vant'
import ProductItem from '~/components/ProductItem' import ProductItem from '~/components/ProductItem'
import store from '~/store' import store from '~/store'
import { observer } from 'mobx-react' import { observer } from 'mobx-react'

12
src/styles/components.scss

@ -3,6 +3,18 @@
height: 160px; height: 160px;
position: relative; position: relative;
.sell-box{
position: absolute;
top: 0;
left: 5px;
width: 171px;
border-radius: 10px 10px 0px 0px;
background-color: rgba(42,44,36,.8);
color: $white;
font-size: 12px;
padding: 2px 0;
}
.text-overflow{ .text-overflow{
max-width: 50px; max-width: 50px;
overflow: hidden; overflow: hidden;

Loading…
Cancel
Save