From dd64aebf29732b96036ff9b99115dfc4f2995fb7 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 2 Jun 2023 14:59:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Information/Component/publicBanner.jsx | 8 +-- src/forge/Information/Pages/headerPage.jsx | 18 ++--- src/forge/Information/Pages/main.jsx | 13 ++-- src/forge/Information/Pages/newsDetail.jsx | 13 ---- src/forge/Information/Pages/newsList.jsx | 18 ++--- src/forge/Information/Pages/projectSource.jsx | 13 ++-- src/forge/Information/Pages/zoneVIP.jsx | 7 +- src/forge/Information/index.jsx | 69 +++++++------------ 8 files changed, 57 insertions(+), 102 deletions(-) diff --git a/src/forge/Information/Component/publicBanner.jsx b/src/forge/Information/Component/publicBanner.jsx index 7ed3313f3..d21f6fedd 100644 --- a/src/forge/Information/Component/publicBanner.jsx +++ b/src/forge/Information/Component/publicBanner.jsx @@ -22,10 +22,10 @@ function PublicBanner(props){ useEffect(()=>{ if(pathname){ - const info = /\/zone\/[0-9]{0,}\/news/g; - const infodetail = /\/zone\/[0-9]{0,}\/newdetail/g; - const project = /\/zone\/[0-9]{0,}\/projects/g; - const vip = /\/zone\/[0-9]{0,}\/VIP/g; + const info = /\/zone\/[A-Za-z0-9]{0,}\/news/g; + const infodetail = /\/zone\/[A-Za-z0-9]{0,}\/newdetail/g; + const project = /\/zone\/[A-Za-z0-9]{0,}\/projects/g; + const vip = /\/zone\/[A-Za-z0-9]{0,}\/VIP/g; if(pathname === `/zone/${deptId}`){ setKey("1"); } diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index 443d88c5b..a6f2fd57a 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -13,16 +13,18 @@ function HeaderPage(props){ const [ personList , setPersonList ] = useState(undefined); const [ newsList, setNewsList ] = useState(undefined); const { deptId } = props.match.params; - const { data } = props; + const { data , id } = props; useEffect(()=>{ - getProjectList(); - getNewsList(); - getPersonList(); - },[]) + if(id){ + getProjectList(); + getNewsList(); + getPersonList(); + } + },[id]) function getPersonList(){ - const url = `${httpUrl}/zone/open/${deptId}/member/homePageList`; + const url = `${httpUrl}/zone/open/${id}/member/homePageList`; axios.get(url).then(result=>{ if(result){ setPersonList(result.data.rows); @@ -31,7 +33,7 @@ function HeaderPage(props){ } function getNewsList(){ - const url = `${httpUrl}/cms/doc/open/zone/${deptId}/homePageDocList`; + const url = `${httpUrl}/cms/doc/open/zone/${id}/homePageDocList`; axios.get(url).then(result=>{ if(result){ setNewsList(result.data.rows); @@ -40,7 +42,7 @@ function HeaderPage(props){ } function getProjectList(){ - const url = `${httpUrl}/zone/open/${deptId}/project/list`; + const url = `${httpUrl}/zone/open/${id}/project/list`; axios.get(url,{params:{ isHomepage:1 }}).then(result=>{ diff --git a/src/forge/Information/Pages/main.jsx b/src/forge/Information/Pages/main.jsx index 22f44a041..014116dc3 100644 --- a/src/forge/Information/Pages/main.jsx +++ b/src/forge/Information/Pages/main.jsx @@ -20,18 +20,19 @@ function Main(props){ const [ hotList , setHotList ] = useState(undefined); const [ isSpin , setIsSpin ] = useState(true); const { deptId , cateId } = props.match.params; + const { id } = props; useEffect(()=>{ - if(deptId) { + if(id) { setIsSpin(true); getMainList(); getHotList(); } - },[deptId]) + },[id]) function getMainList(){ - const url = `${httpUrl}/cms/doc/open/zone/${deptId}/docOverviewList`; + const url = `${httpUrl}/cms/doc/open/zone/${id}/docOverviewList`; axios.get(url).then(result=>{ if(result){ let rows = result.data.rows; @@ -49,7 +50,7 @@ function Main(props){ } function getHotList(){ - const url = `${httpUrl}/cms/doc/open/zone/${deptId}/hotDocList`; + const url = `${httpUrl}/cms/doc/open/zone/${id}/hotDocList`; axios.get(url,{ params:{pageSize:15,pageNum:1} }).then(result=>{ @@ -59,10 +60,6 @@ function Main(props){ }).catch(error=>{}) } - function clickTab(k,idName){ - setKey(k); - } - return(
diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index 11d9e5a39..f8d559b8a 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -1,7 +1,6 @@ import React,{ useState , useEffect } from 'react'; import { Breadcrumb , Divider } from 'antd'; import liulan from '../img/liulan.png'; -import Banner from '../Component/publicBanner'; import RenderHtml from '../../../components/render-html'; import { Base64 } from 'js-base64'; import axios from 'axios'; @@ -27,18 +26,6 @@ function NewsDetail(props){ let data = result.data.data; setDetail(data); setCmsDir(data.cmsDir); - // let c = Base64.decode(data.content); - // let value = c.toString(); - // let reg = /\$(.*)\$/g; - // let arr = value.match(reg); - // if(arr && arr.length>0){ - // for(var i=0;i{}) diff --git a/src/forge/Information/Pages/newsList.jsx b/src/forge/Information/Pages/newsList.jsx index 7789c46e7..e235534ec 100644 --- a/src/forge/Information/Pages/newsList.jsx +++ b/src/forge/Information/Pages/newsList.jsx @@ -21,14 +21,15 @@ function NewsList(props){ const [ mainList , setMainList ] = useState(undefined); const [ details , setDetails ] = useState(undefined); const [ menuSpin , setMenuSpin ] = useState(true); + const { id } = props; useEffect(()=>{ - if(deptId && cateId ){ + if(id && cateId ){ setMenuSpin(true); getMainList(); } - },[deptId,cateId,pageNum]) + },[id,cateId,pageNum]) useEffect(()=>{ if(pageNum){ @@ -37,17 +38,6 @@ function NewsList(props){ },[pageNum]) - - // useEffect(()=>{ - // if(deptId && cateId){ - // setMenuSpin(true); - // getMainList(); - // getHotList(); - // getColumnList(); - // getColumnDetail(); - // } - // },[deptId,cateId]) - function getColumnDetail(){ const url = `${httpUrl}/cms/doc/open/dir/${cateId}`; axios.get(url).then(result=>{ @@ -58,7 +48,7 @@ function NewsList(props){ } function getColumnList(){ - const url = `${httpUrl}/cms/doc/open/zone/${deptId}/dirList`; + const url = `${httpUrl}/cms/doc/open/zone/${id}/dirList`; axios.get(url).then(result=>{ if(result){ setColumnList(result.data.rows); diff --git a/src/forge/Information/Pages/projectSource.jsx b/src/forge/Information/Pages/projectSource.jsx index 9ea7e9524..2ce0b9d6b 100644 --- a/src/forge/Information/Pages/projectSource.jsx +++ b/src/forge/Information/Pages/projectSource.jsx @@ -19,22 +19,23 @@ function ProjectSource(props){ const [ searchName , setSearchName ] = useState(undefined); const [ value , setValue ] = useState(undefined); const [ loading , setLoading ] = useState(false); + const { id } = props; useEffect(()=>{ - if(deptId){ + if(id){ getTypeList(); } - },[deptId]) + },[id]) useEffect(()=>{ - if(deptId){ + if(id){ setLoading(true); getLists(); } - },[deptId,typeId,page,searchName]) + },[id,typeId,page,searchName]) function getLists(){ - const url = `${httpUrl}/zone/open/${deptId}/project/list`; + const url = `${httpUrl}/zone/open/${id}/project/list`; axios.get(url,{ params:{ pageNum:page, @@ -53,7 +54,7 @@ function ProjectSource(props){ function getTypeList(){ - const url = `${httpUrl}/zone/open/${deptId}/projectType/list`; + const url = `${httpUrl}/zone/open/${id}/projectType/list`; axios.get(url).then(result=>{ if(result){ setTypeList(result.data.rows); diff --git a/src/forge/Information/Pages/zoneVIP.jsx b/src/forge/Information/Pages/zoneVIP.jsx index 0a07690e5..34043692a 100644 --- a/src/forge/Information/Pages/zoneVIP.jsx +++ b/src/forge/Information/Pages/zoneVIP.jsx @@ -11,16 +11,17 @@ function ZoneVIP(props){ const { deptId } = props.match.params; const [ vipLists , setVIPLists ] = useState(undefined); const [ isSpin , setIsSpin ] = useState(true); + const { id } = props; useEffect(()=>{ - if(deptId){ + if(id){ setIsSpin(true); getLists(); } - },[deptId]) + },[id]) function getLists(){ - const url = `${httpUrl}/zone/open/${deptId}/member/overviewList`; + const url = `${httpUrl}/zone/open/${id}/member/overviewList`; axios.get(url).then(response=>{ if(response){ setVIPLists(response.data.rows); diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index 49465a8fb..fbf0a9db4 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -40,43 +40,31 @@ const Main = Loadable({ function Index(props){ const [ data , setData ] = useState(undefined); const [ adminUrl , setAdminUrl ] = useState(undefined); - // const [ address , setAddress ] = useState(""); const { deptId } = props.match.params; - - useEffect(()=>{ - // const isDev = window.location.port === '3007' || window.location.origin === "https://testforgeplus.trustie.net"; - // if(isDev === true){ - // setAddress("https://testgetway.trustie.net/api"); - // }else{ - // setAddress("https://gateway.gitlink.org.cn/api"); - // } - // axios.interceptors.request.use( - // config => { - // var localproxy = "https://testgetway.trustie.net"; - // var proxy = ""; - // let url = "/api" +config.url; - // if(isDev){ - // url = localproxy + url ; - // }else{ - // url = proxy + url; - // } - // config.url =url; - // return config; - // }, - // err => { - // return Promise.reject(err); - // } - // ) - },[]) + const [ id , setId ] = useState(undefined); useEffect(()=>{ if(deptId){ getDetail(); - getAdminUrl(); } },[deptId]) - function getAdminUrl(){ + function getDetail(){ + const url = `${httpUrl}/zone/open/zoneName/${deptId}`; + axios.get(url).then(result=>{ + if(result){ + let data = result.data.data; + setData(data); + document.title= data&& data.name; + setId(data.id); + if(data.id){ + getAdminUrl(data.id); + } + } + }).catch(console.error()) + } + + function getAdminUrl(id){ const url = `${httpUrl}/zone/zoneDetail/${deptId}/checkZoneRole`; if (window.location.href.indexOf('localhost') < 0) { axios.defaults.withCredentials = true; @@ -89,17 +77,6 @@ function Index(props){ } }).catch(error=>{}) } - - function getDetail(){ - const url = `${httpUrl}/zone/open/${deptId}`; - axios.get(url).then(result=>{ - if(result){ - let data = result.data.data; - setData(data); - document.title= data&& data.name; - } - }).catch(console.error()) - } return(
@@ -107,37 +84,37 @@ function Index(props){ ( -
+
)} > ( - + )} > ( - + )} > ( - + )} > ( -
+
)} > ( - + )} >