Commit 88418b6c by wangshuo

分销排行榜接口调试

parent 6cb99529
...@@ -7,7 +7,7 @@ export default class CategoryItem extends Component { ...@@ -7,7 +7,7 @@ export default class CategoryItem extends Component {
super(props); super(props);
} }
render() { render() {
const {category_name, price1, price0, first_level_tip, image_name, upgrade, upgradeImg} = this.props; const {course_title, price1, price0, first_level_tip, image_name, upgrade, upgradeImg} = this.props;
return ( return (
<WingBlank> <WingBlank>
<div className={'category'}> <div className={'category'}>
...@@ -21,7 +21,7 @@ export default class CategoryItem extends Component { ...@@ -21,7 +21,7 @@ export default class CategoryItem extends Component {
</div> </div>
<div className={'content'}> <div className={'content'}>
<Flex direction='column' justify='around' align='start' style={{height: '90px'}}> <Flex direction='column' justify='around' align='start' style={{height: '90px'}}>
<p className={'text-overflow-one'}>{category_name}</p> <p className={'text-overflow-one'}>{course_title}</p>
<p><span className={'priceNow'}>{`¥${price1}`}</span><span className={'pricePrimary'}>{`¥${price0}`}</span></p> <p><span className={'priceNow'}>{`¥${price1}`}</span><span className={'pricePrimary'}>{`¥${price0}`}</span></p>
<div className={'shareMoney'} >{`分享赚${first_level_tip}元`}</div> <div className={'shareMoney'} >{`分享赚${first_level_tip}元`}</div>
</Flex> </Flex>
......
...@@ -12,15 +12,15 @@ export default class SortItem extends Component { ...@@ -12,15 +12,15 @@ export default class SortItem extends Component {
super(props); super(props);
} }
render() { render() {
const { sortNum, avatar, shareName, money } = this.props; const { sortNum, avatar_file, user_name, total_account } = this.props;
let sortImgSrc = ''; let sortImgSrc = '';
if(sortNum === '1') { if(sortNum === 1) {
sortImgSrc = FIRST; sortImgSrc = FIRST;
} }
if(sortNum === '2') { if(sortNum === 2) {
sortImgSrc = SECOND; sortImgSrc = SECOND;
} }
if(sortNum === '3') { if(sortNum === 3) {
sortImgSrc = THIRD; sortImgSrc = THIRD;
} }
return ( return (
...@@ -35,12 +35,12 @@ export default class SortItem extends Component { ...@@ -35,12 +35,12 @@ export default class SortItem extends Component {
</div> </div>
<div className={'avatar'}> <div className={'avatar'}>
<Flex justify='start'> <Flex justify='start'>
<img src={avatar} className={'avatarImg'}></img> <img src={avatar_file} className={'avatarImg'}></img>
<span className={'text-overflow-one'} style={{color: '#333333'}}>{shareName}</span> <span className={'text-overflow-one'} style={{color: '#333333'}}>{user_name}</span>
</Flex> </Flex>
</div> </div>
<div className={'money'}> <div className={'money'}>
<Flex justify='center'>{`${money}元`}</Flex> <Flex justify='center'>{`${total_account}元`}</Flex>
</div> </div>
</Flex> </Flex>
</div> </div>
......
...@@ -96,21 +96,34 @@ class _Scholarship extends Component { ...@@ -96,21 +96,34 @@ class _Scholarship extends Component {
isLoading: true, isLoading: true,
}); });
http.get(`${api.home}/m/dist/course_list`).then((res) => { let apiUrl = `${api.home}/m/dist/course_list`;
if (this.tabIndex === 1) { apiUrl = `${api.home}/m/dist/commission_ranking_list` };
http.get(apiUrl).then((res) => {
console.log(res);
if (res.data.code !== 200) { if (res.data.code !== 200) {
this.setState({ isLoading: false }); this.setState({ isLoading: false });
return; return;
} }
if (!res.data.data.list || res.data.data.list.length === 0) {
this.setState({ isLoading: false, hasMore: false, showNoData: this.searchObject.page === 1 }); let newData = [];
return; if(this.tabIndex === 0) {
if (!res.data.data.list || res.data.data.list.length === 0) {
this.setState({ isLoading: false, hasMore: false, showNoData: this.searchObject.page === 1 });
return;
}
newData = res.data.data.list;
} else {
if (!res.data.data || res.data.data.length === 0) {
this.setState({ isLoading: false, hasMore: false, showNoData: this.searchObject.page === 1 });
return;
}
newData = res.data.data;
} }
console.log(res);
this.searchObject.page++; this.searchObject.page++;
const newData = res.data.data.list;
this.rData = [...this.rData, ...newData]; this.rData = [...this.rData, ...newData];
this.setState({ this.setState({
...@@ -133,7 +146,6 @@ class _Scholarship extends Component { ...@@ -133,7 +146,6 @@ class _Scholarship extends Component {
this.onEndReached(); this.onEndReached();
} }
render() { render() {
console.log(this.props);
const row = ( const row = (
rowData, rowData,
rowID rowID
...@@ -142,10 +154,10 @@ class _Scholarship extends Component { ...@@ -142,10 +154,10 @@ class _Scholarship extends Component {
}; };
const row1 = ( const row1 = (
rowData, rowData,
rowID rowID
) => { ) => {
return <SortItem {...rowData} key={rowID} />; return <SortItem {...rowData} sortNum={this.rData.indexOf(rowData) + 1} key={rowID} />;
}; };
const separator = (sectionID, rowID) => ( const separator = (sectionID, rowID) => (
...@@ -162,6 +174,7 @@ class _Scholarship extends Component { ...@@ -162,6 +174,7 @@ class _Scholarship extends Component {
waitMoneyDetail, waitMoneyDetail,
codeSrc, codeSrc,
} = this.state; } = this.state;
const { hasError } = this.props.user;
return ( return (
<div className={'scholarship'}> <div className={'scholarship'}>
<div className={'account-container'}> <div className={'account-container'}>
...@@ -181,7 +194,7 @@ class _Scholarship extends Component { ...@@ -181,7 +194,7 @@ class _Scholarship extends Component {
</WingBlank> </WingBlank>
<WhiteSpace></WhiteSpace> <WhiteSpace></WhiteSpace>
{ {
this.tabIndex === 0 ? ( hasError ? (
<> <>
<WhiteSpace></WhiteSpace> <WhiteSpace></WhiteSpace>
<Flex justify='center'> <Flex justify='center'>
...@@ -205,7 +218,7 @@ class _Scholarship extends Component { ...@@ -205,7 +218,7 @@ class _Scholarship extends Component {
<div className={'over-am-list-item'} > <div className={'over-am-list-item'} >
{ {
this.tabIndex === 0 ? (null) : ( hasError ? (null) : (
<> <>
<div> <div>
<List> <List>
...@@ -225,7 +238,7 @@ class _Scholarship extends Component { ...@@ -225,7 +238,7 @@ class _Scholarship extends Component {
</> </>
) )
} }
<div style={{backgroundColor: '#FFF'}}> <div style={{ backgroundColor: '#FFF' }}>
<Tabs tabs={this.tabList} <Tabs tabs={this.tabList}
initialPage={0} initialPage={0}
// onChange={this.changeTab} // onChange={this.changeTab}
...@@ -235,18 +248,18 @@ class _Scholarship extends Component { ...@@ -235,18 +248,18 @@ class _Scholarship extends Component {
this.rData = []; this.rData = [];
this.searchObject.page = 1; this.searchObject.page = 1;
this.setState( this.setState(
{ {
isLoading: false, isLoading: false,
hasMore: true, hasMore: true,
dataSource: this.state.dataSource.cloneWithRows(this.rData), dataSource: this.state.dataSource.cloneWithRows(this.rData),
}, },
() => { () => {
this.onEndReached(); this.onEndReached();
} }
); );
}} }}
> >
<div style={{ marginTop: '15px', backgroundColor: '#FFF'}}> <div style={{ marginTop: '15px', backgroundColor: '#FFF' }}>
{ {
this.state.dataSource._cachedRowCount !== 0 ? ( this.state.dataSource._cachedRowCount !== 0 ? (
<ListView <ListView
...@@ -355,19 +368,18 @@ class _Scholarship extends Component { ...@@ -355,19 +368,18 @@ class _Scholarship extends Component {
} }
} }
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
console.log(state);
return { return {
user: { user: {
...state.user
}, },
}; };
}; };
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return {}; return {};
}; };
export const Scholarship = connect( export const Scholarship = connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(_Scholarship); )(_Scholarship);
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