杨树林 5 years ago
commit 1885e8ec75

@ -333,7 +333,13 @@ class App extends Component {
{/*实训课程(原实训路径)*/}
<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>

@ -40,6 +40,8 @@ class CoursesNew extends Component {
}
componentDidMount() {
let coursesId = this.props.match.params.coursesId;
let user_school=this.props.current_user&&this.props.current_user.user_school;
@ -85,7 +87,13 @@ class CoursesNew extends Component {
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) => {
if(dateString===""){
this.setState({

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

@ -384,7 +384,7 @@ class NewHeader extends Component {
}
onKeywordSearchKeyDown = (e) => {
window.location.href ="/search"+"?value="+e.target.value;
window.location.href ="/search?value="+e.target.value;
// let code = e.keyCode;
// if(code == 13) {
@ -709,6 +709,7 @@ submittojoinclass=(value)=>{
<Search
placeholder="搜索"
// onSearch={value => console.log(value)}
onPressEnter={this.onKeywordSearchKeyDown}
style={{ width: 258 }}
/>
@ -791,7 +792,7 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<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={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>

@ -502,6 +502,8 @@ class Newshixuns extends Component {
}
sendsure_apply = () => {
let {languagewrite,systemenvironment,testcoderunmode} = this.state;
debugger
// console.log("点击确定")
// console.log("languagewrite"+languagewrite);
// console.log("systemenvironment"+systemenvironment);
@ -987,14 +989,14 @@ class Newshixuns extends Component {
{
deleteisnot=== true?
<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-grey-c fl ml10 ">(单个文件50M以内)</span>
</Upload>
:
<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 ml10 ">(单个文件50M以内)</span>

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

Loading…
Cancel
Save