Solution.js
9.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
import React, { Component } from "react";
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
ScrollView,
ListView,
Dimensions
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
import { Col, Row, Grid } from "react-native-easy-grid";
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {
gridData: {
title: ["角色", "建议产品", "建议保额", "保险年限", "缴费期限", "年缴保费"],
products: [
{
name: "成人意外险",
price: "50W",
long: "1年",
year: "20年",
eachyear: "150元"
},
{
name: "成人意外险",
price: "50W",
long: "1年",
year: "20年",
eachyear: "150元"
},
{
name: "成人意外险",
price: "50W",
long: "1年",
year: "20年",
eachyear: "150元"
}
],
count: "1200",
}
};
}
componentWillMount() {}
componentDidMount() {}
getListData() {
let that = this;
return fetch(`https://devpay.brae.co/test/insurance/topic`, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(resp => {
if (resp.status === 200) {
return resp.json();
} else {
console.error("something went wrong!");
}
})
.then(respJson => {
if (respJson.enmsg != "ok") {
alert(respJson.cnmsg);
} else {
that.setState({
ListData: respJson.data.topic
});
console.log("首页列表", this.state.ListData);
}
});
}
render() {
console.log("solution", this.props.navigation.state.params.answerList);
const { navigate } = this.props.navigation;
const { gridData } = this.state;
return (
<View style={styles.container}>
<View style={styles.ownContaier}>
<View style={styles.headerContainer}>
<View style={styles.titleWrapper}>
<Text style={styles.headerTitle}>关于自己的保险方案</Text>
</View>
</View>
<View style={styles.infoContainer}>
<View style={styles.leftInfoContaier}>
<View style={styles.TInfoContaier}>
<Text>年龄:</Text>
<Text>16岁</Text>
</View>
<View style={styles.BInfoContaier}>
<Text>个人年收入:</Text>
<Text>10万</Text>
</View>
</View>
<View style={styles.rightInfoContaier}>
<View style={styles.TInfoContaier}>
<Text>社保:</Text>
<Text>有社保</Text>
</View>
<View style={styles.BInfoContaier}>
<Text>负责:</Text>
<Text>XXX贷款</Text>
</View>
</View>
</View>
<View style={styles.adviceContainer}>
<Text style={styles.adviceText}>
作为家庭的经济支柱,压力和责任重大,应优先进行保险配置,且应占家庭保险的中支出和总保额的大比重,建议依次配置以下产品,以保障家庭持续、高品质的运营
</Text>
</View>
</View>
<View style={styles.configureContaier}>
<View style={styles.headerContainer}>
<View style={styles.titleWrapper}>
<Text style={styles.headerTitle}>保险配置方案</Text>
</View>
</View>
<ScrollView style={styles.tableContainer}>
<Grid>
<Row>
{/* {gridData.title.map((item,index) => {
return (
<Col key={index} style={styles.gridtitleContaier}><Text style={styles.gridheaderText}>{item}</Text></Col>
)
})} */}
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>角色</Text>
</Col>
<Col size={1.5} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>建议产品</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>建议保额</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>保险年限</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>缴费期限</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>年缴保费</Text>
</Col>
</Row>
<Row>
<Col style={styles.actor} size={1}>
<Text style={styles.contentText}>父亲</Text>
<Text style={styles.contentText}>42岁</Text>
</Col>
<Col size={5.5}>
{gridData.products.map((item, index) => {
return (
<Row key={index}>
<Col size={1.5} style={styles.contentCol}>
<Text style={styles.contentText}>{item.name}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>{item.price}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>{item.long}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>{item.year}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>
{item.eachyear}
</Text>
</Col>
</Row>
);
})}
<Row style={styles.countContainer}>
<Text style={styles.countText}>{gridData.count}</Text>
<Text style={styles.contentText}>元/年</Text>
</Row>
</Col>
</Row>
</Grid>
</ScrollView>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "flex-start",
alignItems: "stretch",
backgroundColor: "#F0F0F0"
},
ownContaier: {
backgroundColor: "white",
marginTop: 10
},
headerContainer: {
marginLeft: 10,
height: 45,
justifyContent: "center",
alignItems: "flex-start"
},
titleWrapper: {
borderStyle: "solid",
borderColor: "#009B3A",
borderLeftWidth: 2,
paddingLeft: 7
},
headerTitle: {
fontSize: 16,
fontWeight: "bold"
},
infoContainer: {
marginLeft: 18,
borderStyle: "solid",
borderColor: "#E8E8E8",
borderTopWidth: 0.5,
flexDirection: "row",
paddingVertical: 12
},
leftInfoContaier: {
flex: 1,
justifyContent: "center",
alignItems: "flex-start"
},
rightInfoContaier: {
flex: 1,
justifyContent: "center",
alignItems: "flex-start"
},
TInfoContaier: {
flexDirection: "row",
marginBottom: 12
},
BInfoContaier: {
flexDirection: "row"
},
adviceContainer: {
marginLeft: 18,
paddingRight: 18,
borderStyle: "solid",
borderColor: "#E8E8E8",
borderTopWidth: 0.5,
paddingVertical: 12
},
adviceText: {
fontSize: 13,
lineHeight: 20,
color: "#242424"
},
configureContaier: {
backgroundColor: "white",
marginTop: 10
},
tableContainer: {
marginLeft: 18,
paddingRight: 18,
borderStyle: "solid",
borderColor: "#E8E8E8",
borderTopWidth: 1,
paddingVertical: 12
},
gridtitleContaier: {
justifyContent: "center",
alignItems: "center",
paddingVertical: 8,
backgroundColor: "#1B9341",
borderColor: "#E8E8E8",
borderStyle: "solid",
borderLeftWidth: 0.5
},
gridheaderText: {
fontSize: 11,
color: "white"
},
actor: {
justifyContent: "center",
alignItems: "center",
borderColor: "#ccc",
borderStyle: "solid",
borderWidth: 0.5
},
contentCol: {
justifyContent: "center",
alignItems: "center",
paddingVertical: 8,
borderColor: "#ccc",
borderStyle: "solid",
borderBottomWidth: 0.5,
borderRightWidth: 0.5
},
contentText: {
fontSize: 12,
lineHeight: 17
},
countContainer: {
justifyContent: "center",
alignItems: "center",
paddingVertical: 8,
borderColor: "#ccc",
borderStyle: "solid",
borderBottomWidth: 0.5,
borderRightWidth: 0.5
},
countText: {
fontSize: 18,
color: "#1B9341"
}
});