杨树林 5 years ago
commit 1885e8ec75

@ -333,7 +333,13 @@ class App extends Component {
{/*实训课程(原实训路径)*/} {/*实训课程(原实训路径)*/}
<Route path="/paths" component={ShixunPaths}></Route> <Route path="/paths" component={ShixunPaths}></Route>
<Route path="/search" component={SearchPage} ></Route>
<Route path="/search"
render={
(props)=>(<SearchPage {...this.props} {...props} {...this.state}></SearchPage>)
}
></Route>
{/*课堂*/} {/*课堂*/}
<Route path="/courses" component={CoursesIndex} {...this.props}></Route> <Route path="/courses" component={CoursesIndex} {...this.props}></Route>

@ -40,6 +40,8 @@ class CoursesNew extends Component {
} }
componentDidMount() { componentDidMount() {
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let user_school=this.props.current_user&&this.props.current_user.user_school; let user_school=this.props.current_user&&this.props.current_user.user_school;
@ -85,7 +87,13 @@ class CoursesNew extends Component {
this.Searchvalue("") this.Searchvalue("")
} }
componentDidUpdate(prevProps){
if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user.user_identity==="学生"){
window.location.href ="/403"
}
}
}
onChangeTimepublishs = (date, dateString) => { onChangeTimepublishs = (date, dateString) => {
if(dateString===""){ if(dateString===""){
this.setState({ this.setState({

@ -7,7 +7,7 @@ import Dialog, {
DialogContentText, DialogContentText,
DialogTitle, DialogTitle,
} from 'material-ui/Dialog'; } from 'material-ui/Dialog';
import {notification } from 'antd';
import axios from 'axios'; import axios from 'axios';
@ -349,7 +349,12 @@ class LoginDialog extends Component {
if(response.status===200){ if(response.status===200){
if (response.data.status === 402) { if (response.data.status === 402) {
window.location.href = response.data.url; window.location.href = response.data.url;
}else{ }else if (response.data.status === -2) {
notification.open({
message: '提示',
description:response.data.message,
});
}else{
broadcastChannelPostMessage('refreshPage') broadcastChannelPostMessage('refreshPage')
this.setState({ this.setState({
isRender:false isRender:false

@ -384,7 +384,7 @@ class NewHeader extends Component {
} }
onKeywordSearchKeyDown = (e) => { onKeywordSearchKeyDown = (e) => {
window.location.href ="/search"+"?value="+e.target.value; window.location.href ="/search?value="+e.target.value;
// let code = e.keyCode; // let code = e.keyCode;
// if(code == 13) { // if(code == 13) {
@ -709,6 +709,7 @@ submittojoinclass=(value)=>{
<Search <Search
placeholder="搜索" placeholder="搜索"
// onSearch={value => console.log(value)} // onSearch={value => console.log(value)}
onPressEnter={this.onKeywordSearchKeyDown} onPressEnter={this.onKeywordSearchKeyDown}
style={{ width: 258 }} style={{ width: 258 }}
/> />
@ -791,7 +792,7 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}> <div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div> <div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline"> <ul className="fl with50 edu-txt-center pr ul-leftline">
<li><Link to={"/courses/new"}>新建课堂</Link></li> {this.props.current_user&&this.props.current_user.user_identity==="学生"?"":<li><Link to={"/courses/new"}>新建课堂</Link></li>}
<li><a href="/shixuns/new">新建实训</a></li> <li><a href="/shixuns/new">新建实训</a></li>
<li><a href={this.props.Headertop===undefined?"":"/paths/new"}>新建实践课程</a></li> <li><a href={this.props.Headertop===undefined?"":"/paths/new"}>新建实践课程</a></li>
<li><a href={this.props.Headertop===undefined?"":this.props.Headertop.new_project_url} target="_blank">新建项目</a></li> <li><a href={this.props.Headertop===undefined?"":this.props.Headertop.new_project_url} target="_blank">新建项目</a></li>

@ -502,6 +502,8 @@ class Newshixuns extends Component {
} }
sendsure_apply = () => { sendsure_apply = () => {
let {languagewrite,systemenvironment,testcoderunmode} = this.state; let {languagewrite,systemenvironment,testcoderunmode} = this.state;
debugger
// console.log("点击确定") // console.log("点击确定")
// console.log("languagewrite"+languagewrite); // console.log("languagewrite"+languagewrite);
// console.log("systemenvironment"+systemenvironment); // console.log("systemenvironment"+systemenvironment);
@ -987,14 +989,14 @@ class Newshixuns extends Component {
{ {
deleteisnot=== true? deleteisnot=== true?
<Upload {...uploadProps} > <Upload {...uploadProps} >
<Icon type="upload" className="fl mt5" > </Icon> <Icon type="upload" className="fl mt3" > </Icon>
<span className="color-blue fl">上传附件</span> <span className="color-blue fl">上传附件</span>
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span> <span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>
</Upload> </Upload>
: :
<Upload {...uploadProps} disabled={true} > <Upload {...uploadProps} disabled={true} >
<Icon type="upload" className="fl mt5" > </Icon> <Icon type="upload" className="fl mt3" > </Icon>
<span className="color-grey-c fl">上传附件</span> <span className="color-grey-c fl">上传附件</span>
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span> <span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>

@ -15,27 +15,28 @@ class SearchPage extends Component{
this.state={ this.state={
tab:"0", tab:"0",
count:0, count:0,
keywords:"", keywords:undefined,
type:"", type:"shixun",
page:1, page:1,
perpages:20, perpages:20,
data:[], data:[],
} }
} }
//切换tab //切换tab
changeTab=(e)=>{ changeTab=(e)=>{
console.log(e.key);
let types ="";
let types ="";
if(parseInt(e.key)===0){ if(parseInt(e.key)===0){
types="course"; types="shixun";
} }
if(parseInt(e.key)===1){ if(parseInt(e.key)===1){
types="shixun"; types="subject";
} }
if(parseInt(e.key)===2){ if(parseInt(e.key)===2){
types="subject"; types="course";
} }
if(parseInt(e.key)===3){ if(parseInt(e.key)===3){
@ -59,16 +60,27 @@ class SearchPage extends Component{
// this.setState({ // this.setState({
// tab:sum, // tab:sum,
// }) // })
let courstype=this.props.match.url; let courstype=decodeURI(decodeURI(this.props.location.search));
courstype = courstype.split('?value='); courstype = courstype.split('?value=');
console.log(courstype);
this.getdata(this.state.page,this.state.type,this.state.keywords);
this.setState({
keywords:courstype[1]
})
this.getdata(this.state.page,this.state.type,courstype[1]);
}
setdatafunsval=(e)=>{
this.setState({
keywords:e.target.value
})
} }
setdatafuns =(value)=>{ setdatafuns =(value)=>{
this.setState({ this.setState({
keywords:value keywords:value
}) })
this.props.history.replace(`/search?value=${value}`)
this.getdata(this.state.page,this.state.type,value); this.getdata(this.state.page,this.state.type,value);
} }
paginationonChanges = (pageNumber) => { paginationonChanges = (pageNumber) => {
@ -92,21 +104,22 @@ class SearchPage extends Component{
return return
} }
console.log("63");
console.log(response.data);
this.setState({ this.setState({
count:response.data.count, count:response.data.count,
data:response.data.results, data:response.data.results,
}) })
}).catch((error) => { }).catch((error) => {
console.log("56");
console.log(error);
}); });
} }
render(){ render(){
let {tab,count,data,page,perpages}=this.state; let {tab,count,data,page,perpages}=this.state;
console.log(tab);
return( return(
<div className="newMain clearfix"> <div className="newMain clearfix">
<div className="headersear" > <div className="headersear" >
@ -114,7 +127,9 @@ class SearchPage extends Component{
<Search <Search
style={{ width: "800px", marginTop:"53px"}} style={{ width: "800px", marginTop:"53px"}}
className="packinput" className="packinput"
value={this.state.keywords}
enterButton={<span><Icon type="search" className="mr5"/> 搜索</span>} enterButton={<span><Icon type="search" className="mr5"/> 搜索</span>}
onInput={(e)=>this.setdatafunsval(e)}
onSearch={ (value)=>this.setdatafuns(value)} /> onSearch={ (value)=>this.setdatafuns(value)} />
</div> </div>
@ -146,11 +161,19 @@ class SearchPage extends Component{
<p className="counttittext">共找到相关结果<span className="counttittexts">{count}</span></p> <p className="counttittext">共找到相关结果<span className="counttittexts">{count}</span></p>
</div> </div>
<div className="mainx"> <div className="mainx">
<div className="educontent project-packages-list mb30"> <div className="educontent project-packages-list mb30">
{data === undefined ? "" : data.map((item, key) => { {data === undefined ? "" : data.map((item, key) => {
return ( return (
<a key={key}
href={
item.type==="shixun"?`/shixuns/${item.identifier}/challenges`:item.type==="course"?`/courses/${item.id}/students`:item.type==="subject"?`/paths/${item.id}`:item.type==="memo"?`/forums/${item.id}`:""
}
target="_blank"
>
<div className="project-package-item"> <div className="project-package-item">
<div className={"font-16 color-dark fl "} > <div className={"font-16 color-dark fl "} >
@ -210,6 +233,8 @@ class SearchPage extends Component{
</div> </div>
</div> </div>
</a>
) )
})} })}

Loading…
Cancel
Save