This commit is contained in:
caishi 2023-06-06 09:25:57 +08:00
parent 78cf50fdc9
commit d99087dcb3
3 changed files with 36 additions and 20 deletions

View File

@ -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);
}

View File

@ -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
})
}

View File

@ -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{