罗广聪

开始处理客户管理的回调

... ... @@ -81,7 +81,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
... ...
... ... @@ -9,14 +9,18 @@ import {
ScrollView,
ListView,
Dimensions,
DatePickerIOS
DatePickerIOS,
AsyncStorage
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
import post from "../../../utils/fetch";
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {
IS_LOGIN: "",
USER_ID: "",
QuesList: [
{
title: "1.我该称呼您先生还是女士呢?",
... ... @@ -59,7 +63,9 @@ export default class Home extends Component {
date: new Date()
};
}
componentWillMount() {}
componentWillMount() {
this.getAsyncStorage();
}
componentDidMount() {}
... ... @@ -91,6 +97,19 @@ export default class Home extends Component {
});
}
getAsyncStorage() {
const that = this;
AsyncStorage.multiGet(["IS_LOGIN", "USER_ID"], (err, result) => {
if (err) {
console.error(err);
}
that.setState({
IS_LOGIN: result[0][1],
USER_ID: result[1][1] != null ? result[1][1] : ""
});
});
}
_renderQuestion() {
return this.state.QuesList.map((item, index) => {
return (
... ... @@ -155,6 +174,7 @@ export default class Home extends Component {
submit() {
const that = this;
const { answerList,USER_ID } = this.state;
const { navigate } = this.props.navigation;
let Temp = this.state.QuesList.map(item => item.answers[item.selected]);
console.log(Temp);
... ... @@ -164,7 +184,21 @@ export default class Home extends Component {
answerList: Temp
},
() => {
post(
`/test/insurance/advice`,
{
userid: USER_ID,
// result: answerList
},
res => {
Alert.alert("导入成功,点击“OK”查看结果", null, () => {
navigate("AISolution", { answerList: that.state.answerList });
});
},
err => {
console.log(err);
}
);
}
);
}
... ...