From dc6cfc342e2fac7cde69d662d8534b79339aa85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Wed, 10 Nov 2021 14:30:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E9=A6=96=E9=A1=B5=E5=AE=9A=E5=88=B6?= =?UTF-8?q?=E5=8C=96=E6=94=B9=E9=80=A0=E5=A4=B4=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 2 +- src/common/UrlTool.js | 9 ++ src/common/educoder.js | 2 +- src/home/index.jsx | 16 +-- src/modules/tpm/NewHeader.js | 141 ++++++++++++++------------- src/modules/tpm/css/headerExcess.css | 10 +- 6 files changed, 104 insertions(+), 76 deletions(-) diff --git a/src/App.js b/src/App.js index 67ec0ab4..7c9d0a96 100644 --- a/src/App.js +++ b/src/App.js @@ -290,7 +290,7 @@ class App extends Component { ( - + // ) } diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index f952f22c..3648323d 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -34,6 +34,15 @@ export function getImage(path) { } } +export function getLogoImageUrl(path) { + const local = 'http://117.50.100.12:49999'; + + if (isDev) { + return `${local}/${path}` + } + return `/${path}`; +} + export function getcdnImageUrl(path) { // https://www.educoder.net // https://testbdweb.trustie.net diff --git a/src/common/educoder.js b/src/common/educoder.js index c6eaf176..a67a6d44 100644 --- a/src/common/educoder.js +++ b/src/common/educoder.js @@ -6,7 +6,7 @@ export { getUploadLogoActionUrl as getUploadLogoActionUrl, getImageUrl as getImageUrl,getImage as getImage, getmyUrl as getmyUrl, getRandomNumber as getRandomNumber, getUrl as getUrl, publicSearchs as publicSearchs, getRandomcode as getRandomcode, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl , getUploadActionUrl as getUploadActionUrl, getUploadActionUrltwo as getUploadActionUrltwo, getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth - , getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file, getcdnImageUrl as getcdnImageUrl + , getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file, getcdnImageUrl as getcdnImageUrl,getLogoImageUrl as getLogoImageUrl } from './UrlTool'; export { setmiyah as setmiyah } from './Component'; diff --git a/src/home/index.jsx b/src/home/index.jsx index e3481436..b72d2823 100644 --- a/src/home/index.jsx +++ b/src/home/index.jsx @@ -1,11 +1,16 @@ import React, { useEffect, useState } from 'react'; import NewSlide from "./NewSlide"; +import { TPMIndexHOC } from '../modules/tpm/TPMIndexHOC'; + import './index.scss'; -function HomePage() { +function HomePage(props) { return ( -
+
+
+
+
@@ -14,8 +19,8 @@ function HomePage() { - - + {/* */} + @@ -27,5 +32,4 @@ function HomePage() { ) } - -export default HomePage; \ No newline at end of file +export default TPMIndexHOC(HomePage); diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index 9d1d5320..eefad5ee 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { Link } from "react-router-dom"; import AccountProfile from "../user/AccountProfile"; -import { getImageUrl } from 'educoder' +import { getImageUrl,getLogoImageUrl } from 'educoder' import axios from 'axios'; import { Modal, Input, message, notification } from 'antd'; @@ -586,6 +586,8 @@ class NewHeader extends Component { return true } else if (url.indexOf('users') > -1 && match.path.indexOf('users') > -1) { return true + } else if (['http://117.50.100.12:8080','https://osredm.com'].includes(url) && match.path === '/') { + return true } else { return false } @@ -618,74 +620,79 @@ class NewHeader extends Component { mygetHelmetapi2, goshowqqgtounp, } = this.state; - /*用户名称 用户头像url*/ - let activeIndex = false; - let activeForums = false; - let activeShixuns = false; - let activePaths = false; - let coursestype = false; - let activePackages = false; - let activeMoopCases = false; - let activeCompetitions = false; - if (match.path === '/forums') { - activeForums = true; - } else if (match.path.startsWith('/shixuns')) { - activeShixuns = true; - } else if (match.path.startsWith('/paths')) { - activePaths = true; - } else if (match.path.startsWith('/courses')) { - coursestype = true; - } else if (match.path.startsWith('/crowdsourcing')) { - activePackages = true; - } else if (match.path.startsWith('/moop_cases')) { - activeMoopCases = true; - } else if (match.path.startsWith('/competitions')) { - activeCompetitions = true; - } else { + let activeIndex = ''; + if(match.path === '/'){ activeIndex = true; } - let headtypes = '/'; - if (mygetHelmetapi2) { - if (mygetHelmetapi2.navbar) { - if (mygetHelmetapi2.navbar.length > 0) { - if (match.path === '/') { - if (headtypesonClickbool === false) { - headtypes = undefined; - } else { - headtypes = headtypess; - } - } else { - for (var i = 0; i < mygetHelmetapi2.navbar.length; i++) { - if (match.path === mygetHelmetapi2.navbar[i].link) { - headtypes = mygetHelmetapi2.navbar[i].link; - break; - } - } - } - } - } - } - let shixuntype = false; - let pathstype = false; + /*用户名称 用户头像url*/ + // let activeIndex = false; + // let activeForums = false; + // let activeShixuns = false; + // let activePaths = false; + // let coursestype = false; + // let activePackages = false; + // let activeMoopCases = false; + // let activeCompetitions = false; + + // if (match.path === '/forums') { + // activeForums = true; + // } else if (match.path.startsWith('/shixuns')) { + // activeShixuns = true; + // } else if (match.path.startsWith('/paths')) { + // activePaths = true; + // } else if (match.path.startsWith('/courses')) { + // coursestype = true; + // } else if (match.path.startsWith('/crowdsourcing')) { + // activePackages = true; + // } else if (match.path.startsWith('/moop_cases')) { + // activeMoopCases = true; + // } else if (match.path.startsWith('/competitions')) { + // activeCompetitions = true; + // } else { + // activeIndex = true; + // } + // let headtypes = '/'; + // if (mygetHelmetapi2) { + // if (mygetHelmetapi2.navbar) { + // if (mygetHelmetapi2.navbar.length > 0) { + // if (match.path === '/') { + // if (headtypesonClickbool === false) { + // headtypes = undefined; + // } else { + // headtypes = headtypess; + // } + // } else { + // for (var i = 0; i < mygetHelmetapi2.navbar.length; i++) { + // if (match.path === mygetHelmetapi2.navbar[i].link) { + // headtypes = mygetHelmetapi2.navbar[i].link; + // break; + // } + // } + // } + // } + // } + // } + // let shixuntype = false; + // let pathstype = false; let coursestypes = false; if (this.props && this.props.mygetHelmetapi != null) { - let shixun = "/shixuns"; - let paths = "/paths"; + // let shixun = "/shixuns"; + // let paths = "/paths"; let courses = "/courses"; this.props.mygetHelmetapi.navbar.map((item, key) => { var reg = RegExp(item.link); - if (shixun.match(reg)) { - if (item.hidden === true) { - shixuntype = true - } - } - if (paths.match(reg)) { - if (item.hidden === true) { - pathstype = true - } - } + // if (shixun.match(reg)) { + // if (item.hidden === true) { + // shixuntype = true + // } + // } + // if (paths.match(reg)) { + // if (item.hidden === true) { + // pathstype = true + // } + // } if (courses.match(reg)) { if (item.hidden === true) { coursestypes = true @@ -694,7 +701,7 @@ class NewHeader extends Component { }) } return ( -
+
{isRender === true ? { mygetHelmetapi2 && mygetHelmetapi2.nav_logo_url ? - 可控开源社区 + 可控开源社区 : "" } @@ -762,7 +769,7 @@ class NewHeader extends Component {
{this.props.user && this.props.user.login &&
- +
{ @@ -816,18 +823,18 @@ class NewHeader extends Component {
{user === undefined ? - this.educoderlogin()} className="mr5 color-grey-6">登录 + this.educoderlogin()} className={`mr5 ${activeIndex ? 'color-white' : 'color-grey-6'}`}>登录 { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.register_url && - 注册 + 注册 } : user.login === "" ? - this.educoderlogin()} className="mr5 color-grey-6">登录 + this.educoderlogin()} className={`mr5 ${activeIndex ? 'color-white' : 'color-grey-6'}`}>登录 { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.register_url && - 注册 + 注册 } : diff --git a/src/modules/tpm/css/headerExcess.css b/src/modules/tpm/css/headerExcess.css index 08ee8377..d0104c36 100644 --- a/src/modules/tpm/css/headerExcess.css +++ b/src/modules/tpm/css/headerExcess.css @@ -9,4 +9,12 @@ left:0px; bottom: 12px; position: absolute; -} \ No newline at end of file +} + +.newHeaders.homePage{ + background-color: #1A2358; +} +.newHeaders.homePage .head-nav ul#header-nav li a{ + color: #fff; +} +