From 70dd51d1cdc251f4e0f06531e4a24dc3c5a84650 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Thu, 25 Nov 2021 13:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=A1=A8=E6=A0=BC=E9=A1=B5?= =?UTF-8?q?=E7=A0=81tab=E5=88=87=E6=8D=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 12 ++++++++---- src/components/pagination/main.js | 14 +++++++++++--- src/pages/exchangecode/list/list.js | 10 +++++++--- src/pages/exchangepage/edittemplate/main.js | 12 +++++++++--- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 6506dbe7..77bdd89e 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -28,6 +28,7 @@ export default class menu extends React.Component { isShowPageBar:true, //是否显示页码 isMultiple: true, isSwitch: true, + page:'', headBackgroud: "", spliteColor: "#f9fafc", countbarVisible:true, @@ -255,10 +256,8 @@ export default class menu extends React.Component { } componentWillReceiveProps(nextProps) { - - this.setState({tableData: nextProps.tableData}); - + this.setState({page: nextProps.page}); this.setState( {dataCount:nextProps.dataCount}) } @@ -302,6 +301,9 @@ export default class menu extends React.Component { this.setState({pageLoading:false}) },500) } + pageShow(e){ + console.log('page',e); + } gridEditChange(e){ } @@ -312,7 +314,7 @@ export default class menu extends React.Component { return selectList } - + render() { const { @@ -567,6 +569,8 @@ export default class menu extends React.Component { this.props.pageChange(e); } } + page={this.props.page} + pageFn={(e)=>this.setState({page:e})} onNextClick = { (e) => { console.log("下一页页码",e) diff --git a/src/components/pagination/main.js b/src/components/pagination/main.js index 43b8c5e2..ffdb45ff 100644 --- a/src/components/pagination/main.js +++ b/src/components/pagination/main.js @@ -10,13 +10,14 @@ import _ from "lodash"; super(props); this.state = { count:10, - page:1, //当前页 + page:props.page|1, //当前页 visible:false, jump_page:"", page_num:"", dataCount:this.props.data - } - } + } + } + getPageArr(pages, current, viewsize){ @@ -89,6 +90,7 @@ import _ from "lodash"; } this.setState({page:e}) + this.props.pageFn(e); this.props.onJumpPage(e) } onInputChange(e,page_num){ @@ -131,6 +133,12 @@ import _ from "lodash"; } this.setState({ visible: false }) } + componentWillMount(){ + } + componentWillReceiveProps(nextProps) { + this.setState({page: nextProps.page}); + } + render() { const { data} = this.props; let page_num =Math.ceil( data.count / this.state.count); diff --git a/src/pages/exchangecode/list/list.js b/src/pages/exchangecode/list/list.js index ca3b4922..7c858b7d 100644 --- a/src/pages/exchangecode/list/list.js +++ b/src/pages/exchangecode/list/list.js @@ -171,7 +171,11 @@ export default class acclist extends React.Component{ } tabFn(index){ this.setState({tabIndex:index}) - this.getCodeListFn({},index); + this.setState({page:1}) + setTimeout(() => { + this.getCodeListFn({},index); + }, 10); + } //page pageChange(e){ @@ -344,10 +348,10 @@ componentDidUpdate(prevProps,prevState){ maxheight={this.state.tableHeight} countbarVisible={false} isSwitch={false} - + page={this.state.page} dataCount={this.state.total} isMultiple={false} - pageChange={(e)=>{ + pageChange={(e)=>{ this.pageChange(e) }} countChange={ diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index e99eb25a..8943fb0d 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -135,7 +135,9 @@ export default class edittemplate extends React.Component{ putMyTheme(this.state.model.id,formdata).then((res)=>{ handelResponse(res,(req,msg)=>{ - Notify.success("保存成功") + Notify.success("保存成功") + + },(err)=>{ Notify.error(err) }) @@ -150,8 +152,12 @@ export default class edittemplate extends React.Component{ addTheme(formdata).then((res)=>{ handelResponse(res,(req,msg)=>{ - Notify.success("保存成功") - + Notify.success("保存213213成功") + setTimeout(() => { + let link = window.location.href.replace(window.location.hash,"#/home/myexchangetemplate"); + window.open(link, "_blank") + }, 2000); + },(err)=>{ Notify.error(err) })