Showing
7 changed files
with
26 additions
and
71 deletions
| @@ -14,7 +14,6 @@ import InsuranceChurch from "./src/pages/InsuranceChurch/index"; | @@ -14,7 +14,6 @@ import InsuranceChurch from "./src/pages/InsuranceChurch/index"; | ||
| 14 | import Mine from "./src/pages/Mine/index"; | 14 | import Mine from "./src/pages/Mine/index"; |
| 15 | import Login from "./src/pages/Login"; | 15 | import Login from "./src/pages/Login"; |
| 16 | import AllProduct from "./src/pages/Home/allProduct"; | 16 | import AllProduct from "./src/pages/Home/allProduct"; |
| 17 | -import CommonWebView from "./src/Components/CommonWebView"; | ||
| 18 | import ProductTemplate from "./src/Components/ProductTemplate"; | 17 | import ProductTemplate from "./src/Components/ProductTemplate"; |
| 19 | import ArticleTemplate from "./src/Components/articleTemplate"; | 18 | import ArticleTemplate from "./src/Components/articleTemplate"; |
| 20 | import Details from "./src/pages/InsuranceCircle/details"; | 19 | import Details from "./src/pages/InsuranceCircle/details"; |
| @@ -88,7 +87,6 @@ const ProtectGod = StackNavigator( | @@ -88,7 +87,6 @@ const ProtectGod = StackNavigator( | ||
| 88 | screen: AllProduct, | 87 | screen: AllProduct, |
| 89 | navigationOptions: { headerTitle: "全部产品" } | 88 | navigationOptions: { headerTitle: "全部产品" } |
| 90 | }, | 89 | }, |
| 91 | - CommonWebView: { screen: CommonWebView }, | ||
| 92 | ProductTemplate: { screen: ProductTemplate }, | 90 | ProductTemplate: { screen: ProductTemplate }, |
| 93 | ArticleTemplate: { screen: ArticleTemplate }, | 91 | ArticleTemplate: { screen: ArticleTemplate }, |
| 94 | Details: { screen: Details } | 92 | Details: { screen: Details } |
src/Components/CommonWebView.js
deleted
100644 → 0
| 1 | -import React, { Component } from 'react'; | ||
| 2 | -import { | ||
| 3 | - StyleSheet, | ||
| 4 | - WebView, | ||
| 5 | - View, | ||
| 6 | - Image, | ||
| 7 | - Dimensions | ||
| 8 | -} from 'react-native'; | ||
| 9 | -import { StackNavigator, TabNavigator } from 'react-navigation'; | ||
| 10 | - | ||
| 11 | - | ||
| 12 | -export default class CommonWebview extends Component { | ||
| 13 | - constructor(props) { | ||
| 14 | - super(props); | ||
| 15 | - } | ||
| 16 | - render() { | ||
| 17 | - console.log("url",this.props) | ||
| 18 | - const url = this.props.navigation.state.params.item.url; | ||
| 19 | - return ( | ||
| 20 | - <WebView | ||
| 21 | - style={styles.container} | ||
| 22 | - source={{uri: this.props.navigation.state.params.item.url}} | ||
| 23 | - /> | ||
| 24 | - ); | ||
| 25 | - } | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | - | ||
| 29 | -const styles = StyleSheet.create({ | ||
| 30 | - container: { | ||
| 31 | - flex: 1, | ||
| 32 | - paddingTop: 64, | ||
| 33 | - justifyContent: "flex-start", | ||
| 34 | - alignItems: "stretch", | ||
| 35 | - backgroundColor: "#EFEFEF", | ||
| 36 | - paddingLeft: 10, | ||
| 37 | - paddingRight: 10, | ||
| 38 | - }, | ||
| 39 | - // img: { | ||
| 40 | - // width: Dimensions.get("window").width - 20, | ||
| 41 | - // }, | ||
| 42 | -}); |
| @@ -7,7 +7,8 @@ import { | @@ -7,7 +7,8 @@ import { | ||
| 7 | Dimensions, | 7 | Dimensions, |
| 8 | ScrollView, | 8 | ScrollView, |
| 9 | Text, | 9 | Text, |
| 10 | - TouchableOpacity | 10 | + TouchableOpacity, |
| 11 | + Alert, | ||
| 11 | } from "react-native"; | 12 | } from "react-native"; |
| 12 | import { StackNavigator, TabNavigator } from "react-navigation"; | 13 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 13 | 14 | ||
| @@ -100,7 +101,12 @@ export default class ProductTemplate extends Component { | @@ -100,7 +101,12 @@ export default class ProductTemplate extends Component { | ||
| 100 | <View style={styles.footerLeft}> | 101 | <View style={styles.footerLeft}> |
| 101 | <Text style={styles.price}>{item.price}</Text> | 102 | <Text style={styles.price}>{item.price}</Text> |
| 102 | </View> | 103 | </View> |
| 103 | - <TouchableOpacity style={styles.footerRight}> | 104 | + <TouchableOpacity |
| 105 | + style={styles.footerRight} | ||
| 106 | + onPress={() => { | ||
| 107 | + Alert.alert("您好,网站正在备案中,暂时无法投保。") | ||
| 108 | + }} | ||
| 109 | + > | ||
| 104 | <Text style={styles.button}>立即投保</Text> | 110 | <Text style={styles.button}>立即投保</Text> |
| 105 | </TouchableOpacity> | 111 | </TouchableOpacity> |
| 106 | </View> | 112 | </View> |
| @@ -13,8 +13,6 @@ import { | @@ -13,8 +13,6 @@ import { | ||
| 13 | } from "react-native"; | 13 | } from "react-native"; |
| 14 | import { StackNavigator, TabNavigator } from "react-navigation"; | 14 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 15 | import Swiper from "react-native-swiper"; | 15 | import Swiper from "react-native-swiper"; |
| 16 | -// import AllProduct from "./allProduct"; | ||
| 17 | -import CommonWebView from "../../Components/CommonWebView"; | ||
| 18 | 16 | ||
| 19 | export default class Home extends Component { | 17 | export default class Home extends Component { |
| 20 | constructor(props) { | 18 | constructor(props) { |
| @@ -24,17 +22,11 @@ export default class Home extends Component { | @@ -24,17 +22,11 @@ export default class Home extends Component { | ||
| 24 | this.state = { | 22 | this.state = { |
| 25 | ListData: [], | 23 | ListData: [], |
| 26 | swiperImgList: [ | 24 | swiperImgList: [ |
| 27 | - // { | ||
| 28 | - // img: require("../../assets/home/slider_1.jpeg") | ||
| 29 | - // // url: "https://www.baidu.com/" | ||
| 30 | - // }, | ||
| 31 | { | 25 | { |
| 32 | img: require("../../assets/home/slider_2.jpeg") | 26 | img: require("../../assets/home/slider_2.jpeg") |
| 33 | - // url: "https://www.baidu.com/" | ||
| 34 | }, | 27 | }, |
| 35 | { | 28 | { |
| 36 | img: require("../../assets/home/slider_3.jpeg") | 29 | img: require("../../assets/home/slider_3.jpeg") |
| 37 | - // url: "https://www.baidu.com/" | ||
| 38 | } | 30 | } |
| 39 | ] | 31 | ] |
| 40 | }; | 32 | }; |
| @@ -143,9 +135,6 @@ export default class Home extends Component { | @@ -143,9 +135,6 @@ export default class Home extends Component { | ||
| 143 | }} | 135 | }} |
| 144 | > | 136 | > |
| 145 | {this.state.swiperImgList.map((item, index) => { | 137 | {this.state.swiperImgList.map((item, index) => { |
| 146 | - { | ||
| 147 | - /* console.log("图片item",item); */ | ||
| 148 | - } | ||
| 149 | return ( | 138 | return ( |
| 150 | <TouchableOpacity style={styles.slide} key={index}> | 139 | <TouchableOpacity style={styles.slide} key={index}> |
| 151 | <Image | 140 | <Image |
| @@ -9,8 +9,7 @@ import { | @@ -9,8 +9,7 @@ import { | ||
| 9 | Image, | 9 | Image, |
| 10 | ListView | 10 | ListView |
| 11 | } from "react-native"; | 11 | } from "react-native"; |
| 12 | -import { StackNavigator, TabNavigator } from 'react-navigation'; | 12 | +import { StackNavigator, TabNavigator } from "react-navigation"; |
| 13 | -import CommonWebView from "../../Components/CommonWebView"; | ||
| 14 | 13 | ||
| 15 | export default class InsuranceChurch extends Component { | 14 | export default class InsuranceChurch extends Component { |
| 16 | // static navigationOptions = { | 15 | // static navigationOptions = { |
| @@ -25,6 +24,7 @@ export default class InsuranceChurch extends Component { | @@ -25,6 +24,7 @@ export default class InsuranceChurch extends Component { | ||
| 25 | componentWillMount() { | 24 | componentWillMount() { |
| 26 | this.getListData(); | 25 | this.getListData(); |
| 27 | } | 26 | } |
| 27 | + | ||
| 28 | getListData() { | 28 | getListData() { |
| 29 | let that = this; | 29 | let that = this; |
| 30 | return fetch(`https://devpay.brae.co/test/insurance/story`, { | 30 | return fetch(`https://devpay.brae.co/test/insurance/story`, { |
| @@ -47,30 +47,36 @@ export default class InsuranceChurch extends Component { | @@ -47,30 +47,36 @@ export default class InsuranceChurch extends Component { | ||
| 47 | } else { | 47 | } else { |
| 48 | that.setState({ | 48 | that.setState({ |
| 49 | ListData: respJson.data.story | 49 | ListData: respJson.data.story |
| 50 | - }) | 50 | + }); |
| 51 | - console.log("保堂列表",respJson.data.story) | 51 | + console.log("保堂列表", respJson.data.story); |
| 52 | } | 52 | } |
| 53 | }); | 53 | }); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | render() { | 56 | render() { |
| 57 | const { navigate } = this.props.navigation; | 57 | const { navigate } = this.props.navigation; |
| 58 | - const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); | 58 | + const ds = new ListView.DataSource({ |
| 59 | + rowHasChanged: (r1, r2) => r1 !== r2 | ||
| 60 | + }); | ||
| 59 | const dataSource = ds.cloneWithRows(this.state.ListData); | 61 | const dataSource = ds.cloneWithRows(this.state.ListData); |
| 60 | return ( | 62 | return ( |
| 61 | <View style={styles.container}> | 63 | <View style={styles.container}> |
| 62 | <ListView | 64 | <ListView |
| 63 | style={styles.scrollViewContainer} | 65 | style={styles.scrollViewContainer} |
| 64 | dataSource={dataSource} | 66 | dataSource={dataSource} |
| 65 | - enableEmptySections = {true} | 67 | + enableEmptySections={true} |
| 66 | - renderRow={(item,index) => { | 68 | + renderRow={(item, index) => { |
| 67 | return ( | 69 | return ( |
| 68 | <TouchableOpacity | 70 | <TouchableOpacity |
| 69 | style={styles.itemContainer} | 71 | style={styles.itemContainer} |
| 70 | key={index} | 72 | key={index} |
| 71 | - onPress={() => navigate("ArticleTemplate", { item: item, model: "story" })} | 73 | + onPress={() => |
| 74 | + navigate("ArticleTemplate", { item: item, model: "story" })} | ||
| 72 | > | 75 | > |
| 73 | - <Image style={styles.itemImgWrapper} source={{uri: item.imgurl}} /> | 76 | + <Image |
| 77 | + style={styles.itemImgWrapper} | ||
| 78 | + source={{ uri: item.imgurl }} | ||
| 79 | + /> | ||
| 74 | <View style={styles.itemRightWrapper}> | 80 | <View style={styles.itemRightWrapper}> |
| 75 | <Text style={styles.itemTextTop} numberOfLines={2}> | 81 | <Text style={styles.itemTextTop} numberOfLines={2}> |
| 76 | {item.title} | 82 | {item.title} |
| @@ -78,7 +84,7 @@ export default class InsuranceChurch extends Component { | @@ -78,7 +84,7 @@ export default class InsuranceChurch extends Component { | ||
| 78 | <Text style={styles.itemTextBottom}>{item.time}</Text> | 84 | <Text style={styles.itemTextBottom}>{item.time}</Text> |
| 79 | </View> | 85 | </View> |
| 80 | </TouchableOpacity> | 86 | </TouchableOpacity> |
| 81 | - ) | 87 | + ); |
| 82 | }} | 88 | }} |
| 83 | /> | 89 | /> |
| 84 | <Text style={styles.scrollViewText}>没有更多了</Text> | 90 | <Text style={styles.scrollViewText}>没有更多了</Text> |
| @@ -92,10 +98,10 @@ const styles = StyleSheet.create({ | @@ -92,10 +98,10 @@ const styles = StyleSheet.create({ | ||
| 92 | flex: 1, | 98 | flex: 1, |
| 93 | justifyContent: "flex-start", | 99 | justifyContent: "flex-start", |
| 94 | alignItems: "stretch", | 100 | alignItems: "stretch", |
| 95 | - backgroundColor: "#EFEFEF", | 101 | + backgroundColor: "#EFEFEF" |
| 96 | }, | 102 | }, |
| 97 | scrollViewContainer: { | 103 | scrollViewContainer: { |
| 98 | - flex: 1, | 104 | + flex: 1 |
| 99 | }, | 105 | }, |
| 100 | scrollViewText: { | 106 | scrollViewText: { |
| 101 | color: "#7A7A7A", | 107 | color: "#7A7A7A", |
| @@ -14,7 +14,6 @@ import { | @@ -14,7 +14,6 @@ import { | ||
| 14 | Dimensions, | 14 | Dimensions, |
| 15 | Keyboard | 15 | Keyboard |
| 16 | } from "react-native"; | 16 | } from "react-native"; |
| 17 | -import WebView from "../../Components/CommonWebView"; | ||
| 18 | 17 | ||
| 19 | export default class Details extends Component { | 18 | export default class Details extends Component { |
| 20 | constructor(props) { | 19 | constructor(props) { |
| @@ -9,7 +9,6 @@ import { | @@ -9,7 +9,6 @@ import { | ||
| 9 | Image, | 9 | Image, |
| 10 | } from "react-native"; | 10 | } from "react-native"; |
| 11 | import { StackNavigator, TabNavigator } from "react-navigation"; | 11 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 12 | -import CommonWebView from "../../Components/CommonWebView"; | ||
| 13 | import Details from "./details"; | 12 | import Details from "./details"; |
| 14 | 13 | ||
| 15 | export default class InsuranceCircle extends Component { | 14 | export default class InsuranceCircle extends Component { |
-
Please register or login to post a comment