From fbc0904eb3ec27406ceb7f01ea6644346202915f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Fri, 16 Jun 2023 15:14:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=9A=E5=88=B6=E4=B8=93=E5=8C=BA?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E8=B7=AF=E5=BE=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 10 +---- src/forge/Information/Component/hot.jsx | 2 +- src/forge/Information/Component/newsBox.jsx | 8 ++-- .../Information/Component/publicBanner.jsx | 14 +++--- src/forge/Information/Pages/headerPage.jsx | 11 +++-- .../Information/Pages/headerPageZone1.jsx | 11 +++-- src/forge/Information/Pages/main.jsx | 19 ++++---- src/forge/Information/Pages/newsDetail.jsx | 6 +-- src/forge/Information/Pages/newsList.jsx | 10 ++--- src/forge/Information/Pages/projectSource.jsx | 8 ++-- src/forge/Information/Pages/zoneVIP.jsx | 9 ++-- src/forge/Information/index.jsx | 43 +++++++++++-------- src/forge/Information/tempInfo.js | 4 ++ 13 files changed, 77 insertions(+), 78 deletions(-) diff --git a/src/App.js b/src/App.js index eb6985bae..d1c049dc0 100644 --- a/src/App.js +++ b/src/App.js @@ -160,7 +160,7 @@ const Topic = Loadable({ }) // 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。 -const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone","zone1"]; +const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone"]; class App extends Component { constructor(props) { @@ -388,14 +388,6 @@ class App extends Component { } }> - { - return () - } - }> - {k+1} - {i.name} + {i.name} ) }) diff --git a/src/forge/Information/Component/newsBox.jsx b/src/forge/Information/Component/newsBox.jsx index 43e5b44ad..9bab62d8f 100644 --- a/src/forge/Information/Component/newsBox.jsx +++ b/src/forge/Information/Component/newsBox.jsx @@ -14,14 +14,14 @@ function PublicBanner(props){
- {newsList[0].name} + {newsList[0].name}

{newsList[0].summary}

{newsList[0].publishTime}

