From 089d6f8ade35e20461c65d048712909a17b4f7c8 Mon Sep 17 00:00:00 2001 From: myf <> Date: Fri, 29 Apr 2022 16:20:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E8=91=A3=E4=BA=8B=E4=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 4 ++++ src/views/Announcement/index.tsx | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.env.production b/.env.production index 3a8a270..650be63 100644 --- a/.env.production +++ b/.env.production @@ -16,3 +16,7 @@ REACT_APP_GRAPH_API_LOTTERY = "https://api.thegraph.com/subgraphs/name/pancakesw REACT_APP_SNAPSHOT_BASE_URL = "https://hub.snapshot.page" REACT_APP_SNAPSHOT_VOTING_API = "https://voting-api.pancakeswap.info/api" + + +REACT_APP_REQUEST_URL = 'http://101.35.117.69:9090' +# REACT_APP_REQUEST_URL = 'http://192.168.2.210:8080' \ No newline at end of file diff --git a/src/views/Announcement/index.tsx b/src/views/Announcement/index.tsx index a0ae578..76cf6ef 100644 --- a/src/views/Announcement/index.tsx +++ b/src/views/Announcement/index.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect, useMemo, useRef } from 'react' import styled from 'styled-components' import { useTranslation } from 'contexts/Localization' -import Container from 'components/Layout/Container' +// import Container from 'components/Layout/Container' import { getAnnouncementPage, getAnnouncementDetail } from 'services/announcement' import { Text, Flex, Image, Input, Heading } from '@pancakeswap/uikit' import ListItem from './components/ListItem' @@ -12,9 +12,9 @@ interface DetailProps { content?: string publishTime?: number } -const ContainerMain = styled(Container)` +const ContainerMain = styled.div` background: ${({ theme }) => theme.colors.gradients.bubblegum}; - padding: 30px 0; + /* padding: 30px 0; */ ` const MainDiv = styled.div` width: 100%; @@ -130,10 +130,18 @@ const Announcement: React.FC = () => { const [list, setList] = useState([]) const [totalVisible, setTotalVisible] = useState(false) const [detailData, setDetailData] = useState({ title: '', publishTime: 0, content: '' }) - const getList = async (page: number, size: number, title?: string) => { + const getList = async (page: number, size: number, title?: string, type?: string) => { if (totalVisible) return + if (type) { + setList([]) + } const data = await getAnnouncementPage({ page, size, title }) - const dataList = [...list, ...data.content] + let dataList = [] + if (type) { + dataList = data.content + } else { + dataList = [...list, ...data.content] + } setList(dataList) if (data.content.length === 0 || !data.content) { setTotalVisible(true) @@ -166,7 +174,8 @@ const Announcement: React.FC = () => { } const searchList = () => { setList([]) - getList(1, 10, searchTitle) + setTotalVisible(false) + getList(1, 10, searchTitle, 'search') } const close = () => { setDetailVisible(false)