罗广聪

AI 大致OK

... ... @@ -152,10 +152,11 @@ export default class Home extends Component {
let Temp = this.state.QuesList.map(item => item.answers[item.selected]);
Temp.splice(3, 1, that.format(that.state.date));
let Result = {
age: 2017 - parseInt(Temp[3].split("-")[0]),
security: Temp[5],
income: Temp[4],
debt: Temp[2]
debt: Temp[1],
target: Temp[2],
age: (2017 - parseInt(Temp[3].split("-")[0])).toString(),
};
console.log("temp Result", Temp, Result);
if (this.state.IS_LOGIN != "yes") {
... ... @@ -168,7 +169,12 @@ export default class Home extends Component {
result: Result
},
res => {
navigate("AISolution");
console.log("请求的AI数据",res)
navigate("AISolution",{
result: res.data.result,
grid: res.data.grid,
detail: res.data.detail,
});
},
err => {}
);
... ...
... ... @@ -53,15 +53,26 @@ export default class Home extends Component {
eachyear: "150元"
}
],
count: "1200"
count: "1200",
result: null,
grid: null,
detail: null,
}
};
}
componentWillMount() {
this.getAsyncStorage();
console.log('智能方案页面的导航数据',this.props.navigation);
this.setState({
result: this.props.navigation.state.params.result,
grid: this.props.navigation.state.params.grid,
detail: this.props.navigation.state.params.detail,
})
}
componentDidMount() {}
componentDidMount() {
console.log('智能方案三个数据',this.state.grid)
}
getAsyncStorage() {
const that = this;
... ... @@ -145,9 +156,10 @@ export default class Home extends Component {
render() {
console.log("solution", this.props.navigation);
const { navigate } = this.props.navigation;
const { gridData } = this.state;
const { gridData,result,grid,detail } = this.state;
return (
<View style={styles.container}>
<ScrollView>
<View style={styles.ownContaier}>
<View style={styles.headerContainer}>
<View style={styles.titleWrapper}>
... ... @@ -158,27 +170,27 @@ export default class Home extends Component {
<View style={styles.leftInfoContaier}>
<View style={styles.TInfoContaier}>
<Text>年龄:</Text>
<Text>16</Text>
<Text>{result.age}</Text>
</View>
<View style={styles.BInfoContaier}>
<Text>个人年收入:</Text>
<Text>10</Text>
<Text>{result.income}</Text>
</View>
</View>
<View style={styles.rightInfoContaier}>
<View style={styles.TInfoContaier}>
<Text>社保:</Text>
<Text>社保</Text>
<Text>{result.security}社保</Text>
</View>
<View style={styles.BInfoContaier}>
<Text></Text>
<Text>XXX贷款</Text>
<Text></Text>
<Text>{result.debt}</Text>
</View>
</View>
</View>
<View style={styles.adviceContainer}>
<Text style={styles.adviceText}>
作为家庭的经济支柱,压力和责任重大,应优先进行保险配置,且应占家庭保险的中支出和总保额的大比重,建议依次配置以下产品,以保障家庭持续、高品质的运营
{detail}
</Text>
</View>
</View>
... ... @@ -218,11 +230,11 @@ export default class Home extends Component {
</Row>
<Row>
<Col style={styles.actor} size={1}>
<Text style={styles.contentText}>父亲</Text>
<Text style={styles.contentText}>42</Text>
<Text style={styles.contentText}>{grid.actor}</Text>
<Text style={styles.contentText}>{grid.age}</Text>
</Col>
<Col size={5.5}>
{gridData.products.map((item, index) => {
{grid.products.map((item, index) => {
return (
<Row key={index}>
<Col size={1.5} style={styles.contentCol}>
... ... @@ -246,7 +258,7 @@ export default class Home extends Component {
);
})}
<Row style={styles.countContainer}>
<Text style={styles.countText}>{gridData.count}</Text>
<Text style={styles.countText}>{grid.count}</Text>
<Text style={styles.contentText}>/</Text>
</Row>
</Col>
... ... @@ -272,13 +284,13 @@ export default class Home extends Component {
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
{/* this.testAgain(); */}
navigate("AIQuestion")
}}
style={styles.testAgainBtn}
>
<Text style={styles.testAgainText}>再测一次</Text>
</TouchableOpacity>
</ScrollView>
</View>
);
}
... ...
... ... @@ -24,8 +24,12 @@ export default class Home extends Component {
this.state = {
IS_LOGIN: "",
USER_ID: "",
result: null,
tested: false,
result: null,
grid: null,
detail: null,
ListData: [],
swiperImgList: [
{
... ... @@ -53,7 +57,9 @@ export default class Home extends Component {
console.log('智能方案答案',res);
this.setState({
tested: res.data.tested,
result: res.data.tested ? res.data.result : null
result: res.data.tested ? res.data.result : null,
grid: res.data.tested ? res.data.grid : null,
detail: res.data.tested ? res.data.detail : null
});
},
err => {
... ... @@ -211,7 +217,9 @@ export default class Home extends Component {
onPress={() => {
if (this.state.tested) {
navigate("AISolution", {
result: this.state.result
result: this.state.result,
grid: this.state.grid,
detail: this.state.detail
});
} else {
navigate("AIBegin");
... ...