diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index 4628a84ee..5f9e93caf 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -1,12 +1,9 @@ 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'; -import axios from 'axios'; -import Nodata from '../../Nodata'; +import { getHomePageList , gethomePageDocList , getAllList } from '../api'; function HeaderPage(props){ const [ projectList , setProjectList ] = useState(undefined); @@ -24,8 +21,7 @@ function HeaderPage(props){ },[id]) function getPersonList(){ - const url = `${httpUrl}/zone/open/${id}/member/homePageList`; - axios.get(url).then(result=>{ + getHomePageList({id}).then(result=>{ if(result){ setPersonList(result.data.rows); } @@ -33,8 +29,7 @@ function HeaderPage(props){ } function getNewsList(){ - const url = `${httpUrl}/cms/doc/open/zone/${id}/homePageDocList`; - axios.get(url).then(result=>{ + gethomePageDocList({id}).then(result=>{ if(result){ setNewsList(result.data.rows); } @@ -42,10 +37,7 @@ function HeaderPage(props){ } function getProjectList(){ - const url = `${httpUrl}/zone/open/${id}/project/list`; - axios.get(url,{params:{ - isHomepage:1 - }}).then(result=>{ + getAllList({id,isHomepage:1}).then(result=>{ if(result){ setProjectList(result.data.rows); } diff --git a/src/forge/Information/api.js b/src/forge/Information/api.js index b1e809544..b7c147ff7 100644 --- a/src/forge/Information/api.js +++ b/src/forge/Information/api.js @@ -1,9 +1,39 @@ import fetch from './fetch'; +/**入口页接口***/ export function getMainInfos(params) { return fetch({ url: `/zone/open/zoneName/${params.deptId}`, method: 'get', }); +} + +export function getCheckZoneRole(params) { + return fetch({ + url: `/zone/zoneDetail/${params.id}/checkZoneRole`, + method: 'get', + }); +} + +/********首页接口******/ +export function getHomePageList(params) { + return fetch({ + url: `/zone/open/${params.id}/member/homePageList`, + method: 'get', + }); +} + +export function gethomePageDocList(params) { + return fetch({ + url: `/cms/doc/open/zone/${params.id}/homePageDocList`, + method: 'get', + }); +} +export function getAllList(params){ + return fetch({ + url:`/zone/open/${params.id}/project/list`, + method: 'get', + params + }) } \ No newline at end of file diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index 58b8733f9..dacaea06d 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -7,10 +7,8 @@ import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC" import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC"; import Loadable from "react-loadable"; import Loading from "../../Loading"; -import axios from 'axios'; import PublicBanner from "./Component/publicBanner"; -import { httpUrl } from './fetch'; -import { getMainInfos } from './api'; +import { getMainInfos , getCheckZoneRole } from './api'; import './index.scss'; const VIP = Loadable({ @@ -60,11 +58,7 @@ function Index(props){ } function getAdminUrl(id){ - const url = `${httpUrl}/zone/zoneDetail/${id}/checkZoneRole`; - if (window.location.href.indexOf('localhost') < 0) { - axios.defaults.withCredentials = true; - } - axios.get(url).then(response=>{ + getCheckZoneRole({id}).then(response=>{ if(response && response.data.code === 200){ setAdminUrl(response.data.data); }else{