罗广聪

prepare AH

@@ -18,77 +18,86 @@ import ProductTemplate from "./src/Components/ProductTemplate"; @@ -18,77 +18,86 @@ 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(
24 - Home: { 30 + {
25 - screen: Home, 31 + Home: {
26 - navigationOptions: { 32 + screen: Home,
27 - title: "首页", 33 + navigationOptions: {
28 - tabBarIcon: ({ focused }) => 34 + title: "首页",
29 - focused ? ( 35 + tabBarIcon: ({ focused }) =>
30 - <Image source={require("./src/assets/tabbar/ic_home_s.png")} /> 36 + focused ? (
31 - ) : ( 37 + <Image source={require("./src/assets/tabbar/ic_home_s.png")} />
32 - <Image source={require("./src/assets/tabbar/ic_home_n.png")} /> 38 + ) : (
33 - ) 39 + <Image source={require("./src/assets/tabbar/ic_home_n.png")} />
34 - } 40 + )
35 - }, 41 + }
36 - InsuranceCircle: { 42 + },
37 - screen: InsuranceCircle, 43 + InsuranceCircle: {
38 - navigationOptions: { 44 + screen: InsuranceCircle,
39 - title: "保圈", 45 + navigationOptions: {
40 - tabBarIcon: ({ focused }) => 46 + title: "保圈",
41 - focused ? ( 47 + tabBarIcon: ({ focused }) =>
42 - <Image source={require("./src/assets/tabbar/ic_circle_s.png")} /> 48 + focused ? (
43 - ) : ( 49 + <Image source={require("./src/assets/tabbar/ic_circle_s.png")} />
44 - <Image source={require("./src/assets/tabbar/ic_circle_n.png")} /> 50 + ) : (
45 - ) 51 + <Image source={require("./src/assets/tabbar/ic_circle_n.png")} />
46 - } 52 + )
47 - }, 53 + }
48 - Discover: { 54 + },
49 - screen: Discover, 55 + Discover: {
50 - navigationOptions: { 56 + screen: Discover,
51 - title: "发现", 57 + navigationOptions: {
52 - // header: null, 58 + title: "发现",
53 - // tabBarVisible: false, 59 + // header: null,
54 - tabBarIcon: ({ focused }) => 60 + // tabBarVisible: false,
55 - focused ? ( 61 + tabBarIcon: ({ focused }) =>
56 - <Image source={require("./src/assets/tabbar/ic_discover_s.png")} /> 62 + focused ? (
57 - ) : ( 63 + <Image source={require("./src/assets/tabbar/ic_discover_s.png")} />
58 - <Image source={require("./src/assets/tabbar/ic_discover_n.png")} /> 64 + ) : (
59 - ) 65 + <Image source={require("./src/assets/tabbar/ic_discover_n.png")} />
60 - } 66 + )
61 - }, 67 + }
62 - InsuranceChurch: { 68 + },
63 - screen: InsuranceChurch, 69 + InsuranceChurch: {
64 - navigationOptions: { 70 + screen: InsuranceChurch,
65 - title: "保堂", 71 + navigationOptions: {
66 - tabBarIcon: ({ focused }) => 72 + title: "保堂",
67 - focused ? ( 73 + tabBarIcon: ({ focused }) =>
68 - <Image source={require("./src/assets/tabbar/ic_umbrella_s.png")} /> 74 + focused ? (
69 - ) : ( 75 + <Image source={require("./src/assets/tabbar/ic_umbrella_s.png")} />
70 - <Image source={require("./src/assets/tabbar/ic_umbrella_n.png")} /> 76 + ) : (
71 - ) 77 + <Image source={require("./src/assets/tabbar/ic_umbrella_n.png")} />
  78 + )
  79 + }
  80 + },
  81 + Mine: {
  82 + screen: Mine,
  83 + navigationOptions: {
  84 + title: "我的",
  85 + tabBarIcon: ({ focused }) =>
  86 + focused ? (
  87 + <Image source={require("./src/assets/tabbar/ic_mine_s.png")} />
  88 + ) : (
  89 + <Image source={require("./src/assets/tabbar/ic_mine_n.png")} />
  90 + )
  91 + }
72 } 92 }
73 }, 93 },
74 - Mine: { 94 + {
75 - screen: Mine, 95 + swipeEnabled: true,
76 - navigationOptions: { 96 + tabBarOptions: {
77 - title: "我的", 97 + activeTintColor: "#1B9341"
78 - tabBarIcon: ({ focused }) =>  
79 - focused ? (  
80 - <Image source={require("./src/assets/tabbar/ic_mine_s.png")} />  
81 - ) : (  
82 - <Image source={require("./src/assets/tabbar/ic_mine_n.png")} />  
83 - )  
84 } 98 }
85 } 99 }
86 -},{ 100 +);
87 - swipeEnabled: true,  
88 - tabBarOptions: {  
89 - activeTintColor: "#1B9341"  
90 - }  
91 -});  
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: {},