Showing
5 changed files
with
107 additions
and
5 deletions
| @@ -17,6 +17,7 @@ import AllProduct from "./src/pages/Home/allProduct"; | @@ -17,6 +17,7 @@ import AllProduct from "./src/pages/Home/allProduct"; | ||
| 17 | import ProductTemplate from "./src/Components/ProductTemplate"; | 17 | import ProductTemplate from "./src/Components/ProductTemplate"; |
| 18 | import ArticleTemplate from "./src/Components/articleTemplate"; | 18 | import ArticleTemplate from "./src/Components/articleTemplate"; |
| 19 | import Details from "./src/pages/InsuranceCircle/details"; | 19 | import Details from "./src/pages/InsuranceCircle/details"; |
| 20 | +import Release from "./src/pages/InsuranceCircle/release"; | ||
| 20 | import Discover from "./src/pages/Discover/index"; | 21 | import Discover from "./src/pages/Discover/index"; |
| 21 | import AIBegin from "./src/pages/Home/AISolution/Begin"; | 22 | import AIBegin from "./src/pages/Home/AISolution/Begin"; |
| 22 | import AIQuestion from "./src/pages/Home/AISolution/Question"; | 23 | import AIQuestion from "./src/pages/Home/AISolution/Question"; |
| @@ -114,6 +115,7 @@ const ProtectGod = StackNavigator( | @@ -114,6 +115,7 @@ const ProtectGod = StackNavigator( | ||
| 114 | ProductTemplate: { screen: ProductTemplate }, | 115 | ProductTemplate: { screen: ProductTemplate }, |
| 115 | ArticleTemplate: { screen: ArticleTemplate }, | 116 | ArticleTemplate: { screen: ArticleTemplate }, |
| 116 | Details: { screen: Details }, | 117 | Details: { screen: Details }, |
| 118 | + Release: { screen: Release }, | ||
| 117 | Discover: { screen: Discover }, | 119 | Discover: { screen: Discover }, |
| 118 | AIBegin: { | 120 | AIBegin: { |
| 119 | screen: AIBegin, | 121 | screen: AIBegin, |
| @@ -238,11 +238,7 @@ const styles = StyleSheet.create({ | @@ -238,11 +238,7 @@ const styles = StyleSheet.create({ | ||
| 238 | backgroundColor: "white" | 238 | backgroundColor: "white" |
| 239 | }, | 239 | }, |
| 240 | KAVContainer: { | 240 | KAVContainer: { |
| 241 | - // flex: 1, | ||
| 242 | justifyContent: "center" | 241 | justifyContent: "center" |
| 243 | - // paddingBottom: 52, | ||
| 244 | - // paddingHorizontal: 20, | ||
| 245 | - // paddingTop: 20, | ||
| 246 | }, | 242 | }, |
| 247 | scrollViewContainer: { | 243 | scrollViewContainer: { |
| 248 | flex: 1 | 244 | flex: 1 |
| @@ -12,17 +12,50 @@ import { StackNavigator, TabNavigator } from "react-navigation"; | @@ -12,17 +12,50 @@ import { StackNavigator, TabNavigator } from "react-navigation"; | ||
| 12 | import Details from "./details"; | 12 | import Details from "./details"; |
| 13 | 13 | ||
| 14 | export default class InsuranceCircle extends Component { | 14 | export default class InsuranceCircle extends Component { |
| 15 | + static navigationOptions = { | ||
| 16 | + // headerRight: this._rightBtn() | ||
| 17 | + } | ||
| 18 | + | ||
| 15 | constructor(props) { | 19 | constructor(props) { |
| 16 | super(props); | 20 | super(props); |
| 17 | this.state = { | 21 | this.state = { |
| 18 | ListData: [], | 22 | ListData: [], |
| 23 | + IS_LOGIN: "", | ||
| 24 | + USER_ID: "", | ||
| 25 | + NICKNAME: "", | ||
| 26 | + PROFESSION: "", | ||
| 19 | }; | 27 | }; |
| 20 | } | 28 | } |
| 21 | 29 | ||
| 22 | componentWillMount() { | 30 | componentWillMount() { |
| 31 | + this.getAsyncStorage(); | ||
| 23 | this.getArticles(); | 32 | this.getArticles(); |
| 24 | } | 33 | } |
| 25 | 34 | ||
| 35 | + _rightBtn() { | ||
| 36 | + return ( | ||
| 37 | + <TouchableOpacity style={{marginRight: 13}} onPress={() => {}}> | ||
| 38 | + <Image source={require("../../assets/circle/ic_announce.png")} style={{width: 19,height: 19}} /> | ||
| 39 | + </TouchableOpacity> | ||
| 40 | + ) | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + getAsyncStorage() { | ||
| 44 | + const that = this; | ||
| 45 | + AsyncStorage.multiGet(["IS_LOGIN","USER_ID","NICKNAME","PROFESSION"],(err, result) => { | ||
| 46 | + if (err) { | ||
| 47 | + console.error(err); | ||
| 48 | + } | ||
| 49 | + console.log("点击登录后的值",result) | ||
| 50 | + that.setState({ | ||
| 51 | + IS_LOGIN: result[0][1], | ||
| 52 | + USER_ID: (result[1][1] != null) ? result[1][1] : "", | ||
| 53 | + NICKNAME: (result[2][1] != null) ? result[2][1] : "", | ||
| 54 | + PROFESSION: (result[3][1] != null) ? result[3][1] : "", | ||
| 55 | + }) | ||
| 56 | + }) | ||
| 57 | + } | ||
| 58 | + | ||
| 26 | getArticles() { | 59 | getArticles() { |
| 27 | var that = this; | 60 | var that = this; |
| 28 | // 请求文章数据 | 61 | // 请求文章数据 |
src/pages/InsuranceCircle/release.js
0 → 100644
| 1 | +import React, { Component } from "react"; | ||
| 2 | +import { | ||
| 3 | + AppRegistry, | ||
| 4 | + StyleSheet, | ||
| 5 | + Text, | ||
| 6 | + View, | ||
| 7 | + Image, | ||
| 8 | + TouchableOpacity, | ||
| 9 | + ScrollView, | ||
| 10 | + ListView, | ||
| 11 | + Dimensions, | ||
| 12 | +} from "react-native"; | ||
| 13 | +import { StackNavigator, TabNavigator } from "react-navigation"; | ||
| 14 | + | ||
| 15 | +export default class Home extends Component { | ||
| 16 | + constructor(props) { | ||
| 17 | + super(props); | ||
| 18 | + this.state = {}; | ||
| 19 | + } | ||
| 20 | + componentWillMount() {} | ||
| 21 | + | ||
| 22 | + componentDidMount() {} | ||
| 23 | + | ||
| 24 | + getListData() { | ||
| 25 | + let that = this; | ||
| 26 | + return fetch(`https://devpay.brae.co/test/insurance/topic`, { | ||
| 27 | + method: "POST", | ||
| 28 | + headers: { | ||
| 29 | + Accept: "application/json", | ||
| 30 | + "Content-Type": "application/json" | ||
| 31 | + } | ||
| 32 | + }) | ||
| 33 | + .then(resp => { | ||
| 34 | + if (resp.status === 200) { | ||
| 35 | + return resp.json(); | ||
| 36 | + } else { | ||
| 37 | + console.error("something went wrong!"); | ||
| 38 | + } | ||
| 39 | + }) | ||
| 40 | + .then(respJson => { | ||
| 41 | + if (respJson.enmsg != "ok") { | ||
| 42 | + alert(respJson.cnmsg); | ||
| 43 | + } else { | ||
| 44 | + that.setState({ | ||
| 45 | + ListData: respJson.data.topic | ||
| 46 | + }); | ||
| 47 | + console.log("首页列表", this.state.ListData); | ||
| 48 | + } | ||
| 49 | + }); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + render() { | ||
| 53 | + // console.log("首页的this.props", this); | ||
| 54 | + // console.log("render首页文章列表", this.state.ListData); | ||
| 55 | + const { navigate } = this.props.navigation; | ||
| 56 | + return ( | ||
| 57 | + <View style={styles.container}> | ||
| 58 | + <Text>发布</Text> | ||
| 59 | + </View> | ||
| 60 | + ); | ||
| 61 | + } | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +const styles = StyleSheet.create({ | ||
| 65 | + container: { | ||
| 66 | + flex: 1, | ||
| 67 | + justifyContent: "flex-start", | ||
| 68 | + alignItems: "stretch", | ||
| 69 | + backgroundColor: "#EFEFEF" | ||
| 70 | + }, | ||
| 71 | +}); |
| @@ -256,7 +256,7 @@ export default class Login extends Component { | @@ -256,7 +256,7 @@ export default class Login extends Component { | ||
| 256 | NICKNAME: nickname, | 256 | NICKNAME: nickname, |
| 257 | PROFESSION: profession, | 257 | PROFESSION: profession, |
| 258 | }); | 258 | }); |
| 259 | - setTimeout(function () { | 259 | + setTimeout(function () { |
| 260 | that.props.navigation.goBack(); | 260 | that.props.navigation.goBack(); |
| 261 | },0) | 261 | },0) |
| 262 | } | 262 | } |
-
Please register or login to post a comment