- 查看详情 + 查看详情

    @@ -29,14 +29,14 @@ function PublicBanner(props){ newsList.map((i,k)=>{ return( k > 0 &&
  • - {i.name} + {i.name}

    {i.summary}

    {i.publishTime} - 查看详情 + 查看详情

  • ) diff --git a/src/forge/Information/Component/publicBanner.jsx b/src/forge/Information/Component/publicBanner.jsx index 50ee32583..e77a19036 100644 --- a/src/forge/Information/Component/publicBanner.jsx +++ b/src/forge/Information/Component/publicBanner.jsx @@ -10,9 +10,7 @@ function PublicBanner(props){ const [ key , setKey ] = useState("1"); const { deptId } = props.match.params; const { pathname } = props.history.location; - const { data , adminUrl } = props; - const temp = props.pathName - + const { data , adminUrl, temp } = props; useEffect(()=>{ if(pathname){ @@ -20,7 +18,7 @@ function PublicBanner(props){ const infodetail = /[A-Za-z0-9]{0,}\/newdetail/g; const project = /[A-Za-z0-9]{0,}\/projects/g; const vip = /[A-Za-z0-9]{0,}\/VIP/g; - if(pathname === `/${temp}/${deptId}`){ + if(pathname === `/zone/${deptId}`){ setKey("1"); } else if(project.test(pathname)){ @@ -46,12 +44,12 @@ function PublicBanner(props){ }
    - 首页 - 开源项目 + 首页 + 开源项目 {/* 资源发布 */} - { tempConfig[temp].mainTitle } + { tempConfig[temp].mainTitle } {/* Sig小组 */} - { tempConfig[temp].member } + { tempConfig[temp].member } { adminUrl && {window.location.href=adminUrl}}>后台管理 }
    diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index ef34b4b14..a69f77b92 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -15,8 +15,7 @@ function HeaderPage(props){ const [ newsList, setNewsList ] = useState(undefined); const [ partnerList, setParterList ] = useState(undefined); const { deptId } = props.match.params; - const { data, id } = props; - const temp = props.pathName + const { data, id, temp } = props; useEffect(()=>{ if(id){ @@ -90,14 +89,14 @@ function HeaderPage(props){
    - {newsList[0].name} + {newsList[0].name}

    {newsList[0].summary}

    {newsList[0].publishTime}

    - 查看详情 + 查看详情

      @@ -105,14 +104,14 @@ function HeaderPage(props){ newsList.map((i,k)=>{ return( k > 0 &&
    • - {i.name} + {i.name}

      {i.summary}

      {i.publishTime} - 查看详情 + 查看详情

    • ) diff --git a/src/forge/Information/Pages/headerPageZone1.jsx b/src/forge/Information/Pages/headerPageZone1.jsx index 23d38e472..dd7aef2a9 100644 --- a/src/forge/Information/Pages/headerPageZone1.jsx +++ b/src/forge/Information/Pages/headerPageZone1.jsx @@ -29,8 +29,7 @@ function HeaderPage(props){ const [ newsList, setNewsList ] = useState(undefined); const [ partnerList, setParterList ] = useState(undefined); const { deptId } = props.match.params; - const { data, id } = props; - const temp = props.pathName + const { data, id, temp } = props; const vision = [ {imageUrl: vision0, title: '促进技术创新和应用', content: '通过开源硬件社区的建设,可以让更多的人参与到硬件开发中来,激发大众的创造力和创新精神,从而推动硬件领域的技术创新和实际应用。'}, @@ -154,7 +153,7 @@ function HeaderPage(props){

      1 - {newsList[0].name} + {newsList[0].name}

      {newsList[0].summary}

      @@ -162,7 +161,7 @@ function HeaderPage(props){ {newsList[0].publishTime} - 查看更多 + 查看更多

        @@ -170,11 +169,11 @@ function HeaderPage(props){ newsList.map((i,k)=>{ return( k > 0 && - +
      • {k + 1} - {i.name} + {i.name}

        {i.summary}

        diff --git a/src/forge/Information/Pages/main.jsx b/src/forge/Information/Pages/main.jsx index 89c38d930..398658fa9 100644 --- a/src/forge/Information/Pages/main.jsx +++ b/src/forge/Information/Pages/main.jsx @@ -11,7 +11,7 @@ import liulan from '../img/liulan.png'; import emptydata from '../../Images/nodata.png'; import DefaultImg from '../Component/defaultImg'; import { httpUrl } from '../fetch'; -import { tempConfig } from '../tempInfo'; +import { tempConfig, tempEnum } from '../tempInfo'; function Main(props){ const [ key , setKey ] = useState("1"); @@ -22,14 +22,13 @@ function Main(props){ const [ isSpin , setIsSpin ] = useState(true); const [ newCateId , setNewCateId ] = useState(undefined); const { deptId , cateId } = props.match.params; - const { id } = props; - const temp = props.pathName + const { id, temp } = props; useEffect(()=>{ if(id) { setIsSpin(true); - if (temp === 'zone') { + if (temp === tempEnum.zone) { getMainList(); } else { getCateList(); @@ -50,7 +49,7 @@ function Main(props){ if(result){ let rows = result.data.rows; setMainList(rows); - if (temp !== 'zone') { + if (temp !== tempEnum.zone) { selectCate(rows[0].id) } setTimeout(() => { @@ -71,7 +70,7 @@ function Main(props){ if(result){ let rows = result.data.rows; setMainList(rows); - if (temp !== 'zone') { + if (temp !== tempEnum.zone) { selectCate(rows[0].id) } setIsSpin(false); @@ -103,7 +102,7 @@ function Main(props){ function selectCate(id) { setNewCateId(id) - props.history.push(`/${temp}/${deptId}/news/${id}`) + props.history.push(`/zone/${deptId}/news/${id}`) } return( @@ -114,13 +113,13 @@ function Main(props){ { mainList && mainList.length>0 && ( - temp === 'zone' ? + temp === tempEnum.zone ?

        - 全部 + 全部 { mainList.map((i,k)=>{ return( - {i.name} + {i.name} ) }) } diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index d7c00fbb4..68633125e 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -12,7 +12,7 @@ function NewsDetail(props){ const [ detail , setDetail ] = useState(undefined); const [ cmsDir , setCmsDir ] = useState(undefined); const [ content , setContent]=useState(undefined); - const temp = props.pathName + const temp = props.temp useEffect(()=>{ if(id){ @@ -38,8 +38,8 @@ function NewsDetail(props){ detail &&
        - {tempConfig[temp].mainTitle} - { cmsDir && {cmsDir.name} } + {tempConfig[temp].mainTitle} + { cmsDir && {cmsDir.name} } 正文
        diff --git a/src/forge/Information/Pages/newsList.jsx b/src/forge/Information/Pages/newsList.jsx index ab7b49a49..67a84e154 100644 --- a/src/forge/Information/Pages/newsList.jsx +++ b/src/forge/Information/Pages/newsList.jsx @@ -11,6 +11,7 @@ import emptydata from '../../Images/nodata.png'; import nodata from '../img/nodata.png'; import { Link } from 'react-router-dom'; import { httpUrl } from '../fetch'; +import { tempEnum } from '../tempInfo'; function NewsList(props){ const { deptId , cateId } = props.match.params; @@ -22,8 +23,7 @@ function NewsList(props){ const [ mainList , setMainList ] = useState(undefined); const [ details , setDetails ] = useState(undefined); const [ menuSpin , setMenuSpin ] = useState(true); - const { id } = props; - const temp = props.pathName + const { id, temp } = props; useEffect(()=>{ @@ -121,7 +121,7 @@ function NewsList(props){ mainList && mainList.length>0 && mainList.map((i,k)=>{ return( -
        {props.history.push(`/${temp}/${deptId}/newdetail/${i.id}`)}} key={k}> +
        {props.history.push(`/zone/${deptId}/newdetail/${i.id}`)}} key={k}> { i.headImg ? @@ -129,7 +129,7 @@ function NewsList(props){ }
        - {i.name} + {i.name}

        {i.summary}

        @@ -145,7 +145,7 @@ function NewsList(props){ { mainList && mainList.length === 0 &&
        - +

        暂无数据~

        } diff --git a/src/forge/Information/Pages/projectSource.jsx b/src/forge/Information/Pages/projectSource.jsx index aebf94159..781284375 100644 --- a/src/forge/Information/Pages/projectSource.jsx +++ b/src/forge/Information/Pages/projectSource.jsx @@ -7,6 +7,7 @@ import Nodata from '../../Nodata'; import axios from 'axios'; import { httpUrl } from '../fetch'; import nodata from '../img/nodata.png'; +import { tempEnum } from '../tempInfo'; const { Search } = Input; @@ -21,8 +22,7 @@ function ProjectSource(props){ const [ searchName , setSearchName ] = useState(undefined); const [ value , setValue ] = useState(undefined); const [ loading , setLoading ] = useState(false); - const { id } = props; - const temp = props.pathName + const { id, temp } = props; useEffect(()=>{ if(id){ @@ -84,7 +84,7 @@ function ProjectSource(props){ {/* */}

        开源项目

        - { temp === 'zone1' &&

        聚合开源特色项目,搭建硬件开源服务桥梁

        } + { temp === tempEnum.zone1 &&

        聚合开源特色项目,搭建硬件开源服务桥梁

        }
        • 项目分类
        • @@ -166,7 +166,7 @@ function ProjectSource(props){ :"" } { - lists && lists.length === 0 && (temp === 'zone1' ? : ) + lists && lists.length === 0 && (temp === tempEnum.zone1 ? : ) }
        diff --git a/src/forge/Information/Pages/zoneVIP.jsx b/src/forge/Information/Pages/zoneVIP.jsx index b3d522d66..e5dcdda91 100644 --- a/src/forge/Information/Pages/zoneVIP.jsx +++ b/src/forge/Information/Pages/zoneVIP.jsx @@ -3,7 +3,7 @@ import Crown from '../img/crown.png'; import Nodata from '../../Nodata'; import { Link } from 'react-router-dom'; import { Spin, Button, Icon } from 'antd'; -import { tempConfig } from '../tempInfo' +import { tempConfig, tempEnum } from '../tempInfo' import MemberApply from '../Component/memberApply'; import { getVIPLists, getAuditStatus, applyJoin } from '../api'; import nodata from '../img/nodata.png'; @@ -22,8 +22,7 @@ function ZoneVIP(props){ const [ isSpin , setIsSpin ] = useState(true); const [ applyVisible , setApplyVisible ] = useState(false); const [ memberStatus , setMemberStatus] = useState(memberStatusEnum.notMember); - const { id, showNotification, checkIfLogin, showLoginDialog } = props; - const temp = props.pathName + const { id, showNotification, checkIfLogin, showLoginDialog, temp } = props; useEffect(()=>{ if(id){ @@ -95,7 +94,7 @@ function ZoneVIP(props){
        {i.typeName}
        - { temp === 'zone1' &&
        {i.typeName}
        } + { temp === tempEnum.zone1 &&
        {i.typeName}
        }

        {i.typeIntroduction}

        @@ -121,7 +120,7 @@ function ZoneVIP(props){
      : ( - temp === 'zone1' ? : + temp === tempEnum.zone1 ? : ) }
    diff --git a/src/forge/Information/index.jsx b/src/forge/Information/index.jsx index 056bc1f78..29d3fcd79 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -13,6 +13,7 @@ import PublicBanner from "./Component/publicBanner"; import './index.scss'; import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css"; +import { tempEnum } from "./tempInfo"; const VIP = Loadable({ loader: () => import("./Pages/zoneVIP"), @@ -51,7 +52,7 @@ function Index(props){ const [ adminUrl , setAdminUrl ] = useState(undefined); const { deptId } = props.match.params; const [ id , setId ] = useState(undefined); - const temp = props.pathName + const [ temp , setTemp ] = useState(tempEnum.zone); useEffect(()=>{ if(deptId){ @@ -59,21 +60,29 @@ function Index(props){ } },[deptId]) + useEffect(() => { + setTheme() + }, [temp]) + function setTheme() { document.getElementsByTagName("html")[0].dataset.theme = temp; } setTheme() function getDetail(){ - getMainInfos(deptId, { template: temp }).then(result=>{ + getMainInfos(deptId).then(result=>{ if(result){ if (result.code === 404) { props.history.push('/nopage'); return - } + } + let data = result.data; + if (data.template) { + setTemp( data.template ) + } setData(data); - document.title= data&& data.name; + document.title= data && data.name; setId(data.id); if(data.id){ getAdminUrl(data.id); @@ -93,42 +102,42 @@ function Index(props){ } return(
    - + { id && } ( -
    +
    )} > ( - + )} > ( - + )} > ( - + )} > ( -
    +
    )} > ( - temp === 'zone' ? : + temp === tempEnum.zone ? : )} > diff --git a/src/forge/Information/tempInfo.js b/src/forge/Information/tempInfo.js index 3ae2fe698..595b0fa67 100644 --- a/src/forge/Information/tempInfo.js +++ b/src/forge/Information/tempInfo.js @@ -1,3 +1,7 @@ +export const tempEnum = { + zone: 'zone', + zone1: 'zone1' +} export const tempConfig = { zone: { mainTitle: '领域资讯', From d7e21d1b3a072aaaa0b0637d36a04d9f1d5d1b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Fri, 16 Jun 2023 18:05:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Component/contributor.jsx | 2 +- src/forge/Information/Component/memberApply.jsx | 5 +++-- src/forge/Information/index.scss | 17 ++++++++++++++++- src/forge/Information/indexZone1.scss | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/forge/Information/Component/contributor.jsx b/src/forge/Information/Component/contributor.jsx index 8e0a0ec74..d20823401 100644 --- a/src/forge/Information/Component/contributor.jsx +++ b/src/forge/Information/Component/contributor.jsx @@ -17,7 +17,7 @@ function Contributor(props) { const [ showList, setShowList] = useState([]); function initList() { - if (personList.length !== 3) { + if (personList.length % 3 !== 0) { setShowList([].concat(personList, new Array(personList.length % 3 - 1).fill({}))) } else { setShowList( personList ) diff --git a/src/forge/Information/Component/memberApply.jsx b/src/forge/Information/Component/memberApply.jsx index af84eee67..2db9d8109 100644 --- a/src/forge/Information/Component/memberApply.jsx +++ b/src/forge/Information/Component/memberApply.jsx @@ -36,10 +36,11 @@ function MemberApply(props){ width="650px" closable={false} destroyOnClose + className="apply-modal" footer={
    - - + +
    } centered diff --git a/src/forge/Information/index.scss b/src/forge/Information/index.scss index 18f83fcc4..fab086fd1 100644 --- a/src/forge/Information/index.scss +++ b/src/forge/Information/index.scss @@ -648,7 +648,7 @@ padding:27px 24px; &>img{ border-radius: 4px; - object-fit: cover; + object-fit: contain; } .zone_infos_desc{ padding:0px 34px 0px 10px; @@ -1097,4 +1097,19 @@ } } } +} +.apply-modal { + .sure-button { + background-color: var(--primary-color); + border-color: var(--primary-color); + &:hover { + background-color: var(--light-color); + } + } + .cancel-button { + &:hover { + color: var(--primary-color); + border-color: var(--primary-color); + } + } } \ No newline at end of file diff --git a/src/forge/Information/indexZone1.scss b/src/forge/Information/indexZone1.scss index 456723ef8..db69b007b 100644 --- a/src/forge/Information/indexZone1.scss +++ b/src/forge/Information/indexZone1.scss @@ -11,7 +11,7 @@ padding:27px 24px; &>img{ border-radius: 4px; - object-fit: cover; + object-fit: contain; } .zone_infos_desc{ padding:0px 34px 0px 10px; From bbb9b8425bb4f5824e53eff5b3a515d42d819b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Fri, 16 Jun 2023 19:11:59 +0800 Subject: [PATCH 3/4] =?UTF-8?q?merge=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Pages/headerPage.jsx | 21 +++------ src/forge/Information/Pages/main.jsx | 10 ++--- src/forge/Information/Pages/newsDetail.jsx | 5 +-- src/forge/Information/Pages/projectSource.jsx | 18 +++----- src/forge/Information/Pages/zoneVIP.jsx | 13 +++--- src/forge/Information/fetch.js | 44 ++++++++++++++++--- src/forge/Information/index.jsx | 9 ++-- src/forge/Information/index.scss | 12 +++-- 8 files changed, 79 insertions(+), 53 deletions(-) diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index a69f77b92..0c8489c71 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -1,12 +1,11 @@ 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 { getHomePageList , gethomePageDocList , getAllList } from '../api'; import axios from 'axios'; -import Nodata from '../../Nodata'; import Partner from '../Component/partner'; function HeaderPage(props){ @@ -27,8 +26,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); } @@ -36,8 +34,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); } @@ -45,10 +42,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); } @@ -59,7 +53,6 @@ function HeaderPage(props){ const url = `${httpUrl}/zone/open/${id}/partners/list`; axios.get(url).then(result=>{ if(result){ - console.log(result) setParterList(result.data.rows); } }).catch(error=>{}) @@ -72,12 +65,12 @@ 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/Pages/main.jsx b/src/forge/Information/Pages/main.jsx index 398658fa9..3a6669913 100644 --- a/src/forge/Information/Pages/main.jsx +++ b/src/forge/Information/Pages/main.jsx @@ -10,7 +10,7 @@ import shijian from '../img/shijian.png'; import liulan from '../img/liulan.png'; import emptydata from '../../Images/nodata.png'; import DefaultImg from '../Component/defaultImg'; -import { httpUrl } from '../fetch'; +import { getNewsAllList , getNewsHotList } from '../api'; import { tempConfig, tempEnum } from '../tempInfo'; function Main(props){ @@ -44,8 +44,7 @@ function Main(props){ }, [newCateId]) function getMainList(){ - const url = `${httpUrl}/cms/doc/open/zone/${id}/docOverviewList`; - axios.get(url).then(result=>{ + getNewsAllList(id).then(result=>{ if(result){ let rows = result.data.rows; setMainList(rows); @@ -79,9 +78,8 @@ function Main(props){ } function getHotList(){ - const url = `${httpUrl}/cms/doc/open/zone/${id}/hotDocList`; - axios.get(url,{ - params:{pageSize:15,pageNum:1} + getNewsHotList(id,{ + pageSize:15,pageNum:1 }).then(result=>{ if(result){ setHotList(result.data.rows); diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index 68633125e..eba75c5f5 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -4,7 +4,7 @@ import liulan from '../img/liulan.png'; import RenderHtml from '../../../components/render-html'; import { Base64 } from 'js-base64'; import axios from 'axios'; -import { httpUrl } from '../fetch'; +import { getNewsDetail } from '../api'; import { tempConfig } from '../tempInfo'; function NewsDetail(props){ @@ -22,8 +22,7 @@ function NewsDetail(props){ },[id]) function getDetails(){ - const url = `${httpUrl}/cms/doc/open/${id}`; - axios.get(url).then(result=>{ + getNewsDetail(id).then(result=>{ if(result){ let data = result.data.data; setDetail(data); diff --git a/src/forge/Information/Pages/projectSource.jsx b/src/forge/Information/Pages/projectSource.jsx index 781284375..c405757a0 100644 --- a/src/forge/Information/Pages/projectSource.jsx +++ b/src/forge/Information/Pages/projectSource.jsx @@ -5,7 +5,7 @@ import { Input , Menu , Pagination , Spin } from 'antd'; import { Link } from 'react-router-dom'; import Nodata from '../../Nodata'; import axios from 'axios'; -import { httpUrl } from '../fetch'; +import { getProjectsLists , getProjectsTypeLists } from '../api'; import nodata from '../img/nodata.png'; import { tempEnum } from '../tempInfo'; @@ -38,14 +38,11 @@ function ProjectSource(props){ },[id,typeId,page,searchName]) function getLists(){ - const url = `${httpUrl}/zone/open/${id}/project/list`; - axios.get(url,{ - params:{ - pageNum:page, - name:searchName, - pageSize, - projectTypeId:typeId===0?undefined:typeId - } + getProjectsLists(id,{ + pageNum:page, + name:searchName, + pageSize, + projectTypeId:typeId===0?undefined:typeId }).then(result=>{ if(result){ setLists(result.data.rows); @@ -57,8 +54,7 @@ function ProjectSource(props){ function getTypeList(){ - const url = `${httpUrl}/zone/open/${id}/projectType/list`; - axios.get(url).then(result=>{ + getProjectsTypeLists(id).then(result=>{ if(result){ setTypeList(result.data.rows); } diff --git a/src/forge/Information/Pages/zoneVIP.jsx b/src/forge/Information/Pages/zoneVIP.jsx index e5dcdda91..6ab83a536 100644 --- a/src/forge/Information/Pages/zoneVIP.jsx +++ b/src/forge/Information/Pages/zoneVIP.jsx @@ -35,7 +35,7 @@ function ZoneVIP(props){ function getLists(){ getVIPLists(id).then(response=>{ if(response){ - setVIPLists(response.rows); + setVIPLists(response.data.rows); setIsSpin(false); } }).catch(error=>{setIsSpin(false);}) @@ -43,8 +43,9 @@ function ZoneVIP(props){ function getMemberStatus() { getAuditStatus(id).then(res => { - if (res && res.code === 200) { - setMemberStatus(res.data) + console.log(res) + if (res && res.data && res.data.code === 200) { + setMemberStatus(res.data.data) } else { setMemberStatus(memberStatusEnum.notMember) } @@ -53,10 +54,10 @@ function ZoneVIP(props){ function onOk(e) { applyJoin(id, e).then(res => { - if (res) { - showNotification(res.msg) + if (res && res.data) { + showNotification(res.data.msg) setApplyVisible(!applyVisible) - if (res.code === 200) { + if (res.data.code === 200) { setMemberStatus(memberStatusEnum.applying) } } diff --git a/src/forge/Information/fetch.js b/src/forge/Information/fetch.js index d42bb4a05..29cc15d28 100644 --- a/src/forge/Information/fetch.js +++ b/src/forge/Information/fetch.js @@ -1,10 +1,44 @@ -import javaFetch from '../javaFetch'; +import axios from 'axios'; +import { message , notification } from 'antd'; +function beforeFetch(actionUrl){ + if (window.location.href.indexOf('localhost') < 0) { + axios.defaults.withCredentials = true; + } + + const service = axios.create({ + baseURL: actionUrl, + timeout: 1800000, // 请求超时时间 + }); + + service.interceptors.response.use( + response => { + const res = response||{}; + if(res && res.data && res.data.code === 404){ + message.error("错误链接!"); + window.location.href = '/nopage'; + return Promise.reject('error'); + }else if(res && res.data && res.data.code === 500){ + message.error(res.data.msg); + return Promise.reject('error'); + }else{ + return response; + } + }, + error => { + console.log(error); + // notification.open({ + // message: "提示", + // description: error.message, + // }); + // return Promise.reject(error); + } + ) + 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 29d3fcd79..c7da2c5ca 100644 --- a/src/forge/Information/index.jsx +++ b/src/forge/Information/index.jsx @@ -72,12 +72,11 @@ function Index(props){ function getDetail(){ getMainInfos(deptId).then(result=>{ if(result){ - if (result.code === 404) { + if (result.data.code === 404) { props.history.push('/nopage'); return - } - - let data = result.data; + } + let data = result.data.data; if (data.template) { setTemp( data.template ) } @@ -93,7 +92,7 @@ function Index(props){ function getAdminUrl(id){ getCheckZoneRole(id).then(response=>{ - if(response){ + if(response && response.data.code === 200){ setAdminUrl(response.data); }else{ setAdminUrl(undefined); diff --git a/src/forge/Information/index.scss b/src/forge/Information/index.scss index fab086fd1..b3c7e6c49 100644 --- a/src/forge/Information/index.scss +++ b/src/forge/Information/index.scss @@ -774,15 +774,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{ @@ -1049,6 +1049,12 @@ margin: 25px 25px 25px 0; border-radius: 12px; } + .informations_detail.markdown-body{ + &>p{ + line-height: 32px; + margin-bottom: 8px!important; + } + } } .zone_parter{ background-color: #fff; From 9adbe37b2b4ff600facd172de046ad57bcb41ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Fri, 16 Jun 2023 19:14:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?merge=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8Dco?= =?UTF-8?q?nt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Information/Pages/main.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/forge/Information/Pages/main.jsx b/src/forge/Information/Pages/main.jsx index 3a6669913..04d33aa19 100644 --- a/src/forge/Information/Pages/main.jsx +++ b/src/forge/Information/Pages/main.jsx @@ -12,6 +12,8 @@ import emptydata from '../../Images/nodata.png'; import DefaultImg from '../Component/defaultImg'; import { getNewsAllList , getNewsHotList } from '../api'; import { tempConfig, tempEnum } from '../tempInfo'; +import { httpUrl } from '../fetch'; + function Main(props){ const [ key , setKey ] = useState("1");