罗广聪

不知道改了啥,反正首页列表右边padding样式没解决,最好用上一个版本

@@ -6,7 +6,8 @@ import { @@ -6,7 +6,8 @@ import {
6 View, 6 View,
7 Image, 7 Image,
8 TouchableOpacity, 8 TouchableOpacity,
9 - ScrollView 9 + ScrollView,
  10 + FlatList
10 } from "react-native"; 11 } from "react-native";
11 import { StackNavigator, TabNavigator } from "react-navigation"; 12 import { StackNavigator, TabNavigator } from "react-navigation";
12 import Swiper from "react-native-swiper"; 13 import Swiper from "react-native-swiper";
@@ -25,53 +26,60 @@ export default class Home extends Component { @@ -25,53 +26,60 @@ export default class Home extends Component {
25 ListData: [ 26 ListData: [
26 { 27 {
27 title: "重疾、大病和防癌险,傻傻分不清?", 28 title: "重疾、大病和防癌险,傻傻分不清?",
  29 + key: 1,
28 context: "重疾险、大病保险和防癌险,这几大险种你能分得清吗?", 30 context: "重疾险、大病保险和防癌险,这几大险种你能分得清吗?",
29 - url: 31 + // context: "重疾险、大病保险和防癌险,这几大险...",
30 - "http://mp.weixin.qq.com/s/vSz_WuGpPYNMNpGQv-zxAQ", 32 + url: "http://mp.weixin.qq.com/s/vSz_WuGpPYNMNpGQv-zxAQ",
31 imgurl: require("../../assets/home/Headlines_重疾险.png") 33 imgurl: require("../../assets/home/Headlines_重疾险.png")
32 }, 34 },
33 { 35 {
34 title: "想为家里老人买份保险,怎么选?", 36 title: "想为家里老人买份保险,怎么选?",
  37 + key: 2,
35 context: "在如今的商业保险中,老年人的保险成为了很多人比较纠结的问题。", 38 context: "在如今的商业保险中,老年人的保险成为了很多人比较纠结的问题。",
36 - url: 39 + // context: "在如今的商业保险中,老年人的保险成...",
37 - "http://mp.weixin.qq.com/s/R_KuAzEVQCVKj7FUOzuHJw", 40 + url: "http://mp.weixin.qq.com/s/R_KuAzEVQCVKj7FUOzuHJw",
38 imgurl: require("../../assets/home/Headlines_中老年医疗险.png") 41 imgurl: require("../../assets/home/Headlines_中老年医疗险.png")
39 }, 42 },
40 { 43 {
41 title: "驾车远行需要做哪些保险准备?", 44 title: "驾车远行需要做哪些保险准备?",
  45 + key: 3,
42 context: "出行前我们需要做哪些准备工作,才能避免发生事故后的束手无策?", 46 context: "出行前我们需要做哪些准备工作,才能避免发生事故后的束手无策?",
43 - url: 47 + // context: "出行前我们需要做哪些准备工作,才能...",
44 - "http://mp.weixin.qq.com/s/Tkm4TrBEXqXJzC4FQdW2MQ", 48 + url: "http://mp.weixin.qq.com/s/Tkm4TrBEXqXJzC4FQdW2MQ",
45 imgurl: require("../../assets/home/Headlines_出驾远行.png") 49 imgurl: require("../../assets/home/Headlines_出驾远行.png")
46 }, 50 },
47 { 51 {
48 title: "选购儿童险,这几大原则也应注意!", 52 title: "选购儿童险,这几大原则也应注意!",
  53 + key: 4,
49 context: "认真对待关于孩子的保险问题,还需要注意投保时候的一些原则。", 54 context: "认真对待关于孩子的保险问题,还需要注意投保时候的一些原则。",
  55 + // context: "认真对待关于孩子的保险问题,还需...",
50 url: "http://mp.weixin.qq.com/s/iUEiBMik_3WMuxnAPFDXXQ", 56 url: "http://mp.weixin.qq.com/s/iUEiBMik_3WMuxnAPFDXXQ",
51 imgurl: require("../../assets/home/Headlines_儿童险.png") 57 imgurl: require("../../assets/home/Headlines_儿童险.png")
52 }, 58 },
53 { 59 {
54 - title: "关于重疾险,这几个关键问题也需了解!", 60 + title: "重疾险这几个关键问题也需了解!",
  61 + key: 5,
55 context: "作为咨询热度较高的险种,很多人对重疾险有着不同的疑问。", 62 context: "作为咨询热度较高的险种,很多人对重疾险有着不同的疑问。",
  63 + // context: "作为咨询热度较高的险种,很多人对重...",
56 url: "http://mp.weixin.qq.com/s/VP-0BcBTvipbuq9bgOZ0NQ", 64 url: "http://mp.weixin.qq.com/s/VP-0BcBTvipbuq9bgOZ0NQ",
57 imgurl: require("../../assets/home/Headlines_意外险.png") 65 imgurl: require("../../assets/home/Headlines_意外险.png")
58 } 66 }
59 ], 67 ],
60 swiperImgList: [ 68 swiperImgList: [
61 { 69 {
62 - img: require("../../assets/home/slider_1.jpeg"), 70 + img: require("../../assets/home/slider_1.jpeg")
63 // url: "https://www.baidu.com/" 71 // url: "https://www.baidu.com/"
64 }, 72 },
65 { 73 {
66 - img: require("../../assets/home/slider_2.jpeg"), 74 + img: require("../../assets/home/slider_2.jpeg")
67 // url: "https://www.baidu.com/" 75 // url: "https://www.baidu.com/"
68 }, 76 },
69 { 77 {
70 - img: require("../../assets/home/slider_3.jpeg"), 78 + img: require("../../assets/home/slider_3.jpeg")
71 // url: "https://www.baidu.com/" 79 // url: "https://www.baidu.com/"
72 - }, 80 + }
73 ] 81 ]
74 - } 82 + };
75 } 83 }
76 componentDidMount() { 84 componentDidMount() {
77 console.log("thisprops", this.props); 85 console.log("thisprops", this.props);
@@ -85,10 +93,16 @@ export default class Home extends Component { @@ -85,10 +93,16 @@ export default class Home extends Component {
85 key={index} 93 key={index}
86 onPress={() => navigate("CommonWebView", { item: item })} 94 onPress={() => navigate("CommonWebView", { item: item })}
87 > 95 >
88 - <Image style={styles.itemImgWrapper} source={item.imgurl} /> 96 + <View style={styles.itemImgWrapper}>
  97 + <Image source={item.imgurl} style={{ width: 74, height: 74 }} />
  98 + </View>
89 <View style={styles.itemRightWrapper}> 99 <View style={styles.itemRightWrapper}>
90 - <Text style={styles.itemTextTop} numberOfLines={1}>{item.title}</Text> 100 + <Text style={styles.itemTextTop} numberOfLines={1}>
91 - <Text style={styles.itemTextBottom} numberOfLines={1}>{item.context}</Text> 101 + {item.title}
  102 + </Text>
  103 + <Text style={styles.itemTextBottom} numberOfLines={1}>
  104 + {item.context}
  105 + </Text>
92 </View> 106 </View>
93 </TouchableOpacity> 107 </TouchableOpacity>
94 ); 108 );
@@ -105,7 +119,7 @@ export default class Home extends Component { @@ -105,7 +119,7 @@ export default class Home extends Component {
105 height={120} 119 height={120}
106 dotStyle={{ 120 dotStyle={{
107 width: 6, 121 width: 6,
108 - height: 6, 122 + height: 6
109 }} 123 }}
110 activeDotStyle={{ 124 activeDotStyle={{
111 width: 6, 125 width: 6,
@@ -117,10 +131,7 @@ export default class Home extends Component { @@ -117,10 +131,7 @@ export default class Home extends Component {
117 /* console.log("图片item",item); */ 131 /* console.log("图片item",item); */
118 } 132 }
119 return ( 133 return (
120 - <TouchableOpacity 134 + <TouchableOpacity style={styles.slide} key={index}>
121 - style={styles.slide}  
122 - key={index}  
123 - >  
124 <Image 135 <Image
125 style={styles.slideImg} 136 style={styles.slideImg}
126 source={item.img} 137 source={item.img}
@@ -141,9 +152,7 @@ export default class Home extends Component { @@ -141,9 +152,7 @@ export default class Home extends Component {
141 {this._swiper()} 152 {this._swiper()}
142 <TouchableOpacity 153 <TouchableOpacity
143 style={styles.midContainer} 154 style={styles.midContainer}
144 - onPress={() => 155 + onPress={() => navigate("AllProduct")}
145 - navigate("AllProduct")  
146 - }  
147 > 156 >
148 <Image 157 <Image
149 source={require("../../assets/home/pic.png")} 158 source={require("../../assets/home/pic.png")}
@@ -162,7 +171,34 @@ export default class Home extends Component { @@ -162,7 +171,34 @@ export default class Home extends Component {
162 style={styles.listContainer} 171 style={styles.listContainer}
163 automaticallyAdjustContentInsets={false} 172 automaticallyAdjustContentInsets={false}
164 > 173 >
165 - {this._renderMap()} 174 + {this.state.ListData.map((item, index) => {
  175 + return (
  176 + <TouchableOpacity
  177 + style={styles.itemContainer}
  178 + key={index}
  179 + onPress={() => navigate("CommonWebView", { item: item })}
  180 + >
  181 + <View style={styles.itemImgWrapper}>
  182 + <Image
  183 + source={item.imgurl}
  184 + style={{ width: 74, height: 74 }}
  185 + />
  186 + </View>
  187 + <View style={styles.itemRightWrapper}>
  188 + <View style={styles.textWrapper}>
  189 + <Text style={styles.itemTextTop} numberOfLines={1}>
  190 + {item.title}
  191 + </Text>
  192 + </View>
  193 + <View style={styles.textWrapper}>
  194 + <Text style={styles.itemTextBottom} numberOfLines={1}>
  195 + {item.context}
  196 + </Text>
  197 + </View>
  198 + </View>
  199 + </TouchableOpacity>
  200 + );
  201 + })}
166 <Text style={styles.scrollViewText}>没有更多了</Text> 202 <Text style={styles.scrollViewText}>没有更多了</Text>
167 </ScrollView> 203 </ScrollView>
168 </View> 204 </View>
@@ -173,7 +209,6 @@ export default class Home extends Component { @@ -173,7 +209,6 @@ export default class Home extends Component {
173 const styles = StyleSheet.create({ 209 const styles = StyleSheet.create({
174 container: { 210 container: {
175 flex: 1, 211 flex: 1,
176 - // paddingTop: 64,  
177 justifyContent: "flex-start", 212 justifyContent: "flex-start",
178 alignItems: "stretch", 213 alignItems: "stretch",
179 backgroundColor: "#EFEFEF" 214 backgroundColor: "#EFEFEF"
@@ -186,8 +221,8 @@ const styles = StyleSheet.create({ @@ -186,8 +221,8 @@ const styles = StyleSheet.create({
186 backgroundColor: "#92BBD9" 221 backgroundColor: "#92BBD9"
187 }, 222 },
188 slideImg: { 223 slideImg: {
189 - flex: 1, 224 + flex: 1
190 - height: 140 225 + // height: 140,
191 }, 226 },
192 midContainer: { 227 midContainer: {
193 height: 45, 228 height: 45,
@@ -229,17 +264,19 @@ const styles = StyleSheet.create({ @@ -229,17 +264,19 @@ const styles = StyleSheet.create({
229 borderTopColor: "#EEEEEE", 264 borderTopColor: "#EEEEEE",
230 borderStyle: "solid", 265 borderStyle: "solid",
231 paddingLeft: 13, 266 paddingLeft: 13,
232 - paddingRight: 13 267 + // paddingRight: 13
233 }, 268 },
234 itemImgWrapper: { 269 itemImgWrapper: {
235 width: 74, 270 width: 74,
236 - height: 66,  
237 marginRight: 12 271 marginRight: 12
238 }, 272 },
239 itemRightWrapper: { 273 itemRightWrapper: {
240 - justifyContent: "center", 274 + flex: 1,
241 - height: 66, 275 + justifyContent: "center"
242 - flex: 1 276 + // paddingRight: 50
  277 + },
  278 + textWrapper: {
  279 + paddingRight: 13
243 }, 280 },
244 itemTextTop: { 281 itemTextTop: {
245 fontSize: 16, 282 fontSize: 16,
@@ -94,9 +94,7 @@ const styles = StyleSheet.create({ @@ -94,9 +94,7 @@ const styles = StyleSheet.create({
94 backgroundColor: "#EFEFEF", 94 backgroundColor: "#EFEFEF",
95 }, 95 },
96 scrollViewContainer: { 96 scrollViewContainer: {
97 - // height: 300  
98 flex: 1, 97 flex: 1,
99 - marginBottom: 49,  
100 }, 98 },
101 scrollViewText: { 99 scrollViewText: {
102 color: "#7A7A7A", 100 color: "#7A7A7A",
@@ -234,7 +234,6 @@ export default class Login extends Component { @@ -234,7 +234,6 @@ export default class Login extends Component {
234 console.error(err); 234 console.error(err);
235 } 235 }
236 console.log("点击登录后的值",result) 236 console.log("点击登录后的值",result)
237 -  
238 that.setState({ 237 that.setState({
239 IS_LOGIN: result[0][1], 238 IS_LOGIN: result[0][1],
240 USER_ID: (result[1][1] != null) ? result[1][1] : "", 239 USER_ID: (result[1][1] != null) ? result[1][1] : "",