forked from Gitlink/forgeplus-react
详情标题
This commit is contained in:
parent
3b07db8ba6
commit
a5ad215a2d
|
|
@ -1,6 +1,7 @@
|
|||
import React,{ useState, useEffect } from 'react';
|
||||
import img1 from '../img/img1.png';
|
||||
import img2 from '../img/img2.png';
|
||||
import { httpUrl } from '../fetch';
|
||||
import guideArrow from '../img/guideArrow.png';
|
||||
import { Link } from 'react-router-dom';
|
||||
import shijian from '../img/shijian.png';
|
||||
|
|
@ -11,18 +12,16 @@ function HeaderPage(props){
|
|||
const [ personList , setPersonList ] = useState(undefined);
|
||||
const [ newsList, setNewsList ] = useState(undefined);
|
||||
const { deptId } = props.match.params;
|
||||
const { data,address } = props;
|
||||
const { data } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(address){
|
||||
getProjectList();
|
||||
getNewsList();
|
||||
getPersonList();
|
||||
}
|
||||
},[address])
|
||||
getProjectList();
|
||||
getNewsList();
|
||||
getPersonList();
|
||||
},[])
|
||||
|
||||
function getPersonList(){
|
||||
const url = `${address}/zone/open/${deptId}/member/homePageList`;
|
||||
const url = `${httpUrl}/zone/open/${deptId}/member/homePageList`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
setPersonList(result.data.rows);
|
||||
|
|
@ -31,7 +30,7 @@ function HeaderPage(props){
|
|||
}
|
||||
|
||||
function getNewsList(){
|
||||
const url = `${address}/cms/doc/open/zone/${deptId}/homePageDocList`;
|
||||
const url = `${httpUrl}/cms/doc/open/zone/${deptId}/homePageDocList`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
setNewsList(result.data.rows);
|
||||
|
|
@ -40,7 +39,7 @@ function HeaderPage(props){
|
|||
}
|
||||
|
||||
function getProjectList(){
|
||||
const url = `${address}/zone/open/${deptId}/project/list`;
|
||||
const url = `${httpUrl}/zone/open/${deptId}/project/list`;
|
||||
axios.get(url,{params:{
|
||||
isHomepage:1
|
||||
}}).then(result=>{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import shijian from '../img/shijian.png';
|
|||
import liulan from '../img/liulan.png';
|
||||
import emptydata from '../../Images/nodata.png';
|
||||
import DefaultImg from '../Component/defaultImg';
|
||||
|
||||
import { httpUrl } from '../fetch';
|
||||
|
||||
function Main(props){
|
||||
const [ key , setKey ] = useState("1");
|
||||
|
|
@ -20,24 +20,19 @@ function Main(props){
|
|||
const [ hotList , setHotList ] = useState(undefined);
|
||||
const [ isSpin , setIsSpin ] = useState(true);
|
||||
const { deptId , cateId } = props.match.params;
|
||||
const { address } = props;
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
if(deptId && address) {
|
||||
if(deptId) {
|
||||
setIsSpin(true);
|
||||
getMainList();
|
||||
getHotList();
|
||||
}
|
||||
},[deptId, address])
|
||||
},[deptId])
|
||||
|
||||
function getMainList(){
|
||||
const url = `${address}/cms/doc/open/zone/${deptId}/docOverviewList`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
pageSize:10,pageNum:1
|
||||
}
|
||||
}).then(result=>{
|
||||
const url = `${httpUrl}/cms/doc/open/zone/${deptId}/docOverviewList`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
let rows = result.data.rows;
|
||||
setMainList(rows);
|
||||
|
|
@ -54,7 +49,7 @@ function Main(props){
|
|||
}
|
||||
|
||||
function getHotList(){
|
||||
const url = `${address}/cms/doc/open/zone/${deptId}/hotDocList`;
|
||||
const url = `${httpUrl}/cms/doc/open/zone/${deptId}/hotDocList`;
|
||||
axios.get(url,{
|
||||
params:{pageSize:15,pageNum:1}
|
||||
}).then(result=>{
|
||||
|
|
@ -150,10 +145,12 @@ function Main(props){
|
|||
}
|
||||
</Spin>
|
||||
</LongWidth>
|
||||
|
||||
<div className="short_width radius4">
|
||||
<Hot title={"热门资讯"} list={hotList} deptId={deptId}/>
|
||||
</div>
|
||||
{
|
||||
hotList && hotList.length>0 &&
|
||||
<div className="short_width radius4">
|
||||
<Hot title={"热门资讯"} list={hotList} deptId={deptId}/>
|
||||
</div>
|
||||
}
|
||||
</Box>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,27 +5,41 @@ import Banner from '../Component/publicBanner';
|
|||
import RenderHtml from '../../../components/render-html';
|
||||
import { Base64 } from 'js-base64';
|
||||
import axios from 'axios';
|
||||
import { httpUrl } from '../fetch';
|
||||
|
||||
function NewsDetail(props){
|
||||
const { deptId , id } = props.match.params;
|
||||
const [ detail , setDetail ] = useState(undefined);
|
||||
const [ cmsDir , setCmsDir ] = useState(undefined);
|
||||
const { address } = props;
|
||||
const [ content , setContent]=useState(undefined);
|
||||
|
||||
useEffect(()=>{
|
||||
if(id && address){
|
||||
if(id){
|
||||
window.scrollTo(0,450);
|
||||
getDetails();
|
||||
}
|
||||
},[id,address])
|
||||
},[id])
|
||||
|
||||
function getDetails(){
|
||||
const url = `${address}/cms/doc/open/${id}`;
|
||||
const url = `${httpUrl}/cms/doc/open/${id}`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
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=>{})
|
||||
}
|
||||
|
|
@ -49,7 +63,12 @@ function NewsDetail(props){
|
|||
</ul>
|
||||
</div>
|
||||
<Divider dashed={true} />
|
||||
<RenderHtml className="informations_detail imageLayerParent" value={Base64.decode(detail.content)} url={props.history.location} />
|
||||
{
|
||||
content ?
|
||||
<RenderHtml className="informations_detail imageLayerParent" value={content} url={props.history.location} />
|
||||
:
|
||||
<span>暂无详情~</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import liulan from '../img/liulan.png';
|
|||
import DefaultImg from '../Component/defaultImg';
|
||||
import emptydata from '../../Images/nodata.png';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { httpUrl } from '../fetch';
|
||||
|
||||
function NewsList(props){
|
||||
const { deptId , cateId } = props.match.params;
|
||||
|
|
@ -20,15 +21,20 @@ function NewsList(props){
|
|||
const [ mainList , setMainList ] = useState(undefined);
|
||||
const [ details , setDetails ] = useState(undefined);
|
||||
const [ menuSpin , setMenuSpin ] = useState(true);
|
||||
const { address } = props;
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
if(deptId && cateId && address){
|
||||
if(deptId && cateId ){
|
||||
setMenuSpin(true);
|
||||
getMainList();
|
||||
}
|
||||
},[deptId,cateId,pageNum,address])
|
||||
},[deptId,cateId,pageNum])
|
||||
|
||||
useEffect(()=>{
|
||||
if(pageNum){
|
||||
window.scrollTo(0,400);
|
||||
}
|
||||
},[pageNum])
|
||||
|
||||
|
||||
|
||||
|
|
@ -43,7 +49,7 @@ function NewsList(props){
|
|||
// },[deptId,cateId])
|
||||
|
||||
function getColumnDetail(){
|
||||
const url = `${address}/cms/doc/open/dir/${cateId}`;
|
||||
const url = `${httpUrl}/cms/doc/open/dir/${cateId}`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
setDetails(result.data.data);
|
||||
|
|
@ -52,7 +58,7 @@ function NewsList(props){
|
|||
}
|
||||
|
||||
function getColumnList(){
|
||||
const url = `${address}/cms/doc/open/zone/${deptId}/dirList`;
|
||||
const url = `${httpUrl}/cms/doc/open/zone/${deptId}/dirList`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
setColumnList(result.data.rows);
|
||||
|
|
@ -63,7 +69,7 @@ function NewsList(props){
|
|||
}
|
||||
|
||||
function getMainList(){
|
||||
const url = `${address}/cms/doc/open/dir/${cateId}/docList`;
|
||||
const url = `${httpUrl}/cms/doc/open/dir/${cateId}/docList`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
pageNum,pageSize
|
||||
|
|
@ -78,7 +84,7 @@ function NewsList(props){
|
|||
}
|
||||
|
||||
function getHotList(){
|
||||
const url = `${address}/cms/doc/open/dir/${cateId}/hotDocList`;
|
||||
const url = `${httpUrl}/cms/doc/open/dir/${cateId}/hotDocList`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
pageNum:1,pageSize:15
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { Input , Menu , Pagination , Spin } from 'antd';
|
|||
import { Link } from 'react-router-dom';
|
||||
import Nodata from '../../Nodata';
|
||||
import axios from 'axios';
|
||||
import { httpUrl } from '../fetch';
|
||||
const { Search } = Input;
|
||||
|
||||
function ProjectSource(props){
|
||||
|
|
@ -18,23 +19,22 @@ function ProjectSource(props){
|
|||
const [ searchName , setSearchName ] = useState(undefined);
|
||||
const [ value , setValue ] = useState(undefined);
|
||||
const [ loading , setLoading ] = useState(false);
|
||||
const { address} = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(deptId && address){
|
||||
if(deptId){
|
||||
getTypeList();
|
||||
}
|
||||
},[deptId,address])
|
||||
},[deptId])
|
||||
|
||||
useEffect(()=>{
|
||||
if(deptId && address){
|
||||
if(deptId){
|
||||
setLoading(true);
|
||||
getLists();
|
||||
}
|
||||
},[deptId,address,typeId,page,searchName])
|
||||
},[deptId,typeId,page,searchName])
|
||||
|
||||
function getLists(){
|
||||
const url = `${address}/zone/open/${deptId}/project/list`;
|
||||
const url = `${httpUrl}/zone/open/${deptId}/project/list`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
pageNum:page,
|
||||
|
|
@ -53,7 +53,7 @@ function ProjectSource(props){
|
|||
|
||||
|
||||
function getTypeList(){
|
||||
const url = `${address}/zone/open/${deptId}/projectType/list`;
|
||||
const url = `${httpUrl}/zone/open/${deptId}/projectType/list`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
setTypeList(result.data.rows);
|
||||
|
|
@ -88,7 +88,7 @@ function ProjectSource(props){
|
|||
typeList && typeList.length>0 &&
|
||||
typeList.map((i,k)=>{
|
||||
return(
|
||||
<li className={i.id === typeId ? "active":""} onClick={()=>{setTypeId(i.id);window.scrollTo(0,0)}}>{i.name}</li>
|
||||
<li className={i.id === typeId ? "active":""} onClick={()=>{setTypeId(i.id);window.scrollTo(0,400)}}>{i.name}</li>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import Crown from '../img/crown.png';
|
|||
import Nodata from '../../Nodata';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Spin } from 'antd';
|
||||
import { httpUrl } from '../fetch';
|
||||
import axios from 'axios';
|
||||
|
||||
|
||||
|
|
@ -10,17 +11,16 @@ function ZoneVIP(props){
|
|||
const { deptId } = props.match.params;
|
||||
const [ vipLists , setVIPLists ] = useState(undefined);
|
||||
const [ isSpin , setIsSpin ] = useState(true);
|
||||
const { address } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(deptId && address){
|
||||
if(deptId){
|
||||
setIsSpin(true);
|
||||
getLists();
|
||||
}
|
||||
},[deptId , address])
|
||||
},[deptId])
|
||||
|
||||
function getLists(){
|
||||
const url = `${address}/zone/open/${deptId}/member/overviewList`;
|
||||
const url = `${httpUrl}/zone/open/${deptId}/member/overviewList`;
|
||||
axios.get(url).then(response=>{
|
||||
if(response){
|
||||
setVIPLists(response.data.rows);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import javaFetch from '../javaFetch';
|
||||
|
||||
// let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
|
||||
// let actionUrl = settings && settings.common.glcc;
|
||||
let actionUrl = "";
|
||||
const isDev = window.location.port === '3007' || window.location.origin === "https://testforgeplus.trustie.net";
|
||||
if(isDev === true){
|
||||
actionUrl = "https://testgetway.trustie.net/api";
|
||||
}else{
|
||||
actionUrl = "https://gateway.gitlink.org.cn/api";
|
||||
}
|
||||
|
||||
const service = javaFetch(actionUrl);
|
||||
export const httpUrl = actionUrl;
|
||||
// export const main_site_url = settings && settings.common.main_site_url
|
||||
export default service;
|
||||
|
|
@ -2,6 +2,7 @@ import React ,{ useEffect , useState } from "react";
|
|||
|
||||
import { Route, Switch } from "react-router-dom";
|
||||
import { withRouter } from "react-router";
|
||||
import { httpUrl } from './fetch';
|
||||
|
||||
import { SnackbarHOC } from "educoder";
|
||||
import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC";
|
||||
|
|
@ -39,18 +40,16 @@ const Main = Loadable({
|
|||
function Index(props){
|
||||
const [ data , setData ] = useState(undefined);
|
||||
const [ adminUrl , setAdminUrl ] = useState(undefined);
|
||||
const [ address , setAddress ] = useState("");
|
||||
// const [ address , setAddress ] = useState("");
|
||||
const { deptId } = props.match.params;
|
||||
const isDev = window.location.port === '3007' || window.location.origin === "https://testforgeplus.trustie.net";
|
||||
|
||||
useEffect(()=>{
|
||||
const isDev = window.location.port === '3007' || window.location.origin === "https://testforgeplus.trustie.net";
|
||||
console.log(isDev,window.location.hostname);
|
||||
if(isDev === true){
|
||||
setAddress("https://testgetway.trustie.net/api");
|
||||
}else{
|
||||
setAddress("https://gateway.gitlink.org.cn/api");
|
||||
}
|
||||
// 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";
|
||||
|
|
@ -71,14 +70,14 @@ function Index(props){
|
|||
},[])
|
||||
|
||||
useEffect(()=>{
|
||||
if(deptId && address){
|
||||
if(deptId){
|
||||
getDetail();
|
||||
getAdminUrl();
|
||||
}
|
||||
},[deptId,address])
|
||||
},[deptId])
|
||||
|
||||
function getAdminUrl(){
|
||||
const url = `${address}/zone/zoneDetail/${deptId}/checkZoneRole`;
|
||||
const url = `${httpUrl}/zone/zoneDetail/${deptId}/checkZoneRole`;
|
||||
if (window.location.href.indexOf('localhost') < 0) {
|
||||
axios.defaults.withCredentials = true;
|
||||
}
|
||||
|
|
@ -92,7 +91,7 @@ function Index(props){
|
|||
}
|
||||
|
||||
function getDetail(){
|
||||
const url = `${address}/zone/open/${deptId}`;
|
||||
const url = `${httpUrl}/zone/open/${deptId}`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
let data = result.data.data;
|
||||
|
|
@ -108,37 +107,37 @@ function Index(props){
|
|||
<Route
|
||||
path="/information/:deptId/news/:cateId"
|
||||
render={(p) => (
|
||||
<Main {...props} {...p} address={address}/>
|
||||
<Main {...props} {...p}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/information/:deptId/newdetail/:id"
|
||||
render={(p) => (
|
||||
<NewsDetail {...props} {...p} address={address}/>
|
||||
<NewsDetail {...props} {...p}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/information/:deptId/VIP"
|
||||
render={(p) => (
|
||||
<VIP {...props} {...p} address={address}/>
|
||||
<VIP {...props} {...p}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/information/:deptId/projects"
|
||||
render={(p) => (
|
||||
<ProjectSource {...props} {...p} address={address}/>
|
||||
<ProjectSource {...props} {...p}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/information/:deptId/news"
|
||||
render={(p) => (
|
||||
<Main {...props} {...p} address={address}/>
|
||||
<Main {...props} {...p}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/information/:deptId"
|
||||
render={(p) => (
|
||||
<HeaderPage {...props} {...p} data={data} address={address}/>
|
||||
<HeaderPage {...props} {...p} data={data}/>
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
|||
|
|
@ -392,9 +392,9 @@
|
|||
.i_name{
|
||||
color:#1f2329;
|
||||
font-size:22px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
margin-bottom: 14px!important;
|
||||
word-break: break-all;
|
||||
}
|
||||
.i_ul_value{
|
||||
display: flex;
|
||||
|
|
|
|||
Loading…
Reference in New Issue