From 28fbfa82cbbecba73a1ae8556e61b430bf09603f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 12 Oct 2019 12:13:01 +0800 Subject: [PATCH 01/43] =?UTF-8?q?=E6=96=B0issues=20=E5=88=86=E6=94=AF?= =?UTF-8?q?=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 137 ++++++++++---------- public/react/package.json | 1 + public/react/src/App.js | 30 ++++- public/react/src/modules/tpm/NewHeader.js | 5 +- public/react/src/modules/tpm/TPMIndexHOC.js | 1 + 5 files changed, 100 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 8dcb6d131..90f519de4 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,70 @@ -# README - -This README would normally document whatever steps are necessary to get the -application up and running. - -Things you may want to cover: - -* Ruby version - -* System dependencies - -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... -#### Jbuilder介绍 -Jbuilder: https://github.com/rails/jbuilder - -#### Rails5 介绍 -rails guide: https://ruby-china.github.io/rails-guides/v5.0/ - -#### API设计文档 -doc for api: https://www.showdoc.cc/web/#/127895880302646?page_id=729221359592009 -user:Hjqreturn PW:12345678 - -#### 测试版访问地址:https://testeduplus2.educoder.net - -#### 实训平台繁忙 - 仓库异常:繁忙等级(81) - -#### 新版域名跳转规则 -新版域名要求总结:testeduplus2.educoder.net/(主要提供实训、实训课堂等业务) -目前有两个域名testbdweb.educoder.net(老版:主要提供课堂、项目、个人主页、后台等服务) - -要求: -1、两服务域名都应该启动‘提供服务 - -2、如果请求链接包含以下的形式,则域名跳至testeduplus2.educoder.net -testeduplus2.educoder.net/shixuns -testeduplus2.educoder.net/shixuns/* -testeduplus2.educoder.net/paths -testeduplus2.educoder.net/paths/* -testeduplus2.educoder.net/myshixuns/ -testeduplus2.educoder.net/tasks/* -testeduplus2.educoder.net/games/* - -如果不满足上述需求的,域名全部跳转至testbdweb.educoder.net -比如:门户首页,如果访问:testeduplus2.educoder.net 应为没包含上述链接。则调制testbdweb.educoder.net -在比如:testeduplus2.educoder.net /users/Hjqreturn没包含上述规则,则跳转到testbdweb.educoder.net/users/Hjqreturn - - -# 需要重构user_extensions 相关sql语句的地方标记 REDO:Extention - -# 文件上传:ActiveStorage -# 新能:bootsnap - -# 注意事项: -# 第一次部署需要执行一些rake任务 -# 配置redis地址 +# README +https://www.trustie.net/issues/24719 +[云上实验室] Logo、导航、底部备案信息定制化 +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... +#### Jbuilder介绍 +Jbuilder: https://github.com/rails/jbuilder + +#### Rails5 介绍 +rails guide: https://ruby-china.github.io/rails-guides/v5.0/ + +#### API设计文档 +doc for api: https://www.showdoc.cc/web/#/127895880302646?page_id=729221359592009 +user:Hjqreturn PW:12345678 + +#### 测试版访问地址:https://testeduplus2.educoder.net + +#### 实训平台繁忙 + 仓库异常:繁忙等级(81) + +#### 新版域名跳转规则 +新版域名要求总结:testeduplus2.educoder.net/(主要提供实训、实训课堂等业务) +目前有两个域名testbdweb.educoder.net(老版:主要提供课堂、项目、个人主页、后台等服务) + +要求: +1、两服务域名都应该启动‘提供服务 + +2、如果请求链接包含以下的形式,则域名跳至testeduplus2.educoder.net +testeduplus2.educoder.net/shixuns +testeduplus2.educoder.net/shixuns/* +testeduplus2.educoder.net/paths +testeduplus2.educoder.net/paths/* +testeduplus2.educoder.net/myshixuns/ +testeduplus2.educoder.net/tasks/* +testeduplus2.educoder.net/games/* + +如果不满足上述需求的,域名全部跳转至testbdweb.educoder.net +比如:门户首页,如果访问:testeduplus2.educoder.net 应为没包含上述链接。则调制testbdweb.educoder.net +在比如:testeduplus2.educoder.net /users/Hjqreturn没包含上述规则,则跳转到testbdweb.educoder.net/users/Hjqreturn + + +# 需要重构user_extensions 相关sql语句的地方标记 REDO:Extention + +# 文件上传:ActiveStorage +# 新能:bootsnap + +# 注意事项: +# 第一次部署需要执行一些rake任务 +# 配置redis地址 # 配置gitlab/intializers/gitlab_config.yml \ No newline at end of file diff --git a/public/react/package.json b/public/react/package.json index 6a0cf6d09..d13714922 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -68,6 +68,7 @@ "react-content-loader": "^3.1.1", "react-dev-utils": "^5.0.0", "react-dom": "^16.9.0", + "react-helmet": "^5.2.1", "react-hot-loader": "^4.0.0", "react-infinite-scroller": "^1.2.4", "react-loadable": "^5.3.1", diff --git a/public/react/src/App.js b/public/react/src/App.js index 9b85acfa8..ed52b9f14 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -9,7 +9,7 @@ import { Route, Switch } from 'react-router-dom'; - +import axios from 'axios'; import '@icedesign/base/dist/ICEDesignBase.css'; import '@icedesign/base/index.scss'; @@ -275,6 +275,7 @@ class App extends Component { Addcoursestypes:false, mydisplay:false, occupation:0, + getapi:undefined, } } @@ -315,7 +316,6 @@ class App extends Component { } componentDidMount() { this.disableVideoContextMenu(); - // force an update if the URL changes history.listen(() => { this.forceUpdate() @@ -324,7 +324,8 @@ class App extends Component { $("html").animate({ scrollTop: $('html').scrollTop() - 0 }) }); - initAxiosInterceptors(this.props) + initAxiosInterceptors(this.props); + this.getAppdata(); // // axios.interceptors.response.use((response) => { // // console.log("response"+response); @@ -350,6 +351,20 @@ class App extends Component { this.setState({ isRender:false, }) + }; + //获取当前定制信息 + getAppdata=()=>{ + let url = "/setting.json"; + axios.get(url).then((response) => { + if(response){ + this.setState({ + getapi:response.data.setting + }) + } + + }).catch((error) => { + + }); } render() { @@ -450,7 +465,7 @@ class App extends Component { > {/*课堂*/} - + {/* */} @@ -484,7 +499,12 @@ class App extends Component { render={ (props)=>() }/> - + () + } + /> diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index de8fade26..d5119245b 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -67,11 +67,14 @@ class NewHeader extends Component { occupation:0, mydisplay:false } - // console.log("176") + console.log("176") // console.log(props); + console.log("NewHeader1234567890"); + console.log(this.props); } componentDidMount() { + window._header_componentHandler = this; //下拉框的显示隐藏 diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index dd4572bcc..25c359956 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -644,6 +644,7 @@ export function TPMIndexHOC(WrappedComponent) { From a3dc1d6adf04ec1588c43effc6f85c820e7ea368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 14 Oct 2019 15:35:31 +0800 Subject: [PATCH 02/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/package.json | 1 - public/react/public/index.html | 5 +- public/react/public/index.test.html | 5 +- public/react/src/App.js | 25 +++++++--- public/react/src/modules/tpm/TPMIndexHOC.js | 55 ++++++++++++++++++--- 5 files changed, 74 insertions(+), 17 deletions(-) diff --git a/public/react/package.json b/public/react/package.json index d13714922..6a0cf6d09 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -68,7 +68,6 @@ "react-content-loader": "^3.1.1", "react-dev-utils": "^5.0.0", "react-dom": "^16.9.0", - "react-helmet": "^5.2.1", "react-hot-loader": "^4.0.0", "react-infinite-scroller": "^1.2.4", "react-loadable": "^5.3.1", diff --git a/public/react/public/index.html b/public/react/public/index.html index 321fbe0e5..bf8046e56 100755 --- a/public/react/public/index.html +++ b/public/react/public/index.html @@ -11,7 +11,7 @@ - + - EduCoder + + diff --git a/public/react/src/App.js b/public/react/src/App.js index ed52b9f14..bf9e98c79 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -275,7 +275,7 @@ class App extends Component { Addcoursestypes:false, mydisplay:false, occupation:0, - getapi:undefined, + getHelmetapi:undefined, } } @@ -358,22 +358,35 @@ class App extends Component { axios.get(url).then((response) => { if(response){ this.setState({ - getapi:response.data.setting - }) + getHelmetapi:response.data.setting + }); + 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.nav_logo_url; + if (oldLink) { + document.head.removeChild(oldLink); + } + document.head.appendChild(link); } }).catch((error) => { }); - } + }; render() { - - + let{getHelmetapi}=this.state; + // console.log("appappapp"); + // console.log(getHelmetapi); return ( + + this.Modifyloginvalue()}> diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 25c359956..1646e2b87 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -7,8 +7,8 @@ import NewFooter from './NewFooter' import SiderBar from './SiderBar' import { getUrl, downloadFile } from 'educoder' import axios from 'axios'; -import { Spin } from 'antd' -import './TPMIndex.css' +import { Spin } from 'antd'; +import './TPMIndex.css'; import LoginDialog from '../login/LoginDialog'; import AccountProfile from '../user/AccountProfile'; @@ -83,7 +83,8 @@ export function TPMIndexHOC(WrappedComponent) { globalLoading: false, dataquerys:{}, - isloginCancel:undefined + isloginCancel:undefined, + mygetHelmetapi:undefined, } } @@ -147,6 +148,8 @@ export function TPMIndexHOC(WrappedComponent) { } componentDidMount() { + console.log("TPMIndexHOC========"); + console.log(this.props); window.addEventListener('keyup', this.keyupListener) if(this.props.match.path==="/"){ @@ -207,7 +210,7 @@ export function TPMIndexHOC(WrappedComponent) { } } }); - + this.getAppdata(); } /** 课堂权限相关方法,暂时写这里了 ----------------------------------------START @@ -277,7 +280,32 @@ export function TPMIndexHOC(WrappedComponent) { // // } + //获取当前定制信息 + getAppdata=()=>{ + let url = "/setting.json"; + axios.get(url).then((response) => { + if(response){ + this.setState({ + mygetHelmetapi:response.data.setting, + }); + // console.log("获取当前定制信息"); + // console.log(response.data.setting); + 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.nav_logo_url; + if (oldLink) { + document.head.removeChild(oldLink); + } + document.head.appendChild(link); + } + + }).catch((error) => { + }); + }; /** 课堂权限相关方法,暂时写这里了 ----------------------------------------END */ @@ -534,6 +562,19 @@ export function TPMIndexHOC(WrappedComponent) { hideGlobalLoading = () => { this.setState({ globalLoading: false }) } + getAppdata=()=>{ + let url = "/setting.json"; + axios.get(url).then((response) => { + if(response){ + this.setState({ + getHelmetapi:response.data.setting + }) + } + + }).catch((error) => { + + }); + }; render() { let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state; const common = { @@ -569,10 +610,12 @@ export function TPMIndexHOC(WrappedComponent) { yslslowCheckresults:this.yslslowCheckresults, yslslowCheckresultsNo:this.yslslowCheckresultsNo, - } + }; + // console.log("this.props.getHelmetapi"); + // console.log(this.props.getHelmetapi); return (
- {isRender===true ? this.hideLoginDialog()} {...this.props} {...this.state} From 8dc47a215785dd0428b35c0e1e61dc14c20f3530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 14 Oct 2019 15:45:03 +0800 Subject: [PATCH 03/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 46 +++++++++++++++++--- public/react/src/modules/tpm/TPMIndexHOC.js | 48 +++++++++++++++++---- 2 files changed, 80 insertions(+), 14 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index bf9e98c79..8a1986cc8 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -357,15 +357,40 @@ class App extends Component { let url = "/setting.json"; axios.get(url).then((response) => { if(response){ - this.setState({ - getHelmetapi:response.data.setting - }); - document.title = response.data.setting.name; + if(response.data){ + this.setState({ + getHelmetapi:response.data.setting + }); + 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.nav_logo_url; + if (oldLink) { + document.head.removeChild(oldLink); + } + document.head.appendChild(link); + }else { + document.title = "EduCoder"; + 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); + } + + }else{ + document.title = "EduCoder"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; link.rel = 'shortcut icon'; - link.href = response.data.setting.nav_logo_url; + link.href = "/react/build/./favicon.ico"; if (oldLink) { document.head.removeChild(oldLink); } @@ -373,7 +398,16 @@ class App extends Component { } }).catch((error) => { - + document.title = "EduCoder"; + 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); }); }; diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 1646e2b87..f0dacf2be 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -285,17 +285,40 @@ export function TPMIndexHOC(WrappedComponent) { let url = "/setting.json"; axios.get(url).then((response) => { if(response){ - this.setState({ - mygetHelmetapi:response.data.setting, - }); - // console.log("获取当前定制信息"); - // console.log(response.data.setting); - document.title = response.data.setting.name; + if(response.data){ + this.setState({ + getHelmetapi:response.data.setting + }); + 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.nav_logo_url; + if (oldLink) { + document.head.removeChild(oldLink); + } + document.head.appendChild(link); + }else { + document.title = "EduCoder"; + 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); + } + + }else{ + document.title = "EduCoder"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; link.rel = 'shortcut icon'; - link.href = response.data.setting.nav_logo_url; + link.href = "/react/build/./favicon.ico"; if (oldLink) { document.head.removeChild(oldLink); } @@ -303,7 +326,16 @@ export function TPMIndexHOC(WrappedComponent) { } }).catch((error) => { - + document.title = "EduCoder"; + 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); }); }; /** From 7191fb89f8c602ca0ba407331f8f38d60250adbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 14 Oct 2019 15:49:33 +0800 Subject: [PATCH 04/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/login/EducoderLogin.js | 2 + public/react/src/modules/tpm/TPMIndexHOC.js | 13 ---- .../src/modules/user/LoginRegisterPage.js | 60 +++++++++---------- 3 files changed, 32 insertions(+), 43 deletions(-) diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index eed3a9add..8a85de374 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -138,6 +138,8 @@ class EducoderLogin extends Component { render() { let {showbool,loginstatus,logini} = this.state; + console.log("EducoderLogingetHelmetapi"); + console.log(this.props.getHelmetapi); return (
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index f0dacf2be..f83834a33 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -594,19 +594,6 @@ export function TPMIndexHOC(WrappedComponent) { hideGlobalLoading = () => { this.setState({ globalLoading: false }) } - getAppdata=()=>{ - let url = "/setting.json"; - axios.get(url).then((response) => { - if(response){ - this.setState({ - getHelmetapi:response.data.setting - }) - } - - }).catch((error) => { - - }); - }; render() { let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state; const common = { diff --git a/public/react/src/modules/user/LoginRegisterPage.js b/public/react/src/modules/user/LoginRegisterPage.js index 1990f118f..8990f1d78 100644 --- a/public/react/src/modules/user/LoginRegisterPage.js +++ b/public/react/src/modules/user/LoginRegisterPage.js @@ -1,30 +1,30 @@ -import React, { Component } from 'react'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import Loading from '../../Loading'; - -import Loadable from 'react-loadable'; - -// import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; - -import { SnackbarHOC, getImageUrl } from 'educoder'; -import LoginRegisterComponent from './LoginRegisterComponent'; -import FindPasswordComponent from './FindPasswordComponent'; - -class LoginRegisterPage extends Component { - render() { - // newMain clearfix - return ( -
- login - -

-

- -
- ); - } -} - -export default SnackbarHOC() ( ( LoginRegisterPage )); +import React, { Component } from 'react'; + +import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; + +import Loading from '../../Loading'; + +import Loadable from 'react-loadable'; + +// import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; + +import { SnackbarHOC, getImageUrl } from 'educoder'; +import LoginRegisterComponent from './LoginRegisterComponent'; +import FindPasswordComponent from './FindPasswordComponent'; + +class LoginRegisterPage extends Component { + render() { + // newMain clearfix + return ( +
+ + +

+

+ +
+ ); + } +} + +export default SnackbarHOC() ( ( LoginRegisterPage )); From 89782ffabde12b3d07db370305d86e275b5fe853 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 14 Oct 2019 16:04:24 +0800 Subject: [PATCH 05/43] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/competitions/index.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/competitions/competitions/index.json.jbuilder b/app/views/competitions/competitions/index.json.jbuilder index f0d70f69e..400f17379 100644 --- a/app/views/competitions/competitions/index.json.jbuilder +++ b/app/views/competitions/competitions/index.json.jbuilder @@ -20,7 +20,7 @@ json.competitions do if section json.current_stage do - json.name = section.competition_stage.name + json.name section.competition_stage.name json.start_time section.display_start_time json.end_time section.display_end_time end From d39b6071dc2042314cf86e677b21915209dc2e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 14 Oct 2019 16:07:47 +0800 Subject: [PATCH 06/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 26 ++++++++++++++++--- .../react/src/modules/login/EducoderLogin.js | 17 +++++++++--- public/react/src/modules/tpm/NewHeader.js | 11 +++++++- public/react/src/modules/tpm/TPMIndexHOC.js | 6 ++--- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 8a1986cc8..1c13dfa3d 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -366,7 +366,7 @@ class App extends Component { oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; link.rel = 'shortcut icon'; - link.href = response.data.setting.nav_logo_url; + link.href = response.data.setting.tab_logo_url; if (oldLink) { document.head.removeChild(oldLink); } @@ -463,10 +463,22 @@ class App extends Component { { + + return () + } + } /> { + + return () + } + } /> { + + return () + } + } /> @@ -151,7 +153,16 @@ class EducoderLogin extends Component { "width": "100%" }}>
- this.gohome()} src={educodernet}/> + { + this.props.getHelmetapi===undefined? + this.gohome()} src={educodernet}/> + : + this.props.getHelmetapi.login_logo_url===undefined? + this.gohome()} src={educodernet}/> + : + this.gohome()} src={getImageUrl(this.props.getHelmetapi.login_logo_url)}/> + } +
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index d5119245b..019726296 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -687,6 +687,8 @@ submittojoinclass=(value)=>{ activeIndex = true; } + console.log("NewHeader"); + console.log(this.props); return (
@@ -703,7 +705,14 @@ submittojoinclass=(value)=>{ {...this.state} />:""} - 高校智能化教学与实训平台 + { + this.props.getHelmetapi===undefined? + 高校智能化教学与实训平台 + :this.props.getHelmetapi.nav_logo_url===undefined? + 高校智能化教学与实训平台 + : + 高校智能化教学与实训平台 + } -
- {/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} - - - { - this.props.getHelmetapi===undefined||this.props.getHelmetapi.navbar===null||this.props.getHelmetapi.navbar===undefined||this.props.getHelmetapi.navbar.length===0? -
-
    - {/*
  • 首页
  • */} - - {/*
  • 实训路径
  • */} - - -
  • - 实践课程 -
  • - - {/*
  • 课堂
  • */} - -
  • - - {/*课堂*/} - - 翻转课堂 -
  • - -
  • - 实训项目 - - -
  • - -
  • 0 ? 'block' : 'none'}}> - 职业路径 -
    0 ? 'block' : 'none'}}> -
      - {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { - return( -
    • {item.name}
    • - ) - }) - } -
    -
    -
  • - - {/*
  • 教学案例
  • */} -
  • - 在线竞赛 - -
  • -
  • 教学案例
  • - {/*
  • */} - {/*众包创新*/} - {/*
  • */} -
  • 交流问答
  • -
  • 工程认证
  • -
