罗广聪

首页入口

... ... @@ -54,6 +54,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
... ... @@ -80,9 +81,10 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
... ...
... ... @@ -17,7 +17,6 @@ import Swiper from "react-native-swiper";
export default class Home extends Component {
constructor(props) {
super(props);
this._renderMap = this._renderMap.bind(this);
this._swiper = this._swiper.bind(this);
this.state = {
ListData: [],
... ... @@ -33,9 +32,10 @@ export default class Home extends Component {
}
componentWillMount() {
this.getListData();
// this.getBannar();
}
componentDidMount() {}
getListData() {
let that = this;
return fetch(`https://devpay.brae.co/test/insurance/topic`, {
... ... @@ -58,11 +58,12 @@ export default class Home extends Component {
} else {
that.setState({
ListData: respJson.data.topic
})
console.log("首页列表",this.state.ListData)
});
console.log("首页列表", this.state.ListData);
}
});
}
getBannar() {
let that = this;
return fetch(`https://devpay.brae.co/test/insurance/banner`, {
... ... @@ -85,35 +86,12 @@ export default class Home extends Component {
} else {
that.setState({
swiperImgList: respJson.data.banner
})
console.log("bannar图",respJson.data.banner)
});
console.log("bannar图", respJson.data.banner);
}
});
}
_renderMap() {
const { navigate } = this.props.navigation;
return this.state.ListData.map((item, index) => {
return (
<TouchableOpacity
style={styles.itemContainer}
key={index}
onPress={() => navigate("CommonWebView", { item: item })}
>
<View style={styles.itemImgWrapper}>
<Image source={item.imgurl} style={{ width: 74, height: 74 }} />
</View>
<View style={styles.itemRightWrapper}>
<Text style={styles.itemTextTop} numberOfLines={1}>
{item.title}
</Text>
<Text style={styles.itemTextBottom} numberOfLines={1}>
{item.context}
</Text>
</View>
</TouchableOpacity>
);
});
}
_swiper() {
const { navigate } = this.props.navigation;
const { height, width } = Dimensions.get("window");
... ... @@ -150,15 +128,21 @@ export default class Home extends Component {
</View>
);
}
render() {
// console.log("首页的this.props", this);
// console.log("render首页文章列表", this.state.ListData);
const { navigate } = this.props.navigation;
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
const ds = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2
});
const dataSource = ds.cloneWithRows(this.state.ListData);
return (
<View style={styles.container}>
{/* 轮播图 */}
{this._swiper()}
{/* 保险产品入口 */}
<TouchableOpacity
style={styles.midContainer}
onPress={() => navigate("AllProduct")}
... ... @@ -173,17 +157,33 @@ export default class Home extends Component {
style={styles.midArrow}
/>
</TouchableOpacity>
{/* 智能方案和健康问卷入口 */}
<View style={styles.AIAndHealthContainer}>
<TouchableOpacity style={styles.AHContainer}>
<Image style={styles.AHIcon} />
<Text style={styles.AHText}>智能方案</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.AHContainer}>
<Image style={styles.AHIcon} />
<Text style={styles.AHText}>健康问卷</Text>
</TouchableOpacity>
</View>
<View style={styles.textContainer}>
<Text style={styles.minText}>保险头条</Text>
</View>
{/* 保险头条列表 */}
<ListView
dataSource={dataSource}
enableEmptySections = {true}
enableEmptySections={true}
renderRow={(item, index) => {
return (
<TouchableOpacity
style={styles.itemContainer}
onPress={() => navigate("ArticleTemplate", { item: item, model: "topic" })}
onPress={() =>
navigate("ArticleTemplate", { item: item, model: "topic" })}
>
<View style={styles.itemImgWrapper}>
<Image
... ... @@ -203,36 +203,6 @@ export default class Home extends Component {
);
}}
/>
{/* <ScrollView
style={styles.listContainer}
automaticallyAdjustContentInsets={false}
>
{this.state.ListData.map((item, index) => {
return (
<TouchableOpacity
style={styles.itemContainer}
key={index}
onPress={() => navigate("ArticleTemplate", { item: item })}
>
<View style={styles.itemImgWrapper}>
<Image
source={{uri: item.image}}
style={{ width: 74, height: 74 }}
/>
</View>
<View style={styles.itemRightWrapper}>
<Text style={styles.itemTextTop} numberOfLines={1}>
{item.title}
</Text>
<Text style={styles.itemTextBottom} numberOfLines={1}>
{item.summary}
</Text>
</View>
</TouchableOpacity>
);
})}
<Text style={styles.scrollViewText}>没有更多了</Text>
</ScrollView> */}
</View>
);
}
... ... @@ -276,6 +246,17 @@ const styles = StyleSheet.create({
position: "absolute",
right: 15
},
AIAndHealthContainer: {
flexDirection: "row",
justifyContent: "space-around",
alignItems: "center",
marginTop: 10,
// marginBottom: 10,
backgroundColor: "white",
},
AHContainer: {},
AHIcon: {},
AHText: {},
textContainer: {
backgroundColor: "#fff",
marginTop: 10,
... ...