Commit 88418b6c by wangshuo

分销排行榜接口调试

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