-
- : -
-
    - {/*
  • 首页
  • */} - - {/*
  • 实训路径
  • */} - - {/*{*/} - {/* this.props.getHelmetapi.navbar && this.props.getHelmetapi.navbar.map((item,key)=>{*/} - - {/* return(*/} - - {/* )*/} - {/* })*/} - {/*}*/} -
  • - 实践课程 -
  • - - {/*
  • 课堂
  • */} + { + this.props.mygetHelmetapi!==undefined&&this.props.mygetHelmetapi.navbar!==null&&this.props.mygetHelmetapi.navbar!==undefined&&this.props.mygetHelmetapi.navbar.length>0? +
    +
      + {/*
    • 首页
    • */} + {/*
    • 实训路径
    • */} + { + this.props.mygetHelmetapi.navbar && this.props.mygetHelmetapi.navbar.map((item,key)=>{ + // console.log("headtypes"); + // console.log(headtypes); + return( +
    • + this.headtypesonClick(item.link,true)}>{item.name} +
    • + ) + }) + } + {/*
    • */} + {/* 实践课程*/} + {/*
    • */} + + {/*
    • 课堂
    • */} + {/*
    • */} + {/* /!*课堂*!/*/} + {/* 翻转课堂*/} + {/*
    • */} + + {/*
    • */} + {/* 实训项目*/} + {/* */} + {/* */} + {/*
    • */} + + + {/*
    • 教学案例
    • */} + {/*
    • */} + {/* 在线竞赛*/} + {/* */} + {/*
    • */} + {/*
    • 教学案例
    • */} + {/*
    • */} + {/*众包创新*/} + {/*
    • */} + {/*
    • 交流问答
    • */} + {/*工程认证*/} + + + + +
    • 0 ? 'block' : 'none'}}> + 职业路径 +
      0 ? 'block' : 'none'}}> +
        + {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { + return( +
      • {item.name}
      • + ) + }) + } +
      +
      +
    • +
    +
    + :this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.navbar===null||this.props.mygetHelmetapi.navbar===undefined||this.props.mygetHelmetapi.navbar.length===0? +
    + +
      + {/*
    • 首页
    • */} + + {/*
    • 实训路径
    • */} +
    • + 实践课程 +
    • -
    • + {/*
    • 课堂
    • */} +
    • + {/*课堂*/} + 翻转课堂 +
    • - {/*课堂*/} +
    • + 实训项目 + {/**/} + {/**/} +
    • - 翻转课堂 - +
    • 0 ? 'block' : 'none'}}> + 职业路径 +
      0 ? 'block' : 'none'}}> +
        + {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { + return( +
      • {item.name}
      • + ) + }) + } +
      +
      +
    • -
    • - 实训项目 - - -
    • - {/*
    • 教学案例
    • */} -
    • - 在线竞赛 - -
    • -
    • 教学案例
    • - {/*
    • */} - {/*众包创新*/} - {/*
    • */} -
    • 交流问答
    • -
    • 工程认证
    • - - - - -
    • 0 ? 'block' : 'none'}}> - 职业路径 -
      0 ? 'block' : 'none'}}> -
        - {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { - return( -
      • {item.name}
      • - ) - }) - } -
      -
      -
    • + {/*
    • 教学案例
    • */} +
    • + 在线竞赛 + {/**/} +
    • +
    • 教学案例
    • + {/*
    • */} + {/*众包创新*/} + {/*
    • */} +
    • 交流问答
    • +
    • 工程认证
    • +
    +
    + : +
    + +
      + {/*
    • 首页
    • */} + + {/*
    • 实训路径
    • */} +
    • + 实践课程 +
    • + + {/*
    • 课堂
    • */} +
    • + {/*课堂*/} + 翻转课堂 +
    • + +
    • + 实训项目 + {/**/} + {/**/} +
    • + +
    • 0 ? 'block' : 'none'}}> + 职业路径 +
      0 ? 'block' : 'none'}}> +
        + {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { + return( +
      • {item.name}
      • + ) + }) + } +
      +
      +
    • + + {/*
    • 教学案例
    • */} +
    • + 在线竞赛 + {/**/} +
    • +
    • 教学案例
    • + {/*
    • */} + {/*众包创新*/} + {/*
    • */} +
    • 交流问答
    • +
    • 工程认证
    • +
    +
    + } -
