forked from Gitlink/forgeplus-react
This commit is contained in:
parent
58f939416a
commit
dd64aebf29
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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=>{
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
<div>
|
||||
<div className="main_content">
|
||||
|
|
|
|||
|
|
@ -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<arr.length;i++){
|
||||
// let str = ` $`+arr[i]+`$ `;
|
||||
// value = value.replaceAll(/\$(.*)\$/g,str);
|
||||
// console.log("---------------:",arr[i],str);
|
||||
// console.log("---------------:",value);
|
||||
// }
|
||||
// }
|
||||
setContent(Base64.decode(data.content));
|
||||
}
|
||||
}).catch(error=>{})
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
<div className="information_main">
|
||||
<PublicBanner {...props} data={data} adminUrl={adminUrl}/>
|
||||
|
|
@ -107,37 +84,37 @@ function Index(props){
|
|||
<Route
|
||||
path="/zone/:deptId/news/:cateId"
|
||||
render={(p) => (
|
||||
<Main {...props} {...p}/>
|
||||
<Main {...props} {...p} id={id}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/zone/:deptId/newdetail/:id"
|
||||
render={(p) => (
|
||||
<NewsDetail {...props} {...p}/>
|
||||
<NewsDetail {...props} {...p} id={id}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/zone/:deptId/VIP"
|
||||
render={(p) => (
|
||||
<VIP {...props} {...p}/>
|
||||
<VIP {...props} {...p} id={id}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/zone/:deptId/projects"
|
||||
render={(p) => (
|
||||
<ProjectSource {...props} {...p}/>
|
||||
<ProjectSource {...props} {...p} id={id}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/zone/:deptId/news"
|
||||
render={(p) => (
|
||||
<Main {...props} {...p}/>
|
||||
<Main {...props} {...p} id={id}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/zone/:deptId"
|
||||
render={(p) => (
|
||||
<HeaderPage {...props} {...p} data={data}/>
|
||||
<HeaderPage {...props} {...p} data={data} id={id}/>
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
|||
Loading…
Reference in New Issue