罗广聪

AI 大致OK

@@ -152,10 +152,11 @@ export default class Home extends Component { @@ -152,10 +152,11 @@ export default class Home extends Component {
152 let Temp = this.state.QuesList.map(item => item.answers[item.selected]); 152 let Temp = this.state.QuesList.map(item => item.answers[item.selected]);
153 Temp.splice(3, 1, that.format(that.state.date)); 153 Temp.splice(3, 1, that.format(that.state.date));
154 let Result = { 154 let Result = {
155 - age: 2017 - parseInt(Temp[3].split("-")[0]),  
156 security: Temp[5], 155 security: Temp[5],
157 income: Temp[4], 156 income: Temp[4],
158 - debt: Temp[2] 157 + debt: Temp[1],
  158 + target: Temp[2],
  159 + age: (2017 - parseInt(Temp[3].split("-")[0])).toString(),
159 }; 160 };
160 console.log("temp Result", Temp, Result); 161 console.log("temp Result", Temp, Result);
161 if (this.state.IS_LOGIN != "yes") { 162 if (this.state.IS_LOGIN != "yes") {
@@ -168,7 +169,12 @@ export default class Home extends Component { @@ -168,7 +169,12 @@ export default class Home extends Component {
168 result: Result 169 result: Result
169 }, 170 },
170 res => { 171 res => {
171 - navigate("AISolution"); 172 + console.log("请求的AI数据",res)
  173 + navigate("AISolution",{
  174 + result: res.data.result,
  175 + grid: res.data.grid,
  176 + detail: res.data.detail,
  177 + });
172 }, 178 },
173 err => {} 179 err => {}
174 ); 180 );
@@ -53,15 +53,26 @@ export default class Home extends Component { @@ -53,15 +53,26 @@ export default class Home extends Component {
53 eachyear: "150元" 53 eachyear: "150元"
54 } 54 }
55 ], 55 ],
56 - count: "1200" 56 + count: "1200",
  57 + result: null,
  58 + grid: null,
  59 + detail: null,
57 } 60 }
58 }; 61 };
59 } 62 }
60 componentWillMount() { 63 componentWillMount() {
61 this.getAsyncStorage(); 64 this.getAsyncStorage();
  65 + console.log('智能方案页面的导航数据',this.props.navigation);
  66 + this.setState({
  67 + result: this.props.navigation.state.params.result,
  68 + grid: this.props.navigation.state.params.grid,
  69 + detail: this.props.navigation.state.params.detail,
  70 + })
62 } 71 }
63 72
64 - componentDidMount() {} 73 + componentDidMount() {
  74 + console.log('智能方案三个数据',this.state.grid)
  75 + }
