针对500跳转nopage页面
This commit is contained in:
parent
dd64aebf29
commit
46616025c6
|
|
@ -58,8 +58,8 @@ function HeaderPage(props){
|
|||
data && (data.introductionTitle || data.introductionContent || data.introductionImage) &&
|
||||
<div className="boxmain zone_infos">
|
||||
<div className="zone_infos_desc">
|
||||
<p className="z_name">{data.introductionTitle}</p>
|
||||
<p className="z_desc task-hide-2">{data.introductionContent}</p>
|
||||
{data.introductionTitle && <p className="z_name">{data.introductionTitle}</p>}
|
||||
<p className="z_desc task-hide-2" style={{WebkitLineClamp:data.introductionTitle?"4":"7"}}>{data.introductionContent}</p>
|
||||
</div>
|
||||
{
|
||||
data.introductionImage &&
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
import fetch from './fetch';
|
||||
|
||||
export function getMainInfos(params) {
|
||||
return fetch({
|
||||
url: `/zone/open/zoneName/${params.deptId}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
|
@ -1,10 +1,28 @@
|
|||
import javaFetch from '../javaFetch';
|
||||
import axios from 'axios';
|
||||
import { message } from 'antd';
|
||||
|
||||
function beforeFetch(actionUrl){
|
||||
const service = axios.create({
|
||||
baseURL: actionUrl,
|
||||
timeout: 1800000, // 请求超时时间
|
||||
});
|
||||
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
const res = response||{};
|
||||
if(res && res.data && res.data.code === 500){
|
||||
message.error("错误链接!");
|
||||
window.location.href = '/nopage';
|
||||
}else{
|
||||
return response;
|
||||
}
|
||||
}
|
||||
)
|
||||
return service;
|
||||
}
|
||||
let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
|
||||
let actionUrl = settings && settings.common.zone +"/api";
|
||||
let actionUrl = settings && settings.common.zone +'/api';
|
||||
|
||||
|
||||
const service = javaFetch(actionUrl);
|
||||
const service = beforeFetch(actionUrl);
|
||||
export const httpUrl = actionUrl;
|
||||
// export const main_site_url = settings && settings.common.main_site_url
|
||||
export default service;
|
||||
|
|
@ -2,8 +2,6 @@ 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";
|
||||
import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC";
|
||||
|
|
@ -11,6 +9,8 @@ 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 './index.scss';
|
||||
|
||||
const VIP = Loadable({
|
||||
|
|
@ -29,10 +29,6 @@ const NewsDetail = Loadable({
|
|||
loader: () => import("./Pages/newsDetail"),
|
||||
loading: Loading,
|
||||
});
|
||||
const NewsList = Loadable({
|
||||
loader: () => import("./Pages/newsList"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Main = Loadable({
|
||||
loader: () => import("./Pages/main"),
|
||||
loading: Loading,
|
||||
|
|
@ -50,8 +46,7 @@ function Index(props){
|
|||
},[deptId])
|
||||
|
||||
function getDetail(){
|
||||
const url = `${httpUrl}/zone/open/zoneName/${deptId}`;
|
||||
axios.get(url).then(result=>{
|
||||
getMainInfos({deptId}).then(result=>{
|
||||
if(result){
|
||||
let data = result.data.data;
|
||||
setData(data);
|
||||
|
|
@ -65,7 +60,7 @@ function Index(props){
|
|||
}
|
||||
|
||||
function getAdminUrl(id){
|
||||
const url = `${httpUrl}/zone/zoneDetail/${deptId}/checkZoneRole`;
|
||||
const url = `${httpUrl}/zone/zoneDetail/${id}/checkZoneRole`;
|
||||
if (window.location.href.indexOf('localhost') < 0) {
|
||||
axios.defaults.withCredentials = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -703,15 +703,15 @@
|
|||
margin-right: 0px!important;
|
||||
}
|
||||
.imgBox{
|
||||
background-color: #E3E7F3;
|
||||
border-radius: 8px;
|
||||
// background-color: #E3E7F3;
|
||||
border-radius: 50%;
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
margin-right: 14px;
|
||||
img{
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
border-radius: 8px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.infosBox{
|
||||
|
|
@ -935,4 +935,10 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.informations_detail.markdown-body{
|
||||
&>p{
|
||||
line-height: 32px;
|
||||
margin-bottom: 8px!important;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue