罗广聪

添加和修改都OK 回调没处理

... ... @@ -25,7 +25,9 @@ export default class Edit extends Component {
this.state = {
USER_ID: "",
IS_LOGIN: "",
customer_id: this.props.navigation.state.params.item.id,
customer_id: this.props.navigation.state.params.item
? this.props.navigation.state.params.item.id
: null,
todo: this.props.navigation.state.params.todo,
name: "",
age: "",
... ... @@ -138,7 +140,7 @@ export default class Edit extends Component {
delete() {
const that = this;
const { customer_id } = this.state;
const { state,goBack } = this.props.navigation;
const { state, goBack } = this.props.navigation;
post(
`/test/insurance/contact/del/${customer_id}`,
{},
... ... @@ -338,7 +340,7 @@ export default class Edit extends Component {
<View style={styles.btnContainer}>
<TouchableOpacity
onPress={() => {
if(this.state.todo == 'edit') {
if (this.state.todo == "edit") {
this.submit();
} else {
this.add();
... ...
... ... @@ -24,7 +24,7 @@ export default class Customer extends Component {
USER_ID: "",
NICKNAME: "",
PROFESSION: "",
hasCustomer: true,
hasCustomer: false,
customersList: []
};
this.getAllPhone = this.getAllPhone.bind(this);
... ... @@ -73,10 +73,12 @@ export default class Customer extends Component {
`/test/insurance/contact/get/${that.state.USER_ID}`,
{},
res => {
that.setState({
hasCustomer: true,
customersList: res.data.contacts
});
if (res.data.contacts) {
that.setState({
hasCustomer: true,
customersList: res.data.contacts
});
}
},
err => {
console.log("通信录err", err);
... ... @@ -136,7 +138,7 @@ export default class Customer extends Component {
<TouchableOpacity
style={styles.mainBtnContaierLeft}
onPress={() => {
navigate("CustomerEdit",{todo: 'add'});
navigate("CustomerEdit", { todo: "add" });
}}
>
<Image
... ... @@ -145,7 +147,12 @@ export default class Customer extends Component {
/>
<Text style={styles.mainBtnLeftText}>手动添加</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.mainBtnContaierRight}>
<TouchableOpacity
style={styles.mainBtnContaierRight}
onPress={() => {
this.getAllPhone();
}}
>
<Image
style={styles.mainBtnRightImg}
source={require("../../assets/customer/ic_message.png")}
... ... @@ -162,7 +169,7 @@ export default class Customer extends Component {
onPress={() =>
navigate("CustomerEdit", {
item: item,
todo: 'edit',
todo: "edit",
refreshCallback: this.getAsyncStorage
})}
>
... ...