From a5ad215a2d58bf0f10d0adad58ccd9fb57279062 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 2 Jun 2023 10:55:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Pages/headerPage.jsx | 19 +++++----- src/forge/Information/Pages/main.jsx | 27 ++++++-------- src/forge/Information/Pages/newsDetail.jsx | 29 ++++++++++++--- src/forge/Information/Pages/newsList.jsx | 20 ++++++---- src/forge/Information/Pages/projectSource.jsx | 16 ++++---- src/forge/Information/Pages/zoneVIP.jsx | 8 ++-- src/forge/Information/fetch.js | 16 ++++++++ src/forge/Information/index.jsx | 37 +++++++++---------- src/forge/Information/index.scss | 2 +- 9 files changed, 105 insertions(+), 69 deletions(-) create mode 100644 src/forge/Information/fetch.js diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index 144d1f853..eaf6f1c27 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -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=>{ diff --git a/src/forge/Information/Pages/main.jsx b/src/forge/Information/Pages/main.jsx index 694a06f08..c5a305b05 100644 --- a/src/forge/Information/Pages/main.jsx +++ b/src/forge/Information/Pages/main.jsx @@ -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){ } - -
- -
+ { + hotList && hotList.length>0 && +
+ +
+ } diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index f57c3f07d..b78af91e6 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -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{}) } @@ -49,7 +63,12 @@ function NewsDetail(props){ - + { + content ? + + : + 暂无详情~ + } } diff --git a/src/forge/Information/Pages/newsList.jsx b/src/forge/Information/Pages/newsList.jsx index d729cf540..5e3d2c008 100644 --- a/src/forge/Information/Pages/newsList.jsx +++ b/src/forge/Information/Pages/newsList.jsx @@ -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 diff --git a/src/forge/Information/Pages/projectSource.jsx b/src/forge/Information/Pages/projectSource.jsx index c4926f3f8..9ea7e9524 100644 --- a/src/forge/Information/Pages/projectSource.jsx +++ b/src/forge/Information/Pages/projectSource.jsx @@ -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( -
  • {setTypeId(i.id);window.scrollTo(0,0)}}>{i.name}
  • +
  • {setTypeId(i.id);window.scrollTo(0,400)}}>{i.name}
  • ) }) } diff --git a/src/forge/Information/Pages/zoneVIP.jsx b/src/forge/Information/Pages/zoneVIP.jsx index 0487ea549..0a07690e5 100644 --- a/src/forge/Information/Pages/zoneVIP.jsx +++ b/src/forge/Information/Pages/zoneVIP.jsx @@ -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); diff --git a/src/forge/Information/fetch.js b/src/forge/Information/fetch.js new file mode 100644 index 000000000..37b4e187b --- /dev/null +++ b/src/forge/Information/fetch.js @@ -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; \ No newline at end of file diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index f7c8607e0..5e13c8ae3 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -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){ ( -
    +
    )} > ( - + )} > ( - + )} > ( - + )} > ( -
    +
    )} > ( - + )} > diff --git a/src/forge/Information/index.scss b/src/forge/Information/index.scss index b8e851199..753639c48 100644 --- a/src/forge/Information/index.scss +++ b/src/forge/Information/index.scss @@ -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;