From 6b22732286fcc77a8312292446cea41d21530f03 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Fri, 21 Jan 2022 15:07:31 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E8=BF=87=E5=A4=9A=EF=BC=8C?= =?UTF-8?q?=E5=9B=9E=E5=88=B0=E9=A1=B6=E9=83=A8=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangepage/edittemplate/main.js | 2 +- src/pages/exchangepage/template/main.js | 20 ++++++++++++++------ src/pages/exchangepage/template/main.less | 14 ++++++++++++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index 49165b37..b13623a6 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -152,7 +152,7 @@ getLandingdata(val){ if(!this.state.model.top_image) { Notify.clear(); - Notify.error("请上落地页顶部banner") + Notify.error("请上传落地页顶部banner") this.setState({activeNavStatus:1}); return; } diff --git a/src/pages/exchangepage/template/main.js b/src/pages/exchangepage/template/main.js index 40e6638a..5a6d9246 100644 --- a/src/pages/exchangepage/template/main.js +++ b/src/pages/exchangepage/template/main.js @@ -19,7 +19,9 @@ import {handelResponse,getThemeType,getSystemTemplate,getTheme,copyThemecustom} // // // - +window.addEventListener('scroll',function(){ + console.log('滚动'); +}); export default class mytemplate extends React.Component{ constructor(props){ super(props) @@ -46,7 +48,6 @@ export default class mytemplate extends React.Component{ } componentDidMount(e){ //监听滚动条滚动事件 - let component=document.querySelector('.mytemplate'); let self=this; @@ -206,6 +207,12 @@ export default class mytemplate extends React.Component{ sessionStorage.setItem('pageChange',0); } + } + toTop(){ + this.refs.component.scrollTo({ + top:0, + behavior:'smooth', + }); } onBack(){ this.refs.preview.popPage() @@ -213,12 +220,12 @@ export default class mytemplate extends React.Component{ onClose(){ this.setState({preview_visible:false}) } - + render(){ return( -
-
+
+
@@ -230,7 +237,7 @@ export default class mytemplate extends React.Component{
-
+
@@ -339,6 +346,7 @@ export default class mytemplate extends React.Component{
+
到底部了哟,没有了哦
diff --git a/src/pages/exchangepage/template/main.less b/src/pages/exchangepage/template/main.less index 261d9990..5100ccd4 100644 --- a/src/pages/exchangepage/template/main.less +++ b/src/pages/exchangepage/template/main.less @@ -2253,7 +2253,7 @@ div.previewclose { } .scroller-page { - height: 100%; + height: 95vh; overflow: auto; position: relative; top: -2px @@ -2430,7 +2430,7 @@ div.previewclose { .scroller-page-body { height: 100%; - overflow: scroll; + // overflow: scroll; padding-top: 150px; position: relative } @@ -2548,3 +2548,13 @@ div.previewclose { background-color: var(--theme-default-hover-bg, var(--theme-primary-8, #e6efff)); z-index: 1; } +.toTopBtn{ + position: fixed; + bottom: 0; + width: 90px; + right: 2vh; + cursor: pointer; +} +.toTopBtn:hover{ + transform: scale(1.2); +} \ No newline at end of file From 24b82c46bd6b67ab3ccfa0614c0a65d707e32a4d Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Fri, 21 Jan 2022 15:38:37 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=9B=9E=E5=88=B0=E9=A1=B6=E9=83=A8=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangepage/template/main.js | 24 +++++++++++------------ src/pages/exchangepage/template/main.less | 21 +++++++++++++++----- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/pages/exchangepage/template/main.js b/src/pages/exchangepage/template/main.js index 5a6d9246..ee94d407 100644 --- a/src/pages/exchangepage/template/main.js +++ b/src/pages/exchangepage/template/main.js @@ -36,6 +36,7 @@ export default class mytemplate extends React.Component{ preview_visible:false, topbar:"", top:"", + toTopshow:false, center:"", bottom:"" } @@ -220,7 +221,12 @@ export default class mytemplate extends React.Component{ onClose(){ this.setState({preview_visible:false}) } - + mouseupFn(){ + this.setState({toTopshow:true}); + } + mouseoverFn(){ + this.setState({toTopshow:false}); + } render(){ return( @@ -334,19 +340,11 @@ export default class mytemplate extends React.Component{ ) }) } - - - - - - - - - - -
- +
+ + +
到底部了哟,没有了哦
diff --git a/src/pages/exchangepage/template/main.less b/src/pages/exchangepage/template/main.less index 5100ccd4..0c857a23 100644 --- a/src/pages/exchangepage/template/main.less +++ b/src/pages/exchangepage/template/main.less @@ -2548,13 +2548,24 @@ div.previewclose { background-color: var(--theme-default-hover-bg, var(--theme-primary-8, #e6efff)); z-index: 1; } -.toTopBtn{ +.toTop-canvas{ + width: 60px; + height: 60px; + border-radius: 60px; + background: #fff; + display: flex; + justify-content: center; + align-items: center; + box-shadow: 1px 2px 3px 3px #eee; position: fixed; - bottom: 0; - width: 90px; right: 2vh; + bottom:2vh; cursor: pointer; } -.toTopBtn:hover{ - transform: scale(1.2); +.toTopBtn{ + width: 40px; + fill-opacity: 0.2; +} +.toTop-canvas:hover{ + transform: scale(1.1); } \ No newline at end of file From 64ddb0f97d708e31e082dc78328131efd310a4d0 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Fri, 21 Jan 2022 15:59:43 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangepage/template/main.js | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/pages/exchangepage/template/main.js b/src/pages/exchangepage/template/main.js index ee94d407..4d407f55 100644 --- a/src/pages/exchangepage/template/main.js +++ b/src/pages/exchangepage/template/main.js @@ -37,6 +37,7 @@ export default class mytemplate extends React.Component{ topbar:"", top:"", toTopshow:false, + toTopFlag:false, center:"", bottom:"" } @@ -48,8 +49,7 @@ export default class mytemplate extends React.Component{ } componentDidMount(e){ - //监听滚动条滚动事件 - + let self=this; getThemeType().then(res=>{ @@ -74,13 +74,19 @@ export default class mytemplate extends React.Component{ }) }).catch(err=>{ }); - + //监听滚动条滚动事件 + this.refs.component.addEventListener('scroll',(event)=>{ + let scrolHeight=event.target.scrollTop; + console.log('滚动事件',event); + if(scrolHeight>300){ + this.setState({toTopFlag:true}); + }else{ + this.setState({toTopFlag:false}); + } + }) } - bindHandleScroll = (event) => { - console.log('滚动事件'); - console.log('滚动事件',event); - } + componentWillUnmount() { window.removeEventListener('scroll', this.bindHandleScroll); } @@ -341,10 +347,12 @@ export default class mytemplate extends React.Component{ }) }
-
- + { + this.state.toTopFlag?
+ +
:null + } -
到底部了哟,没有了哦
From cf0e21530e1e6cab9d9e4badd79c8eb85f685668 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Fri, 21 Jan 2022 17:11:16 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=95=B0=E6=8D=AE=E8=BF=87=E5=A4=9A=EF=BC=8C?= =?UTF-8?q?=E9=80=A0=E6=88=90=E5=8D=A1=E9=A1=BF=EF=BC=8C=E6=87=92=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangepage/template/main.js | 83 +++++++++++++++++++++---- 1 file changed, 70 insertions(+), 13 deletions(-) diff --git a/src/pages/exchangepage/template/main.js b/src/pages/exchangepage/template/main.js index 4d407f55..9625f31e 100644 --- a/src/pages/exchangepage/template/main.js +++ b/src/pages/exchangepage/template/main.js @@ -31,6 +31,7 @@ export default class mytemplate extends React.Component{ typeList:[{id:-1,title:"全部"}], tabIndex:0, sourceIndex:0, + page:1, typeIndex:0, system_template:[], preview_visible:false, @@ -38,6 +39,7 @@ export default class mytemplate extends React.Component{ top:"", toTopshow:false, toTopFlag:false, + endreq:true, center:"", bottom:"" } @@ -64,7 +66,7 @@ export default class mytemplate extends React.Component{ }) }).catch(err=>{ }); - let data={page:1,limit:10000} + let data={page:1,limit:10} getSystemTemplate(data).then(res=>{ handelResponse(res,(req,msg)=>{ this.setState({system_template:req.data}) @@ -77,9 +79,57 @@ export default class mytemplate extends React.Component{ //监听滚动条滚动事件 this.refs.component.addEventListener('scroll',(event)=>{ let scrolHeight=event.target.scrollTop; - console.log('滚动事件',event); if(scrolHeight>300){ this.setState({toTopFlag:true}); + let isBottom=event.target.scrollHeight-event.target.clientHeight; + if(isBottom==event.target.scrollTop){ + + let endreq=this.state.endreq; + if(endreq){ + let page=this.state.page;//请求 + page=page+1; + console.log(91,this.state); + let data={page:page,limit:10} + if(this.state.sourceIndex==0){//系统模板 + if(this.state.typeIndex>0){ + data.type_id=this.state.typeIndex; + } + let preResult=this.state.system_template; + getSystemTemplate(data).then(res=>{ + handelResponse(res,(req,msg)=>{ + if(req.data.length>0){ + let addres=preResult.concat(req.data) + this.setState({system_template:addres,page:page}) + }else{ + this.setState({endreq:false}); + } + + },(err)=>{ + + }) + }).catch(err=>{ + }); + }else{ + let preResult=this.state.system_template; + getTheme(data).then(res=>{ + handelResponse(res,(req,msg)=>{ + if(req.data.length>0){ + let addres=preResult.concat(req.data) + this.setState({system_template:addres,page:page}) + }else{ + this.setState({endreq:false}); + } + + + },(err)=>{ + + }) + }).catch(err=>{ + }); + } + + } + } }else{ this.setState({toTopFlag:false}); } @@ -98,25 +148,30 @@ export default class mytemplate extends React.Component{ window.location.href= "/#/edittemplate" } typeClick(e){ - this.setState({typeIndex:e}) + this.setState({typeIndex:e,page:1}) if(e == -1)//全部 { - let data={page:1,limit:10000} + let data={page:1,limit:10} getSystemTemplate(data).then(res=>{ handelResponse(res,(req,msg)=>{ console.log(req) - this.setState({system_template:req.data}) + this.setState({system_template:req.data}) + if(req.data.length<10){ + this.setState({endreq:false}); + } },(err)=>{ }) }).catch(err=>{ }); }else{ - let data={type_id:e,page:1,limit:10000} + let data={type_id:e,page:1,limit:10} getSystemTemplate(data).then(res=>{ handelResponse(res,(req,msg)=>{ this.setState({system_template:req.data}) - + if(req.data.length<10){ + this.setState({endreq:false}); + } },(err)=>{ }) @@ -126,14 +181,14 @@ export default class mytemplate extends React.Component{ } } sourceClick(e){ - this.setState({sourceIndex:e}) - + this.setState({sourceIndex:e,page:1,endreq:true}) + if(e == 0) { - let data={page:1,limit:10000} + let data={page:1,limit:10} getSystemTemplate(data).then(res=>{ handelResponse(res,(req,msg)=>{ - console.log(req) + this.setState({system_template:req.data}) },(err)=>{ @@ -143,7 +198,7 @@ export default class mytemplate extends React.Component{ }); } else{ - let data={page:1,limit:10000} + let data={page:1,limit:10} getTheme(data).then(res=>{ handelResponse(res,(req,msg)=>{ this.setState({system_template:req.data}) @@ -353,7 +408,9 @@ export default class mytemplate extends React.Component{ :null } -
到底部了哟,没有了哦
+
+ {this.state.endreq?'正在加载中...':'到底部了哟,没有了哦'} +
From 547d169992aa7c48b29bb10656dcdafca05d0e1a Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Fri, 21 Jan 2022 18:21:01 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=85=A8=E9=83=A8=E7=8A=B6=E6=80=81=E6=97=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangepage/template/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/exchangepage/template/main.js b/src/pages/exchangepage/template/main.js index 9625f31e..552374b0 100644 --- a/src/pages/exchangepage/template/main.js +++ b/src/pages/exchangepage/template/main.js @@ -91,7 +91,7 @@ export default class mytemplate extends React.Component{ console.log(91,this.state); let data={page:page,limit:10} if(this.state.sourceIndex==0){//系统模板 - if(this.state.typeIndex>0){ + if(this.state.typeIndex!=0){ data.type_id=this.state.typeIndex; } let preResult=this.state.system_template; @@ -148,8 +148,8 @@ export default class mytemplate extends React.Component{ window.location.href= "/#/edittemplate" } typeClick(e){ - this.setState({typeIndex:e,page:1}) - if(e == -1)//全部 + this.setState({typeIndex:e,page:1,endreq:true}) + if(e ==0)//全部 { let data={page:1,limit:10} getSystemTemplate(data).then(res=>{