From 0aa34cfc8573991d99a88027e8274220853db6a5 Mon Sep 17 00:00:00 2001
From: myf <>
Date: Thu, 5 May 2022 20:54:53 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E9=93=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
src/App.tsx | 1 +
src/components/Menu/index.tsx | 34 +++++++++++++-----------
src/views/Home/components/FristCom.tsx | 36 ++++++++++++++++----------
4 files changed, 44 insertions(+), 29 deletions(-)
diff --git a/.env.development b/.env.development
index ba50e11..9f188d7 100644
--- a/.env.development
+++ b/.env.development
@@ -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'
diff --git a/src/App.tsx b/src/App.tsx
index 39dd9e3..20c0ddf 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -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'
diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx
index 3b96828..3cc7886 100644
--- a/src/components/Menu/index.tsx
+++ b/src/components/Menu/index.tsx
@@ -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}
/>
)
diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx
index 2437c2f..73119ab 100644
--- a/src/views/Home/components/FristCom.tsx
+++ b/src/views/Home/components/FristCom.tsx
@@ -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 = () => {
{/* {t('Bazaar')} */}
- {detail?.outsideChainVos?.map((item) => {
+ {linkList?.map((item) => {
return (
openLink(item.link)}
+ onClick={() => openLink(item.list[0].link)}
/>
)
})}
@@ -189,8 +199,8 @@ const FristCom: React.FC = () => {
-
-
+
+
{/* {burned.map((item) => {
return