Showing
4 changed files
with
75 additions
and
30 deletions
| @@ -23,6 +23,7 @@ import AIBegin from "./src/pages/Home/AISolution/Begin"; | @@ -23,6 +23,7 @@ import AIBegin from "./src/pages/Home/AISolution/Begin"; | ||
| 23 | import AIQuestion from "./src/pages/Home/AISolution/Question"; | 23 | import AIQuestion from "./src/pages/Home/AISolution/Question"; |
| 24 | import AISolution from "./src/pages/Home/AISolution/Solution"; | 24 | import AISolution from "./src/pages/Home/AISolution/Solution"; |
| 25 | import HealthQuestionnaire from "./src/pages/Home/healthQuestionnaire"; | 25 | import HealthQuestionnaire from "./src/pages/Home/healthQuestionnaire"; |
| 26 | +import Evaluate from "./src/pages/Mine/Evaluate"; | ||
| 26 | 27 | ||
| 27 | // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面 | 28 | // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面 |
| 28 | const MainTabBar = TabNavigator( | 29 | const MainTabBar = TabNavigator( |
| @@ -133,6 +134,10 @@ const ProtectGod = StackNavigator( | @@ -133,6 +134,10 @@ const ProtectGod = StackNavigator( | ||
| 133 | HealthQuestionnaire: { | 134 | HealthQuestionnaire: { |
| 134 | screen: HealthQuestionnaire, | 135 | screen: HealthQuestionnaire, |
| 135 | navigationOptions: { headerTitle: "健康问卷" } | 136 | navigationOptions: { headerTitle: "健康问卷" } |
| 137 | + }, | ||
| 138 | + Evaluate: { | ||
| 139 | + screen: Evaluate, | ||
| 140 | + navigationOptions: { headerTitle: "评价" } | ||
| 136 | } | 141 | } |
| 137 | }, | 142 | }, |
| 138 | { | 143 | { |
src/pages/Mine/Evaluate.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 | +import post from "../../utils/fetch"; | ||
| 15 | + | ||
| 16 | +export default class Home extends Component { | ||
| 17 | + static navigationOptions = ({ navigation }) => { | ||
| 18 | + const { state, setParams, navigate } = navigation; | ||
| 19 | + return { | ||
| 20 | + headerRight: ( | ||
| 21 | + <TouchableOpacity | ||
| 22 | + style={{ marginRight: 13 }} | ||
| 23 | + onPress={() => state.params.submit()} | ||
| 24 | + > | ||
| 25 | + <Text style={{fontSize: 16,color: "#0071E1"}}>提交</Text> | ||
| 26 | + </TouchableOpacity> | ||
| 27 | + ) | ||
| 28 | + }; | ||
| 29 | + }; | ||
| 30 | + constructor(props) { | ||
| 31 | + super(props); | ||
| 32 | + this.state = {}; | ||
| 33 | + } | ||
| 34 | + componentWillMount() {} | ||
| 35 | + | ||
| 36 | + componentDidMount() { | ||
| 37 | + this.props.navigation.setParams({ | ||
| 38 | + submit: this.submit.bind(this) | ||
| 39 | + }); | ||
| 40 | + } | ||
| 41 | + // | ||
| 42 | + submit() { console.log("提交成功") } | ||
| 43 | + | ||
| 44 | + getListData() { | ||
| 45 | + post("/test/insurance/article", {}, res => {}, err => {}); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + render() { | ||
| 49 | + const { navigate } = this.props.navigation; | ||
| 50 | + return ( | ||
| 51 | + <View style={styles.container}> | ||
| 52 | + <Text>评价页面</Text> | ||
| 53 | + </View> | ||
| 54 | + ); | ||
| 55 | + } | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +const styles = StyleSheet.create({ | ||
| 59 | + container: { | ||
| 60 | + flex: 1, | ||
| 61 | + justifyContent: "flex-start", | ||
| 62 | + alignItems: "stretch", | ||
| 63 | + backgroundColor: "#EFEFEF" | ||
| 64 | + } | ||
| 65 | +}); |
| @@ -315,7 +315,7 @@ export default class Mine extends Component { | @@ -315,7 +315,7 @@ export default class Mine extends Component { | ||
| 315 | 315 | ||
| 316 | {/* 评价和客服 */} | 316 | {/* 评价和客服 */} |
| 317 | <View style={styles.midContainer}> | 317 | <View style={styles.midContainer}> |
| 318 | - <TouchableOpacity style={styles.itemContainer}> | 318 | + <TouchableOpacity style={styles.itemContainer} onPress={() => navigate('Evaluate')}> |
| 319 | <View style={styles.itemLeft}> | 319 | <View style={styles.itemLeft}> |
| 320 | <Text style={styles.leftTitle}>评价我们</Text> | 320 | <Text style={styles.leftTitle}>评价我们</Text> |
| 321 | </View> | 321 | </View> |
| @@ -11,6 +11,7 @@ import { | @@ -11,6 +11,7 @@ import { | ||
| 11 | Dimensions, | 11 | Dimensions, |
| 12 | } from "react-native"; | 12 | } from "react-native"; |
| 13 | import { StackNavigator, TabNavigator } from "react-navigation"; | 13 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 14 | +import post from "../../utils/fetch"; | ||
| 14 | 15 | ||
| 15 | export default class Home extends Component { | 16 | export default class Home extends Component { |
| 16 | constructor(props) { | 17 | constructor(props) { |
| @@ -22,40 +23,14 @@ export default class Home extends Component { | @@ -22,40 +23,14 @@ export default class Home extends Component { | ||
| 22 | componentDidMount() {} | 23 | componentDidMount() {} |
| 23 | 24 | ||
| 24 | getListData() { | 25 | getListData() { |
| 25 | - let that = this; | 26 | + post("/test/insurance/article", {}, res => {}, err => {}); |
| 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 | } | 27 | } |
| 51 | 28 | ||
| 52 | render() { | 29 | render() { |
| 53 | - // console.log("首页的this.props", this); | ||
| 54 | - // console.log("render首页文章列表", this.state.ListData); | ||
| 55 | const { navigate } = this.props.navigation; | 30 | const { navigate } = this.props.navigation; |
| 56 | return ( | 31 | return ( |
| 57 | <View style={styles.container}> | 32 | <View style={styles.container}> |
| 58 | - <Text>智能问题</Text> | 33 | + <Text>页面</Text> |
| 59 | </View> | 34 | </View> |
| 60 | ); | 35 | ); |
| 61 | } | 36 | } |
| @@ -67,5 +42,5 @@ const styles = StyleSheet.create({ | @@ -67,5 +42,5 @@ const styles = StyleSheet.create({ | ||
| 67 | justifyContent: "flex-start", | 42 | justifyContent: "flex-start", |
| 68 | alignItems: "stretch", | 43 | alignItems: "stretch", |
| 69 | backgroundColor: "#EFEFEF" | 44 | backgroundColor: "#EFEFEF" |
| 70 | - }, | 45 | + } |
| 71 | }); | 46 | }); |
-
Please register or login to post a comment