鉴权体系重构 issues/4108
This commit is contained in:
parent
d85cad70e4
commit
49c4843448
File diff suppressed because it is too large
Load Diff
|
|
@ -4,7 +4,7 @@ import { httpUrl } from '../fetch';
|
|||
import guideArrow from '../img/guideArrow.png';
|
||||
import { Link } from 'react-router-dom';
|
||||
import shijian from '../img/shijian.png';
|
||||
import { getHomePageList , gethomePageDocList , getAllList } from '../api';
|
||||
import { getHomePageList , gethomePageDocList , getAllList, getPartnerList } from '../api';
|
||||
import axios from 'axios';
|
||||
import Partner from '../Component/partner';
|
||||
|
||||
|
|
@ -21,12 +21,13 @@ function HeaderPage(props){
|
|||
getProjectList();
|
||||
getNewsList();
|
||||
getPersonList();
|
||||
getPartnerList();
|
||||
getPartner();
|
||||
}
|
||||
},[id])
|
||||
|
||||
function getPersonList(){
|
||||
getHomePageList(id).then(result=>{
|
||||
console.log(123124125);
|
||||
if(result){
|
||||
setPersonList(result.data.rows);
|
||||
}
|
||||
|
|
@ -49,9 +50,8 @@ function HeaderPage(props){
|
|||
}).catch(console.error())
|
||||
}
|
||||
|
||||
function getPartnerList(){
|
||||
const url = `${httpUrl}/zone/open/${id}/partners/list`;
|
||||
axios.get(url).then(result=>{
|
||||
function getPartner(){
|
||||
getPartnerList(id).then(result => {
|
||||
if(result){
|
||||
const array = result.data.rows;
|
||||
const newArray = [];
|
||||
|
|
@ -66,7 +66,7 @@ function HeaderPage(props){
|
|||
}
|
||||
setParterList(newArray);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
})
|
||||
}
|
||||
return(
|
||||
<div className="zone_box">
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ import ra from '../img/ra.png'
|
|||
import title from '../img/title.png'
|
||||
import { Link } from 'react-router-dom';
|
||||
import shijian from '../img/shijian.png';
|
||||
import axios from 'axios';
|
||||
import Nodata from '../../Nodata';
|
||||
import Projects from '../Component/projects';
|
||||
import Contributor from '../Component/contributor';
|
||||
import Partner from '../Component/partner';
|
||||
import '../indexZone1.scss'
|
||||
import { getProjectsLists, getPartnerList, getHomePageList, gethomePageDocList } from '../api'
|
||||
|
||||
function HeaderPage(props){
|
||||
const [ projectList , setProjectList ] = useState(undefined);
|
||||
|
|
@ -65,13 +65,12 @@ function HeaderPage(props){
|
|||
getProjectList();
|
||||
getNewsList();
|
||||
getPersonList();
|
||||
getPartnerList();
|
||||
getPartner();
|
||||
}
|
||||
},[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);
|
||||
}
|
||||
|
|
@ -79,19 +78,14 @@ 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);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
||||
function getProjectList(){
|
||||
const url = `${httpUrl}/zone/open/${id}/project/list`;
|
||||
axios.get(url,{params:{
|
||||
isHomepage:1
|
||||
}}).then(result=>{
|
||||
getProjectsLists(id,{ isHomepage:1 }).then(result=>{
|
||||
if(result){
|
||||
if (result.data.rows.length < 3) {
|
||||
setProjectList(result.data.rows)
|
||||
|
|
@ -99,12 +93,11 @@ function HeaderPage(props){
|
|||
setProjectList([...result.data.rows, {}]);
|
||||
}
|
||||
}
|
||||
}).catch(console.error())
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
||||
function getPartnerList(){
|
||||
const url = `${httpUrl}/zone/open/${id}/partners/list`;
|
||||
axios.get(url).then(result=>{
|
||||
function getPartner(){
|
||||
getPartnerList(id).then(result => {
|
||||
if(result){
|
||||
const array = result.data.rows;
|
||||
const newArray = [];
|
||||
|
|
@ -119,7 +112,7 @@ function HeaderPage(props){
|
|||
}
|
||||
setParterList(newArray);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
})
|
||||
}
|
||||
return(
|
||||
<div className="zone1_box">
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@ export function getAllList(id,params){
|
|||
})
|
||||
}
|
||||
|
||||
export function getPartnerList(id){
|
||||
return fetch({
|
||||
url:`/zone/open/${id}/partners/list`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
/**领域资讯 */
|
||||
export function getNewsAllList(id,params){
|
||||
return fetch({
|
||||
|
|
@ -83,6 +90,7 @@ export function delNewsMyList(id){
|
|||
|
||||
/**开源项目 */
|
||||
export function getProjectsLists(id,params){
|
||||
console.log('==========================project/list==================================')
|
||||
return fetch({
|
||||
url:`/zone/open/${id}/project/list`,
|
||||
method: 'get',
|
||||
|
|
|
|||
|
|
@ -6,10 +6,19 @@ function beforeFetch(actionUrl){
|
|||
axios.defaults.withCredentials = true;
|
||||
}
|
||||
|
||||
const service = axios.create({
|
||||
const config = {
|
||||
baseURL: actionUrl,
|
||||
timeout: 1800000, // 请求超时时间
|
||||
});
|
||||
}
|
||||
if (deptId) {
|
||||
// 用于权限区分
|
||||
config.headers = {
|
||||
'Dept-Id': deptId
|
||||
}
|
||||
}
|
||||
console.log(config);
|
||||
|
||||
const service = axios.create(config);
|
||||
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
|
|
@ -38,6 +47,8 @@ function beforeFetch(actionUrl){
|
|||
}
|
||||
let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
|
||||
let actionUrl = settings && settings.common.zone +'/api';
|
||||
const deptId = sessionStorage.getItem('deptId')
|
||||
console.log(deptId)
|
||||
|
||||
const service = beforeFetch(actionUrl);
|
||||
export const httpUrl = actionUrl;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ function Index(props){
|
|||
return
|
||||
}
|
||||
let data = result.data.data;
|
||||
if (data.template) {
|
||||
if (data && data.template) {
|
||||
setTemp( data.template )
|
||||
}
|
||||
setData(data);
|
||||
|
|
@ -129,6 +129,8 @@ function Index(props){
|
|||
getAdminUrl(data.id);
|
||||
getRole(data.id)
|
||||
}
|
||||
// 存储deptId,所有专区接口header带上
|
||||
sessionStorage.setItem('deptId', data.deptId)
|
||||
setSeoMeta(`${data.name},`, data.name, data.subTitle, `/zone/${deptId}`)
|
||||
}
|
||||
}).catch(console.error())
|
||||
|
|
|
|||
Loading…
Reference in New Issue