65 76
66 getAsyncStorage() { 77 getAsyncStorage() {
67 const that = this; 78 const that = this;
@@ -145,9 +156,10 @@ export default class Home extends Component { @@ -145,9 +156,10 @@ export default class Home extends Component {
145 render() { 156 render() {
146 console.log("solution", this.props.navigation); 157 console.log("solution", this.props.navigation);
147 const { navigate } = this.props.navigation; 158 const { navigate } = this.props.navigation;
148 - const { gridData } = this.state; 159 + const { gridData,result,grid,detail } = this.state;
149 return ( 160 return (
150 <View style={styles.container}> 161 <View style={styles.container}>
  162 + <ScrollView>
151 <View style={styles.ownContaier}> 163 <View style={styles.ownContaier}>
152 <View style={styles.headerContainer}> 164 <View style={styles.headerContainer}>
153 <View style={styles.titleWrapper}> 165 <View style={styles.titleWrapper}>
@@ -158,27 +170,27 @@ export default class Home extends Component { @@ -158,27 +170,27 @@ export default class Home extends Component {
158 <View style={styles.leftInfoContaier}> 170 <View style={styles.leftInfoContaier}>
159 <View style={styles.TInfoContaier}> 171 <View style={styles.TInfoContaier}>
160 <Text>年龄:</Text> 172 <Text>年龄:</Text>
161 - <Text>16</Text> 173 + <Text>{result.age}</Text>
162 </View> 174 </View>
163 <View style={styles.BInfoContaier}> 175 <View style={styles.BInfoContaier}>
164 <Text>个人年收入:</Text> 176 <Text>个人年收入:</Text>
165 - <Text>10</Text> 177 + <Text>{result.income}</Text>
166 </View> 178 </View>
167 </View> 179 </View>
168 <View style={styles.rightInfoContaier}> 180 <View style={styles.rightInfoContaier}>
169 <View style={styles.TInfoContaier}> 181 <View style={styles.TInfoContaier}>
170 <Text>社保:</Text> 182 <Text>社保:</Text>
171 - <Text>社保</Text> 183 + <Text>{result.security}社保</Text>
172 </View> 184 </View>
173 <View style={styles.BInfoContaier}> 185 <View style={styles.BInfoContaier}>
174 - <Text></Text> 186 + <Text></Text>
175 - <Text>XXX贷款</Text> 187 + <Text>{result.debt}</Text>
176 </View> 188 </View>
177 </View> 189 </View>
178 </View> 190 </View>
179 <View style={styles.adviceContainer}> 191 <View style={styles.adviceContainer}>
180 <Text style={styles.adviceText}> 192 <Text style={styles.adviceText}>
181 - 作为家庭的经济支柱,压力和责任重大,应优先进行保险配置,且应占家庭保险的中支出和总保额的大比重,建议依次配置以下产品,以保障家庭持续、高品质的运营 193 + {detail}
182 </Text> 194 </Text>
183 </View> 195 </View>
184 </View> 196 </View>
@@ -218,11 +230,11 @@ export default class Home extends Component { @@ -218,11 +230,11 @@ export default class Home extends Component {
218 </Row> 230 </Row>
219 <Row> 231 <Row>
220 <Col style={styles.actor} size={1}> 232 <Col style={styles.actor} size={1}>
221 - <Text style={styles.contentText}>父亲</Text> 233 + <Text style={styles.contentText}>{grid.actor}</Text>
222 - <Text style={styles.contentText}>42</Text> 234 + <Text style={styles.contentText}>{grid.age}</Text>
223 </Col> 235 </Col>
224 <Col size={5.5}> 236 <Col size={5.5}>
225 - {gridData.products.map((item, index) => { 237 + {grid.products.map((item, index) => {
226 return ( 238 return (
227 <Row key={index}> 239 <Row key={index}>
228 <Col size={1.5} style={styles.contentCol}> 240 <Col size={1.5} style={styles.contentCol}>
@@ -246,7 +258,7 @@ export default class Home extends Component { @@ -246,7 +258,7 @@ export default class Home extends Component {
246 ); 258 );
247 })} 259 })}
248 <Row style={styles.countContainer}> 260 <Row style={styles.countContainer}>
249 - <Text style={styles.countText}>{gridData.count}</Text> 261 + <Text style={styles.countText}>{grid.count}</Text>
250 <Text style={styles.contentText}>/</Text> 262 <Text style={styles.contentText}>/</Text>
251 </Row> 263 </Row>
252 </Col> 264 </Col>
@@ -272,13 +284,13 @@ export default class Home extends Component { @@ -272,13 +284,13 @@ export default class Home extends Component {
272 </TouchableOpacity> 284 </TouchableOpacity>
273 <TouchableOpacity 285 <TouchableOpacity
274 onPress={() => { 286 onPress={() => {
275 - {/* this.testAgain(); */}  
276 navigate("AIQuestion") 287 navigate("AIQuestion")
277 }} 288 }}
278 style={styles.testAgainBtn} 289 style={styles.testAgainBtn}
279 > 290 >
280 <Text style={styles.testAgainText}>再测一次</Text> 291 <Text style={styles.testAgainText}>再测一次</Text>
281 </TouchableOpacity> 292 </TouchableOpacity>
  293 + </ScrollView>
282 </View> 294 </View>
283 ); 295 );
284 } 296 }
@@ -24,8 +24,12 @@ export default class Home extends Component { @@ -24,8 +24,12 @@ export default class Home extends Component {
24 this.state = { 24 this.state = {
25 IS_LOGIN: "", 25 IS_LOGIN: "",
26 USER_ID: "", 26 USER_ID: "",
27 - result: null, 27 +
28 tested: false, 28 tested: false,
  29 + result: null,
  30 + grid: null,
  31 + detail: null,
  32 +
29 ListData: [], 33 ListData: [],
30 swiperImgList: [ 34 swiperImgList: [
31 { 35 {
@@ -53,7 +57,9 @@ export default class Home extends Component { @@ -53,7 +57,9 @@ export default class Home extends Component {
53 console.log('智能方案答案',res); 57 console.log('智能方案答案',res);
54 this.setState({ 58 this.setState({
55 tested: res.data.tested, 59 tested: res.data.tested,
56 - result: res.data.tested ? res.data.result : null 60 + result: res.data.tested ? res.data.result : null,
  61 + grid: res.data.tested ? res.data.grid : null,
  62 + detail: res.data.tested ? res.data.detail : null
57 }); 63 });
58 }, 64 },
59 err => { 65 err => {
@@ -211,7 +217,9 @@ export default class Home extends Component { @@ -211,7 +217,9 @@ export default class Home extends Component {
211 onPress={() => { 217 onPress={() => {
212 if (this.state.tested) { 218 if (this.state.tested) {
213 navigate("AISolution", { 219 navigate("AISolution", {
214 - result: this.state.result 220 + result: this.state.result,
  221 + grid: this.state.grid,
  222 + detail: this.state.detail
215 }); 223 });
216 } else { 224 } else {
217 navigate("AIBegin"); 225 navigate("AIBegin");