罗广聪

中央文案 发现

... ... @@ -17,6 +17,7 @@ import AllProduct from "./src/pages/Home/allProduct";
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";
// 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面
const MainTabBar = TabNavigator({
... ... @@ -44,6 +45,20 @@ const MainTabBar = TabNavigator({
)
}
},
Discover: {
screen: Discover,
navigationOptions: {
title: "发现",
// header: null,
// tabBarVisible: false,
tabBarIcon: ({ focused }) =>
focused ? (
<Image source={require("./src/assets/tabbar/ic_discover_s.png")} />
) : (
<Image source={require("./src/assets/tabbar/ic_discover_n.png")} />
)
}
},
InsuranceChurch: {
screen: InsuranceChurch,
navigationOptions: {
... ... @@ -89,7 +104,8 @@ const ProtectGod = StackNavigator(
},
ProductTemplate: { screen: ProductTemplate },
ArticleTemplate: { screen: ArticleTemplate },
Details: { screen: Details }
Details: { screen: Details },
Discover: { screen: Discover }
},{
navigationOptions: {
// headerTintColor: "blue",
... ...
... ... @@ -80,7 +80,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
... ...
... ... @@ -121,7 +121,9 @@ const styles = StyleSheet.create({
justifyContent: "flex-start",
backgroundColor: "#EFEFEF"
},
scrollViewContainer: {},
scrollViewContainer: {
marginBottom: 49,
},
headerContainer: {},
headerImage: {
width: Dimensions.get("window").width,
... ...
import React, { Component } from "react";
import {
StyleSheet,
WebView,
View,
Image,
Dimensions,
ScrollView,
Text,
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
export default class Discover extends Component {
constructor(props) {
super(props);
this.state = {
image: "",
};
}
componentWillMount() {
this.getImages();
}
getImages() {
let that = this,
id = this.state.id,
model = this.state.model;
return fetch(`https://devpay.brae.co/test/insurance/wallpaper`, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(resp => {
console.log("大爷",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({
image: respJson.data.image
});
console.log("图片文章", respJson.data);
}
});
}
render() {
const { image } = this.state;
return (
<View style={styles.container}>
{/* <Text>图片首页</Text> */}
<Image
style={styles.image}
source={{uri: image}}
resizeMode="contain"
>
<Text>中央文案</Text>
</Image>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "white"
},
image: {
width: Dimensions.get("window").width,
height: Dimensions.get("window").height,
justifyContent: "center",
alignItems: "center",
}
});
... ...