罗广聪

prepare AH

@@ -18,9 +18,16 @@ import ProductTemplate from "./src/Components/ProductTemplate"; @@ -18,9 +18,16 @@ 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 Discover from "./src/pages/Discover/index"; 20 import Discover from "./src/pages/Discover/index";
  21 +import AIBegin from "./src/pages/Home/AISolution/Begin";
  22 +import AIQuestion from "./src/pages/Home/AISolution/Question";
  23 +import AISolution from "./src/pages/Home/AISolution/Solution";
  24 +import HealthBegin from "./src/pages/Home/HealthQuestionnaire/HealthBegin";
  25 +import HealthQuestion from "./src/pages/Home/HealthQuestionnaire/HealthQuestion";
  26 +import HealthResult from "./src/pages/Home/HealthQuestionnaire/HealthResult";
21 27
22 // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面 28 // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面
23 -const MainTabBar = TabNavigator({ 29 +const MainTabBar = TabNavigator(
  30 + {
24 Home: { 31 Home: {
25 screen: Home, 32 screen: Home,
26 navigationOptions: { 33 navigationOptions: {
@@ -83,12 +90,14 @@ const MainTabBar = TabNavigator({ @@ -83,12 +90,14 @@ const MainTabBar = TabNavigator({
83 ) 90 )
84 } 91 }
85 } 92 }
86 -},{ 93 + },
  94 + {
87 swipeEnabled: true, 95 swipeEnabled: true,
88 tabBarOptions: { 96 tabBarOptions: {
89 activeTintColor: "#1B9341" 97 activeTintColor: "#1B9341"
90 } 98 }
91 -}); 99 + }
  100 +);
92 101
93 const ProtectGod = StackNavigator( 102 const ProtectGod = StackNavigator(
94 { 103 {
@@ -105,8 +114,33 @@ const ProtectGod = StackNavigator( @@ -105,8 +114,33 @@ const ProtectGod = StackNavigator(
105 ProductTemplate: { screen: ProductTemplate }, 114 ProductTemplate: { screen: ProductTemplate },
106 ArticleTemplate: { screen: ArticleTemplate }, 115 ArticleTemplate: { screen: ArticleTemplate },
107 Details: { screen: Details }, 116 Details: { screen: Details },
108 - Discover: { screen: Discover } 117 + Discover: { screen: Discover },
109 - },{ 118 + AIBegin: {
  119 + screen: AIBegin,
  120 + navigationOptions: { headerTitle: "智能方案" }
  121 + },
  122 + AIQuestion: {
  123 + screen: AIQuestion,
  124 + navigationOptions: { headerTitle: "智能方案" }
  125 + },
  126 + AISolution: {
  127 + screen: AISolution,
  128 + navigationOptions: { headerTitle: "智能方案" }
  129 + },
  130 + HealthBegin: {
  131 + screen: HealthBegin,
  132 + navigationOptions: { headerTitle: "健康问卷" }
  133 + },
  134 + HealthQuestion: {
  135 + screen: HealthQuestion,
  136 + navigationOptions: { headerTitle: "健康问卷" }
  137 + },
  138 + HealthResult: {
  139 + screen: HealthResult,
  140 + navigationOptions: { headerTitle: "健康问卷" }
  141 + },
  142 + },
  143 + {
110 navigationOptions: { 144 navigationOptions: {
111 // headerTintColor: "blue", 145 // headerTintColor: "blue",
112 headerBackTitle: "返回", 146 headerBackTitle: "返回",
@@ -117,8 +151,6 @@ const ProtectGod = StackNavigator( @@ -117,8 +151,6 @@ const ProtectGod = StackNavigator(
117 } 151 }
118 ); 152 );
119 153
120 -const styles = StyleSheet.create( 154 +const styles = StyleSheet.create();
121 -  
122 -);  
123 155
124 AppRegistry.registerComponent("ProtectGod", () => ProtectGod); 156 AppRegistry.registerComponent("ProtectGod", () => ProtectGod);
  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 +});
  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 +});
  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 +});
@@ -160,11 +160,21 @@ export default class Home extends Component { @@ -160,11 +160,21 @@ export default class Home extends Component {
160 160
161 {/* 智能方案和健康问卷入口 */} 161 {/* 智能方案和健康问卷入口 */}
162 <View style={styles.AIAndHealthContainer}> 162 <View style={styles.AIAndHealthContainer}>
163 - <TouchableOpacity style={styles.AHContainer}> 163 + <TouchableOpacity
  164 + style={styles.AHContainer}
  165 + onPress={() => {
  166 + navigate("AIBegin");
  167 + }}
  168 + >
164 <Image style={styles.AHIcon} /> 169 <Image style={styles.AHIcon} />
165 <Text style={styles.AHText}>智能方案</Text> 170 <Text style={styles.AHText}>智能方案</Text>
166 </TouchableOpacity> 171 </TouchableOpacity>
167 - <TouchableOpacity style={styles.AHContainer}> 172 + <TouchableOpacity
  173 + style={styles.AHContainer}
  174 + onPress={() => {
  175 + navigate("HealthBegin");
  176 + }}
  177 + >
168 <Image style={styles.AHIcon} /> 178 <Image style={styles.AHIcon} />
169 <Text style={styles.AHText}>健康问卷</Text> 179 <Text style={styles.AHText}>健康问卷</Text>
170 </TouchableOpacity> 180 </TouchableOpacity>
@@ -251,8 +261,9 @@ const styles = StyleSheet.create({ @@ -251,8 +261,9 @@ const styles = StyleSheet.create({
251 justifyContent: "space-around", 261 justifyContent: "space-around",
252 alignItems: "center", 262 alignItems: "center",
253 marginTop: 10, 263 marginTop: 10,
254 - // marginBottom: 10,  
255 backgroundColor: "white", 264 backgroundColor: "white",
  265 + paddingTop: 10,
  266 + paddingBottom: 10,
256 }, 267 },
257 AHContainer: {}, 268 AHContainer: {},
258 AHIcon: {}, 269 AHIcon: {},