Showing
4 changed files
with
284 additions
and
0 deletions
src/pages/Home/AISolution/Begin.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 | +}); |
src/pages/Home/AISolution/Question.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 | +}); |
src/pages/Home/AISolution/Solution.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 | +}); |
src/pages/Template.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 | +}); |
-
Please register or login to post a comment