...
|
...
|
@@ -37,16 +37,27 @@ export default class ScreenSub extends Component { |
|
|
let obj = resource&&resource.get('filterSub')?resource.get('filterSub'):null;
|
|
|
let key = obj?obj.get('key'):null;
|
|
|
let list = obj?obj.get('list'):null;
|
|
|
let keyLists = obj?obj.get('keyList'):null;
|
|
|
let specialList = obj?obj.get('specialList'):null;
|
|
|
|
|
|
if (key == 'brand') {
|
|
|
let dataSourceList = list?list.toJS():{};
|
|
|
let keyList = list.keySeq()?list.keySeq().toJS():[];
|
|
|
keyList.shift();
|
|
|
let keyList = keyLists?keyLists.toJS():[];
|
|
|
let object = specialList?specialList.toJS():[];
|
|
|
if (object && object.length>0) {
|
|
|
keyList.unshift('#');
|
|
|
}
|
|
|
let y = 30 + 40;
|
|
|
for (var i = 0; i < keyList.length; i++) {
|
|
|
if (sectionID == keyList[i]) {
|
|
|
break;
|
|
|
}
|
|
|
let count = dataSourceList[keyList[i]].length;
|
|
|
let count = 0;
|
|
|
if (keyList[i] == '#') {
|
|
|
count = object.length;
|
|
|
}else {
|
|
|
count = dataSourceList[keyList[i]].length;
|
|
|
}
|
|
|
y = y + 30 + 40 * count;
|
|
|
}
|
|
|
this.refs.brandList && this.refs.brandList.scrollTo({x: 0, y: y, animated: false});
|
...
|
...
|
@@ -54,9 +65,13 @@ export default class ScreenSub extends Component { |
|
|
}
|
|
|
|
|
|
renderSectionHeader(sectionData, sectionID) {
|
|
|
let title = sectionID;
|
|
|
if (sectionID == '特殊') {
|
|
|
title = '#';
|
|
|
}
|
|
|
return(
|
|
|
<View style={styles.Header}>
|
|
|
<Text style={styles.HeaderText}>{sectionID}</Text>
|
|
|
<Text style={styles.HeaderText}>{title}</Text>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -71,29 +86,47 @@ export default class ScreenSub extends Component { |
|
|
);
|
|
|
}
|
|
|
|
|
|
|
|
|
render() {
|
|
|
let {resource} = this.props;
|
|
|
|
|
|
let obj = resource&&resource.get('filterSub')?resource.get('filterSub'):null;
|
|
|
let key = obj?obj.get('key'):null;
|
|
|
let list = obj?obj.get('list'):null;
|
|
|
|
|
|
if (key == 'brand') {
|
|
|
let object = obj?obj.toJS():null;
|
|
|
let keyList = obj?obj.get('keyList'):null;
|
|
|
let keyLists = keyList?keyList.toJS():[];
|
|
|
let allObj = object?object.allObj:null;
|
|
|
let specialList = object?object.specialList:null;
|
|
|
let dataSourceList = list?list.toJS():{};
|
|
|
let keyList = list.keySeq()?list.keySeq().toJS():[];
|
|
|
keyList.shift();
|
|
|
keyList = Immutable.fromJS(keyList);
|
|
|
let dataSource = {};
|
|
|
|
|
|
if (specialList && specialList.length>0) {
|
|
|
keyLists.unshift('#');
|
|
|
dataSource = {
|
|
|
所有品牌: [allObj],
|
|
|
特殊: specialList,
|
|
|
...dataSourceList,
|
|
|
};
|
|
|
}else {
|
|
|
dataSource = {
|
|
|
所有品牌: [allObj],
|
|
|
...dataSourceList,
|
|
|
};
|
|
|
}
|
|
|
let ketList_new = Immutable.fromJS(keyLists);
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<ListView
|
|
|
ref='brandList'
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
enableEmptySections={true}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSourceList)}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
|
|
|
renderRow={this.renderRow}
|
|
|
renderSectionHeader={this.renderSectionHeader}
|
|
|
/>
|
|
|
<IndexListView dataSource={keyList.toArray()} onLetterPress={this.scrollToSection}/>
|
|
|
<IndexListView dataSource={ketList_new.toArray()} onLetterPress={this.scrollToSection}/>
|
|
|
</View>
|
|
|
);
|
|
|
}else {
|
...
|
...
|
|