新版选择实训build

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

@ -7,38 +7,34 @@ 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){
}
let{page,type,status,search,order,diff,limit}=this.state;
this.getdatalist(page,type,status,search,order,diff,limit)
}
})
}else{
getdatalist=(page,type,status,search,order,diff,limit)=>{
let url="/shixuns/shixun_list.json"
axios.get(url,{params:{
type:'all', //这是带过来的值
status:'all',
search:undefined,
diff:0,
order:'desc',
page:1,
limit:15,
page,
type,
status,
search,
order,
diff,
limit
}}).then((response) => {
if(response.data){
this.setState({
shixun_list:response.data.shixun_list,
@ -47,15 +43,14 @@ class NewShixunModel extends Component{
}
})
}
}
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 = (
<Menu className="menus">
<Menu.Item>
<a onClick={()=>this.DropdownClick(0)}>
<a className={diff===0?"color-blue":""} onClick={()=>this.DropdownClick(0)}>
所有
</a>
</Menu.Item>
<Menu.Item >
<a onClick={()=>this.DropdownClick(1)} >
<a className={diff===1?"color-blue":""} onClick={()=>this.DropdownClick(1)} >
初级
</a>
</Menu.Item>
<Menu.Item>
<a onClick={()=>this.DropdownClick(2)}>
<a className={diff===2?"color-blue":""} onClick={()=>this.DropdownClick(2)}>
中级
</a>
</Menu.Item>
<Menu.Item>
<a onClick={()=>this.DropdownClick(3)}>
<a className={diff===3?"color-blue":""} onClick={()=>this.DropdownClick(3)}>
高级
</a>
</Menu.Item>
<Menu.Item>
<a onClick={()=>this.DropdownClick(4)}>
<a className={diff===4?"color-blue":""} onClick={()=>this.DropdownClick(4)}>
顶级
</a>
</Menu.Item>
@ -130,9 +172,8 @@ class NewShixunModel extends Component{
<Drawer
placement="top"
closable={false}
onClose={this.onClose}
destroyOnClose={true}
visible={true}
visible={this.props.NewShixunModelType}
height={'100%'}
>
<div className={"clearfix educontent pr"}>
@ -145,7 +186,7 @@ class NewShixunModel extends Component{
style={{ width: "800px"}}
className="packinput"
placeholder="实训信息 / 院校名称 / 创建者"
value={this.state.keywords}
value={this.state.search}
enterButton={<span>搜索</span>}
onInput={(e)=>this.setdatafunsval(e)}
onSearch={ (value)=>this.setdatafuns(value)} />
@ -155,14 +196,14 @@ class NewShixunModel extends Component{
<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 pointer mr30">
<a className={" color-grey-6"}>学习人数</a>
<sapn className="relativef ml5 " onClick={()=>this.updatedlist(sort_by)}>
<i className={"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue"}></i>
<i className={"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
<a className={" color-grey-6"} onClick={()=>this.updatedlist(order)}>学习人数</a>
<sapn className="relativef ml5 " >
<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={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>
</span>
@ -174,28 +215,16 @@ class NewShixunModel extends Component{
</p>
<p className="font-12 alltopiscright ml25 fr">
<span className="fr mr30 topcsactive pointer color-grey-3">我的实训</span>
<span className="fr mr30 topcsactive pointer color-grey-3 color-blue">全部实训</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={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 topcsactive pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部实训</span>
</p>
</div>
{/*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*/}
<Checkbox.Group onChange={()=>this.getGrouplist()} value={Grouplist}>
<Checkbox.Group onChange={this.getGrouplist} value={Grouplist}>
{shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{
console.log(item.content)
return(
<div className="mt20 edu-back-white pd20 relativef newshixunlist" key={key}>
<div className="clearfix">
@ -204,7 +233,7 @@ class NewShixunModel extends Component{
<Checkbox
value={item.id}
key={item.id}
className="fl task-hide edu-txt-left"
className="fl task-hide edu-txt-left mt3"
name="shixun_homework[]"
></Checkbox>
<a title={item.title} className="ml15 fl font-16 color-dark maxwidth900">
@ -212,22 +241,17 @@ class NewShixunModel extends Component{
</a>
<div className="cl"></div>
<p className="newshixunmodelmidfont">
{/*{item.content}*/}
{item.challenge_names.map((item,key)=>{
return(
<span>{item}</span>
)
})}
</p>
{JSON.stringify(item.content) == "{}"?"":<p className="newshixunmodelmidfont">
{/*{item.description}*/}
</p>}
<p className="newshixunmodelbotfont">
{item.challenge_names.length===0?"":<p className="newshixunmodelbotfont">
{item.challenge_names.map((item,key)=>{
return(
<span>{item}</span>
)
})}
</p>
</p>}
<div className={"newshixunpd030"}>
<div className="xuxianpro"></div>
@ -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}
/>
</div>:""}
<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>
</div>

@ -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 {

@ -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{
<div>
{/*新版实训model*/}
<NewShixunModel
{NewShixunModelType===true?<NewShixunModel
{...this.props}
{...this.state}
type={'shixuns'}
/>
hideNewShixunModelType={()=>this.hideNewShixunModelType()}
/>:""}
{/*提示*/}
@ -1061,7 +1074,7 @@ class ShixunHomework extends Component{
</span>:
<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?<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>
</p>

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

Loading…
Cancel
Save