新版选择实训build

dev_cs
杨树明 6 years ago
parent 0a1b2ee2a6
commit 606d119c6c

@ -7,55 +7,50 @@ class NewShixunModel extends Component{
constructor(props){ constructor(props){
super(props) super(props)
this.state={ this.state={
diff:0,
shixun_list:undefined, shixun_list:undefined,
shixuns_count:undefined, shixuns_count:undefined,
Grouplist:[], Grouplist:[],
page:1,
type:'all',
status:'all',
search:undefined,
order:'desc',
diff:0,
limit:15,
} }
} }
componentDidMount() { componentDidMount() {
console.log(this.props.type) let{page,type,status,search,order,diff,limit}=this.state;
this.getdatalist(page,type,status,search,order,diff,limit)
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,
})
}
})
} 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({ 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)=>{ ItsCourse=(item)=>{
@ -75,39 +70,86 @@ class NewShixunModel extends Component{
Grouplist: Grouplist, 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() { 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; // let {visible,patheditarry}=this.props;
const menus = ( const menus = (
<Menu className="menus"> <Menu className="menus">
<Menu.Item> <Menu.Item>
<a onClick={()=>this.DropdownClick(0)}> <a className={diff===0?"color-blue":""} onClick={()=>this.DropdownClick(0)}>
所有 所有
</a> </a>
</Menu.Item> </Menu.Item>
<Menu.Item > <Menu.Item >
<a onClick={()=>this.DropdownClick(1)} > <a className={diff===1?"color-blue":""} onClick={()=>this.DropdownClick(1)} >
初级 初级
</a> </a>
</Menu.Item> </Menu.Item>
<Menu.Item> <Menu.Item>
<a onClick={()=>this.DropdownClick(2)}> <a className={diff===2?"color-blue":""} onClick={()=>this.DropdownClick(2)}>
中级 中级
</a> </a>
</Menu.Item> </Menu.Item>
<Menu.Item> <Menu.Item>
<a onClick={()=>this.DropdownClick(3)}> <a className={diff===3?"color-blue":""} onClick={()=>this.DropdownClick(3)}>
高级 高级
</a> </a>
</Menu.Item> </Menu.Item>
<Menu.Item> <Menu.Item>
<a onClick={()=>this.DropdownClick(4)}> <a className={diff===4?"color-blue":""} onClick={()=>this.DropdownClick(4)}>
顶级 顶级
</a> </a>
</Menu.Item> </Menu.Item>
@ -130,9 +172,8 @@ class NewShixunModel extends Component{
<Drawer <Drawer
placement="top" placement="top"
closable={false} closable={false}
onClose={this.onClose}
destroyOnClose={true} destroyOnClose={true}
visible={true} visible={this.props.NewShixunModelType}
height={'100%'} height={'100%'}
> >
<div className={"clearfix educontent pr"}> <div className={"clearfix educontent pr"}>
@ -145,7 +186,7 @@ class NewShixunModel extends Component{
style={{ width: "800px"}} style={{ width: "800px"}}
className="packinput" className="packinput"
placeholder="实训信息 / 院校名称 / 创建者" placeholder="实训信息 / 院校名称 / 创建者"
value={this.state.keywords} value={this.state.search}
enterButton={<span>搜索</span>} enterButton={<span>搜索</span>}
onInput={(e)=>this.setdatafunsval(e)} onInput={(e)=>this.setdatafunsval(e)}
onSearch={ (value)=>this.setdatafuns(value)} /> onSearch={ (value)=>this.setdatafuns(value)} />
@ -155,14 +196,14 @@ class NewShixunModel extends Component{
<p className="font-12 ml5 fl"> <p className="font-12 ml5 fl">
<span className="fl color-grey-9 mr20">已选 <span className={"color-blue"}>6</span> </span> <span className="fl color-grey-9 mr20">已选 <span className={"color-blue"}>{Grouplist.length}</span> </span>
<span className="fl color-grey-9 mr20"> <span className={"color-blue"}>{shixuns_count===undefined?"":shixuns_count}</span> </span> <span className="fl color-grey-9 mr20"> <span className={"color-blue"}>{shixuns_count===undefined?"":shixuns_count}</span> </span>
<span className="fl color-grey-9 pointer mr30"> <span className="fl color-grey-9 pointer mr30">
<a className={" color-grey-6"}>学习人数</a> <a className={" color-grey-6"} onClick={()=>this.updatedlist(order)}>学习人数</a>
<sapn className="relativef ml5 " onClick={()=>this.updatedlist(sort_by)}> <sapn className="relativef ml5 " >
<i className={"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue"}></i> <i className={order==="desc"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
<i className={"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i> <i className={order==="asc"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
</sapn> </sapn>
</span> </span>
@ -174,28 +215,16 @@ class NewShixunModel extends Component{
</p> </p>
<p className="font-12 alltopiscright ml25 fr"> <p className="font-12 alltopiscright ml25 fr">
<span className="fr mr30 topcsactive pointer color-grey-3">我的实训</span> <span className={type==="mine"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 topcsactive pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的实训</span>
<span className="fr mr30 topcsactive pointer color-grey-3 color-blue">全部实训</span> <span className={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 topcsactive pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部实训</span>
</p> </p>
</div> </div>
{/*author_name: "刘强"*/}
{/*author_school_name: "湖南工业大学"*/} <Checkbox.Group onChange={this.getGrouplist} value={Grouplist}>
{/*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*/}
<Checkbox.Group onChange={()=>this.getGrouplist()} value={Grouplist}>
{shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{ {shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{
console.log(item.content)
return( return(
<div className="mt20 edu-back-white pd20 relativef newshixunlist" key={key}> <div className="mt20 edu-back-white pd20 relativef newshixunlist" key={key}>
<div className="clearfix"> <div className="clearfix">
@ -204,7 +233,7 @@ class NewShixunModel extends Component{
<Checkbox <Checkbox
value={item.id} value={item.id}
key={item.id} key={item.id}
className="fl task-hide edu-txt-left" className="fl task-hide edu-txt-left mt3"
name="shixun_homework[]" name="shixun_homework[]"
></Checkbox> ></Checkbox>
<a title={item.title} className="ml15 fl font-16 color-dark maxwidth900"> <a title={item.title} className="ml15 fl font-16 color-dark maxwidth900">
@ -212,22 +241,17 @@ class NewShixunModel extends Component{
</a> </a>
<div className="cl"></div> <div className="cl"></div>
<p className="newshixunmodelmidfont"> {JSON.stringify(item.content) == "{}"?"":<p className="newshixunmodelmidfont">
{/*{item.content}*/} {/*{item.description}*/}
{item.challenge_names.map((item,key)=>{ </p>}
return(
<span>{item}</span>
)
})}
</p>
<p className="newshixunmodelbotfont"> {item.challenge_names.length===0?"":<p className="newshixunmodelbotfont">
{item.challenge_names.map((item,key)=>{ {item.challenge_names.map((item,key)=>{
return( return(
<span>{item}</span> <span>{item}</span>
) )
})} })}
</p> </p>}
<div className={"newshixunpd030"}> <div className={"newshixunpd030"}>
<div className="xuxianpro"></div> <div className="xuxianpro"></div>
@ -278,13 +302,13 @@ class NewShixunModel extends Component{
defaultCurrent={1} defaultCurrent={1}
pageSize={15} pageSize={15}
total={shixuns_count===undefined?"":shixuns_count} total={shixuns_count===undefined?"":shixuns_count}
// current={page} current={page}
// onChange={this.PaginationCourse} onChange={this.PaginationCourse}
/> />
</div>:""} </div>:""}
<div className={" edu-txt-center padding20-30"}> <div className={" edu-txt-center padding20-30"}>
<Button className={"mr20 newshixunmode"}>取消</Button> <Button className={"mr20 newshixunmode"} onClick={()=>this.props.hideNewShixunModelType()}>取消</Button>
<Button className={"newshixunmode"} type="primary">确定</Button> <Button className={"newshixunmode"} type="primary">确定</Button>
</div> </div>

@ -10,7 +10,7 @@
height: 55px; height: 55px;
width:663px !important; width:663px !important;
font-size: 14px; font-size: 14px;
color: #681616 !important; /*color: #681616 !important;*/
border-color: #E1EDF8 !important; border-color: #E1EDF8 !important;
padding-left: 20px; padding-left: 20px;
} }
@ -161,6 +161,7 @@
.newshixunlist{ .newshixunlist{
max-height:227px; max-height:227px;
width: 1200px;
} }
.xuxianpro { .xuxianpro {

@ -446,18 +446,18 @@ class ShixunHomework extends Component{
} }
// 选用实训 // // 选用实训
createCommonWork=()=>{ // createCommonWork=()=>{
//
this.setState({ // this.setState({
hometypepvisible:true, // hometypepvisible:true,
shixunmodal:true, // shixunmodal:true,
patheditarry:[], // patheditarry:[],
checkBoxValues:[] // checkBoxValues:[]
}) // })
//
//
} // }
// 选用实训路径 // 选用实训路径
createCommonpath=()=>{ createCommonpath=()=>{
@ -897,6 +897,18 @@ class ShixunHomework extends Component{
this.props.history.push(this.props.current_user.first_category_url); this.props.history.push(this.props.current_user.first_category_url);
} }
} }
showNewShixunModelType=()=>{
this.setState({
NewShixunModelType:true,
patheditarry:[],
checkBoxValues:[]
})
}
hideNewShixunModelType=()=>{
this.setState({
NewShixunModelType:false
})
}
render(){ render(){
let { let {
modalname, modalname,
@ -932,7 +944,7 @@ class ShixunHomework extends Component{
course_modules, course_modules,
shixunpath, shixunpath,
order, order,
antIcon, NewShixunModelType,
}=this.state; }=this.state;
let main_id=this.props.match.params.main_id; let main_id=this.props.match.params.main_id;
@ -943,11 +955,12 @@ class ShixunHomework extends Component{
<div> <div>
{/*新版实训model*/} {/*新版实训model*/}
<NewShixunModel {NewShixunModelType===true?<NewShixunModel
{...this.props} {...this.props}
{...this.state} {...this.state}
type={'shixuns'} type={'shixuns'}
/> hideNewShixunModelType={()=>this.hideNewShixunModelType()}
/>:""}
{/*提示*/} {/*提示*/}
@ -1061,7 +1074,7 @@ class ShixunHomework extends Component{
</span>: </span>:
<WordsBtn style="blue" onClick={()=>this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名</WordsBtn>:""} <WordsBtn style="blue" onClick={()=>this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名</WordsBtn>:""}
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?<WordsBtn style="blue" className="mr30 font-16" onClick={this.createCommonpath}>选用实践课程</WordsBtn>:"":""} {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?<WordsBtn style="blue" className="mr30 font-16" onClick={this.createCommonpath}>选用实践课程</WordsBtn>:"":""}
{this.props.isAdmin()===true?<a className={"btn colorblue font-16"} onClick={()=>this.createCommonWork()}>选用实训</a>:""} {this.props.isAdmin()===true?<a className={"btn colorblue font-16"} onClick={()=>this.showNewShixunModelType()}>选用实训</a>:""}
</li> </li>
</p> </p>

@ -12,7 +12,7 @@
height: 55px; height: 55px;
width:663px !important; width:663px !important;
font-size: 18px; font-size: 18px;
color: #681616 !important; /*color: #681616 !important;*/
border-color: #E1EDF8 !important; border-color: #E1EDF8 !important;
} }

Loading…
Cancel
Save