Phecda

添加eslint

... ... @@ -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";
... ... @@ -112,6 +113,10 @@ const ProtectGod = StackNavigator(
ProductTemplate: { screen: ProductTemplate },
ArticleTemplate: { screen: ArticleTemplate },
Details: { screen: Details },
Release: {
screen: Release,
navigationOptions: { headerTitle: "发布" }
},
Discover: { screen: Discover },
AIBegin: {
screen: AIBegin,
... ...
No preview for this file type
... ... @@ -10,12 +10,43 @@ import {
ListView,
Dimensions
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
import { StackNavigator, TabNavigator, NavigationActions } from "react-navigation";
import { Col, Row, Grid } from "react-native-easy-grid";
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {};
this.state = {
gridData: {
title: ["角色", "建议产品", "建议保额", "保险年限", "缴费期限", "年缴保费"],
actor: "父亲",
age: "42岁",
products: [
{
name: "成人意外险",
price: "50W",
long: "1年",
year: "20年",
eachyear: "150元"
},
{
name: "成人意外险",
price: "50W",
long: "1年",
year: "20年",
eachyear: "150元"
},
{
name: "成人意外险",
price: "50W",
long: "1年",
year: "20年",
eachyear: "150元"
}
],
count: "1200"
}
};
}
componentWillMount() {}
... ... @@ -49,9 +80,21 @@ export default class Home extends Component {
});
}
submit() {
this.props.navigation.dispatch(NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({
routeName: "MainTabBar"
})
]
}))
}
render() {
console.log("solution", this.props.navigation.state.params.answerList);
console.log("solution", this.props.navigation);
const { navigate } = this.props.navigation;
const { gridData } = this.state;
return (
<View style={styles.container}>
<View style={styles.ownContaier}>
... ... @@ -84,20 +127,98 @@ export default class Home extends Component {
</View>
<View style={styles.adviceContainer}>
<Text style={styles.adviceText}>
作为家庭的经济支柱,压力和责任重大,应优先进行保险配置,且应占家庭保险的中支出和总保额的大比重,建议依次配置以下产品,以保障家庭持续、高品质的运营
作为家庭的经济支柱,压力和责任重大,应优先进行保险配置,且应占家庭保险的中支出和总保额的大比重,建议依次配置以下产品,以保障家庭持续、高品质的运营
</Text>
</View>
</View>
<View style={styles.configureContaier}>
<View style={styles.headerContainer}>
<View style={styles.titleWrapper}>
<Text style={styles.headerTitle}>保险配置方案</Text>
</View>
</View>
<View style={styles.tableContainer}>
<Text>表格</Text>
<ScrollView style={styles.tableContainer}>
<Grid>
<Row>
{/* {gridData.title.map((item,index) => {
return (
<Col key={index} style={styles.gridtitleContaier}><Text style={styles.gridheaderText}>{item}</Text></Col>
)
})} */}
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>角色</Text>
</Col>
<Col size={1.5} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>建议产品</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>建议保额</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>保险年限</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>缴费期限</Text>
</Col>
<Col size={1} style={styles.gridtitleContaier}>
<Text style={styles.gridheaderText}>年缴保费</Text>
</Col>
</Row>
<Row>
<Col style={styles.actor} size={1}>
<Text style={styles.contentText}>父亲</Text>
<Text style={styles.contentText}>42</Text>
</Col>
<Col size={5.5}>
{gridData.products.map((item, index) => {
return (
<Row key={index}>
<Col size={1.5} style={styles.contentCol}>
<Text style={styles.contentText}>{item.name}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>{item.price}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>{item.long}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>{item.year}</Text>
</Col>
<Col size={1} style={styles.contentCol}>
<Text style={styles.contentText}>
{item.eachyear}
</Text>
</Col>
</Row>
);
})}
<Row style={styles.countContainer}>
<Text style={styles.countText}>{gridData.count}</Text>
<Text style={styles.contentText}>/</Text>
</Row>
</Col>
</Row>
</Grid>
</ScrollView>
<View style={styles.tipsContainer}>
<Image
style={{ width: 16, height: 16 }}
source={require("../../../assets/home/ic_notice.png")}
/>
<Text style={styles.tipsText}>保险配置预算仅供参考,实际缴费金额与投保时内容有关。</Text>
</View>
</View>
<TouchableOpacity
onPress={() => {
this.submit();
}}
style={styles.confirmBtn}
>
<Text style={styles.confirmBtnText}>完成</Text>
</TouchableOpacity>
</View>
);
}
... ... @@ -136,7 +257,7 @@ const styles = StyleSheet.create({
borderColor: "#E8E8E8",
borderTopWidth: 0.5,
flexDirection: "row",
paddingVertical: 12,
paddingVertical: 12
},
leftInfoContaier: {
flex: 1,
... ... @@ -150,10 +271,10 @@ const styles = StyleSheet.create({
},
TInfoContaier: {
flexDirection: "row",
marginBottom: 12,
marginBottom: 12
},
BInfoContaier: {
flexDirection: "row",
flexDirection: "row"
},
adviceContainer: {
marginLeft: 18,
... ... @@ -161,15 +282,94 @@ const styles = StyleSheet.create({
borderStyle: "solid",
borderColor: "#E8E8E8",
borderTopWidth: 0.5,
paddingVertical: 12,
paddingVertical: 12
},
adviceText: {
fontSize: 13,
lineHeight: 20,
color: "#242424",
color: "#242424"
},
configureContaier: {
backgroundColor: "white",
marginTop: 10
}
},
tableContainer: {
marginLeft: 18,
paddingRight: 18,
borderStyle: "solid",
borderColor: "#E8E8E8",
borderTopWidth: 1,
paddingVertical: 12
},
gridtitleContaier: {
justifyContent: "center",
alignItems: "center",
paddingVertical: 8,
backgroundColor: "#1B9341",
borderColor: "#E8E8E8",
borderStyle: "solid",
borderLeftWidth: 0.5
},
gridheaderText: {
fontSize: 11,
color: "white"
},
actor: {
justifyContent: "center",
alignItems: "center",
borderColor: "#ccc",
borderStyle: "solid",
borderWidth: 0.5
},
contentCol: {
justifyContent: "center",
alignItems: "center",
paddingVertical: 8,
borderColor: "#ccc",
borderStyle: "solid",
borderBottomWidth: 0.5,
borderRightWidth: 0.5
},
contentText: {
fontSize: 12,
lineHeight: 17
},
countContainer: {
justifyContent: "center",
alignItems: "center",
paddingVertical: 8,
borderColor: "#ccc",
borderStyle: "solid",
borderBottomWidth: 0.5,
borderRightWidth: 0.5
},
countText: {
fontSize: 18,
color: "#1B9341"
},
tipsContainer: {
flexDirection: "row",
alignItems: "center",
marginHorizontal: 24,
marginBottom: 10
},
tipsText: {
fontSize: 12,
color: "#7A7A7A",
lineHeight: 17,
marginLeft: 5
},
confirmBtn: {
marginVertical: 20,
marginHorizontal: 40,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#1B9341",
height: 45,
borderRadius: 5
},
confirmBtnText: {
fontSize: 16,
color: "white"
},
});
... ...
... ... @@ -238,11 +238,7 @@ const styles = StyleSheet.create({
backgroundColor: "white"
},
KAVContainer: {
// flex: 1,
justifyContent: "center"
// paddingBottom: 52,
// paddingHorizontal: 20,
// paddingTop: 20,
},
scrollViewContainer: {
flex: 1
... ...
... ... @@ -7,21 +7,100 @@ import {
ScrollView,
TouchableOpacity,
Image,
AsyncStorage,
Alert,
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
import Details from "./details";
export default class InsuranceCircle extends Component {
static navigationOptions = ({ navigation }) => {
const { state, setParams, navigate } = navigation;
// console.log("保圈页面-发布", state);
return {
headerRight: (
<TouchableOpacity
style={{ marginRight: 13 }}
onPress={() => state.params.testLoginAndGo()}
>
<Image
source={require("../../assets/circle/ic_announce.png")}
style={{ width: 19, height: 19 }}
/>
</TouchableOpacity>
)
};
};
constructor(props) {
super(props);
this.state = {
ListData: [],
IS_LOGIN: "",
USER_ID: "",
NICKNAME: "",
PROFESSION: ""
};
}
componentWillMount() {
// this.getAsyncStorage();
this.getArticles();
}
componentDidMount() {
this.props.navigation.setParams({
testLoginAndGo: this.testLoginAndGo.bind(this)
});
}
testLoginAndGo() {
const that = this;
const { navigate } = this.props.navigation;
console.log("为何是underfined?",this);
// this.getAsyncStorage();
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] : ""
},() => {
if (this.state.IS_LOGIN == 'yes') {
navigate("Release");
} else {
Alert.alert("请先登录账号");
}
});
}
);
// if (this.state.IS_LOGIN == 'yes') {
// navigate("Release");
// } else {
// Alert.alert("请先登录账号");
// }
}
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;
... ... @@ -45,7 +124,7 @@ export default class InsuranceCircle extends Component {
alert(respJson.cnmsg);
} else {
that.setState({
ListData: respJson.data.data,
ListData: respJson.data.data
});
console.log("state.ListData", this.state.ListData);
}
... ...
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)
}
... ...
... ... @@ -2605,7 +2605,7 @@ lodash@^3.5.0:
version "3.10.1"
resolved "http://registry.npm.taobao.org/lodash/download/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
lodash@^4.14.0, lodash@^4.16.6, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.6.1:
lodash@^4.11.1, lodash@^4.14.0, lodash@^4.16.6, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.6.1:
version "4.17.4"
resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
... ... @@ -3251,6 +3251,12 @@ react-native-drawer-layout@1.3.2:
dependencies:
react-native-dismiss-keyboard "1.0.0"
react-native-easy-grid@^0.1.15:
version "0.1.15"
resolved "http://registry.npm.taobao.org/react-native-easy-grid/download/react-native-easy-grid-0.1.15.tgz#02939ae032d74662b50c9540d902c79866ba638a"
dependencies:
lodash "^4.11.1"
react-native-swiper@^1.5.11:
version "1.5.11"
resolved "http://registry.npm.taobao.org/react-native-swiper/download/react-native-swiper-1.5.11.tgz#2d46ded43f383dbde4540d513cb4eaaa60eaed61"
... ...