Showing
1 changed file
with
17 additions
and
5 deletions
| @@ -12,6 +12,7 @@ import { | @@ -12,6 +12,7 @@ import { | ||
| 12 | } from "react-native"; | 12 | } from "react-native"; |
| 13 | import { StackNavigator, TabNavigator } from "react-navigation"; | 13 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 14 | import Details from "./details"; | 14 | import Details from "./details"; |
| 15 | +import post from "../../utils/fetch"; | ||
| 15 | 16 | ||
| 16 | export default class InsuranceCircle extends Component { | 17 | export default class InsuranceCircle extends Component { |
| 17 | static navigationOptions = ({ navigation }) => { | 18 | static navigationOptions = ({ navigation }) => { |
| @@ -38,7 +39,7 @@ export default class InsuranceCircle extends Component { | @@ -38,7 +39,7 @@ export default class InsuranceCircle extends Component { | ||
| 38 | USER_ID: "", | 39 | USER_ID: "", |
| 39 | NICKNAME: "", | 40 | NICKNAME: "", |
| 40 | PROFESSION: "", | 41 | PROFESSION: "", |
| 41 | - forGoBack: "", | 42 | + forGoBack: "" |
| 42 | }; | 43 | }; |
| 43 | } | 44 | } |
| 44 | componentWillMount() { | 45 | componentWillMount() { |
| @@ -71,11 +72,13 @@ export default class InsuranceCircle extends Component { | @@ -71,11 +72,13 @@ export default class InsuranceCircle extends Component { | ||
| 71 | }, | 72 | }, |
| 72 | () => { | 73 | () => { |
| 73 | if (this.state.IS_LOGIN == "yes") { | 74 | if (this.state.IS_LOGIN == "yes") { |
| 74 | - navigate("Release", { refreshCallback: data => { | 75 | + navigate("Release", { |
| 76 | + refreshCallback: data => { | ||
| 75 | that.setState({ | 77 | that.setState({ |
| 76 | ListData: data | 78 | ListData: data |
| 77 | - }) | 79 | + }); |
| 78 | - } }); | 80 | + } |
| 81 | + }); | ||
| 79 | } else { | 82 | } else { |
| 80 | Alert.alert("请先登录账号"); | 83 | Alert.alert("请先登录账号"); |
| 81 | } | 84 | } |
| @@ -107,6 +110,16 @@ export default class InsuranceCircle extends Component { | @@ -107,6 +110,16 @@ export default class InsuranceCircle extends Component { | ||
| 107 | getArticles() { | 110 | getArticles() { |
| 108 | var that = this; | 111 | var that = this; |
| 109 | // 请求文章数据 | 112 | // 请求文章数据 |
| 113 | + // post( | ||
| 114 | + // "/test/insurance/article", | ||
| 115 | + // {}, | ||
| 116 | + // res => { | ||
| 117 | + // console.log("post", res.data.data); | ||
| 118 | + // }, | ||
| 119 | + // err => { | ||
| 120 | + // console.log(err); | ||
| 121 | + // } | ||
| 122 | + // ); | ||
| 110 | return fetch(`https://devpay.brae.co/test/insurance/article`, { | 123 | return fetch(`https://devpay.brae.co/test/insurance/article`, { |
| 111 | method: "POST", | 124 | method: "POST", |
| 112 | headers: { | 125 | headers: { |
| @@ -128,7 +141,6 @@ export default class InsuranceCircle extends Component { | @@ -128,7 +141,6 @@ export default class InsuranceCircle extends Component { | ||
| 128 | that.setState({ | 141 | that.setState({ |
| 129 | ListData: respJson.data.data | 142 | ListData: respJson.data.data |
| 130 | }); | 143 | }); |
| 131 | - // console.log("state.ListData", this.state.ListData); | ||
| 132 | } | 144 | } |
| 133 | }) | 145 | }) |
| 134 | .catch(err => console.error(err)); | 146 | .catch(err => console.error(err)); |
-
Please register or login to post a comment