罗广聪

发布

... ... @@ -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 Release from "./src/pages/InsuranceCircle/release";
import Discover from "./src/pages/Discover/index";
import AIBegin from "./src/pages/Home/AISolution/Begin";
import AIQuestion from "./src/pages/Home/AISolution/Question";
... ... @@ -114,6 +115,7 @@ const ProtectGod = StackNavigator(
ProductTemplate: { screen: ProductTemplate },
ArticleTemplate: { screen: ArticleTemplate },
Details: { screen: Details },
Release: { screen: Release },
Discover: { screen: Discover },
AIBegin: {
screen: AIBegin,
... ...
... ... @@ -238,11 +238,7 @@ const styles = StyleSheet.create({
backgroundColor: "white"
},
KAVContainer: {
// flex: 1,
justifyContent: "center"
// paddingBottom: 52,
// paddingHorizontal: 20,
// paddingTop: 20,
},
scrollViewContainer: {
flex: 1
... ...
... ... @@ -12,17 +12,50 @@ import { StackNavigator, TabNavigator } from "react-navigation";
import Details from "./details";
export default class InsuranceCircle extends Component {
static navigationOptions = {
// headerRight: this._rightBtn()
}
constructor(props) {
super(props);
this.state = {
ListData: [],
IS_LOGIN: "",
USER_ID: "",
NICKNAME: "",
PROFESSION: "",
};
}
componentWillMount() {
this.getAsyncStorage();
this.getArticles();
}
_rightBtn() {
return (
<TouchableOpacity style={{marginRight: 13}} onPress={() => {}}>
<Image source={require("../../assets/circle/ic_announce.png")} style={{width: 19,height: 19}} />
</TouchableOpacity>
)
}
getAsyncStorage() {
const that = this;
AsyncStorage.multiGet(["IS_LOGIN","USER_ID","NICKNAME","PROFESSION"],(err, result) => {
if (err) {
console.error(err);
}
console.log("点击登录后的值",result)
that.setState({
IS_LOGIN: result[0][1],
USER_ID: (result[1][1] != null) ? result[1][1] : "",
NICKNAME: (result[2][1] != null) ? result[2][1] : "",
PROFESSION: (result[3][1] != null) ? result[3][1] : "",
})
})
}
getArticles() {
var that = this;
// 请求文章数据
... ...
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"
},
});
... ...
... ... @@ -256,7 +256,7 @@ export default class Login extends Component {
NICKNAME: nickname,
PROFESSION: profession,
});
setTimeout(function () {
setTimeout(function () {
that.props.navigation.goBack();
},0)
}
... ...