吸顶处理

dev_aliyun_beta
杨树明 6 years ago
parent 743328681b
commit 4b3df80703

@ -22,7 +22,9 @@ class Ordering extends Component{
this.state={ this.state={
isSpin:false, isSpin:false,
antIcon:false, antIcon:false,
datas:undefined datas:undefined,
windowsscrollTop:false,
windowsscrollTopsum:0
} }
} }
@ -49,8 +51,44 @@ class Ordering extends Component{
isSpin:false isSpin:false
}) })
}) })
window.addEventListener('scroll', this.handleScroll.bind(this)) //监听滚动
// window.addEventListener('resize', this.handleResize.bind(this)) //监听窗口大小改变
}
// componentWillUnmount() { //一定要最后移除监听器以防多个组件之间导致this的指向紊乱
// window.removeEventListener('scroll', this.handleScroll.bind(this))
// window.removeEventListener('resize', this.handleResize.bind(this))
// }
handleScroll=(e)=>{
// console.log(
// '浏览器滚动事件',
// e.srcElement.scrollingElement.scrollTop,
// e.srcElement.scrollingElement.scrollHeight
// )
//e.srcElement.scrollingElement.scrollTop为距离滚动条顶部高度
// e.srcElement.scrollingElement.scrollHeight为整个文档高度
if(e.srcElement.scrollingElement.scrollTop>60){
this.setState({
windowsscrollTop:true,
windowsscrollTopsum:e.srcElement.scrollingElement.scrollTop
})
} }
if(e.srcElement.scrollingElement.scrollTop===0){
this.setState({
windowsscrollTop:false
})
}
}
//
// handleResize = e => {
// console.log('浏览器窗口大小改变事件', e.target.innerWidth)
// }
onDragEnd=(result)=>{ onDragEnd=(result)=>{
@ -112,16 +150,28 @@ class Ordering extends Component{
} }
render(){ render(){
let { let {
datas, datas,
Modalstype, Modalstype,
windowsscrollTop,
windowsscrollTopsum
}=this.state; }=this.state;
let main_id=this.props.match.params.main_id; let main_id=this.props.match.params.main_id;
let category_id=this.props.match.params.category_id; let category_id=this.props.match.params.category_id;
console.log(this.props) console.log(this.props)
console.log(window)
let positiontype=null;
if(windowsscrollTop===true){
positiontype={position:'fixed',zIndex:'9000',left:'20%',top: '0px'}
}else{
positiontype={}
}
return( return(
<div className={"mb200"}> <div className={"mb200"}>
@ -139,7 +189,7 @@ class Ordering extends Component{
<div className="educontent clearfix"> <div className="educontent clearfix">
<div className={"mt20 mb20"}> {windowsscrollTop===false?<div className={"mt20 mb20"}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item href={this.props.current_user&&this.props.current_user.first_category_url}>{this.props.current_user&&this.props.current_user.course_name}</Breadcrumb.Item> <Breadcrumb.Item href={this.props.current_user&&this.props.current_user.first_category_url}>{this.props.current_user&&this.props.current_user.course_name}</Breadcrumb.Item>
@ -147,16 +197,15 @@ class Ordering extends Component{
<Breadcrumb.Item>调整排序</Breadcrumb.Item> <Breadcrumb.Item>调整排序</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
</div> </div>:""}
<p className="clearfix bor-bottom-greyE edu-back-white orderingbox">
<p className="clearfix bor-bottom-greyE edu-back-white orderingbox"
style={positiontype}
>
<span>温馨提示请在列表中长按鼠标左键进行拖放排序完成排序后请点击保存</span> <span>温馨提示请在列表中长按鼠标左键进行拖放排序完成排序后请点击保存</span>
<Button className="fr orderingbtnleft" type="primary">保存</Button> <Button className="fr orderingbtnleft" type="primary">保存</Button>
<Button className="fr mr30 orderingbtnright">取消</Button> <Button className="fr mr30 orderingbtnright">取消</Button>
</p> </p>
@ -170,6 +219,7 @@ class Ordering extends Component{
ref={provided.innerRef} ref={provided.innerRef}
{...provided.droppableProps} {...provided.droppableProps}
className={"educontent mb50 mt40 droppableul"} className={"educontent mb50 mt40 droppableul"}
onScroll={this.contentViewScrolledit}
> >
{datas===undefined?"": {datas===undefined?"":
datas.map((item, index) => { datas.map((item, index) => {

Loading…
Cancel
Save