This commit is contained in:
parent
dd5c62b05e
commit
0aa34cfc85
|
|
@ -20,4 +20,4 @@ REACT_APP_SNAPSHOT_VOTING_API = "https://xtjyd0liqe.execute-api.ap-northeast-1.a
|
|||
|
||||
|
||||
REACT_APP_REQUEST_URL = 'http://101.35.117.69:9090'
|
||||
# REACT_APP_REQUEST_URL = 'http://192.168.2.210:8080'
|
||||
# REACT_APP_REQUEST_URL = 'http://192.168.2.28:8080'
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import React, { lazy, useEffect } from 'react'
|
|||
import { Router, Redirect, Route, Switch } from 'react-router-dom'
|
||||
import { ResetCSS } from '@pancakeswap/uikit'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import { uccnDetail, indexInfo } from 'services/user'
|
||||
import BigNumber from 'bignumber.js'
|
||||
import useEagerConnect from 'hooks/useEagerConnect'
|
||||
import { usePollCoreFarmData, useFetchProfile, usePollBlockNumber } from 'state/hooks'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React, { useEffect, useState, useMemo } from 'react'
|
||||
import { Menu as UikitMenu, ConnectorNames } from '@pancakeswap/uikit'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import { uccnDetail, indexInfo } from 'services/user'
|
||||
import { useWeb3React } from '@web3-react/core'
|
||||
import { languageList } from 'config/localization/languages'
|
||||
import { useTranslation } from 'contexts/Localization'
|
||||
|
|
@ -10,10 +11,11 @@ import { usePriceHccUsdt, useProfile } from 'state/hooks'
|
|||
import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo } from 'state/userInfo/hooks'
|
||||
import useWeb3Provider from 'hooks/useActiveWeb3React'
|
||||
import { clearUserInfo } from 'state/actions'
|
||||
import { uccnDetail } from 'services/user'
|
||||
import config from './config'
|
||||
|
||||
const list = []
|
||||
const Menu = (props) => {
|
||||
console.log(props)
|
||||
const account = useAccount()
|
||||
const { login, logout } = useAuth()
|
||||
const [hasWalletLogin, setHasWalletLogin] = useState(false)
|
||||
|
|
@ -39,6 +41,20 @@ const Menu = (props) => {
|
|||
dispatch(clearUserInfo())
|
||||
logout()
|
||||
}
|
||||
|
||||
const [linkList, setLinkList] = useState([])
|
||||
const getDetails = async () => {
|
||||
const result = await indexInfo()
|
||||
const { data } = result.data
|
||||
data.externalLinkList.forEach((item) => {
|
||||
const links = []
|
||||
Object.keys(item.linkMap).forEach((key) => {
|
||||
links.push({ name: key, link: item.linkMap[key], icon: item.iconResource.url })
|
||||
})
|
||||
list.push({ icon: item.iconResource.url, list: links })
|
||||
})
|
||||
setLinkList(list)
|
||||
}
|
||||
// 钱包登录后
|
||||
useEffect(() => {
|
||||
if (unActiveAccount && library.provider && hasWalletLogin) {
|
||||
|
|
@ -47,20 +63,8 @@ const Menu = (props) => {
|
|||
}
|
||||
}, [unActiveAccount, hasWalletLogin, library])
|
||||
|
||||
const [detail, setDetail] = useState({
|
||||
outSideChainNumb: '',
|
||||
outsideChainVos: [],
|
||||
telegramNumb: '',
|
||||
tradingVolume: '',
|
||||
userNumb: '',
|
||||
})
|
||||
const getDetail = async () => {
|
||||
const result = await uccnDetail()
|
||||
const { data } = result.data
|
||||
setDetail(data)
|
||||
}
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
getDetails()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
|
@ -76,7 +80,7 @@ const Menu = (props) => {
|
|||
setLang={setLanguage}
|
||||
cakePriceUsd={hccPriceUsdt.toNumber()}
|
||||
links={config(t)}
|
||||
outLink={detail?.outsideChainVos}
|
||||
outLink={linkList}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -134,21 +134,32 @@ const FristCom: React.FC = () => {
|
|||
const { t } = useTranslation()
|
||||
const dispatch = useDispatch()
|
||||
const [detail, setDetail] = useState({
|
||||
outSideChainNumb: '',
|
||||
outsideChainVos: [],
|
||||
telegramNumb: '',
|
||||
tradingVolume: '',
|
||||
userNumb: '',
|
||||
externalLinkList: [],
|
||||
userCount: '',
|
||||
volume: '',
|
||||
})
|
||||
const [linkList, setLinkList] = useState([])
|
||||
|
||||
const getDetail = async () => {
|
||||
const data = await uccnDetail()
|
||||
const data = await indexInfo()
|
||||
const list = []
|
||||
data.externalLinkList.forEach((item) => {
|
||||
const links = []
|
||||
Object.keys(item.linkMap).forEach((key) => {
|
||||
links.push({ name: key, link: item.linkMap[key], icon: item.iconResource.url })
|
||||
})
|
||||
list.push({ icon: item.iconResource.url, list: links })
|
||||
})
|
||||
setLinkList(list)
|
||||
setDetail(data)
|
||||
}
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
const openLink = (link) => {
|
||||
window.open(link)
|
||||
console.log('link:', link)
|
||||
// window.open(link)
|
||||
window.location.href = link
|
||||
}
|
||||
return (
|
||||
<>
|
||||
|
|
@ -169,16 +180,15 @@ const FristCom: React.FC = () => {
|
|||
</RadiusBtn>
|
||||
{/* <WhiteBtn variant="secondary">{t('Bazaar')}</WhiteBtn> */}
|
||||
<Flex>
|
||||
{detail?.outsideChainVos?.map((item) => {
|
||||
{linkList?.map((item) => {
|
||||
return (
|
||||
<BtnImage
|
||||
key={item.id}
|
||||
style={{ borderRadius: '50%' }}
|
||||
src={item.cover}
|
||||
src={item.icon}
|
||||
alt={item.name}
|
||||
width={34}
|
||||
height={34}
|
||||
onClick={() => openLink(item.link)}
|
||||
onClick={() => openLink(item.list[0].link)}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
|
|
@ -189,8 +199,8 @@ const FristCom: React.FC = () => {
|
|||
</InfoDiv>
|
||||
</FlexDiv>
|
||||
<ScoreDiv>
|
||||
<FlexItemCom name={t('Number of holders')} valueNum={detail?.userNumb} />
|
||||
<FlexItemCom name={t('Your volume')} valueNum={detail?.tradingVolume} />
|
||||
<FlexItemCom name={t('Number of holders')} valueNum={detail?.userCount} />
|
||||
<FlexItemCom name={t('Your volume')} valueNum={detail?.volume} />
|
||||
<FlexItemCom name={t('market value')} valueNum={0} />
|
||||
{/* {burned.map((item) => {
|
||||
return <FlexItemCom key={item.id} name={item.name} value={item.value} />
|
||||
|
|
|
|||
Loading…
Reference in New Issue