罗广聪

评论接上了 细节页面还没调整好

... ... @@ -20,57 +20,57 @@ export default class InsuranceCircle extends Component {
super(props);
this.state = {
ListData: [
{
title: "家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…",
content:
"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
name: "嘿嘿嘿",
identity: "保险代理人",
image: require("../../assets/Mine/iconpic1.png"),
num: "30",
time: "2017-8-15",
comments: [{
replyer: "噢噢噢",
replayicon: require("../../assets/Mine/iconpic1.png"),
beenreplyer: "嘿嘿嘿",
content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",
time: "两小时前",
},{
replyer: "哦哦哦",
replayicon: require("../../assets/Mine/iconpic1.png"),
beenreplyer: "哈哈哈",
content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",
time: "两小时前",
},{
replyer: "洛洛洛",
replayicon: require("../../assets/Mine/iconpic1.png"),
beenreplyer: "额额额",
content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",
time: "两小时前",
}],
},
{
title: "家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…",
content:
"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
name: "嘿嘿嘿",
identity: "保险代理人",
image: require("../../assets/circle/newspic.png"),
num: "29",
time: "2017-8-15",
comments: []
},
{
title: "因为你病不起,输不起,也折腾不起…",
content:
"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
name: "luosf",
identity: "保险代理人",
image: require("../../assets/circle/newspic.png"),
num: "10",
time: "2017-8-15",
comments: []
}
// {
// title: "家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…",
// content:
// "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
// name: "嘿嘿嘿",
// identity: "保险代理人",
// image: require("../../assets/Mine/iconpic1.png"),
// num: "30",
// time: "2017-8-15",
// comments: [{
// replyer: "噢噢噢",
// replayicon: require("../../assets/Mine/iconpic1.png"),
// beenreplyer: "嘿嘿嘿",
// content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",
// time: "两小时前",
// },{
// replyer: "哦哦哦",
// replayicon: require("../../assets/Mine/iconpic1.png"),
// beenreplyer: "哈哈哈",
// content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",
// time: "两小时前",
// },{
// replyer: "洛洛洛",
// replayicon: require("../../assets/Mine/iconpic1.png"),
// beenreplyer: "额额额",
// content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",
// time: "两小时前",
// }],
// },
// {
// title: "家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…",
// content:
// "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
// name: "嘿嘿嘿",
// identity: "保险代理人",
// image: require("../../assets/circle/newspic.png"),
// num: "29",
// time: "2017-8-15",
// comments: []
// },
// {
// title: "因为你病不起,输不起,也折腾不起…",
// content:
// "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",
// name: "luosf",
// identity: "保险代理人",
// image: require("../../assets/circle/newspic.png"),
// num: "10",
// time: "2017-8-15",
// comments: []
// }
],
testData: null,
};
... ... @@ -78,7 +78,7 @@ export default class InsuranceCircle extends Component {
componentDidMount() {
var that = this;
return fetch(`https://mpay.brae.co/test/insurance/article`,{
return fetch(`https://devpay.brae.co/test/insurance/article`,{
method: "POST",
headers: {
'Accept': 'application/json',
... ... @@ -100,9 +100,9 @@ export default class InsuranceCircle extends Component {
alert(respJson.cnmsg);
} else {
that.setState({
testData: respJson.data
ListData: respJson.data.data
});
console.log('state.testData',that.state.testData);
console.log('state.testData',this.state.ListData);
}
})
.catch((err) => console.error(err))
... ... @@ -132,7 +132,7 @@ export default class InsuranceCircle extends Component {
<View style={styles.itemInfoWrapper}>
<View style={styles.itemInfoLeft}>
<Image
source={item.image}
source={require("../../assets/Mine/iconpic1.png")}
style={[styles.itemInfoIcon, { width: 26, height: 26 }]}
/>
<Text style={styles.itemInfoName}>{item.name}</Text>
... ... @@ -171,10 +171,11 @@ const styles = StyleSheet.create({
itemContainer: {
backgroundColor: "#fff",
marginBottom: 10,
height: 180,
// height: 180,
paddingLeft: 13,
paddingRight: 13,
paddingTop: 19
paddingTop: 19,
paddingBottom: 12,
},
itemTitle: {
fontSize: 17,
... ...
... ... @@ -110,7 +110,7 @@ export default class Login extends Component {
<TouchableOpacity
style={styles.confirmBtnLogin}
onPress={() => {
this.loginRequest()
this.loginRequest();
}}
>
<Text style={styles.confirmText}>登录</Text>
... ... @@ -135,7 +135,7 @@ export default class Login extends Component {
isRegister: !this.state.isRegister,
phone: "",
password: "",
nickname: "",
nickname: ""
})}
>
<Text style={styles.register}>注册账号</Text>
... ... @@ -148,7 +148,7 @@ export default class Login extends Component {
isRegister: !this.state.isRegister,
phone: "",
password: "",
nickname: "",
nickname: ""
})}
>
<Text style={styles.register}>登录</Text>
... ... @@ -195,15 +195,18 @@ export default class Login extends Component {
if (respJson.enmsg != "ok") {
alert(respJson.cnmsg);
} else {
that.setState({
that.setState(
{
// testData: respJson.data
});
}
);
AsyncStorage.setItem("IS_LOGIN", "yes", function(err) {
if (err) {
console.log("存储出错", err);
return false;
}
that.props.navigation.navigate("Mine");
// that.props.navigation.navigate("Mine");
that.props.navigation.goBack();
});
}
})
... ... @@ -243,10 +246,10 @@ export default class Login extends Component {
if (respJson.enmsg != "ok") {
alert(respJson.cnmsg);
} else {
console.log("注册按钮返回的数据",respJson.data);
console.log("注册按钮返回的数据", respJson.data);
that.setState({
isRegister: !that.state.isRegister,
id: respJson.data.id,
id: respJson.data.id
});
alert("注册成功!");
}
... ...
... ... @@ -8,9 +8,9 @@ import {
Image,
AlertIOS,
AsyncStorage,
Button,
Button
} from "react-native";
import { StackNavigator, TabNavigator } from 'react-navigation';
import { StackNavigator, TabNavigator } from "react-navigation";
export default class Mine extends Component {
// static navigationOptions = {
... ... @@ -21,50 +21,50 @@ export default class Mine extends Component {
this.state = {
IS_LOGIN: "no",
name: "哈哈哈",
identity: "职业代理人",
identity: "职业代理人"
};
this.saveResponse1 = this.saveResponse1.bind(this);
this.saveResponse2 = this.saveResponse2.bind(this);
}
componentWillMount() {
var _that = this;
console.log("this",this)
AsyncStorage.getItem("IS_LOGIN",(err, result) => {
console.log("this", this);
AsyncStorage.getItem("IS_LOGIN", (err, result) => {
if (err) {
console.error(err);
}
_that.setState({
IS_LOGIN: result
})
console.log("我的页面的IS_LOGIN",this.state.IS_LOGIN);
})
});
console.log("我的页面的IS_LOGIN", this.state.IS_LOGIN);
});
}
componentDidMount() {
// console.log("hello,AsyncStorage");
}
signIn() {
var _that = this
AsyncStorage.setItem("IS_LOGIN","yes",function (err) {
var _that = this;
AsyncStorage.setItem("IS_LOGIN", "yes", function(err) {
if (err) {
console.log("存储出错",err);
console.log("存储出错", err);
return false;
}
})
});
_that.setState({
IS_LOGIN: "yes"
})
});
}
signOut() {
var _that = this
AsyncStorage.setItem("IS_LOGIN","no",function (err) {
var _that = this;
AsyncStorage.setItem("IS_LOGIN", "no", function(err) {
if (err) {
console.log("存储出错",err);
console.log("存储出错", err);
return false;
}
})
});
_that.setState({
IS_LOGIN: "no"
})
});
}
saveResponse1(d) {
if (this.state.IS_LOGIN == "yes") {
... ... @@ -100,11 +100,13 @@ export default class Mine extends Component {
style={styles.leftIcon}
source={require("../../assets/tabbar/ic_circle_s.png")}
/>
<Text style={styles.leftTitle}>昵称</Text>
<Text style={styles.leftTitle}>设置昵称</Text>
{/* {this.state.IS_LOGIN ? <Text style={styles.leftTitle}>昵称</Text> : null} */}
</View>
<View style={styles.itemRight}>
{ this.state.IS_LOGIN === "yes" ? <Text style={styles.itemRightContent}>{this.state.name}</Text> : null}
{this.state.IS_LOGIN === "yes" ? (
<Text style={styles.itemRightContent}>{this.state.name}</Text>
) : null}
{/* <Text style={styles.itemRightContent}>{this.state.name}</Text> */}
<Image
style={styles.itemRightImg}
... ... @@ -124,11 +126,15 @@ export default class Mine extends Component {
style={styles.leftIcon}
source={require("../../assets/tabbar/ic_circle_s.png")}
/>
<Text style={styles.leftTitle}>职业</Text>
<Text style={styles.leftTitle}>设置职业</Text>
</View>
<View style={styles.itemRight}>
{/* <Text style={styles.itemRightContent}>{this.state.identity}</Text> */}
{ this.state.IS_LOGIN === "yes"? <Text style={styles.itemRightContent}>{this.state.identity}</Text> : null}
{this.state.IS_LOGIN === "yes" ? (
<Text style={styles.itemRightContent}>
{this.state.identity}
</Text>
) : null}
<Image
style={styles.itemRightImg}
source={require("../../assets/Mine/rightArrow_gray.png")}
... ... @@ -142,18 +148,15 @@ export default class Mine extends Component {
style={styles.loginOut}
onLogin={this.props.onLogin}
onPress={() => {
{/* this.signOut(); */}
navigate("Login",{IS_LOGIN: this.state.IS_LOGIN});
this.state.IS_LOGIN == "yes"
? this.signOut()
: navigate("Login", { IS_LOGIN: this.state.IS_LOGIN });
}}
>
<Text style={styles.loginOutText}>{this.state.IS_LOGIN ? "登录" : "退出登录"}</Text>
<Text style={styles.loginOutText}>
{this.state.IS_LOGIN == "yes" ? "退出登录" : "登录"}
</Text>
</TouchableOpacity>
{/* <Button
title="登出"
onPress={() => {
this.signOut();
}}
/> */}
</View>
);
}
... ... @@ -164,7 +167,7 @@ const styles = StyleSheet.create({
flex: 1,
justifyContent: "flex-start",
alignItems: "stretch",
backgroundColor: "#EFEFEF",
backgroundColor: "#EFEFEF"
},
header: {
backgroundColor: "#1B9341",
... ... @@ -176,7 +179,7 @@ const styles = StyleSheet.create({
},
mineIcon: {
width: 86,
height: 86,
height: 86
},
mineName: {
fontSize: 16,
... ... @@ -235,5 +238,8 @@ const styles = StyleSheet.create({
loginOutText: {
textAlign: "center",
fontSize: 15
},
button: {
// fontSize: 14
}
});
... ...