Commit 4ab8124c by wangshuo

精品特惠 赚奖学金 tab替换

parent c047e3d2
......@@ -43,7 +43,8 @@ class Preferential extends Component {
http.get(`${API.home}/m/home/bargainZone`).then((res) => {
if (res.data.code === 200) {
this.setState({
dataList: res.data.data
dataList: res.data.data,
isLoading: false,
})
} else {
Toast.info(res.data.msg, 2)
......@@ -55,7 +56,8 @@ class Preferential extends Component {
http.get(`${API.home}/m/home/grouponList`).then((res) => {
if (res.data.code === 200) {
this.setState({
dataList: res.data.data
dataList: res.data.data,
isLoading: false,
})
} else {
Toast.info(res.data.msg, 2)
......@@ -64,7 +66,10 @@ class Preferential extends Component {
}
// tab 切换
ontabclick = (tab, index) => {
this.state.courseStatus = index
this.setState({
courseStatus: index,
isLoading: true,
})
switch (index) {
case 0:
this.specialSale()
......@@ -104,66 +109,67 @@ class Preferential extends Component {
animated={false}
onChange={(tab, index) => this.ontabclick(tab, index)}
swipeable={false}
page={this.state.courseStatus}
renderTabBar={props => <div className={'custom-tab-bar'}>
<Tabs.DefaultTabBar {...props}/>
</div>}
>
<div className='tabs'>
<ul>
{this.state.dataList.map((item, index) => {
const Info = (
<div className="info">
<p className='title' onClick={() => this.toCourseDetail(item.course_id)}>
{/* <Link to={`/detail?id=${item.course_id}`}> */}
{item.course_title}
{/* </Link> */}
</p>
<p className='contact text-overflow-2'>{item.course_desc}</p>
<div className='des'>
{!item.is_buy &&
<p className="course-price">
{this.state.courseStatus === 0 &&
<span className='price'>特惠价:</span>
}
<span className="new">¥{item.price1}</span>
<span className="old">¥{item.price0}</span>
</p>
}
{item.is_buy &&
<a className="isbuy">已购买</a>
</Tabs>
<div className='tabs'>
<ul>
{this.state.dataList.map((item, index) => {
const Info = (
<div className="info">
<p className='title' onClick={() => this.toCourseDetail(item.course_id)}>
{/* <Link to={`/detail?id=${item.course_id}`}> */}
{item.course_title}
{/* </Link> */}
</p>
<p className='contact text-overflow-2'>{item.course_desc}</p>
<div className='des'>
{!item.is_buy &&
<p className="course-price">
{this.state.courseStatus === 0 &&
<span className='price'>特惠价:</span>
}
</div>
</div>
)
const status = (
!item.is_buy &&
<div>
{this.state.courseStatus === 1 &&
<p className='course-status'>砍价减{item.bargain_price}</p>
}
{this.state.courseStatus === 2 &&
<p className='course-status'>拼团价{item.price}</p>
<span className="new">¥{item.price1}</span>
<span className="old">¥{item.price0}</span>
</p>
}
{
item.is_aist && <span className='return_cash'></span>
{item.is_buy &&
<a className="isbuy">已购买</a>
}
</div>
)
return (
<VList
key={index}
img={item.image_name}
id={item.course_id}
status={status}
info={Info}
toDetail={this.toCourseDetail}
/>
)
})}
</ul>
</div>
)
const status = (
!item.is_buy &&
<div>
{this.state.courseStatus === 1 &&
<p className='course-status'>砍价减{item.bargain_price}</p>
}
{this.state.courseStatus === 2 &&
<p className='course-status'>拼团价{item.price}</p>
}
{
item.is_aist && <span className='return_cash'></span>
}
</div>
)
return (
<VList
key={index}
img={item.image_name}
id={item.course_id}
status={status}
info={Info}
toDetail={this.toCourseDetail}
/>
)
})}
</ul>
</div>
</Tabs>
</div>
<WhiteSpace/>
</div>
</Loading>
......
......@@ -31,6 +31,7 @@ class _Scholarship extends Component {
isLoading: false,
showNoData: false,
hasMore: true,
tab: 0,
}
this.downImage = React.createRef();
this.tabIndex = 0;
......@@ -307,6 +308,7 @@ class _Scholarship extends Component {
isLoading: false,
hasMore: true,
dataSource: this.state.dataSource.cloneWithRows(this.rData),
tab: index,
},
() => {
this.onEndReached();
......@@ -314,43 +316,52 @@ class _Scholarship extends Component {
);
}}
>
<div style={{ marginTop: '15px', backgroundColor: '#FFF' }}>
{
this.state.dataSource._cachedRowCount !== 0 ? (
<ListView
useBodyScroll={this.state.useBodyScroll}
dataSource={this.state.dataSource}
renderRow={row}
renderBodyComponent={() => <div />}
onEndReached={this.onEndReached}
pageSize={4}
onEndReachedThreshold={100}
/>
) : (
</Tabs>
{
this.state.tab === 0 ? (
<div style={{ marginTop: '15px', backgroundColor: '#FFF' }}>
{
this.state.dataSource._cachedRowCount !== 0 ? (
<ListView
useBodyScroll={this.state.useBodyScroll}
dataSource={this.state.dataSource}
renderRow={row}
renderBodyComponent={() => <div />}
onEndReached={this.onEndReached}
pageSize={4}
onEndReachedThreshold={100}
/>
) : (
null
)
}
}
</div>
) : null
}
</div>
<div>
<Flex justify='center' align='center' className={'runtimeList'}>榜单实时更新,仅显示前50</Flex>
{
this.state.dataSource._cachedRowCount !== 0 ? (
<ListView
useBodyScroll={this.state.useBodyScroll}
dataSource={this.state.dataSource}
renderRow={row1}
renderBodyComponent={() => <div />}
onEndReached={this.onEndReached}
pageSize={4}
onEndReachedThreshold={100}
/>
) : (
{
this.state.tab === 1 ? (
<div>
<Flex justify='center' align='center' className={'runtimeList'}>榜单实时更新,仅显示前50</Flex>
{
this.state.dataSource._cachedRowCount !== 0 ? (
<ListView
useBodyScroll={this.state.useBodyScroll}
dataSource={this.state.dataSource}
renderRow={row1}
renderBodyComponent={() => <div />}
onEndReached={this.onEndReached}
pageSize={4}
onEndReachedThreshold={100}
/>
) : (
null
)
}
</div>
</Tabs>
}
</div>
) : null
}
</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