罗广聪

增加文章组件

@@ -16,6 +16,7 @@ import Login from "./src/pages/Login"; @@ -16,6 +16,7 @@ import Login from "./src/pages/Login";
16 import AllProduct from "./src/pages/Home/allProduct"; 16 import AllProduct from "./src/pages/Home/allProduct";
17 import CommonWebView from "./src/Components/CommonWebView"; 17 import CommonWebView from "./src/Components/CommonWebView";
18 import CommonImageView from "./src/Components/CommonImageView"; 18 import CommonImageView from "./src/Components/CommonImageView";
  19 +import ArticleTemplate from "./src/Components/articleTemplate";
19 import Details from "./src/pages/InsuranceCircle/details"; 20 import Details from "./src/pages/InsuranceCircle/details";
20 21
21 // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面 22 // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面
@@ -89,6 +90,7 @@ const ProtectGod = StackNavigator( @@ -89,6 +90,7 @@ const ProtectGod = StackNavigator(
89 }, 90 },
90 CommonWebView: { screen: CommonWebView }, 91 CommonWebView: { screen: CommonWebView },
91 CommonImageView: { screen: CommonImageView }, 92 CommonImageView: { screen: CommonImageView },
  93 + ArticleTemplate: { screen: ArticleTemplate },
92 Details: { screen: Details } 94 Details: { screen: Details }
93 },{ 95 },{
94 navigationOptions: { 96 navigationOptions: {
@@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
120 </BuildableProductRunnable> 120 </BuildableProductRunnable>
121 </ProfileAction> 121 </ProfileAction>
122 <AnalyzeAction 122 <AnalyzeAction
123 - buildConfiguration = "Debug"> 123 + buildConfiguration = "Release">
124 </AnalyzeAction> 124 </AnalyzeAction>
125 <ArchiveAction 125 <ArchiveAction
126 buildConfiguration = "Release" 126 buildConfiguration = "Release"
@@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
71 "extent" : "full-screen", 71 "extent" : "full-screen",
72 "idiom" : "iphone", 72 "idiom" : "iphone",
73 "subtype" : "736h", 73 "subtype" : "736h",
74 - "filename" : "HD5.5.png", 74 + "filename" : "1242-2208.png",
75 "minimum-system-version" : "8.0", 75 "minimum-system-version" : "8.0",
76 "orientation" : "portrait", 76 "orientation" : "portrait",
77 "scale" : "3x" 77 "scale" : "3x"
@@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
88 "extent" : "full-screen", 88 "extent" : "full-screen",
89 "idiom" : "iphone", 89 "idiom" : "iphone",
90 "subtype" : "667h", 90 "subtype" : "667h",
91 - "filename" : "HD4.7.png", 91 + "filename" : "750-1334.png",
92 "minimum-system-version" : "8.0", 92 "minimum-system-version" : "8.0",
93 "orientation" : "portrait", 93 "orientation" : "portrait",
94 "scale" : "2x" 94 "scale" : "2x"
@@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
96 { 96 {
97 "orientation" : "portrait", 97 "orientation" : "portrait",
98 "idiom" : "iphone", 98 "idiom" : "iphone",
99 - "filename" : "2x.png", 99 + "filename" : "640-960.png",
100 "extent" : "full-screen", 100 "extent" : "full-screen",
101 "minimum-system-version" : "7.0", 101 "minimum-system-version" : "7.0",
102 "scale" : "2x" 102 "scale" : "2x"
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 "extent" : "full-screen", 105 "extent" : "full-screen",
106 "idiom" : "iphone", 106 "idiom" : "iphone",
107 "subtype" : "retina4", 107 "subtype" : "retina4",
108 - "filename" : "Retina4.png", 108 + "filename" : "640-1136.png",
109 "minimum-system-version" : "7.0", 109 "minimum-system-version" : "7.0",
110 "orientation" : "portrait", 110 "orientation" : "portrait",
111 "scale" : "2x" 111 "scale" : "2x"
  1 +import React, { Component } from "react";
  2 +import {
  3 + StyleSheet,
  4 + WebView,
  5 + View,
  6 + Image,
  7 + Dimensions,
  8 + ScrollView,
  9 + Text,
  10 + FlatList,
  11 + ListView
  12 +} from "react-native";
  13 +import { StackNavigator, TabNavigator } from "react-navigation";
  14 +
  15 +export default class ArticleTemplate extends Component {
  16 + constructor(props) {
  17 + super(props);
  18 + this.state = {
  19 + id: this.props.navigation.state.params.item.id,
  20 + articleData: {
  21 + paragraph: []
  22 + }
  23 + };
  24 + }
  25 + componentWillMount() {
  26 + console.log("will 的ID",this.state.id)
  27 + this.getArticles();
  28 + }
  29 + getArticles() {
  30 + let that = this,
  31 + id = this.state.id;
  32 +return fetch(`https://devpay.brae.co/test/insurance/topic/${id}`, {
  33 + method: "POST",
  34 + headers: {
  35 + Accept: "application/json",
  36 + "Content-Type": "application/json"
  37 + }
  38 +})
  39 + .then(resp => {
  40 + if (resp.status === 200) {
  41 + return resp.json();
  42 + } else {
  43 + console.error("something went wrong!");
  44 + }
  45 + })
  46 + .then(respJson => {
  47 + if (respJson.enmsg != "ok") {
  48 + alert(respJson.cnmsg);
  49 + } else {
  50 + that.setState({
  51 + articleData: respJson.data.articleData
  52 + })
  53 + console.log("详情页的文章",respJson.data.articleData)
  54 + }
  55 + });
  56 + }
  57 + render() {
  58 + const { articleData } = this.state;
  59 + return (
  60 + <View style={styles.container}>
  61 + <ScrollView automaticallyAdjustContentInsets={false}>
  62 + <View style={styles.headerContaier}>
  63 + <Text style={styles.headerTitle}>{articleData.title}</Text>
  64 + <View style={styles.infoWrapper}>
  65 + <Text style={styles.time}>{articleData.time}</Text>
  66 + <Text style={styles.author}>{articleData.author}</Text>
  67 + </View>
  68 + </View>
  69 + <View style={styles.contentConatiner}>
  70 + {articleData.paragraph.map((item, index) => {
  71 + return (
  72 + <View style={styles.paragraphContainer} key={index}>
  73 + {item.title ? (
  74 + <Text style={styles.paragraphTitle}>{item.title}</Text>
  75 + ) : null}
  76 + {item.image ? (
  77 + <Image style={styles.paragraphImage} resizeMode="contain" source={{uri: item.image}} />
  78 + ) : null}
  79 + <Text style={styles.paragraphContent}>{item.content}</Text>
  80 + </View>
  81 + );
  82 + })}
  83 + </View>
  84 + </ScrollView>
  85 + </View>
  86 + );
  87 + }
  88 +}
  89 +
  90 +const styles = StyleSheet.create({
  91 + container: {
  92 + flex: 1,
  93 + backgroundColor: "white"
  94 + },
  95 + headerContaier: {
  96 + marginTop: 23,
  97 + marginLeft: 15,
  98 + marginRight: 15
  99 + },
  100 + headerTitle: {
  101 + color: "#030303",
  102 + fontSize: 24,
  103 + lineHeight: 30
  104 + },
  105 + infoWrapper: {
  106 + marginTop: 10,
  107 + flexDirection: "row"
  108 + },
  109 + time: {
  110 + fontSize: 15,
  111 + color: "#999999",
  112 + marginRight: 8
  113 + },
  114 + author: {
  115 + fontSize: 15,
  116 + color: "#999999"
  117 + },
  118 + contentConatiner: {
  119 + marginTop: 20,
  120 + marginLeft: 15,
  121 + marginRight: 15
  122 + },
  123 + paragraphContainer: {
  124 + marginTop: 20,
  125 + marginBottom: 20
  126 + },
  127 + paragraphTitle: {
  128 + alignSelf: "center",
  129 + color: "#1B9341",
  130 + fontSize: 15,
  131 + marginBottom: 15,
  132 + // backgroundColor: "red",
  133 + },
  134 + paragraphImage: {
  135 + width: Dimensions.get("window").width - 30,
  136 + height: 140,
  137 + // backgroundColor: "blue",
  138 + marginBottom: 20,
  139 + },
  140 + paragraphContent: {
  141 + color: "#555555",
  142 + fontSize: 15,
  143 + lineHeight: 22,
  144 + // backgroundColor: "yellow",
  145 + }
  146 +});
No preview for this file type
@@ -8,6 +8,7 @@ import { @@ -8,6 +8,7 @@ import {
8 TouchableOpacity, 8 TouchableOpacity,
9 ScrollView, 9 ScrollView,
10 FlatList, 10 FlatList,
  11 + ListView,
11 Dimensions 12 Dimensions
12 } from "react-native"; 13 } from "react-native";
13 import { StackNavigator, TabNavigator } from "react-navigation"; 14 import { StackNavigator, TabNavigator } from "react-navigation";
@@ -21,51 +22,11 @@ export default class Home extends Component { @@ -21,51 +22,11 @@ export default class Home extends Component {
21 // }; 22 // };
22 constructor(props) { 23 constructor(props) {
23 super(props); 24 super(props);
  25 +
24 this._renderMap = this._renderMap.bind(this); 26 this._renderMap = this._renderMap.bind(this);
25 this._swiper = this._swiper.bind(this); 27 this._swiper = this._swiper.bind(this);
26 this.state = { 28 this.state = {
27 - ListData: [ 29 + ListData: [],
28 - {  
29 - title: "重疾、大病和防癌险,傻傻分不清?",  
30 - key: 1,  
31 - context: "重疾险、大病保险和防癌险,这几大险种你能分得清吗?",  
32 - // context: "重疾险、大病保险和防癌险,这几大险...",  
33 - url: "http://mp.weixin.qq.com/s/vSz_WuGpPYNMNpGQv-zxAQ",  
34 - imgurl: require("../../assets/home/Headlines_重疾险.png")  
35 - },  
36 - {  
37 - title: "想为家里老人买份保险,怎么选?",  
38 - key: 2,  
39 - context: "在如今的商业保险中,老年人的保险成为了很多人比较纠结的问题。",  
40 - // context: "在如今的商业保险中,老年人的保险成...",  
41 - url: "http://mp.weixin.qq.com/s/R_KuAzEVQCVKj7FUOzuHJw",  
42 - imgurl: require("../../assets/home/Headlines_中老年医疗险.png")  
43 - },  
44 - {  
45 - title: "驾车远行需要做哪些保险准备?",  
46 - key: 3,  
47 - context: "出行前我们需要做哪些准备工作,才能避免发生事故后的束手无策?",  
48 - // context: "出行前我们需要做哪些准备工作,才能...",  
49 - url: "http://mp.weixin.qq.com/s/Tkm4TrBEXqXJzC4FQdW2MQ",  
50 - imgurl: require("../../assets/home/Headlines_出驾远行.png")  
51 - },  
52 - {  
53 - title: "选购儿童险,这几大原则也应注意!",  
54 - key: 4,  
55 - context: "认真对待关于孩子的保险问题,还需要注意投保时候的一些原则。",  
56 - // context: "认真对待关于孩子的保险问题,还需...",  
57 - url: "http://mp.weixin.qq.com/s/iUEiBMik_3WMuxnAPFDXXQ",  
58 - imgurl: require("../../assets/home/Headlines_儿童险.png")  
59 - },  
60 - {  
61 - title: "重疾险这几个关键问题也需了解!",  
62 - key: 5,  
63 - context: "作为咨询热度较高的险种,很多人对重疾险有着不同的疑问。",  
64 - // context: "作为咨询热度较高的险种,很多人对重...",  
65 - url: "http://mp.weixin.qq.com/s/VP-0BcBTvipbuq9bgOZ0NQ",  
66 - imgurl: require("../../assets/home/Headlines_意外险.png")  
67 - }  
68 - ],  
69 swiperImgList: [ 30 swiperImgList: [
70 // { 31 // {
71 // img: require("../../assets/home/slider_1.jpeg") 32 // img: require("../../assets/home/slider_1.jpeg")
@@ -82,8 +43,63 @@ export default class Home extends Component { @@ -82,8 +43,63 @@ export default class Home extends Component {
82 ] 43 ]
83 }; 44 };
84 } 45 }
85 - componentDidMount() { 46 + componentWillMount() {
86 - console.log("thisprops", this.props); 47 + this.getListData();
  48 + this.getBannar();
  49 + }
  50 + componentDidMount() {}
  51 + getListData() {
  52 + let that = this;
  53 + return fetch(`https://devpay.brae.co/test/insurance/topic`, {
  54 + method: "POST",
  55 + headers: {
  56 + Accept: "application/json",
  57 + "Content-Type": "application/json"
  58 + }
  59 + })
  60 + .then(resp => {
  61 + if (resp.status === 200) {
  62 + return resp.json();
  63 + } else {
  64 + console.error("something went wrong!");
  65 + }
  66 + })
  67 + .then(respJson => {
  68 + if (respJson.enmsg != "ok") {
  69 + alert(respJson.cnmsg);
  70 + } else {
  71 + that.setState({
  72 + ListData: respJson.data.topic
  73 + })
  74 + }
  75 + });
  76 + }
  77 + getBannar() {
  78 + let that = this;
  79 + return fetch(`https://devpay.brae.co/test/insurance/banner`, {
  80 + method: "POST",
  81 + headers: {
  82 + Accept: "application/json",
  83 + "Content-Type": "application/json"
  84 + }
  85 + })
  86 + .then(resp => {
  87 + if (resp.status === 200) {
  88 + return resp.json();
  89 + } else {
  90 + console.error("something went wrong!");
  91 + }
  92 + })
  93 + .then(respJson => {
  94 + if (respJson.enmsg != "ok") {
  95 + alert(respJson.cnmsg);
  96 + } else {
  97 + that.setState({
  98 + swiperImgList: respJson.data.banner
  99 + })
  100 + console.log("bannar图",respJson.data.banner)
  101 + }
  102 + });
87 } 103 }
88 _renderMap() { 104 _renderMap() {
89 const { navigate } = this.props.navigation; 105 const { navigate } = this.props.navigation;
@@ -111,7 +127,7 @@ export default class Home extends Component { @@ -111,7 +127,7 @@ export default class Home extends Component {
111 } 127 }
112 _swiper() { 128 _swiper() {
113 const { navigate } = this.props.navigation; 129 const { navigate } = this.props.navigation;
114 - const {height, width} = Dimensions.get('window'); 130 + const { height, width } = Dimensions.get("window");
115 const imgHeight = width * 140 / 375; 131 const imgHeight = width * 140 / 375;
116 return ( 132 return (
117 <View style={{ height: imgHeight }}> 133 <View style={{ height: imgHeight }}>
@@ -122,7 +138,7 @@ export default class Home extends Component { @@ -122,7 +138,7 @@ export default class Home extends Component {
122 height={imgHeight} 138 height={imgHeight}
123 dotStyle={{ 139 dotStyle={{
124 width: 6, 140 width: 6,
125 - height: 6, 141 + height: 6
126 }} 142 }}
127 activeDotStyle={{ 143 activeDotStyle={{
128 width: 6, 144 width: 6,
@@ -138,7 +154,7 @@ export default class Home extends Component { @@ -138,7 +154,7 @@ export default class Home extends Component {
138 <Image 154 <Image
139 style={styles.slideImg} 155 style={styles.slideImg}
140 source={item.img} 156 source={item.img}
141 - width={Dimensions.get('window').width} 157 + width={Dimensions.get("window").width}
142 resizeMode="stretch" 158 resizeMode="stretch"
143 /> 159 />
144 </TouchableOpacity> 160 </TouchableOpacity>
@@ -149,8 +165,11 @@ export default class Home extends Component { @@ -149,8 +165,11 @@ export default class Home extends Component {
149 ); 165 );
150 } 166 }
151 render() { 167 render() {
152 - console.log("首页的this.props", this); 168 + // console.log("首页的this.props", this);
  169 + // console.log("render首页文章列表", this.state.ListData);
153 const { navigate } = this.props.navigation; 170 const { navigate } = this.props.navigation;
  171 + const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
  172 + const dataSource = ds.cloneWithRows(this.state.ListData);
154 return ( 173 return (
155 <View style={styles.container}> 174 <View style={styles.container}>
156 {this._swiper()} 175 {this._swiper()}
@@ -171,7 +190,34 @@ export default class Home extends Component { @@ -171,7 +190,34 @@ export default class Home extends Component {
171 <View style={styles.textContainer}> 190 <View style={styles.textContainer}>
172 <Text style={styles.minText}>保险头条</Text> 191 <Text style={styles.minText}>保险头条</Text>
173 </View> 192 </View>
174 - <ScrollView 193 + <ListView
  194 + dataSource={dataSource}
  195 + enableEmptySections = {true}
  196 + renderRow={(item, index) => {
  197 + return (
  198 + <TouchableOpacity
  199 + style={styles.itemContainer}
  200 + onPress={() => navigate("ArticleTemplate", { item: item })}
  201 + >
  202 + <View style={styles.itemImgWrapper}>
  203 + <Image
  204 + source={{ uri: item.image }}
  205 + style={{ width: 74, height: 74 }}
  206 + />
  207 + </View>
  208 + <View style={styles.itemRightWrapper}>
  209 + <Text style={styles.itemTextTop} numberOfLines={1}>
  210 + {item.title}
  211 + </Text>
  212 + <Text style={styles.itemTextBottom} numberOfLines={1}>
  213 + {item.summary}
  214 + </Text>
  215 + </View>
  216 + </TouchableOpacity>
  217 + );
  218 + }}
  219 + />
  220 + {/* <ScrollView
175 style={styles.listContainer} 221 style={styles.listContainer}
176 automaticallyAdjustContentInsets={false} 222 automaticallyAdjustContentInsets={false}
177 > 223 >
@@ -180,27 +226,27 @@ export default class Home extends Component { @@ -180,27 +226,27 @@ export default class Home extends Component {
180 <TouchableOpacity 226 <TouchableOpacity
181 style={styles.itemContainer} 227 style={styles.itemContainer}
182 key={index} 228 key={index}
183 - onPress={() => navigate("CommonWebView", { item: item })} 229 + onPress={() => navigate("ArticleTemplate", { item: item })}
184 > 230 >
185 <View style={styles.itemImgWrapper}> 231 <View style={styles.itemImgWrapper}>
186 <Image 232 <Image
187 - source={item.imgurl} 233 + source={{uri: item.image}}
188 style={{ width: 74, height: 74 }} 234 style={{ width: 74, height: 74 }}
189 /> 235 />
190 </View> 236 </View>
191 <View style={styles.itemRightWrapper}> 237 <View style={styles.itemRightWrapper}>
192 - <Text style={styles.itemTextTop} numberOfLines={1}> 238 + <Text style={styles.itemTextTop} numberOfLines={1}>
193 - {item.title} 239 + {item.title}
194 - </Text> 240 + </Text>
195 - <Text style={styles.itemTextBottom} numberOfLines={1}> 241 + <Text style={styles.itemTextBottom} numberOfLines={1}>
196 - {item.context} 242 + {item.summary}
197 - </Text> 243 + </Text>
198 </View> 244 </View>
199 </TouchableOpacity> 245 </TouchableOpacity>
200 ); 246 );
201 })} 247 })}
202 <Text style={styles.scrollViewText}>没有更多了</Text> 248 <Text style={styles.scrollViewText}>没有更多了</Text>
203 - </ScrollView> 249 + </ScrollView> */}
204 </View> 250 </View>
205 ); 251 );
206 } 252 }
@@ -215,8 +261,8 @@ const styles = StyleSheet.create({ @@ -215,8 +261,8 @@ const styles = StyleSheet.create({
215 }, 261 },
216 swiperWrapper: {}, 262 swiperWrapper: {},
217 slide: { 263 slide: {
218 - height: Dimensions.get('window').width*140/375, 264 + height: Dimensions.get("window").width * 140 / 375,
219 - width: Dimensions.get('window').width, 265 + width: Dimensions.get("window").width,
220 justifyContent: "center", 266 justifyContent: "center",
221 alignItems: "center", 267 alignItems: "center",
222 backgroundColor: "#92BBD9" 268 backgroundColor: "#92BBD9"
@@ -264,7 +310,7 @@ const styles = StyleSheet.create({ @@ -264,7 +310,7 @@ const styles = StyleSheet.create({
264 borderTopWidth: 1, 310 borderTopWidth: 1,
265 borderTopColor: "#EEEEEE", 311 borderTopColor: "#EEEEEE",
266 borderStyle: "solid", 312 borderStyle: "solid",
267 - paddingLeft: 13, 313 + paddingLeft: 13
268 // paddingRight: 13 314 // paddingRight: 13
269 }, 315 },
270 itemImgWrapper: { 316 itemImgWrapper: {
@@ -20,39 +20,69 @@ export default class InsuranceChurch extends Component { @@ -20,39 +20,69 @@ export default class InsuranceChurch extends Component {
20 // this._renderMap = this._renderMap.bind(this); 20 // this._renderMap = this._renderMap.bind(this);
21 this.state = { 21 this.state = {
22 ListData: [ 22 ListData: [
23 - { 23 + // {
24 - title: "凶猛台风来袭!与伤亡相关的保险知识你需要了解!", 24 + // title: "凶猛台风来袭!与伤亡相关的保险知识你需要了解!",
25 - time: "刚刚", 25 + // time: "刚刚",
26 - url: "http://mp.weixin.qq.com/s/_lGAz9sSxuulbdPGZ020cQ", 26 + // url: "http://mp.weixin.qq.com/s/_lGAz9sSxuulbdPGZ020cQ",
27 - imgurl: require("../../assets/church/1.png") 27 + // imgurl: require("../../assets/church/1.png")
28 - }, 28 + // },
29 - { 29 + // {
30 - title: "17世纪伦敦火灾频发,牛掰的保险公司有高招!", 30 + // title: "17世纪伦敦火灾频发,牛掰的保险公司有高招!",
31 - time: "3小时前", 31 + // time: "3小时前",
32 - url: "http://mp.weixin.qq.com/s/cJ7oHQ__GBiBxBGZ1SCgDg", 32 + // url: "http://mp.weixin.qq.com/s/cJ7oHQ__GBiBxBGZ1SCgDg",
33 - imgurl: require("../../assets/church/2.png") 33 + // imgurl: require("../../assets/church/2.png")
34 - }, 34 + // },
35 - { 35 + // {
36 - title: "这两个国家为何会有这些天气保险呢?原来是这样.....", 36 + // title: "这两个国家为何会有这些天气保险呢?原来是这样.....",
37 - time: "昨天", 37 + // time: "昨天",
38 - url: "http://mp.weixin.qq.com/s/EimQbKC0ziqN0o8_S1ACFQ", 38 + // url: "http://mp.weixin.qq.com/s/EimQbKC0ziqN0o8_S1ACFQ",
39 - imgurl: require("../../assets/church/3.png") 39 + // imgurl: require("../../assets/church/3.png")
40 - }, 40 + // },
41 - { 41 + // {
42 - title: "车险小白必须知道的不计免赔险", 42 + // title: "车险小白必须知道的不计免赔险",
43 - time: "9月10日", 43 + // time: "9月10日",
44 - url: "http://mp.weixin.qq.com/s/W9uR5G6ZlTb7HLLX-DZzSQ", 44 + // url: "http://mp.weixin.qq.com/s/W9uR5G6ZlTb7HLLX-DZzSQ",
45 - imgurl: require("../../assets/church/4.png") 45 + // imgurl: require("../../assets/church/4.png")
46 - }, 46 + // },
47 - { 47 + // {
48 - title: "“五险一金”进了嘻哈歌词,有关社保和商业保险的知识你了解吗?", 48 + // title: "“五险一金”进了嘻哈歌词,有关社保和商业保险的知识你了解吗?",
49 - time: "9月9日", 49 + // time: "9月9日",
50 - url: "http://mp.weixin.qq.com/s/0I7p2vaM23CsDiI41hHNOQ", 50 + // url: "http://mp.weixin.qq.com/s/0I7p2vaM23CsDiI41hHNOQ",
51 - imgurl: require("../../assets/church/5.png") 51 + // imgurl: require("../../assets/church/5.png")
52 - }, 52 + // },
53 ] 53 ]
54 }; 54 };
55 } 55 }
  56 + componentWillMount() {
  57 + this.getListData();
  58 + }
  59 + getListData() {
  60 + let that = this;
  61 + return fetch(`https://devpay.brae.co/test/insurance/story`, {
  62 + method: "POST",
  63 + headers: {
  64 + Accept: "application/json",
  65 + "Content-Type": "application/json"
  66 + }
  67 + })
  68 + .then(resp => {
  69 + if (resp.status === 200) {
  70 + return resp.json();
  71 + } else {
  72 + console.error("something went wrong!");
  73 + }
  74 + })
  75 + .then(respJson => {
  76 + if (respJson.enmsg != "ok") {
  77 + alert(respJson.cnmsg);
  78 + } else {
  79 + that.setState({
  80 + ListData: respJson.data
  81 + })
  82 + console.log("保堂列表",respJson.data)
  83 + }
  84 + });
  85 + }
56 86
57 render() { 87 render() {
58 const { navigate } = this.props.navigation; 88 const { navigate } = this.props.navigation;