From 46616025c609b10015716d20a42403e16d8bceda Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 5 Jun 2023 10:01:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=88=E5=AF=B9500=E8=B7=B3=E8=BD=ACnopage?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Pages/headerPage.jsx | 4 ++-- src/forge/Information/api.js | 9 +++++++ src/forge/Information/fetch.js | 28 ++++++++++++++++++---- src/forge/Information/index.jsx | 13 ++++------ src/forge/Information/index.scss | 12 +++++++--- 5 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 src/forge/Information/api.js diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index a6f2fd57a..1443cf3e4 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -58,8 +58,8 @@ function HeaderPage(props){ data && (data.introductionTitle || data.introductionContent || data.introductionImage) &&
-

{data.introductionTitle}

-

{data.introductionContent}

+ {data.introductionTitle &&

{data.introductionTitle}

} +

{data.introductionContent}

{ data.introductionImage && diff --git a/src/forge/Information/api.js b/src/forge/Information/api.js new file mode 100644 index 000000000..b1e809544 --- /dev/null +++ b/src/forge/Information/api.js @@ -0,0 +1,9 @@ + +import fetch from './fetch'; + +export function getMainInfos(params) { + return fetch({ + url: `/zone/open/zoneName/${params.deptId}`, + method: 'get', + }); +} \ No newline at end of file diff --git a/src/forge/Information/fetch.js b/src/forge/Information/fetch.js index d42bb4a05..2f8ddb125 100644 --- a/src/forge/Information/fetch.js +++ b/src/forge/Information/fetch.js @@ -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; \ No newline at end of file diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index fbf0a9db4..58b8733f9 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -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; } diff --git a/src/forge/Information/index.scss b/src/forge/Information/index.scss index 753639c48..e9edfa98f 100644 --- a/src/forge/Information/index.scss +++ b/src/forge/Information/index.scss @@ -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; + } } \ No newline at end of file