+ :""}
+
+ );
+}
}
export default LoginDialog ;
diff --git a/src/modules/question/Question.js b/src/modules/question/Question.js
index 35b8518b..02d64a50 100644
--- a/src/modules/question/Question.js
+++ b/src/modules/question/Question.js
@@ -988,15 +988,6 @@ class Question extends Component {
}
return (
-
{
mydisplay === true ?
diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js
index c3318e44..c132384d 100644
--- a/src/modules/tpm/NewHeader.js
+++ b/src/modules/tpm/NewHeader.js
@@ -1,9 +1,9 @@
import React, { Component } from 'react';
import { Link } from "react-router-dom";
-import AccountProfile from"../user/AccountProfile";
+import AccountProfile from "../user/AccountProfile";
import { getImageUrl } from 'educoder'
import axios from 'axios';
-import { Modal , Input , message , notification } from 'antd';
+import { Modal, Input, message, notification } from 'antd';
import LoginDialog from '../login/LoginDialog';
import GotoQQgroup from '../../modal/GotoQQgroup'
@@ -22,38 +22,38 @@ window._header_componentHandler = null;
class NewHeader extends Component {
constructor(props) {
super(props)
- this.state={
- Addcoursestypes:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- RadioGroupvalue:undefined,
- submitapplications:false,
- isRender:false,
- showSearchOpentype:false,
- showTrial:false,
- setevaluatinghides:false,
- occupation:0,
- mydisplay:false,
- headtypesonClickbool:false,
- headtypess:"/",
- mygetHelmetapi2: null,
- goshowqqgtounp:false,
- visiblemyss:false,
+ this.state = {
+ Addcoursestypes: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ RadioGroupvalue: undefined,
+ submitapplications: false,
+ isRender: false,
+ showSearchOpentype: false,
+ showTrial: false,
+ setevaluatinghides: false,
+ occupation: 0,
+ mydisplay: false,
+ headtypesonClickbool: false,
+ headtypess: "/",
+ mygetHelmetapi2: null,
+ goshowqqgtounp: false,
+ visiblemyss: false,
+ }
+ }
+ componentDidUpdate = (prevProps) => {
+ if (this.state.mygetHelmetapi2 === undefined) {
+ this.getAppdata();
}
}
- componentDidUpdate = (prevProps) => {
- if(this.state.mygetHelmetapi2===undefined){
- this.getAppdata();
- }
- }
componentDidMount() {
this.getAppdata();
window._header_componentHandler = this;
@@ -61,7 +61,7 @@ class NewHeader extends Component {
//下拉框的显示隐藏
var hoverTimeout;
var hoveredPanel;
- $(".edu-menu-panel").hover(function(){
+ $(".edu-menu-panel").hover(function () {
if (hoverTimeout) { // 一次只显示一个panel
if (hoveredPanel && hoveredPanel !== this) {
$(hoveredPanel).find(".edu-menu-list").hide()
@@ -71,54 +71,54 @@ class NewHeader extends Component {
}
hoveredPanel = this;
$(this).find(".edu-menu-list").show();
- },function(){
- var that =this;
+ }, function () {
+ var that = this;
// 延迟hide
- hoverTimeout = setTimeout(function() {
+ hoverTimeout = setTimeout(function () {
$(that).find(".edu-menu-list").hide();
}, 800)
});
//获取游览器地址
- try {
- window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href))
- } catch (e) {
+ try {
+ window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href))
+ } catch (e) {
- }
+ }
}
openNotification = (messge) => {
notification.open({
message: "提示",
description:
- messge,
+ messge,
});
};
componentWillReceiveProps(newProps, oldProps) {
this.setState({
- user:newProps.user
+ user: newProps.user
})
- if(newProps.Headertop!==undefined){
- old_url=newProps.Headertop.old_url
+ if (newProps.Headertop !== undefined) {
+ old_url = newProps.Headertop.old_url
}
}
- getCookie=(key)=>{
- var arr,reg = RegExp('(^| )'+key+'=([^;]+)(;|$)');
- if (arr === document.cookie.match(reg))
+ getCookie = (key) => {
+ var arr, reg = RegExp('(^| )' + key + '=([^;]+)(;|$)');
+ if (arr === document.cookie.match(reg))
return decodeURIComponent(arr[2]);
else
return null;
}
- delCookie=(name)=>{
+ delCookie = (name) => {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
- var cval=this.getCookie(name);
- if(cval!=null){
- document.cookie= name + "="+cval+";expires="+exp.toGMTString();
+ var cval = this.getCookie(name);
+ if (cval != null) {
+ document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
}
onLogout = () => {
@@ -127,93 +127,93 @@ class NewHeader extends Component {
axios.get(url, {
})
.then((response) => {
- if(response.data.status===1){
+ if (response.data.status === 1) {
this.setState({
- user:undefined
+ user: undefined
})
- window.location.href ="/login"
+ window.location.href = "/login"
message.success('退出成功');
}
});
}
- tojoinclass=()=>{
- let{user} =this.state;
- if(user===undefined){
+ tojoinclass = () => {
+ let { user } = this.state;
+ if (user === undefined) {
this.setState({
- isRender:true
+ isRender: true
})
return
}
- if(user&&user.login===""){
+ if (user && user.login === "") {
this.setState({
- isRender:true
+ isRender: true
})
return;
}
- if(user&&user.profile_completed===false){
- this.setState({
- AccountProfiletype:true
- })
- return;
- }
-
- this.setState({
- Addcoursestypes:true,
- })
- }
-
- tojoinitem=()=>{
- if(this.props.user && this.props.user.email===undefined || this.props.user && this.props.user.email===null || this.props.user && this.props.user.email===""){
- this.openNotification("请先绑定邮箱,谢谢");
- return
- }
- let{user} =this.state;
- if(user===undefined){
+ if (user && user.profile_completed === false) {
this.setState({
- isRender:true
- })
- return
- }
- if(user&&user.login===""){
- this.setState({
- isRender:true
+ AccountProfiletype: true
})
return;
}
- if(user&&user.profile_completed===false){
- this.setState({
- AccountProfiletype:true
- })
- return;
- }
-
- this.setState({
- tojoinitemtype:true
- })
- }
-
-
- submitstatevalue=(sum,value,data)=>{
this.setState({
- Addcoursestypes:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- submitapplicationssum:sum,
- submitapplications:true,
- submitapplicationsvalue:value,
- submitapplicationsvaluedata:data,
- RadioGroupvalue:undefined
+ Addcoursestypes: true,
+ })
+ }
+
+ tojoinitem = () => {
+ if (this.props.user && this.props.user.email === undefined || this.props.user && this.props.user.email === null || this.props.user && this.props.user.email === "") {
+ this.openNotification("请先绑定邮箱,谢谢");
+ return
+ }
+ let { user } = this.state;
+ if (user === undefined) {
+ this.setState({
+ isRender: true
+ })
+ return
+ }
+ if (user && user.login === "") {
+ this.setState({
+ isRender: true
+ })
+ return;
+ }
+
+ if (user && user.profile_completed === false) {
+ this.setState({
+ AccountProfiletype: true
+ })
+ return;
+ }
+
+ this.setState({
+ tojoinitemtype: true
+ })
+ }
+
+
+ submitstatevalue = (sum, value, data) => {
+ this.setState({
+ Addcoursestypes: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ submitapplicationssum: sum,
+ submitapplications: true,
+ submitapplicationsvalue: value,
+ submitapplicationsvaluedata: data,
+ RadioGroupvalue: undefined
})
}
@@ -223,54 +223,54 @@ class NewHeader extends Component {
});
}
- submitsubmitapplications=()=>{
+ submitsubmitapplications = () => {
let {
submitapplicationssum,
submitapplicationsvaluedata
- }=this.state;
+ } = this.state;
this.setState({
- submitapplications:false,
- RadioGroupvalue:undefined
+ submitapplications: false,
+ RadioGroupvalue: undefined
})
- if(submitapplicationssum===0){
- if(submitapplicationsvaluedata!==undefined){
- window.location.href = "/courses/"+submitapplicationsvaluedata;
+ if (submitapplicationssum === 0) {
+ if (submitapplicationsvaluedata !== undefined) {
+ window.location.href = "/courses/" + submitapplicationsvaluedata;
}
- }else if(submitapplicationssum===1){
- if(submitapplicationsvaluedata!==undefined){
- window.location.href = "/projects/"+submitapplicationsvaluedata;
+ } else if (submitapplicationssum === 1) {
+ if (submitapplicationsvaluedata !== undefined) {
+ window.location.href = "/projects/" + submitapplicationsvaluedata;
}
}
}
- hidesubmitapplications=()=>{
+ hidesubmitapplications = () => {
this.setState({
- Addcoursestypes:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- submitapplications:false,
- RadioGroupvalue:undefined
+ Addcoursestypes: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ submitapplications: false,
+ RadioGroupvalue: undefined
})
}
- educoderlogin=()=>{
+ educoderlogin = () => {
//登录账号
this.setState({
- isRender:true
+ isRender: true
})
}
- educoderloginysl=()=>{
+ educoderloginysl = () => {
//退出账号
var url = `/accounts/logout.json`;
axios.get((url)).then((result) => {
- if(result!==undefined){
+ if (result !== undefined) {
window.location.href = "/";
}
}).catch((error) => {
@@ -278,411 +278,411 @@ class NewHeader extends Component {
})
}
- hideAddcoursestypes=()=>{
+ hideAddcoursestypes = () => {
this.setState({
- Addcoursestypes:false
+ Addcoursestypes: false
})
};
- HideAddcoursestypess=(i)=>{
+ HideAddcoursestypess = (i) => {
console.log("调用了");
this.setState({
- Addcoursestypes:false,
- mydisplay:true,
- occupation:i,
+ Addcoursestypes: false,
+ mydisplay: true,
+ occupation: i,
})
};
- ModalCancelsy=()=>{
+ ModalCancelsy = () => {
this.setState({
- mydisplay:false,
+ mydisplay: false,
})
};
- hidetojoinclass=()=>{
+ hidetojoinclass = () => {
this.setState({
- tojoinclasstype:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- RadioGroupvalue:undefined
+ tojoinclasstype: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ RadioGroupvalue: undefined
})
}
-submittojoinclass=(value)=>{
- let {tojoinclasstitle,rolearr,RadioGroupvalue}=this.state;
+ submittojoinclass = (value) => {
+ let { tojoinclasstitle, rolearr, RadioGroupvalue } = this.state;
- if(tojoinclasstitle===undefined){
- this.setState({
- code_notice:true
- })
- return
- }
- let newrolearr=rolearr;
- if(tojoinclasstitle.length<6){
+ if (tojoinclasstitle === undefined) {
this.setState({
- code_notice:true
+ code_notice: true
})
return
}
- if(tojoinclasstitle===""||tojoinclasstitle===undefined){
- this.setState({
- code_notice:true
- })
- return
- }else{
- this.setState({
- code_notice:false
- })
- }
-
- let pamst=[];
- let num=0;
- for(var i = 0 ; i
{
+ if (response.data.status === 1) {
+ this.submitstatevalue(1, "您输入的邀请码错误")
+ } else if (response.data.status === 2) {
+ this.submitstatevalue(1, "您已经是该项目成员", response.data.project)
+ } else if (response.data.status === 3) {
+ this.submitstatevalue(1, "请选择一个角色")
+ } else if (response.data.status === 4) {
+ this.submitstatevalue(1, "您的申请已提交,请等待项目管理员审批")
+ } else if (response.data.status === 5) {
+ this.submitstatevalue(1, "您已经申请加入该项目了,请耐心等待")
+ } else if (response.data.status === 6) {
+ this.submitstatevalue(1, "您已成功加入项目", response.data.project)
+ } else if (response.data.status === 0) {
+ if (RadioGroupvalue === "reporter") {
+ this.openNotification("您加入项目成功!");
+ window.location.href = `/projects/${response.data.project_id}`;
+ } else {
+ this.openNotification("您的申请已提交,请等待项目管理员审批!");
+ }
+ }
+ })
+ }
+ this.hidetojoinclass()
}
- if(value===1){
- let url="/project_applies.json";
- axios.post(url,{
- code:tojoinclasstitle,
- role:RadioGroupvalue
- }
- ).then((response) => {
- if( response.data.status===1){
- this.submitstatevalue(1,"您输入的邀请码错误")
- }else if( response.data.status===2){
- this.submitstatevalue( 1,"您已经是该项目成员",response.data.project)
- }else if( response.data.status===3){
- this.submitstatevalue( 1,"请选择一个角色")
- }else if( response.data.status===4){
- this.submitstatevalue( 1,"您的申请已提交,请等待项目管理员审批")
- }else if( response.data.status===5){
- this.submitstatevalue( 1,"您已经申请加入该项目了,请耐心等待")
- }else if( response.data.status===6){
- this.submitstatevalue( 1,"您已成功加入项目",response.data.project)
- }else if( response.data.status===0){
- if(RadioGroupvalue==="reporter"){
- this.openNotification("您加入项目成功!");
- window.location.href=`/projects/${response.data.project_id}`;
- }else{
- this.openNotification("您的申请已提交,请等待项目管理员审批!");
- }
- }
- })
- }
- this.hidetojoinclass()
-}
// 关闭
cancelModulationModels = () => {
- this.setState({isRenders: false})
+ this.setState({ isRenders: false })
}
- inputjoinclassvalue=(e)=>{
+ inputjoinclassvalue = (e) => {
console.log(e.target.value.length);
- if(e.target.value.length>=7){
+ if (e.target.value.length >= 7) {
this.openNotification("请输入6位项目邀请码!");
return
}
this.setState({
- tojoinclasstitle:e.target.value
+ tojoinclasstitle: e.target.value
})
}
- showSearchOpen=(e)=>{
- this.setState({
- showSearchOpentype:true
- })
+ showSearchOpen = (e) => {
+ this.setState({
+ showSearchOpentype: true
+ })
- }
+ }
- hideshowSearchOpen=(e)=>{
- let {setevaluatinghides}=this.state;
- if(setevaluatinghides===true){
- this.setState({
- showSearchOpentype:false,
- setevaluatinghides:false
- })
-
- }
- }
-
- onKeywordSearchKeyDown = (value) => {
- let url=`/search?value=${value}`;
- this.props.history.push(url)
- }
-
- onKeywordSearchKeyDowns=()=>{
- this.setState(
- {
- setevaluatinghides:false
- }
- )
- }
-
- setevaluatinghides=()=>{
- this.setState(
- {
- setevaluatinghides:true
- }
- )
- }
- //头部获取是否已经登录了
- getUser=(url,type)=>{
- if(type==="projects"){
- if(this.props.user && this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){
- this.openNotification("请先绑定邮箱,谢谢");
- return
- }
- }
- let{user} =this.state;
-
- if(user===undefined){
- this.setState({
- isRender:true
- })
- return
- }
- if(user&&user.login===""){
+ hideshowSearchOpen = (e) => {
+ let { setevaluatinghides } = this.state;
+ if (setevaluatinghides === true) {
this.setState({
- isRender:true
+ showSearchOpentype: false,
+ setevaluatinghides: false
+ })
+
+ }
+ }
+
+ onKeywordSearchKeyDown = (value) => {
+ let url = `/search?value=${value}`;
+ this.props.history.push(url)
+ }
+
+ onKeywordSearchKeyDowns = () => {
+ this.setState(
+ {
+ setevaluatinghides: false
+ }
+ )
+ }
+
+ setevaluatinghides = () => {
+ this.setState(
+ {
+ setevaluatinghides: true
+ }
+ )
+ }
+ //头部获取是否已经登录了
+ getUser = (url, type) => {
+ if (type === "projects") {
+ if (this.props.user && this.props.user.email === undefined || this.props.user && this.props.user.email === null || this.props.user && this.props.user.email === "") {
+ this.openNotification("请先绑定邮箱,谢谢");
+ return
+ }
+ }
+ let { user } = this.state;
+
+ if (user === undefined) {
+ this.setState({
+ isRender: true
+ })
+ return
+ }
+ if (user && user.login === "") {
+ this.setState({
+ isRender: true
})
return;
}
- if(user&&user.profile_completed===false){
- this.setState({
- AccountProfiletype:true
- })
- return;
- }
- if(type==="newshixuns"){
- if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){
+ if (user && user.profile_completed === false) {
+ this.setState({
+ AccountProfiletype: true
+ })
+ return;
+ }
+ if (type === "newshixuns") {
+ if (this.props && this.props.current_user && this.props.current_user.is_shixun_marker === false) {
this.setgoshowqqgtounp(true);
return;
}
}
- if(url !== undefined || url!==""){
+ if (url !== undefined || url !== "") {
window.location.href = url;
}
}
//修改登录方法
- Modifyloginvalue=()=>{
+ Modifyloginvalue = () => {
this.setState({
- isRender:false,
+ isRender: false,
})
}
- hideAccountProfile=()=>{
- this.setState({
- AccountProfiletype:false
- })
- };
- headtypesonClick=(url,bool)=>{
- this.setState({
- headtypess:url,
- headtypesonClickbool:bool,
- })
- }
- //获取数据为空的时候
- gettablogourlnull = () => {
- this.setState({
- mygetHelmetapi2: undefined
- });
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = "/react/build/./favicon.ico";
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- };
+ hideAccountProfile = () => {
+ this.setState({
+ AccountProfiletype: false
+ })
+ };
+ headtypesonClick = (url, bool) => {
+ this.setState({
+ headtypess: url,
+ headtypesonClickbool: bool,
+ })
+ }
+ //获取数据为空的时候
+ gettablogourlnull = () => {
+ this.setState({
+ mygetHelmetapi2: undefined
+ });
+ var link = document.createElement('link'),
+ oldLink = document.getElementById('dynamic-favicon');
+ link.id = 'dynamic-favicon';
+ link.rel = 'shortcut icon';
+ link.href = "/react/build/./favicon.ico";
+ if (oldLink) {
+ document.head.removeChild(oldLink);
+ }
+ document.head.appendChild(link);
+ };
- //获取数据的时候
- gettablogourldata = (response) => {
- document.title = response.data.setting.name;
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = '/' + response.data.setting.tab_logo_url;
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- }
+ //获取数据的时候
+ gettablogourldata = (response) => {
+ document.title = response.data.setting.name;
+ var link = document.createElement('link'),
+ oldLink = document.getElementById('dynamic-favicon');
+ link.id = 'dynamic-favicon';
+ link.rel = 'shortcut icon';
+ link.href = '/' + response.data.setting.tab_logo_url;
+ if (oldLink) {
+ document.head.removeChild(oldLink);
+ }
+ document.head.appendChild(link);
+ }
- handleVisibleChanges = (boll) => {
- this.setState({
- visiblemyss: boll,
- })
+ handleVisibleChanges = (boll) => {
+ this.setState({
+ visiblemyss: boll,
+ })
- }
+ }
- getAppdata=()=>{
- try {
- var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
- var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
+ getAppdata = () => {
+ try {
+ var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
+ var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
this.setState({
- mygetHelmetapi2:chromesettingArray
+ mygetHelmetapi2: chromesettingArray
});
if (chromesettingArray.tab_logo_url) {
this.gettablogourldata(chromesettingresponseArray);
} else {
this.gettablogourlnull();
}
- }catch (e) {
+ } catch (e) {
this.geturlsdata();
- }
- };
-
- geturlsdata=()=>{
- let url = "/setting.json";
- axios.get(url).then((response) => {
- if(response){
- if(response.data){
- this.setState({
- mygetHelmetapi2:response.data.setting
- });
- localStorage.setItem('chromesetting',JSON.stringify(response.data.setting));
- localStorage.setItem('chromesettingresponse',JSON.stringify(response));
- try {
- if (response.data.setting.tab_logo_url) {
- this.gettablogourldata(response);
- } else {
- this.gettablogourlnull();
- }
- } catch (e) {
- this.gettablogourlnull();
- }
-
-
- } else {
-
- this.gettablogourlnull();
-
- }
-
- } else {
- this.gettablogourlnull();
-
- }
-
- }).catch((error) => {
- this.gettablogourlnull();
-
- });
- }
-
-
- matchpaths=(url)=>{
- const {match} = this.props;
- if (url=== '/forums'&&match.path === '/forums') {
- return true
- } else if (url.startsWith('/projects')&&match.path.startsWith('/projects')) {
- return true
- }else if (url.startsWith('/paths')&&match.path.startsWith('/paths')) {
- return true
- } else if (url.startsWith('/courses')&&match.path.startsWith('/courses')) {
- return true
- }else if (url.startsWith('/competitions')&&match.path.startsWith('/competitions')) {
- return true
- }else if (url.startsWith('/statistics')&&match.path.startsWith('/statistics')) {
- return true
- } else {
- return false
- }
}
+ };
+
+ geturlsdata = () => {
+ let url = "/setting.json";
+ axios.get(url).then((response) => {
+ if (response) {
+ if (response.data) {
+ this.setState({
+ mygetHelmetapi2: response.data.setting
+ });
+ localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
+ localStorage.setItem('chromesettingresponse', JSON.stringify(response));
+ try {
+ if (response.data.setting.tab_logo_url) {
+ this.gettablogourldata(response);
+ } else {
+ this.gettablogourlnull();
+ }
+ } catch (e) {
+ this.gettablogourlnull();
+ }
- // 处理弹框
- setgoshowqqgtounp=(bool)=>{
- this.setState({
- goshowqqgtounp:bool
- })
- }
+ } else {
+
+ this.gettablogourlnull();
+
+ }
+
+ } else {
+ this.gettablogourlnull();
+
+ }
+
+ }).catch((error) => {
+ this.gettablogourlnull();
+
+ });
+ }
+
+
+ matchpaths = (url) => {
+ const { match } = this.props;
+ if (url === '/forums' && match.path === '/forums') {
+ return true
+ } else if (url.startsWith('/projects') && match.path.startsWith('/projects')) {
+ return true
+ } else if (url.startsWith('/paths') && match.path.startsWith('/paths')) {
+ return true
+ } else if (url.startsWith('/courses') && match.path.startsWith('/courses')) {
+ return true
+ } else if (url.startsWith('/competitions') && match.path.startsWith('/competitions')) {
+ return true
+ } else if (url.startsWith('/statistics') && match.path.startsWith('/statistics')) {
+ return true
+ } else {
+ return false
+ }
+ }
+
+
+ // 处理弹框
+ setgoshowqqgtounp = (bool) => {
+ this.setState({
+ goshowqqgtounp: bool
+ })
+ }
render() {
const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
- const {match} = this.props;
+ const { match } = this.props;
- let {Addcoursestypes,
+ let { Addcoursestypes,
tojoinitemtype,
tojoinclasstitle,
code_notice,
checked_notice,
- AccountProfiletype,
+ AccountProfiletype,
submitapplications,
submitapplicationsvalue,
user,
isRender,
- showSearchOpentype,
- headtypesonClickbool,
- headtypess,
- mygetHelmetapi2,
- goshowqqgtounp,
- }=this.state;
+ showSearchOpentype,
+ headtypesonClickbool,
+ headtypess,
+ 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;
+ 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;
- }
+ 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='/';
+ let headtypes = '/';
- if(mygetHelmetapi2) {
+ if (mygetHelmetapi2) {
if (mygetHelmetapi2.navbar) {
if (mygetHelmetapi2.navbar.length > 0) {
if (match.path === '/') {
@@ -703,342 +703,173 @@ submittojoinclass=(value)=>{
}
}
}
- let shixuntype=false;
- let pathstype=false;
- let coursestypes=false;
- if(this.props&&this.props.mygetHelmetapi!=null){
- 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(courses.match(reg)){
- if(item.hidden===true){
- coursestypes=true
- }
- }
- })
- }
-
- const contents = (
-
- );
- return (
-
-
-