Commit 4ab8124c by wangshuo

精品特惠 赚奖学金 tab替换

parent c047e3d2
...@@ -43,7 +43,8 @@ class Preferential extends Component { ...@@ -43,7 +43,8 @@ class Preferential extends Component {
http.get(`${API.home}/m/home/bargainZone`).then((res) => { http.get(`${API.home}/m/home/bargainZone`).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
dataList: res.data.data dataList: res.data.data,
isLoading: false,
}) })
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
...@@ -55,7 +56,8 @@ class Preferential extends Component { ...@@ -55,7 +56,8 @@ class Preferential extends Component {
http.get(`${API.home}/m/home/grouponList`).then((res) => { http.get(`${API.home}/m/home/grouponList`).then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ this.setState({
dataList: res.data.data dataList: res.data.data,
isLoading: false,
}) })
} else { } else {
Toast.info(res.data.msg, 2) Toast.info(res.data.msg, 2)
...@@ -64,7 +66,10 @@ class Preferential extends Component { ...@@ -64,7 +66,10 @@ class Preferential extends Component {
} }
// tab 切换 // tab 切换
ontabclick = (tab, index) => { ontabclick = (tab, index) => {
this.state.courseStatus = index this.setState({
courseStatus: index,
isLoading: true,
})
switch (index) { switch (index) {
case 0: case 0:
this.specialSale() this.specialSale()
...@@ -104,10 +109,12 @@ class Preferential extends Component { ...@@ -104,10 +109,12 @@ class Preferential extends Component {
animated={false} animated={false}
onChange={(tab, index) => this.ontabclick(tab, index)} onChange={(tab, index) => this.ontabclick(tab, index)}
swipeable={false} swipeable={false}
page={this.state.courseStatus}
renderTabBar={props => <div className={'custom-tab-bar'}> renderTabBar={props => <div className={'custom-tab-bar'}>
<Tabs.DefaultTabBar {...props}/> <Tabs.DefaultTabBar {...props}/>
</div>} </div>}
> >
</Tabs>
<div className='tabs'> <div className='tabs'>
<ul> <ul>
{this.state.dataList.map((item, index) => { {this.state.dataList.map((item, index) => {
...@@ -163,7 +170,6 @@ class Preferential extends Component { ...@@ -163,7 +170,6 @@ class Preferential extends Component {
</ul> </ul>
</div> </div>
</Tabs>
<WhiteSpace/> <WhiteSpace/>
</div> </div>
</Loading> </Loading>
......
...@@ -31,6 +31,7 @@ class _Scholarship extends Component { ...@@ -31,6 +31,7 @@ class _Scholarship extends Component {
isLoading: false, isLoading: false,
showNoData: false, showNoData: false,
hasMore: true, hasMore: true,
tab: 0,
} }
this.downImage = React.createRef(); this.downImage = React.createRef();
this.tabIndex = 0; this.tabIndex = 0;
...@@ -307,6 +308,7 @@ class _Scholarship extends Component { ...@@ -307,6 +308,7 @@ class _Scholarship extends Component {
isLoading: false, isLoading: false,
hasMore: true, hasMore: true,
dataSource: this.state.dataSource.cloneWithRows(this.rData), dataSource: this.state.dataSource.cloneWithRows(this.rData),
tab: index,
}, },
() => { () => {
this.onEndReached(); this.onEndReached();
...@@ -314,6 +316,9 @@ class _Scholarship extends Component { ...@@ -314,6 +316,9 @@ class _Scholarship extends Component {
); );
}} }}
> >
</Tabs>
{
this.state.tab === 0 ? (
<div style={{ marginTop: '15px', backgroundColor: '#FFF' }}> <div style={{ marginTop: '15px', backgroundColor: '#FFF' }}>
{ {
this.state.dataSource._cachedRowCount !== 0 ? ( this.state.dataSource._cachedRowCount !== 0 ? (
...@@ -332,6 +337,11 @@ class _Scholarship extends Component { ...@@ -332,6 +337,11 @@ class _Scholarship extends Component {
} }
</div> </div>
) : null
}
{
this.state.tab === 1 ? (
<div> <div>
<Flex justify='center' align='center' className={'runtimeList'}>榜单实时更新,仅显示前50</Flex> <Flex justify='center' align='center' className={'runtimeList'}>榜单实时更新,仅显示前50</Flex>
{ {
...@@ -350,7 +360,8 @@ class _Scholarship extends Component { ...@@ -350,7 +360,8 @@ class _Scholarship extends Component {
) )
} }
</div> </div>
</Tabs> ) : null
}
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment