罗广聪

prepare AH

... ... @@ -18,9 +18,16 @@ import ProductTemplate from "./src/Components/ProductTemplate";
import ArticleTemplate from "./src/Components/articleTemplate";
import Details from "./src/pages/InsuranceCircle/details";
import Discover from "./src/pages/Discover/index";
import AIBegin from "./src/pages/Home/AISolution/Begin";
import AIQuestion from "./src/pages/Home/AISolution/Question";
import AISolution from "./src/pages/Home/AISolution/Solution";
import HealthBegin from "./src/pages/Home/HealthQuestionnaire/HealthBegin";
import HealthQuestion from "./src/pages/Home/HealthQuestionnaire/HealthQuestion";
import HealthResult from "./src/pages/Home/HealthQuestionnaire/HealthResult";
// 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面
const MainTabBar = TabNavigator({
const MainTabBar = TabNavigator(
{
Home: {
screen: Home,
navigationOptions: {
... ... @@ -83,12 +90,14 @@ const MainTabBar = TabNavigator({
)
}
}
},{
},
{
swipeEnabled: true,
tabBarOptions: {
activeTintColor: "#1B9341"
}
});
}
);
const ProtectGod = StackNavigator(
{
... ... @@ -105,8 +114,33 @@ const ProtectGod = StackNavigator(
ProductTemplate: { screen: ProductTemplate },
ArticleTemplate: { screen: ArticleTemplate },
Details: { screen: Details },
Discover: { screen: Discover }
},{
Discover: { screen: Discover },
AIBegin: {
screen: AIBegin,
navigationOptions: { headerTitle: "智能方案" }
},
AIQuestion: {
screen: AIQuestion,
navigationOptions: { headerTitle: "智能方案" }
},
AISolution: {
screen: AISolution,
navigationOptions: { headerTitle: "智能方案" }
},
HealthBegin: {
screen: HealthBegin,
navigationOptions: { headerTitle: "健康问卷" }
},
HealthQuestion: {
screen: HealthQuestion,
navigationOptions: { headerTitle: "健康问卷" }
},
HealthResult: {
screen: HealthResult,
navigationOptions: { headerTitle: "健康问卷" }
},
},
{
navigationOptions: {
// headerTintColor: "blue",
headerBackTitle: "返回",
... ... @@ -117,8 +151,6 @@ const ProtectGod = StackNavigator(
}
);
const styles = StyleSheet.create(
);
const styles = StyleSheet.create();
AppRegistry.registerComponent("ProtectGod", () => ProtectGod);
... ...
import React, { Component } from "react";
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
ScrollView,
ListView,
Dimensions,
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentWillMount() {}
componentDidMount() {}
getListData() {
let that = this;
return fetch(`https://devpay.brae.co/test/insurance/topic`, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(resp => {
if (resp.status === 200) {
return resp.json();
} else {
console.error("something went wrong!");
}
})
.then(respJson => {
if (respJson.enmsg != "ok") {
alert(respJson.cnmsg);
} else {
that.setState({
ListData: respJson.data.topic
});
console.log("首页列表", this.state.ListData);
}
});
}
render() {
// console.log("首页的this.props", this);
// console.log("render首页文章列表", this.state.ListData);
const { navigate } = this.props.navigation;
return (
<View style={styles.container}>
<Text>健康问卷开始</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "flex-start",
alignItems: "stretch",
backgroundColor: "#EFEFEF"
},
});
... ...
import React, { Component } from "react";
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
ScrollView,
ListView,
Dimensions,
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentWillMount() {}
componentDidMount() {}
getListData() {
let that = this;
return fetch(`https://devpay.brae.co/test/insurance/topic`, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(resp => {
if (resp.status === 200) {
return resp.json();
} else {
console.error("something went wrong!");
}
})
.then(respJson => {
if (respJson.enmsg != "ok") {
alert(respJson.cnmsg);
} else {
that.setState({
ListData: respJson.data.topic
});
console.log("首页列表", this.state.ListData);
}
});
}
render() {
// console.log("首页的this.props", this);
// console.log("render首页文章列表", this.state.ListData);
const { navigate } = this.props.navigation;
return (
<View style={styles.container}>
<Text>健康问卷 问题</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "flex-start",
alignItems: "stretch",
backgroundColor: "#EFEFEF"
},
});
... ...
import React, { Component } from "react";
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
ScrollView,
ListView,
Dimensions,
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentWillMount() {}
componentDidMount() {}
getListData() {
let that = this;
return fetch(`https://devpay.brae.co/test/insurance/topic`, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(resp => {
if (resp.status === 200) {
return resp.json();
} else {
console.error("something went wrong!");
}
})
.then(respJson => {
if (respJson.enmsg != "ok") {
alert(respJson.cnmsg);
} else {
that.setState({
ListData: respJson.data.topic
});
console.log("首页列表", this.state.ListData);
}
});
}
render() {
// console.log("首页的this.props", this);
// console.log("render首页文章列表", this.state.ListData);
const { navigate } = this.props.navigation;
return (
<View style={styles.container}>
<Text>健康问卷 结果</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "flex-start",
alignItems: "stretch",
backgroundColor: "#EFEFEF"
},
});
... ...
... ... @@ -160,11 +160,21 @@ export default class Home extends Component {
{/* 智能方案和健康问卷入口 */}
<View style={styles.AIAndHealthContainer}>
<TouchableOpacity style={styles.AHContainer}>
<TouchableOpacity
style={styles.AHContainer}
onPress={() => {
navigate("AIBegin");
}}
>
<Image style={styles.AHIcon} />
<Text style={styles.AHText}>智能方案</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.AHContainer}>
<TouchableOpacity
style={styles.AHContainer}
onPress={() => {
navigate("HealthBegin");
}}
>
<Image style={styles.AHIcon} />
<Text style={styles.AHText}>健康问卷</Text>
</TouchableOpacity>
... ... @@ -251,8 +261,9 @@ const styles = StyleSheet.create({
justifyContent: "space-around",
alignItems: "center",
marginTop: 10,
// marginBottom: 10,
backgroundColor: "white",
paddingTop: 10,
paddingBottom: 10,
},
AHContainer: {},
AHIcon: {},
... ...