-
- } -
{ - this.props.mygetHelmetapi!==undefined&&this.props.mygetHelmetapi.navbar!==null&&this.props.mygetHelmetapi.navbar!==undefined&&this.props.mygetHelmetapi.navbar.length>0? + mygetHelmetapi2!==undefined&&mygetHelmetapi2.navbar!==null&&mygetHelmetapi2.navbar!==undefined&&mygetHelmetapi2.navbar.length>0?
    {/*
  • 首页
  • */} {/*
  • 实训路径
  • */} { - this.props.mygetHelmetapi.navbar && this.props.mygetHelmetapi.navbar.map((item,key)=>{ + mygetHelmetapi2.navbar && mygetHelmetapi2.navbar.map((item,key)=>{ // console.log("headtypes"); // console.log(headtypes); return( -
  • - this.headtypesonClick(item.link,true)}>{item.name} +
  • this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`}> + {item.name}
  • ) }) @@ -876,65 +966,65 @@ submittojoinclass=(value)=>{
- :this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.navbar===null||this.props.mygetHelmetapi.navbar===undefined||this.props.mygetHelmetapi.navbar.length===0? -
- -
    - {/*
  • 首页
  • */} - - {/*
  • 实训路径
  • */} -
  • - 实践课程 -
  • - - {/*
  • 课堂
  • */} -
  • - {/*课堂*/} - 翻转课堂 -
  • - -
  • - 实训项目 - {/**/} - {/**/} -
  • - -
  • 0 ? 'block' : 'none'}}> - 职业路径 -
    0 ? 'block' : 'none'}}> -
      - {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { - return( -
    • {item.name}
    • - ) - }) - } -
    -
    -
  • - - {/*
  • 教学案例
  • */} -
  • - 在线竞赛 - {/**/} -
  • -
  • 教学案例
  • - {/*
  • */} - {/*众包创新*/} - {/*
  • */} -
  • 交流问答
  • -
  • 工程认证
  • -
-
+ // :mygetHelmetapi2===undefined||mygetHelmetapi2.navbar===null||mygetHelmetapi2.navbar===undefined||mygetHelmetapi2.navbar.length===0? + //
+ // + //
    + // {/*
  • 首页
  • */} + // + // {/*
  • 实训路径
  • */} + //
  • + // 实践课程 + //
  • + // + // {/*
  • 课堂
  • */} + //
  • + // {/*课堂*/} + // 翻转课堂 + //
  • + // + //
  • + // 实训项目 + // {/**/} + // {/**/} + //
  • + // + //
  • 0 ? 'block' : 'none'}}> + // 职业路径 + //
    0 ? 'block' : 'none'}}> + //
      + // {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { + // return( + //
    • {item.name}
    • + // ) + // }) + // } + //
    + //
    + //
  • + // + // {/*
  • 教学案例
  • */} + //
  • + // 在线竞赛 + // {/**/} + //
  • + //
  • 教学案例
  • + // {/*
  • */} + // {/*众包创新*/} + // {/*
  • */} + //
  • 交流问答
  • + //
  • 工程认证
  • + //
+ //
:
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 31bbba3ec..dc76b67d1 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -148,8 +148,8 @@ export function TPMIndexHOC(WrappedComponent) { } componentDidMount() { - console.log("TPMIndexHOC========"); - console.log(this.props); + // console.log("TPMIndexHOC========"); + // console.log(this.props); window.addEventListener('keyup', this.keyupListener) if(this.props.match.path==="/"){ From c6222714946b0cb214ca2910cdd096c64ef5350a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 09:10:25 +0800 Subject: [PATCH 10/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 844610e54..f77a831fb 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -876,9 +876,9 @@ submittojoinclass=(value)=>{ this.headtypesonClick("/",false)} className={"fl mr30 ml25 mt10"}> { mygetHelmetapi2===undefined||mygetHelmetapi2.nav_logo_url===null||mygetHelmetapi2.nav_logo_url===undefined? - 高校智能化教学与实训平台 + 高校智能化教学与实训平台 : - 高校智能化教学与实训平台 + 高校智能化教学与实训平台 } From 5169a3682cb73817dd4cde1218d93ce326ef7b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 09:13:15 +0800 Subject: [PATCH 11/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index af00842f2..7867791cf 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -94,10 +94,10 @@ export function initAxiosInterceptors(props) { } } - if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 - console.log("被阻止了是重复请求================================="); - return false; - } + // if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 + // console.log("被阻止了是重复请求================================="); + // return false; + // } // 非file_update请求 if (config.url.indexOf('update_file') === -1) { requestMap[config.url] = true; From 5537c1e622bff6b5f299bb9743a790fdc822cfd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 09:15:39 +0800 Subject: [PATCH 12/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 2 +- public/react/src/modules/tpm/NewHeader.js | 6 +++--- public/react/src/modules/tpm/TPMIndexHOC.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index d3a753617..c771021bf 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -378,7 +378,7 @@ class App extends Component { oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; link.rel = 'shortcut icon'; - link.href = response.data.setting.tab_logo_url; + link.href = '/'+response.data.setting.tab_logo_url; if (oldLink) { document.head.removeChild(oldLink); } diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index f77a831fb..cb0e571cd 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -657,8 +657,8 @@ submittojoinclass=(value)=>{ console.log("开始刷新数据了") let url = "/setting.json"; axios.get(url).then((response) => { - console.log("axios.get"); - console.log(response); + // console.log("axios.get"); + // console.log(response); if(response){ if(response.data){ @@ -670,7 +670,7 @@ submittojoinclass=(value)=>{ oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; link.rel = 'shortcut icon'; - link.href = response.data.setting.tab_logo_url; + link.href = '/'+response.data.setting.tab_logo_url; if (oldLink) { document.head.removeChild(oldLink); } diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index dc76b67d1..18caee33c 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -294,7 +294,7 @@ export function TPMIndexHOC(WrappedComponent) { oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; link.rel = 'shortcut icon'; - link.href = response.data.setting.tab_logo_url; + link.href = '/'+response.data.setting.tab_logo_url; if (oldLink) { document.head.removeChild(oldLink); } From 5a9b1645217f051a23a9432d537336d4db4bc75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 10:00:42 +0800 Subject: [PATCH 13/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 20 ++++++++++---------- public/react/src/modules/tpm/TPMIndexHOC.js | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index cb0e571cd..a7391509a 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -76,8 +76,8 @@ class NewHeader extends Component { // console.log(this.props); } componentDidUpdate = (prevProps) => { - console.log("componentDidMount2"); - console.log(this.state.mygetHelmetapi2); + // console.log("componentDidMount2"); + // console.log(this.state.mygetHelmetapi2); if(this.state.mygetHelmetapi2===undefined){ this.getAppdata(); } @@ -771,14 +771,14 @@ submittojoinclass=(value)=>{ let headtypes='/'; - console.log("mygetHelmetapi2"); - console.log(mygetHelmetapi2); + // console.log("mygetHelmetapi2"); + // console.log(mygetHelmetapi2); if(mygetHelmetapi2){ if(mygetHelmetapi2.navbar){ if(mygetHelmetapi2.navbar.length>0){ - console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-="); - - console.log(match.path); + // console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-="); + // + // console.log(match.path); if(match.path==='/'){ if(headtypesonClickbool===false){ headtypes=undefined; @@ -855,9 +855,9 @@ submittojoinclass=(value)=>{ // console.log("NewHeadergetHelmetapi432423423423"); // console.log(mygetHelmetapi2); - console.log("NewHeadermygetHelmetapi123123123123"); - console.log(mygetHelmetapi2); - console.log(this.props); + // console.log("NewHeadermygetHelmetapi123123123123"); + // console.log(mygetHelmetapi2); + // console.log(this.props); return (
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 18caee33c..3cfba64f6 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -201,6 +201,8 @@ export function TPMIndexHOC(WrappedComponent) { axios.get(url, { }).then((response) => { + console.log("开始请求/get_navigation_info.json"); + console.log(response); if(response!=undefined){ if(response.status===200){ this.setState({ From f35bc5f18d06478b2d66247816067d1e9347bcff Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 15 Oct 2019 10:20:30 +0800 Subject: [PATCH 14/43] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/competition_mode_setting.rb | 3 +++ .../20191015013924_add_new_column_to_competitions.rb | 6 ++++++ ...20191015015723_create_competition_mode_settings.rb | 11 +++++++++++ spec/models/competition_mode_setting_spec.rb | 5 +++++ 4 files changed, 25 insertions(+) create mode 100644 app/models/competition_mode_setting.rb create mode 100644 db/migrate/20191015013924_add_new_column_to_competitions.rb create mode 100644 db/migrate/20191015015723_create_competition_mode_settings.rb create mode 100644 spec/models/competition_mode_setting_spec.rb diff --git a/app/models/competition_mode_setting.rb b/app/models/competition_mode_setting.rb new file mode 100644 index 000000000..b6bafa7c3 --- /dev/null +++ b/app/models/competition_mode_setting.rb @@ -0,0 +1,3 @@ +class CompetitionModeSetting < ApplicationRecord + belongs_to :course +end diff --git a/db/migrate/20191015013924_add_new_column_to_competitions.rb b/db/migrate/20191015013924_add_new_column_to_competitions.rb new file mode 100644 index 000000000..616a46059 --- /dev/null +++ b/db/migrate/20191015013924_add_new_column_to_competitions.rb @@ -0,0 +1,6 @@ +class AddNewColumnToCompetitions < ActiveRecord::Migration[5.2] + def change + add_column :competitions, :bonus, :integer, default: 0 + add_column :competitions, :mode, :integer, default: 0 + end +end diff --git a/db/migrate/20191015015723_create_competition_mode_settings.rb b/db/migrate/20191015015723_create_competition_mode_settings.rb new file mode 100644 index 000000000..5d170eeab --- /dev/null +++ b/db/migrate/20191015015723_create_competition_mode_settings.rb @@ -0,0 +1,11 @@ +class CreateCompetitionModeSettings < ActiveRecord::Migration[5.2] + def change + create_table :competition_mode_settings do |t| + t.references :course + t.datetime :start_time + t.datetime :end_time + + t.timestamps + end + end +end diff --git a/spec/models/competition_mode_setting_spec.rb b/spec/models/competition_mode_setting_spec.rb new file mode 100644 index 000000000..535767880 --- /dev/null +++ b/spec/models/competition_mode_setting_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CompetitionModeSetting, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 1ac84425e294b1b78280f9f6e6356940278cda89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 10:36:37 +0800 Subject: [PATCH 15/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 3 + .../react/src/modules/forums/MemoTechShare.js | 232 +++++++++--------- .../react/src/modules/login/EducoderLogin.js | 7 +- public/react/src/modules/tpm/TPMIndexHOC.js | 15 +- 4 files changed, 133 insertions(+), 124 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 7867791cf..0510cd293 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -95,6 +95,9 @@ export function initAxiosInterceptors(props) { } // if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 + // console.log(config); + // console.log(JSON.parse(config)); + // console.log(config.url); // console.log("被阻止了是重复请求================================="); // return false; // } diff --git a/public/react/src/modules/forums/MemoTechShare.js b/public/react/src/modules/forums/MemoTechShare.js index de6ba074c..d32bd2e2f 100644 --- a/public/react/src/modules/forums/MemoTechShare.js +++ b/public/react/src/modules/forums/MemoTechShare.js @@ -1,116 +1,116 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames' - -import Pagination from 'rc-pagination'; - -import { postPaginationHOC } from './PostPaginationHOC' - -import PostItem from './PostItem' - -import ForumsNavTab from './ForumsNavTab' - -// import queryString from 'query-string' -import { queryString } from 'educoder' - -import MemoList from './MemoList' - - -class MemoTechShare extends Component { - constructor(props) { - super(props) - - this.handleLocationChange = this.handleLocationChange.bind(this); - - this.state = { - - } - } - - onPaginationChange(pageNum, pageSize) { - this.props.onPaginationChange(pageNum, pageSize) - } - - componentDidMount() { - // this.handleLocationChange(this.props.history.location); - // this.unlisten = this.props.history.listen(this.handleLocationChange); - } - - componentWillUnmount() { - // this.unlisten(); - } - componentDidUpdate(prevProps) { - if(this.props.match.params.memoType !== prevProps.match.params.memoType) { - // do something - console.log(`memoType changed`) - this.props.fetchMemos(); - } - } - - componentWillReceiveProps(newProps, newContext) { - if (newProps.match.url === this.props.match.url) { - const oldParsed = queryString.parse(this.props.location.search); - const newParsed = queryString.parse(newProps.location.search); - if (!newParsed.page && oldParsed.page || - (oldParsed.order && newParsed.order && oldParsed.order != newParsed.order)) { - this.props.fetchMemos(); - } - console.log('componentWillReceiveProps...') - } - } - - handleLocationChange(location) { - console.log(`- - - location: '${location.pathname}'`); - if (location.pathname) { - if (location.pathname.indexOf('/forums/categories/all') != -1 - && this.props.location.search && this.props.location.search.indexOf('order=') != -1 - && location.search.indexOf('order=') != -1) { - const oldParsed = queryString.parse(this.props.location.search); - const newParsed = queryString.parse(location.search); - if (oldParsed.order != newParsed.order) { // 只有在热门和最新间跳转时,才需要处理 - this.props.fetchMemos(); - } - } - } - } - - renderMemoList() { - - - // const { memo_list, user } = this.props; - // if (!memo_list) { - // return '' - // } - // return memo_list.map( (item, index) => { - - // return ( - // this.setTop(memo)} - // setDown={(memo)=>this.setDown(memo)} memo={item} - // > - // ) - // }) - return this.props.renderMemoList(); - } - - render() { - const { match, history, currentPage, memo_count ,memo_list } = this.props - - return ( - - - this.renderMemoList()} - onPaginationChange={ (pageNum, pageSize) => this.props.onPaginationChange(pageNum, pageSize) } - > - - - ); - } -} - -export default postPaginationHOC() ( MemoTechShare ); +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; + +import PropTypes from 'prop-types'; + +import classNames from 'classnames' + +import Pagination from 'rc-pagination'; + +import { postPaginationHOC } from './PostPaginationHOC' + +import PostItem from './PostItem' + +import ForumsNavTab from './ForumsNavTab' + +// import queryString from 'query-string' +import { queryString } from 'educoder' + +import MemoList from './MemoList' + + +class MemoTechShare extends Component { + constructor(props) { + super(props) + + this.handleLocationChange = this.handleLocationChange.bind(this); + + this.state = { + + } + } + + onPaginationChange(pageNum, pageSize) { + this.props.onPaginationChange(pageNum, pageSize) + } + + componentDidMount() { + // this.handleLocationChange(this.props.history.location); + // this.unlisten = this.props.history.listen(this.handleLocationChange); + } + + componentWillUnmount() { + // this.unlisten(); + } + componentDidUpdate(prevProps) { + if(this.props.match.params.memoType !== prevProps.match.params.memoType) { + // do something + console.log(`memoType changed`) + this.props.fetchMemos(); + } + } + + componentWillReceiveProps(newProps, newContext) { + if (newProps.match.url === this.props.match.url) { + const oldParsed = queryString.parse(this.props.location.search); + const newParsed = queryString.parse(newProps.location.search); + if (!newParsed.page && oldParsed.page || + (oldParsed.order && newParsed.order && oldParsed.order != newParsed.order)) { + this.props.fetchMemos(); + } + // console.log('componentWillReceiveProps...') + } + } + + handleLocationChange(location) { + console.log(`- - - location: '${location.pathname}'`); + if (location.pathname) { + if (location.pathname.indexOf('/forums/categories/all') != -1 + && this.props.location.search && this.props.location.search.indexOf('order=') != -1 + && location.search.indexOf('order=') != -1) { + const oldParsed = queryString.parse(this.props.location.search); + const newParsed = queryString.parse(location.search); + if (oldParsed.order != newParsed.order) { // 只有在热门和最新间跳转时,才需要处理 + this.props.fetchMemos(); + } + } + } + } + + renderMemoList() { + + + // const { memo_list, user } = this.props; + // if (!memo_list) { + // return '' + // } + // return memo_list.map( (item, index) => { + + // return ( + // this.setTop(memo)} + // setDown={(memo)=>this.setDown(memo)} memo={item} + // > + // ) + // }) + return this.props.renderMemoList(); + } + + render() { + const { match, history, currentPage, memo_count ,memo_list } = this.props + + return ( + + + this.renderMemoList()} + onPaginationChange={ (pageNum, pageSize) => this.props.onPaginationChange(pageNum, pageSize) } + > + + + ); + } +} + +export default postPaginationHOC() ( MemoTechShare ); diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 393c1cf3c..c7a5a0cbf 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -28,6 +28,7 @@ import educodernet from '../../../src/images/login/educodernet.png'; import LoginRegisterComponent from '../user/LoginRegisterComponent'; import FindPasswordComponent from '../user/FindPasswordComponent'; import passopen from "../../images/login/passopen.png"; +import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; //educoder登入页面 var sectionStyle = { "height": "100%", @@ -109,7 +110,8 @@ class EducoderLogin extends Component { } componentDidMount() { - + console.log("EducoderLogin"); + console.log(this.props); } Setlogins=(i)=>{ @@ -206,8 +208,7 @@ class EducoderLogin extends Component { } } - -export default EducoderLogin; +export default SnackbarHOC() (TPMIndexHOC ( EducoderLogin )); // showbool === 2 ? //
{ let url = "/setting.json"; - axios.get(url).then((response) => { - if(response){ - if(response.data){ + axios.get(url,{ + + }).then((response) => { + console.log("开始请求/setting.json"); + console.log("获取当前定制信息"); + console.log(response); + if(response!=undefined){ + if(response.status===200){ this.setState({ mygetHelmetapi:response.data.setting }); @@ -301,7 +306,7 @@ export function TPMIndexHOC(WrappedComponent) { document.head.removeChild(oldLink); } document.head.appendChild(link); - }else { + }else{ document.title = "EduCoder"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); @@ -313,7 +318,6 @@ export function TPMIndexHOC(WrappedComponent) { } document.head.appendChild(link); } - }else{ document.title = "EduCoder"; var link = document.createElement('link'), @@ -328,6 +332,7 @@ export function TPMIndexHOC(WrappedComponent) { } }).catch((error) => { + console.log(error); document.title = "EduCoder"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); From 5642586feb6048d0c5a8bbc6af14bb203c1364ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 11:13:01 +0800 Subject: [PATCH 16/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 6 +- public/react/src/AppConfig.js | 14 +- .../react/src/modules/login/EducoderLogin.js | 6 +- public/react/src/modules/tpm/NewHeader.js | 138 +++++++++--------- public/react/src/modules/tpm/TPMIndexHOC.js | 6 +- 5 files changed, 87 insertions(+), 83 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index c771021bf..6aa615c3b 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -337,7 +337,7 @@ class App extends Component { }); initAxiosInterceptors(this.props); - this.getAppdata(); + // this.getAppdata(); // // axios.interceptors.response.use((response) => { // // console.log("response"+response); @@ -368,6 +368,8 @@ class App extends Component { getAppdata=()=>{ let url = "/setting.json"; axios.get(url).then((response) => { + console.log("app.js开始请求/setting.json"); + console.log("获取当前定制信息"); if(response){ if(response.data){ this.setState({ @@ -710,4 +712,4 @@ moment.defineLocale('zh-cn', { doy: 4 // The week that contains Jan 4th is the first week of the year. } }); -export default SnackbarHOC()(App); \ No newline at end of file +export default SnackbarHOC()(App) ; \ No newline at end of file diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 0510cd293..aa986d867 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -94,13 +94,13 @@ export function initAxiosInterceptors(props) { } } - // if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 - // console.log(config); - // console.log(JSON.parse(config)); - // console.log(config.url); - // console.log("被阻止了是重复请求================================="); - // return false; - // } + if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 + console.log(config); + console.log(JSON.parse(config)); + console.log(config.url); + console.log("被阻止了是重复请求================================="); + return false; + } // 非file_update请求 if (config.url.indexOf('update_file') === -1) { requestMap[config.url] = true; diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index c7a5a0cbf..4e35eb7e3 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -20,6 +20,7 @@ import { } from "antd"; import {Link, Switch, Route, Redirect} from 'react-router-dom'; import { SnackbarHOC,getImageUrl } from 'educoder'; +import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; import '../courses/css/members.css'; import "../courses/common/formCommon.css" import '../courses/css/Courses.css'; @@ -28,7 +29,6 @@ import educodernet from '../../../src/images/login/educodernet.png'; import LoginRegisterComponent from '../user/LoginRegisterComponent'; import FindPasswordComponent from '../user/FindPasswordComponent'; import passopen from "../../images/login/passopen.png"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; //educoder登入页面 var sectionStyle = { "height": "100%", @@ -208,7 +208,9 @@ class EducoderLogin extends Component { } } -export default SnackbarHOC() (TPMIndexHOC ( EducoderLogin )); +// export default EducoderLogin ; +export default TPMIndexHOC ( EducoderLogin ); +// SnackbarHOC() (TPMIndexHOC ( EducoderLogin )); // showbool === 2 ? //
{ // console.log("componentDidMount2"); - // console.log(this.state.mygetHelmetapi2); - if(this.state.mygetHelmetapi2===undefined){ - this.getAppdata(); - } + // console.log(this.props.mygetHelmetapi); + // if(this.props.mygetHelmetapi===undefined){ + // this.getAppdata(); + // } } componentDidMount() { console.log("componentDidMount1"); - this.getAppdata(); + // this.getAppdata(); window._header_componentHandler = this; //下拉框的显示隐藏 @@ -653,70 +653,70 @@ submittojoinclass=(value)=>{ headtypesonClickbool:bool, }) } - getAppdata=()=>{ - console.log("开始刷新数据了") - let url = "/setting.json"; - axios.get(url).then((response) => { - // console.log("axios.get"); - // console.log(response); - - if(response){ - if(response.data){ - this.setState({ - mygetHelmetapi2:response.data.setting - }); - 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); - }else { - document.title = "EduCoder"; - 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); - } - - }else{ - document.title = "EduCoder"; - 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); - } - - }).catch((error) => { - console.log("开始刷新数据了但报错了"); - console.log(error); - - document.title = "EduCoder"; - 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); - }); - }; + // getAppdata=()=>{ + // console.log("开始刷新数据了") + // let url = "/setting.json"; + // axios.get(url).then((response) => { + // // console.log("axios.get"); + // // console.log(response); + // + // if(response){ + // if(response.data){ + // this.setState({ + // mygetHelmetapi2:response.data.setting + // }); + // 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); + // }else { + // document.title = "EduCoder"; + // 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); + // } + // + // }else{ + // document.title = "EduCoder"; + // 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); + // } + // + // }).catch((error) => { + // console.log("开始刷新数据了但报错了"); + // console.log(error); + // + // document.title = "EduCoder"; + // 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); + // }); + // }; render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 const {match,} = this.props; diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index ba94bbcc3..598ef4892 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -148,8 +148,8 @@ export function TPMIndexHOC(WrappedComponent) { } componentDidMount() { - // console.log("TPMIndexHOC========"); - // console.log(this.props); + console.log("TPMIndexHOC========"); + console.log(this.props); window.addEventListener('keyup', this.keyupListener) if(this.props.match.path==="/"){ @@ -212,7 +212,7 @@ export function TPMIndexHOC(WrappedComponent) { } } }); - this.getAppdata(); + this.getAppdata(); } /** 课堂权限相关方法,暂时写这里了 ----------------------------------------START From 0667d239b395b7f11071f0294f49f63a6b177f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 11:16:14 +0800 Subject: [PATCH 17/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 16 +-- .../react/src/modules/login/EducoderLogin.js | 4 +- public/react/src/modules/tpm/NewHeader.js | 100 +++--------------- 3 files changed, 26 insertions(+), 94 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index aa986d867..cddea79a6 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -93,14 +93,14 @@ export function initAxiosInterceptors(props) { config.url = url; } } - - if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 - console.log(config); - console.log(JSON.parse(config)); - console.log(config.url); - console.log("被阻止了是重复请求================================="); - return false; - } + // + // if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 显示这个方法会影响到定制信息 + // console.log(config); + // console.log(JSON.parse(config)); + // console.log(config.url); + // console.log("被阻止了是重复请求================================="); + // return false; + // } // 非file_update请求 if (config.url.indexOf('update_file') === -1) { requestMap[config.url] = true; diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 4e35eb7e3..617dc2d8a 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -208,9 +208,7 @@ class EducoderLogin extends Component { } } -// export default EducoderLogin ; -export default TPMIndexHOC ( EducoderLogin ); -// SnackbarHOC() (TPMIndexHOC ( EducoderLogin )); +export default EducoderLogin ; // showbool === 2 ? //
{ headtypesonClickbool:bool, }) } - // getAppdata=()=>{ - // console.log("开始刷新数据了") - // let url = "/setting.json"; - // axios.get(url).then((response) => { - // // console.log("axios.get"); - // // console.log(response); - // - // if(response){ - // if(response.data){ - // this.setState({ - // mygetHelmetapi2:response.data.setting - // }); - // 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); - // }else { - // document.title = "EduCoder"; - // 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); - // } - // - // }else{ - // document.title = "EduCoder"; - // 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); - // } - // - // }).catch((error) => { - // console.log("开始刷新数据了但报错了"); - // console.log(error); - // - // document.title = "EduCoder"; - // 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); - // }); - // }; render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 const {match,} = this.props; @@ -739,7 +674,6 @@ submittojoinclass=(value)=>{ showSearchOpentype, headtypesonClickbool, headtypess, - mygetHelmetapi2, }=this.state; /* 用户名称 用户头像url @@ -771,12 +705,12 @@ submittojoinclass=(value)=>{ let headtypes='/'; - // console.log("mygetHelmetapi2"); - // console.log(mygetHelmetapi2); - if(mygetHelmetapi2){ - if(mygetHelmetapi2.navbar){ - if(mygetHelmetapi2.navbar.length>0){ - // console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-="); + // console.log("this.props.mygetHelmetapi"); + // console.log(this.props.mygetHelmetapi); + if(this.props.mygetHelmetapi){ + if(this.props.mygetHelmetapi.navbar){ + if(this.props.mygetHelmetapi.navbar.length>0){ + // console.log("this.props.mygetHelmetapi.navbar.length>0====-=-=--=-=-=-="); // // console.log(match.path); if(match.path==='/'){ @@ -787,9 +721,9 @@ submittojoinclass=(value)=>{ } }else { - for(var i=0;i{ } // console.log("NewHeadergetHelmetapi432423423423"); - // console.log(mygetHelmetapi2); + // console.log(this.props.mygetHelmetapi); // console.log("NewHeadermygetHelmetapi123123123123"); - // console.log(mygetHelmetapi2); + // console.log(this.props.mygetHelmetapi); // console.log(this.props); return ( @@ -875,10 +809,10 @@ submittojoinclass=(value)=>{ />:""} this.headtypesonClick("/",false)} className={"fl mr30 ml25 mt10"}> { - mygetHelmetapi2===undefined||mygetHelmetapi2.nav_logo_url===null||mygetHelmetapi2.nav_logo_url===undefined? + this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.nav_logo_url===null||this.props.mygetHelmetapi.nav_logo_url===undefined? 高校智能化教学与实训平台 : - 高校智能化教学与实训平台 + 高校智能化教学与实训平台 } @@ -894,13 +828,13 @@ submittojoinclass=(value)=>{ } { - mygetHelmetapi2!==undefined&&mygetHelmetapi2.navbar!==null&&mygetHelmetapi2.navbar!==undefined&&mygetHelmetapi2.navbar.length>0? + this.props.mygetHelmetapi!==undefined&&this.props.mygetHelmetapi.navbar!==null&&this.props.mygetHelmetapi.navbar!==undefined&&this.props.mygetHelmetapi.navbar.length>0?
    {/*
  • 首页
  • */} {/*
  • 实训路径
  • */} { - mygetHelmetapi2.navbar && mygetHelmetapi2.navbar.map((item,key)=>{ + this.props.mygetHelmetapi.navbar && this.props.mygetHelmetapi.navbar.map((item,key)=>{ // console.log("headtypes"); // console.log(headtypes); return( @@ -966,7 +900,7 @@ submittojoinclass=(value)=>{
- // :mygetHelmetapi2===undefined||mygetHelmetapi2.navbar===null||mygetHelmetapi2.navbar===undefined||mygetHelmetapi2.navbar.length===0? + // :this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.navbar===null||this.props.mygetHelmetapi.navbar===undefined||this.props.mygetHelmetapi.navbar.length===0? //
// //
    From 775b33ad4b5739d3bed06685b8957182504cf7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 11:24:05 +0800 Subject: [PATCH 18/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 2 +- .../react/src/modules/login/EducoderLogin.js | 8 +- public/react/src/modules/tpm/NewHeader.js | 106 ++++++++++++++---- 3 files changed, 91 insertions(+), 25 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 6aa615c3b..c1cba8a2d 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -337,7 +337,7 @@ class App extends Component { }); initAxiosInterceptors(this.props); - // this.getAppdata(); + this.getAppdata(); // // axios.interceptors.response.use((response) => { // // console.log("response"+response); diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 617dc2d8a..680c4bbc7 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -110,8 +110,8 @@ class EducoderLogin extends Component { } componentDidMount() { - console.log("EducoderLogin"); - console.log(this.props); + // console.log("EducoderLogin"); + // console.log(this.props); } Setlogins=(i)=>{ @@ -140,8 +140,8 @@ class EducoderLogin extends Component { render() { let {showbool,loginstatus,logini} = this.state; - // console.log("EducoderLogingetHelmetapi"); - // console.log(this.props); + console.log("EducoderLogingetHelmetapi"); + console.log(this.props); // console.log(this.props.mygetHelmetapi); return (
    diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 26e7ede7a..a7391509a 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -68,6 +68,7 @@ class NewHeader extends Component { mydisplay:false, headtypesonClickbool:false, headtypess:"/", + mygetHelmetapi2:undefined, } console.log("176") // console.log(props); @@ -76,10 +77,10 @@ class NewHeader extends Component { } componentDidUpdate = (prevProps) => { // console.log("componentDidMount2"); - // console.log(this.props.mygetHelmetapi); - // if(this.props.mygetHelmetapi===undefined){ - // this.getAppdata(); - // } + // console.log(this.state.mygetHelmetapi2); + if(this.state.mygetHelmetapi2===undefined){ + this.getAppdata(); + } } componentDidMount() { console.log("componentDidMount1"); @@ -652,6 +653,70 @@ submittojoinclass=(value)=>{ headtypesonClickbool:bool, }) } + getAppdata=()=>{ + console.log("开始刷新数据了") + let url = "/setting.json"; + axios.get(url).then((response) => { + // console.log("axios.get"); + // console.log(response); + + if(response){ + if(response.data){ + this.setState({ + mygetHelmetapi2:response.data.setting + }); + 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); + }else { + document.title = "EduCoder"; + 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); + } + + }else{ + document.title = "EduCoder"; + 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); + } + + }).catch((error) => { + console.log("开始刷新数据了但报错了"); + console.log(error); + + document.title = "EduCoder"; + 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); + }); + }; render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 const {match,} = this.props; @@ -674,6 +739,7 @@ submittojoinclass=(value)=>{ showSearchOpentype, headtypesonClickbool, headtypess, + mygetHelmetapi2, }=this.state; /* 用户名称 用户头像url @@ -705,12 +771,12 @@ submittojoinclass=(value)=>{ let headtypes='/'; - // console.log("this.props.mygetHelmetapi"); - // console.log(this.props.mygetHelmetapi); - if(this.props.mygetHelmetapi){ - if(this.props.mygetHelmetapi.navbar){ - if(this.props.mygetHelmetapi.navbar.length>0){ - // console.log("this.props.mygetHelmetapi.navbar.length>0====-=-=--=-=-=-="); + // console.log("mygetHelmetapi2"); + // console.log(mygetHelmetapi2); + if(mygetHelmetapi2){ + if(mygetHelmetapi2.navbar){ + if(mygetHelmetapi2.navbar.length>0){ + // console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-="); // // console.log(match.path); if(match.path==='/'){ @@ -721,9 +787,9 @@ submittojoinclass=(value)=>{ } }else { - for(var i=0;i{ } // console.log("NewHeadergetHelmetapi432423423423"); - // console.log(this.props.mygetHelmetapi); + // console.log(mygetHelmetapi2); // console.log("NewHeadermygetHelmetapi123123123123"); - // console.log(this.props.mygetHelmetapi); + // console.log(mygetHelmetapi2); // console.log(this.props); return ( @@ -809,10 +875,10 @@ submittojoinclass=(value)=>{ />:""} this.headtypesonClick("/",false)} className={"fl mr30 ml25 mt10"}> { - this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.nav_logo_url===null||this.props.mygetHelmetapi.nav_logo_url===undefined? + mygetHelmetapi2===undefined||mygetHelmetapi2.nav_logo_url===null||mygetHelmetapi2.nav_logo_url===undefined? 高校智能化教学与实训平台 : - 高校智能化教学与实训平台 + 高校智能化教学与实训平台 } @@ -828,13 +894,13 @@ submittojoinclass=(value)=>{ } { - this.props.mygetHelmetapi!==undefined&&this.props.mygetHelmetapi.navbar!==null&&this.props.mygetHelmetapi.navbar!==undefined&&this.props.mygetHelmetapi.navbar.length>0? + mygetHelmetapi2!==undefined&&mygetHelmetapi2.navbar!==null&&mygetHelmetapi2.navbar!==undefined&&mygetHelmetapi2.navbar.length>0?
      {/*
    • 首页
    • */} {/*
    • 实训路径
    • */} { - this.props.mygetHelmetapi.navbar && this.props.mygetHelmetapi.navbar.map((item,key)=>{ + mygetHelmetapi2.navbar && mygetHelmetapi2.navbar.map((item,key)=>{ // console.log("headtypes"); // console.log(headtypes); return( @@ -900,7 +966,7 @@ submittojoinclass=(value)=>{
    - // :this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.navbar===null||this.props.mygetHelmetapi.navbar===undefined||this.props.mygetHelmetapi.navbar.length===0? + // :mygetHelmetapi2===undefined||mygetHelmetapi2.navbar===null||mygetHelmetapi2.navbar===undefined||mygetHelmetapi2.navbar.length===0? //
    // //
      From 38670e7e003e0ca0398a7bb5400b9ddaca4932e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 11:28:51 +0800 Subject: [PATCH 19/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 598ef4892..b7c0ed1f2 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -282,17 +282,15 @@ export function TPMIndexHOC(WrappedComponent) { // // } + //获取当前定制信息 //获取当前定制信息 getAppdata=()=>{ let url = "/setting.json"; - axios.get(url,{ - - }).then((response) => { - console.log("开始请求/setting.json"); + axios.get(url).then((response) => { + console.log("app.js开始请求/setting.json"); console.log("获取当前定制信息"); - console.log(response); - if(response!=undefined){ - if(response.status===200){ + if(response){ + if(response.data){ this.setState({ mygetHelmetapi:response.data.setting }); @@ -306,7 +304,7 @@ export function TPMIndexHOC(WrappedComponent) { document.head.removeChild(oldLink); } document.head.appendChild(link); - }else{ + }else { document.title = "EduCoder"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); @@ -318,6 +316,7 @@ export function TPMIndexHOC(WrappedComponent) { } document.head.appendChild(link); } + }else{ document.title = "EduCoder"; var link = document.createElement('link'), @@ -332,7 +331,6 @@ export function TPMIndexHOC(WrappedComponent) { } }).catch((error) => { - console.log(error); document.title = "EduCoder"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); From 0066df62ffcb768189b8052d49d3c7e6c6037c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 13:00:51 +0800 Subject: [PATCH 20/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index b7c0ed1f2..f44ef59ea 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -148,8 +148,8 @@ export function TPMIndexHOC(WrappedComponent) { } componentDidMount() { - console.log("TPMIndexHOC========"); - console.log(this.props); + // console.log("TPMIndexHOC========"); + // console.log(this.props); window.addEventListener('keyup', this.keyupListener) if(this.props.match.path==="/"){ From f55b8408cc6c8bc672236658533d2c8fb0f663ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 13:38:26 +0800 Subject: [PATCH 21/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index f44ef59ea..0dfb0f16a 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -212,6 +212,7 @@ export function TPMIndexHOC(WrappedComponent) { } } }); + ///请求定制化的信息 this.getAppdata(); } /** From 69faeb35dfa8272aebd9ae87babbde52f469f526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 13:40:38 +0800 Subject: [PATCH 22/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 4 ++-- public/react/src/modules/tpm/TPMIndexHOC.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index c1cba8a2d..fd945914a 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -368,8 +368,8 @@ class App extends Component { getAppdata=()=>{ let url = "/setting.json"; axios.get(url).then((response) => { - console.log("app.js开始请求/setting.json"); - console.log("获取当前定制信息"); + // console.log("app.js开始请求/setting.json"); + // console.log("获取当前定制信息"); if(response){ if(response.data){ this.setState({ diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 0dfb0f16a..ad3f517d7 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -201,8 +201,8 @@ export function TPMIndexHOC(WrappedComponent) { axios.get(url, { }).then((response) => { - console.log("开始请求/get_navigation_info.json"); - console.log(response); + // console.log("开始请求/get_navigation_info.json"); + // console.log(response); if(response!=undefined){ if(response.status===200){ this.setState({ @@ -288,8 +288,8 @@ export function TPMIndexHOC(WrappedComponent) { getAppdata=()=>{ let url = "/setting.json"; axios.get(url).then((response) => { - console.log("app.js开始请求/setting.json"); - console.log("获取当前定制信息"); + // console.log("app.js开始请求/setting.json"); + // console.log("获取当前定制信息"); if(response){ if(response.data){ this.setState({ From fb6428362b3b4bdc38b2327bef55f1aed9711212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 13:41:47 +0800 Subject: [PATCH 23/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index a7391509a..da591d85d 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -654,7 +654,7 @@ submittojoinclass=(value)=>{ }) } getAppdata=()=>{ - console.log("开始刷新数据了") + // console.log("开始刷新数据了") let url = "/setting.json"; axios.get(url).then((response) => { // console.log("axios.get"); @@ -702,7 +702,7 @@ submittojoinclass=(value)=>{ } }).catch((error) => { - console.log("开始刷新数据了但报错了"); + console.log("开始刷新定制数据了但报错了"); console.log(error); document.title = "EduCoder"; From 815a4ce509d07ae10aac893b52f140c0a61292ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 13:51:37 +0800 Subject: [PATCH 24/43] =?UTF-8?q?=E8=B0=83=E6=95=B4=20issues/24777?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/Studentshavecompletedthelist.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 438c07aeb..e1a1f17f9 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -2663,6 +2663,9 @@ class Studentshavecompletedthelist extends Component { .ant-spin-nested-loading > div > .ant-spin .ant-spin-dot { top: 72%;} } + .ysltableows2 .ant-table-thead > tr > th, .ant-table-tbody > tr > td { + padding: 9px; + } `}
      {data === undefined ? "" : div > .ant-spin .ant-spin-dot { top: 72%;} } + .ysltableows2 .ant-table-thead > tr > th, .ant-table-tbody > tr > td { + padding: 9px; + } `} -
      +
      {datas === undefined ? "" :
      Date: Tue, 15 Oct 2019 14:32:08 +0800 Subject: [PATCH 25/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/Testpapersettinghomepage.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index 6c7a35058..aac519410 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -249,6 +249,17 @@ class Testpapersettinghomepage extends Component{ // DownloadMessageval:undefined // }) // } + getsetdata =()=>{ + let{tab}=this.state; + try { + if(tab[0]===0){ + console.log(this.child); + } + }catch (e) { + + } + + } bindRef = ref => { this.child = ref }; goback=()=>{ // let {datalist}=this.state; @@ -410,6 +421,7 @@ class Testpapersettinghomepage extends Component{ Exercisetype={"exercise"} action={this.Commonheadofthetestpaper} single={true} + getsetdata={()=>this.getsetdata()} > :"":""} {isAdmin === true? 编辑试卷:""} From a389cda80551e7d96bdab9bd799781dd7acc962a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 14:52:09 +0800 Subject: [PATCH 26/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index da591d85d..c8ff333d5 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -902,10 +902,26 @@ submittojoinclass=(value)=>{ { mygetHelmetapi2.navbar && mygetHelmetapi2.navbar.map((item,key)=>{ // console.log("headtypes"); - // console.log(headtypes); + // console.log(headtypes);hidden + var str=new RegExp("http"); + var strbool=false; + //test方法返回值为(true或者false) + if(item.link){ + if(str.test(item.link)===true){ + strbool=true + }else{ + strbool=false + } + } + return( -
    • this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`}> - {item.name} +
    • this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`} style={item.hidden==true?{ display: 'block'}:{ display: 'none'}}> + { + strbool===true? + {item.name} + : + {item.name} + }
    • ) }) From 1f0bf9620d0ce53453d83bfb436a501ec393201f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 14:55:01 +0800 Subject: [PATCH 27/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index c8ff333d5..824730b73 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -915,7 +915,7 @@ submittojoinclass=(value)=>{ } return( -
    • this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`} style={item.hidden==true?{ display: 'block'}:{ display: 'none'}}> +
    • this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`} style={item.hidden==false?{ display: 'block'}:{ display: 'none'}}> { strbool===true? {item.name} From 937d947a01a5bdbcea8a2d6dbb3592007ed8dbdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 15:12:40 +0800 Subject: [PATCH 28/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 824730b73..330573f81 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -913,9 +913,9 @@ submittojoinclass=(value)=>{ strbool=false } } - + console.log(item.hidden); return( -
    • this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`} style={item.hidden==false?{ display: 'block'}:{ display: 'none'}}> +
    • this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`} style={item.hidden==false?{display: 'block'}:{display: 'none'}}> { strbool===true? {item.name} From 25791baf47c1c62e282973bf83758cf357d8d9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 15 Oct 2019 15:38:24 +0800 Subject: [PATCH 29/43] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Testpapersettinghomepage.js | 12 +++++++----- .../poll/pollPublicBtn/ImmediatelyPublish.js | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index aac519410..2adae0994 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -61,7 +61,7 @@ class Testpapersettinghomepage extends Component{ } //试卷公用头部 Commonheadofthetestpaper=()=>{ - // console.log("Commonheadofthetestpaper"); + console.log("Commonheadofthetestpaper 试卷公用头部"); var exercise_id = this.props.match.params.Id; var url = `/exercises/${exercise_id}/common_header.json`; axios.get(url).then((response) => { @@ -250,10 +250,12 @@ class Testpapersettinghomepage extends Component{ // }) // } getsetdata =()=>{ - let{tab}=this.state; + // console.log("Testpapersettinghomepage"); + // console.log("getsetdatassssss"); + let{tab}=this.state; try { - if(tab[0]===0){ - console.log(this.child); + if(tab[0]==="0"){ + this.child.Teacherliststudentlist(); } }catch (e) { @@ -421,7 +423,7 @@ class Testpapersettinghomepage extends Component{ Exercisetype={"exercise"} action={this.Commonheadofthetestpaper} single={true} - getsetdata={()=>this.getsetdata()} + getsetdata={this.getsetdata} > :"":""} {isAdmin === true? 编辑试卷:""} diff --git a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js index c7585a390..9644acfde 100644 --- a/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js +++ b/public/react/src/modules/courses/poll/pollPublicBtn/ImmediatelyPublish.js @@ -89,6 +89,7 @@ class Immediatelypublish extends Component{ Cancel:this.homeworkhide, Saves:this.homeworkstartend, }) + } }).catch((error) => { console.log(error) @@ -135,7 +136,8 @@ class Immediatelypublish extends Component{ } - } + } + } //取消提示弹框 @@ -189,7 +191,18 @@ class Immediatelypublish extends Component{ this.homeworkhide(); // 调用父级公共头部的接口刷新 - this.props.action() + try { + this.props.action(); + }catch (e) { + + } + // 调用父级刷新数据的接口刷新 + try { + this.props.getsetdata() + }catch (e) { + + } + } }).catch((error)=>{ console.log(error); @@ -274,7 +287,7 @@ class Immediatelypublish extends Component{ modalSave={this.modalCancel} > - 立即发布 + this.homeworkstart()}>立即发布 ) } From 2587be26b374f285677c92e60535a233b2a84e1e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 15 Oct 2019 16:05:31 +0800 Subject: [PATCH 30/43] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/competitions_controller.rb | 6 ++++++ app/views/admins/shared/_sidebar.html.erb | 2 ++ config/routes.rb | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 app/controllers/admins/competitions_controller.rb diff --git a/app/controllers/admins/competitions_controller.rb b/app/controllers/admins/competitions_controller.rb new file mode 100644 index 000000000..0e17993da --- /dev/null +++ b/app/controllers/admins/competitions_controller.rb @@ -0,0 +1,6 @@ +class Admins::CompetitionController < Admins::BaseController + + def index + + end +end \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index 145910928..ca6fb2a46 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -66,6 +66,8 @@ <% end %>
    • +
    • <%= sidebar_item(admins_competitions_path, '竞赛', icon: 'trophy', controller: 'admins-competitions') %>
    • +
    • <%= sidebar_item_group('#setting-submenu', '网站建设', icon: 'cogs') do %>
    • <%= sidebar_item(admins_carousels_path, '轮播图', icon: 'image', controller: 'admins-carousels') %>
    • diff --git a/config/routes.rb b/config/routes.rb index 32725e8e9..f6f8db066 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -980,6 +980,8 @@ Rails.application.routes.draw do resource :laboratory_setting, only: [:show, :update] resource :laboratory_user, only: [:create, :destroy] end + + resources :competitions, only: [:index, :destroy] end resources :colleges, only: [] do From 45f337e66fb2ed11ea1240c5fc689379eb42820b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 15 Oct 2019 17:08:29 +0800 Subject: [PATCH 31/43] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/competitions_controller.rb | 11 ++++++- app/views/admins/competitions/index.html.erb | 32 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 app/views/admins/competitions/index.html.erb diff --git a/app/controllers/admins/competitions_controller.rb b/app/controllers/admins/competitions_controller.rb index 0e17993da..3d6bef819 100644 --- a/app/controllers/admins/competitions_controller.rb +++ b/app/controllers/admins/competitions_controller.rb @@ -1,6 +1,15 @@ -class Admins::CompetitionController < Admins::BaseController +class Admins::CompetitionsController < Admins::BaseController def index + params[:sort_by] = params[:sort_by].presence || 'created_on' + params[:sort_direction] = params[:sort_direction].presence || 'desc' + @competitions = custom_sort Competition.all, params[:sort_by], params[:sort_direction] + @params_page = params[:page] || 1 + @competitions = paginate @competitions + respond_to do |format| + format.js + format.html + end end end \ No newline at end of file diff --git a/app/views/admins/competitions/index.html.erb b/app/views/admins/competitions/index.html.erb new file mode 100644 index 000000000..adcee53b1 --- /dev/null +++ b/app/views/admins/competitions/index.html.erb @@ -0,0 +1,32 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('竞赛列表', admins_competitions_path) %> +<% end %> + +
      + <%= form_tag(admins_shixuns_path, method: :get, class: 'form-inline search-form',id:"shixuns-search-form",remote:true) do %> +
      + + <% status_options = [['全部', ''], ["编辑中(#{@editing_shixuns})", "editing"], ["待审核(#{@pending_shixuns})", 'pending'], ["已发布(#{@processed_shixuns})", 'processed'],["已关闭(#{@closed_shixuns})",'closed']] %> + <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> +
      + +
      + + <%= select_tag(:tag, options_for_select(@shixuns_type_check.unshift(["",nil])), class: 'form-control',id:"tag-choosed") %> +
      + +
      + + <% auto_trial_options = [['创建者姓名', 0], ['实训名称', 1], ['学校名称', 2]] %> + <%= select_tag(:search_type, options_for_select(auto_trial_options), class: 'form-control') %> +
      + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %> + <%= link_to "清除",admins_shixuns_path,class: "btn btn-default",id:"shixuns-clear-search",'data-disable-with': '清除中...' %> + <% end %> + 导出 +
      + +
      + <%= render partial: 'admins/shixuns/shared/list', locals: { shixuns: @shixuns } %> +
      From cc96158acc8bce19660930bbfcbe82e775b1fcd9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 15 Oct 2019 17:13:55 +0800 Subject: [PATCH 32/43] =?UTF-8?q?=E5=8A=A9=E6=95=99=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 2 +- app/controllers/course_groups_controller.rb | 2 +- app/controllers/course_second_categories_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 1081a82ce..2bcc8d8f6 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -2,7 +2,7 @@ class BoardsController < ApplicationController before_action :require_login, :check_auth before_action :find_course, only: [:create] before_action :set_board, except: [:create] - before_action :teacher_or_admin_allowed + before_action :teacher_allowed def index @boards = @course.boards.includes(messages: [:last_reply, :author]) diff --git a/app/controllers/course_groups_controller.rb b/app/controllers/course_groups_controller.rb index 0e16d1bac..bfdb959b4 100644 --- a/app/controllers/course_groups_controller.rb +++ b/app/controllers/course_groups_controller.rb @@ -2,7 +2,7 @@ class CourseGroupsController < ApplicationController before_action :require_login, :check_auth before_action :set_group, except: [:create] before_action :find_course, only: [:create] - before_action :teacher_or_admin_allowed + before_action :teacher_allowed def create tip_exception("分班名称不能为空") if params[:name].blank? diff --git a/app/controllers/course_second_categories_controller.rb b/app/controllers/course_second_categories_controller.rb index e5c3366cd..2de1637f2 100644 --- a/app/controllers/course_second_categories_controller.rb +++ b/app/controllers/course_second_categories_controller.rb @@ -1,7 +1,7 @@ class CourseSecondCategoriesController < ApplicationController before_action :require_login, :check_auth before_action :set_category - before_action :teacher_or_admin_allowed + before_action :teacher_allowed # 目录重命名 def rename_category From 5a4d225c7029d4eae9016dcc960cb78060ccece6 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 15 Oct 2019 17:19:42 +0800 Subject: [PATCH 33/43] no message --- public/react/src/modules/courses/members/studentsList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 1f6bf9096..1cee6051e 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -706,7 +706,7 @@ class studentsList extends Component{ - { this.props.history.push(`/courses/${coursesids}/course_groups`)}} + { this.props.history.push(`/courses/${courseId}/course_groups`)}} style={{color: '#212121', verticalAlign: 'initial', marginRight: '14px' }} > {course_group_name || '未分班'} From da2bf0bbad1449267c14f9f3b5645087cce83816 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 15 Oct 2019 17:23:58 +0800 Subject: [PATCH 34/43] =?UTF-8?q?=E5=8A=A9=E6=95=99=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/competitions/index.html.erb | 27 +------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/app/views/admins/competitions/index.html.erb b/app/views/admins/competitions/index.html.erb index adcee53b1..8fa238181 100644 --- a/app/views/admins/competitions/index.html.erb +++ b/app/views/admins/competitions/index.html.erb @@ -2,31 +2,6 @@ <% add_admin_breadcrumb('竞赛列表', admins_competitions_path) %> <% end %> -
      - <%= form_tag(admins_shixuns_path, method: :get, class: 'form-inline search-form',id:"shixuns-search-form",remote:true) do %> -
      - - <% status_options = [['全部', ''], ["编辑中(#{@editing_shixuns})", "editing"], ["待审核(#{@pending_shixuns})", 'pending'], ["已发布(#{@processed_shixuns})", 'processed'],["已关闭(#{@closed_shixuns})",'closed']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
      - -
      - - <%= select_tag(:tag, options_for_select(@shixuns_type_check.unshift(["",nil])), class: 'form-control',id:"tag-choosed") %> -
      - -
      - - <% auto_trial_options = [['创建者姓名', 0], ['实训名称', 1], ['学校名称', 2]] %> - <%= select_tag(:search_type, options_for_select(auto_trial_options), class: 'form-control') %> -
      - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %> - <%= link_to "清除",admins_shixuns_path,class: "btn btn-default",id:"shixuns-clear-search",'data-disable-with': '清除中...' %> - <% end %> - 导出 -
      - -
      +
      <%= render partial: 'admins/shixuns/shared/list', locals: { shixuns: @shixuns } %>
      From 2dbd9d993e16d6502d7c7846132d7a863b391340 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 15 Oct 2019 17:25:11 +0800 Subject: [PATCH 35/43] courseId --- public/react/src/modules/courses/members/studentsList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 1cee6051e..20ab384f1 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -598,7 +598,7 @@ class studentsList extends Component{ .then((response) => { if (response.data.status == 0) { this.props.showNotification('删除成功') - this.props.history.push(`/courses/${coursesId}/course_groups`) + this.props.history.push(`/courses/${courseId}/course_groups`) } }) .catch(function (error) { From bf97b69a8b29a882b439e7457f87006965587626 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 15 Oct 2019 17:27:39 +0800 Subject: [PATCH 36/43] mr30 --- public/react/src/modules/courses/members/studentsList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 20ab384f1..ffdb9ed59 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -751,7 +751,7 @@ class studentsList extends Component{ !isStudentPage && !isCourseEnd && isAdmin && this.addDir()}>新建分班 } { - !isStudentPage && isStudent && !isParent && course_group_id != 0 && this.addToDir()}>加入分班 } + !isStudentPage && isStudent && !isParent && course_group_id != 0 && this.addToDir()}>加入分班 }