From 606d119c6c3ea5daf4dbc24de0a5ed4b79fe9f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 11 Sep 2019 18:55:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E9=80=89=E6=8B=A9=E5=AE=9E?= =?UTF-8?q?=E8=AE=ADbuild?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/NewShixunModel.js | 188 ++++++++++-------- .../courses/coursesPublic/Newshixunmodel.css | 3 +- .../courses/shixunHomework/shixunHomework.js | 45 +++-- public/react/src/search/searchc.css | 2 +- 4 files changed, 138 insertions(+), 100 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js index d16581962..8737178ec 100644 --- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js +++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js @@ -7,55 +7,50 @@ class NewShixunModel extends Component{ constructor(props){ super(props) this.state={ - diff:0, shixun_list:undefined, shixuns_count:undefined, Grouplist:[], + page:1, + type:'all', + status:'all', + search:undefined, + order:'desc', + diff:0, + limit:15, } } componentDidMount() { - console.log(this.props.type) - - if(this.props.type==='shixun'){ - let url="/shixuns/shixun_list.json" - axios.get(url).then((response) => { - - if(response.data){ - console.log(response.data); - if(response.data.status===0){ - } - } - - }) - }else{ - let url="/shixuns/shixun_list.json" - axios.get(url,{params:{ - type:'all', //这是带过来的值 - status:'all', - search:undefined, - diff:0, - order:'desc', - page:1, - limit:15, - }}).then((response) => { - - if(response.data){ - this.setState({ - shixun_list:response.data.shixun_list, - shixuns_count:response.data.shixuns_count, - }) - } - - }) + let{page,type,status,search,order,diff,limit}=this.state; + this.getdatalist(page,type,status,search,order,diff,limit) + } - } + getdatalist=(page,type,status,search,order,diff,limit)=>{ + let url="/shixuns/shixun_list.json" + axios.get(url,{params:{ + page, + type, + status, + search, + order, + diff, + limit + }}).then((response) => { + if(response.data){ + this.setState({ + shixun_list:response.data.shixun_list, + shixuns_count:response.data.shixuns_count, + }) + } + }) } - DropdownClick=(type)=>{ + DropdownClick=(diff)=>{ this.setState({ - diff:type + diff:diff }) + let{page,type,status,search,order,limit}=this.state; + this.getdatalist(page,type,status,search,order,diff,limit) } ItsCourse=(item)=>{ @@ -75,39 +70,86 @@ class NewShixunModel extends Component{ Grouplist: Grouplist, }) } + + PaginationCourse=(pageNumber)=>{ + this.setState({ + page:pageNumber + }) + let{type,status,search,order,diff,limit}=this.state; + this.getdatalist(pageNumber,type,status,search,order,diff,limit) + } + + belongto=(value)=>{ + this.setState({ + type:value + }) + let{page,status,search,order,diff,limit}=this.state; + this.getdatalist(page,value,status,search,order,diff,limit) + } + + updatedlist=(order)=>{ + + if(order==="desc"){ + this.setState({ + order:"asc" + }) + let{type,page,status,search,diff,limit}=this.state; + this.getdatalist(page,type,status,search,"asc",diff,limit) + }else{ + this.setState({ + order:"desc" + }) + let{type,page,status,search,diff,limit}=this.state; + this.getdatalist(page,type,status,search,"desc",diff,limit) + } + + } + + setdatafunsval=(e)=>{ + this.setState({ + search:e.target.value + }) + } + setdatafuns=(value)=>{ + this.setState({ + search:value + }) + let{type,page,status,diff,order,limit}=this.state; + this.getdatalist(page,type,status,value,order,diff,limit) + } render() { - let {diff,Grouplist,shixun_list,shixuns_count}=this.state; + let {diff,Grouplist,shixun_list,shixuns_count,page,type,order}=this.state; // let {visible,patheditarry}=this.props; const menus = ( - this.DropdownClick(0)}> + this.DropdownClick(0)}> 所有 - this.DropdownClick(1)} > + this.DropdownClick(1)} > 初级 - this.DropdownClick(2)}> + this.DropdownClick(2)}> 中级 - this.DropdownClick(3)}> + this.DropdownClick(3)}> 高级 - this.DropdownClick(4)}> + this.DropdownClick(4)}> 顶级 @@ -130,9 +172,8 @@ class NewShixunModel extends Component{
@@ -145,7 +186,7 @@ class NewShixunModel extends Component{ style={{ width: "800px"}} className="packinput" placeholder="实训信息 / 院校名称 / 创建者" - value={this.state.keywords} + value={this.state.search} enterButton={搜索} onInput={(e)=>this.setdatafunsval(e)} onSearch={ (value)=>this.setdatafuns(value)} /> @@ -155,14 +196,14 @@ class NewShixunModel extends Component{

- 已选 6 个实训 + 已选 {Grouplist.length} 个实训 {shixuns_count===undefined?"":shixuns_count} 个实训 - 学习人数 - this.updatedlist(sort_by)}> - - + this.updatedlist(order)}>学习人数 + + + @@ -174,28 +215,16 @@ class NewShixunModel extends Component{

- 我的实训 - 全部实训 + this.belongto("mine")}>我的实训 + this.belongto("all")}>全部实训

- {/*author_name: "刘强"*/} - {/*author_school_name: "湖南工业大学"*/} - {/*challenge_names: ["打印输出 Hello World", "打印输出图形", "求3个数的最大值", "熟悉C语言调试过程"]*/} - {/*challenges_count: 4*/} - {/*content: {}*/} - {/*id: 1504*/} - {/*identifier: "tb7hw62n"*/} - {/*level: "初级"*/} - {/*study_count: 6002*/} - {/*subjects: [{id: 138, name: "C语言程序设计"}, {id: 180, name: "C语言程序设计(湖南师范大学)"}, {id: 211, name: "移动云启 —— C语言练习题库"}]*/} - {/*title: "C语言程序设计编辑与调试环境"*/} - {/*visits_count: 9419*/} - - this.getGrouplist()} value={Grouplist}> + + {shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{ - console.log(item.content) + return(
@@ -204,7 +233,7 @@ class NewShixunModel extends Component{ @@ -212,22 +241,17 @@ class NewShixunModel extends Component{
-

- {/*{item.content}*/} - {item.challenge_names.map((item,key)=>{ - return( - {item} - ) - })} -

+ {JSON.stringify(item.content) == "{}"?"":

+ {/*{item.description}*/} +

} -

+ {item.challenge_names.length===0?"":

{item.challenge_names.map((item,key)=>{ return( {item} ) })} -

+

}
@@ -278,13 +302,13 @@ class NewShixunModel extends Component{ defaultCurrent={1} pageSize={15} total={shixuns_count===undefined?"":shixuns_count} - // current={page} - // onChange={this.PaginationCourse} + current={page} + onChange={this.PaginationCourse} />
:""}
- +
diff --git a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css index cd3a07838..03e183999 100644 --- a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css +++ b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css @@ -10,7 +10,7 @@ height: 55px; width:663px !important; font-size: 14px; - color: #681616 !important; + /*color: #681616 !important;*/ border-color: #E1EDF8 !important; padding-left: 20px; } @@ -161,6 +161,7 @@ .newshixunlist{ max-height:227px; + width: 1200px; } .xuxianpro { diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index aee4f35b4..d29980e79 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -446,18 +446,18 @@ class ShixunHomework extends Component{ } - // 选用实训 - createCommonWork=()=>{ - - this.setState({ - hometypepvisible:true, - shixunmodal:true, - patheditarry:[], - checkBoxValues:[] - }) - - - } + // // 选用实训 + // createCommonWork=()=>{ + // + // this.setState({ + // hometypepvisible:true, + // shixunmodal:true, + // patheditarry:[], + // checkBoxValues:[] + // }) + // + // + // } // 选用实训路径 createCommonpath=()=>{ @@ -897,6 +897,18 @@ class ShixunHomework extends Component{ this.props.history.push(this.props.current_user.first_category_url); } } + showNewShixunModelType=()=>{ + this.setState({ + NewShixunModelType:true, + patheditarry:[], + checkBoxValues:[] + }) + } + hideNewShixunModelType=()=>{ + this.setState({ + NewShixunModelType:false + }) + } render(){ let { modalname, @@ -932,7 +944,7 @@ class ShixunHomework extends Component{ course_modules, shixunpath, order, - antIcon, + NewShixunModelType, }=this.state; let main_id=this.props.match.params.main_id; @@ -943,11 +955,12 @@ class ShixunHomework extends Component{
{/*新版实训model*/} - + hideNewShixunModelType={()=>this.hideNewShixunModelType()} + />:""} {/*提示*/} @@ -1061,7 +1074,7 @@ class ShixunHomework extends Component{ : this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名:""} {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?选用实践课程:"":""} - {this.props.isAdmin()===true?this.createCommonWork()}>选用实训:""} + {this.props.isAdmin()===true?this.showNewShixunModelType()}>选用实训:""}

diff --git a/public/react/src/search/searchc.css b/public/react/src/search/searchc.css index 99f35738a..15c34650b 100644 --- a/public/react/src/search/searchc.css +++ b/public/react/src/search/searchc.css @@ -12,7 +12,7 @@ height: 55px; width:663px !important; font-size: 18px; - color: #681616 !important; + /*color: #681616 !important;*/ border-color: #E1EDF8 !important; }