罗广聪

已处理好全局状态和回退刷新的问题

@@ -27,7 +27,7 @@ export default class Home extends Component { @@ -27,7 +27,7 @@ export default class Home extends Component {
27 title: "平安保险第一个", 27 title: "平安保险第一个",
28 context: "600万医疗报废,自费药,进口药,器材费", 28 context: "600万医疗报废,自费药,进口药,器材费",
29 url: 29 url:
30 - "http://m.people.cn/n4/2017/0907/c190-9825877.html?admincptm=1504789835057", 30 + "http://hankschan.legendh5.com/h5/b8302dac-0563-478c-ff82-ba8ab20c1cb3.html",
31 imgurl: require("../../assets/circle/newspic.png") 31 imgurl: require("../../assets/circle/newspic.png")
32 }, 32 },
33 { 33 {
@@ -17,15 +17,21 @@ export default class Details extends Component { @@ -17,15 +17,21 @@ export default class Details extends Component {
17 super(props); 17 super(props);
18 this.state = { 18 this.state = {
19 data: this.props.navigation.state.params.item, 19 data: this.props.navigation.state.params.item,
20 - text: "" 20 + // 留言
  21 + text: "",
  22 + comments: []
21 }; 23 };
22 } 24 }
23 componentWillMount() { 25 componentWillMount() {
24 console.log("详情页", this); 26 console.log("详情页", this);
  27 + this.getComments();
  28 + }
  29 + componentDidMount() {
  30 + // this.getComments();
25 } 31 }
26 32
27 render() { 33 render() {
28 - const { data } = this.state; 34 + const { data, comments } = this.state;
29 return ( 35 return (
30 <View style={styles.container}> 36 <View style={styles.container}>
31 <KeyboardAvoidingView behavior="padding" style={styles.KAVContainer}> 37 <KeyboardAvoidingView behavior="padding" style={styles.KAVContainer}>
@@ -33,49 +39,52 @@ export default class Details extends Component { @@ -33,49 +39,52 @@ export default class Details extends Component {
33 style={styles.scrollViewContainer} 39 style={styles.scrollViewContainer}
34 automaticallyAdjustContentInsets={false} 40 automaticallyAdjustContentInsets={false}
35 > 41 >
  42 + {/* 标题 */}
36 <Text style={styles.titleText} numberOfLines={3}> 43 <Text style={styles.titleText} numberOfLines={3}>
37 {data.title} 44 {data.title}
38 </Text> 45 </Text>
  46 +
39 {/* 个人信息 */} 47 {/* 个人信息 */}
40 <View style={styles.personContainer}> 48 <View style={styles.personContainer}>
41 - <Image style={styles.personImg} source={data.image} /> 49 + <Image
  50 + style={styles.personImg}
  51 + source={require("../../assets/Mine/iconpic1.png")}
  52 + />
42 <View style={styles.personRightContainer}> 53 <View style={styles.personRightContainer}>
43 <View style={styles.personRTContainer}> 54 <View style={styles.personRTContainer}>
44 <Text style={styles.personRTName}>{data.name}</Text> 55 <Text style={styles.personRTName}>{data.name}</Text>
45 <Text style={styles.personRTIdentity}>{data.identity}</Text> 56 <Text style={styles.personRTIdentity}>{data.identity}</Text>
46 </View> 57 </View>
  58 + {/* 时间等请求获取 */}
47 <Text style={styles.personRB}>{data.time}</Text> 59 <Text style={styles.personRB}>{data.time}</Text>
48 </View> 60 </View>
49 </View> 61 </View>
  62 +
50 {/* 正文 */} 63 {/* 正文 */}
51 <Text style={styles.content}>{data.content}</Text> 64 <Text style={styles.content}>{data.content}</Text>
52 <Text style={styles.copyright}>本文版权归 {data.name} 所有</Text> 65 <Text style={styles.copyright}>本文版权归 {data.name} 所有</Text>
  66 +
53 {/* 评论 */} 67 {/* 评论 */}
54 <View style={styles.commentsContainer}> 68 <View style={styles.commentsContainer}>
55 <View style={styles.commentsHeader}> 69 <View style={styles.commentsHeader}>
56 <Text style={styles.commentsHeaderL}>评论</Text> 70 <Text style={styles.commentsHeaderL}>评论</Text>
57 <Text style={styles.commentsHeaderR}> 71 <Text style={styles.commentsHeaderR}>
58 - ( {data.comments.length} ) 72 + {/* ( {comments.length} ) */}
59 </Text> 73 </Text>
60 </View> 74 </View>
61 - {data.comments.map((item, index) => { 75 + {this.state.comments.map((item, index) => {
62 return ( 76 return (
63 <View style={styles.itemContainer} key={index}> 77 <View style={styles.itemContainer} key={index}>
64 - <Image style={styles.itemIcon} source={item.replayicon} /> 78 + <Image
  79 + style={styles.itemIcon}
  80 + source={require("../../assets/Mine/iconpic1.png")}
  81 + />
65 <View style={styles.itemRightContainer}> 82 <View style={styles.itemRightContainer}>
66 <View style={styles.itemRightTop}> 83 <View style={styles.itemRightTop}>
67 <View style={styles.itemRightTopLeft}> 84 <View style={styles.itemRightTopLeft}>
68 - <Text style={styles.itemReplyer}>{item.replyer}</Text> 85 + <Text style={styles.itemReplyer}>{item.user}</Text>
69 - <Text style={styles.itemWord}>回复</Text>  
70 - <Text style={styles.itemBeenreplyer}>  
71 - {item.beenreplyer}  
72 - </Text>  
73 </View> 86 </View>
74 <Text style={styles.itemTime}>{item.time}</Text> 87 <Text style={styles.itemTime}>{item.time}</Text>
75 - {/* <Image  
76 - style={styles.itemRightTopRight}  
77 - source={require("../../assets/tabbar/ic_circle_n.png")}  
78 - /> */}  
79 </View> 88 </View>
80 <Text style={styles.itemRightBottom}>{item.content}</Text> 89 <Text style={styles.itemRightBottom}>{item.content}</Text>
81 </View> 90 </View>
@@ -107,25 +116,73 @@ export default class Details extends Component { @@ -107,25 +116,73 @@ export default class Details extends Component {
107 <Text style={styles.sendButton}>发送</Text> 116 <Text style={styles.sendButton}>发送</Text>
108 </TouchableOpacity> 117 </TouchableOpacity>
109 </View> 118 </View>
110 - {/* <TouchableOpacity  
111 - ononPress={() => {  
112 - this.props.navigator.push({  
113 - component: WebView,  
114 - passProps: {  
115 - url: "https://www.baidu.com"  
116 - }  
117 - });  
118 - }}  
119 - >  
120 - <Text>跳转试试看</Text>  
121 - </TouchableOpacity> */}  
122 </KeyboardAvoidingView> 119 </KeyboardAvoidingView>
123 </View> 120 </View>
124 ); 121 );
125 } 122 }
126 123
  124 + getComments() {
  125 + let that = this,
  126 + articleID = this.state.data.id,
  127 + formData = new FormData();
  128 + formData.append("article", articleID);
  129 + return fetch(`https://devpay.brae.co/test/insurance/comment/get`, {
  130 + method: "POST",
  131 + headers: {
  132 + Accept: "application/json",
  133 + "Content-Type": "application/json"
  134 + },
  135 + body: formData
  136 + })
  137 + .then(resp => {
  138 + if (resp.status === 200) {
  139 + return resp.json();
  140 + } else {
  141 + console.error("something went wrong!");
  142 + }
  143 + })
  144 + .then(respJson => {
  145 + if (respJson.enmsg != "ok") {
  146 + alert(respJson.cnmsg);
  147 + } else {
  148 + that.setState({
  149 + comments: respJson.data.comment
  150 + });
  151 + console.log("comments", respJson.data.comment);
  152 + }
  153 + })
  154 + .catch(err => console.error(err));
  155 + }
  156 +
127 sendMsg() { 157 sendMsg() {
128 - var that = this; 158 + var that = this,
  159 + formData = new FormData();
  160 + // 请求文章数据
  161 + return fetch(`https://devpay.brae.co/test/insurance/comment/add`, {
  162 + method: "POST",
  163 + headers: {
  164 + Accept: "application/json",
  165 + "Content-Type": "application/json"
  166 + }
  167 + })
  168 + .then(resp => {
  169 + if (resp.status === 200) {
  170 + return resp.json();
  171 + } else {
  172 + console.error("something went wrong!");
  173 + }
  174 + })
  175 + .then(respJson => {
  176 + if (respJson.enmsg != "ok") {
  177 + alert(respJson.cnmsg);
  178 + } else {
  179 + that.setState({
  180 + ListData: respJson.data.data
  181 + });
  182 + console.log("state.ListData", this.state.ListData);
  183 + }
  184 + })
  185 + .catch(err => console.error(err));
129 this.setState({ 186 this.setState({
130 text: "" 187 text: ""
131 }); 188 });
@@ -137,7 +194,7 @@ const styles = StyleSheet.create({ @@ -137,7 +194,7 @@ const styles = StyleSheet.create({
137 flex: 1, 194 flex: 1,
138 justifyContent: "flex-start", 195 justifyContent: "flex-start",
139 alignItems: "stretch", 196 alignItems: "stretch",
140 - backgroundColor: "white", 197 + backgroundColor: "white"
141 }, 198 },
142 KAVContainer: { 199 KAVContainer: {
143 flex: 1, 200 flex: 1,
@@ -13,71 +13,16 @@ import CommonWebView from "../../Components/CommonWebView"; @@ -13,71 +13,16 @@ import CommonWebView from "../../Components/CommonWebView";
13 import Details from "./details"; 13 import Details from "./details";
14 14
15 export default class InsuranceCircle extends Component { 15 export default class InsuranceCircle extends Component {
16 - // static navigationOptions = {  
17 - // title: '保圈',  
18 - // };  
19 constructor(props) { 16 constructor(props) {
20 super(props); 17 super(props);
21 this.state = { 18 this.state = {
22 - ListData: [ 19 + ListData: [],
23 - // {  
24 - // title: "家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…",  
25 - // content:  
26 - // "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",  
27 - // name: "嘿嘿嘿",  
28 - // identity: "保险代理人",  
29 - // image: require("../../assets/Mine/iconpic1.png"),  
30 - // num: "30",  
31 - // time: "2017-8-15",  
32 - // comments: [{  
33 - // replyer: "噢噢噢",  
34 - // replayicon: require("../../assets/Mine/iconpic1.png"),  
35 - // beenreplyer: "嘿嘿嘿",  
36 - // content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",  
37 - // time: "两小时前",  
38 - // },{  
39 - // replyer: "哦哦哦",  
40 - // replayicon: require("../../assets/Mine/iconpic1.png"),  
41 - // beenreplyer: "哈哈哈",  
42 - // content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",  
43 - // time: "两小时前",  
44 - // },{  
45 - // replyer: "洛洛洛",  
46 - // replayicon: require("../../assets/Mine/iconpic1.png"),  
47 - // beenreplyer: "额额额",  
48 - // content: "生活就是如此矛是如此此生活就是如此矛盾现实生活就是如此矛盾现",  
49 - // time: "两小时前",  
50 - // }],  
51 - // },  
52 - // {  
53 - // title: "家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…",  
54 - // content:  
55 - // "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",  
56 - // name: "嘿嘿嘿",  
57 - // identity: "保险代理人",  
58 - // image: require("../../assets/circle/newspic.png"),  
59 - // num: "29",  
60 - // time: "2017-8-15",  
61 - // comments: []  
62 - // },  
63 - // {  
64 - // title: "因为你病不起,输不起,也折腾不起…",  
65 - // content:  
66 - // "现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…",  
67 - // name: "luosf",  
68 - // identity: "保险代理人",  
69 - // image: require("../../assets/circle/newspic.png"),  
70 - // num: "10",  
71 - // time: "2017-8-15",  
72 - // comments: []  
73 - // }  
74 - ],  
75 - testData: null,  
76 }; 20 };
77 } 21 }
78 22
79 componentDidMount() { 23 componentDidMount() {
80 var that = this; 24 var that = this;
  25 + // 请求文章数据
81 return fetch(`https://devpay.brae.co/test/insurance/article`,{ 26 return fetch(`https://devpay.brae.co/test/insurance/article`,{
82 method: "POST", 27 method: "POST",
83 headers: { 28 headers: {
@@ -86,8 +31,6 @@ export default class InsuranceCircle extends Component { @@ -86,8 +31,6 @@ export default class InsuranceCircle extends Component {
86 }, 31 },
87 }) 32 })
88 .then((resp) => { 33 .then((resp) => {
89 - // console.log("测试接口",resp);  
90 - // return false;  
91 if (resp.status === 200) { 34 if (resp.status === 200) {
92 return resp.json(); 35 return resp.json();
93 } else { 36 } else {
@@ -96,13 +39,12 @@ export default class InsuranceCircle extends Component { @@ -96,13 +39,12 @@ export default class InsuranceCircle extends Component {
96 }) 39 })
97 .then((respJson) => { 40 .then((respJson) => {
98 if (respJson.enmsg != 'ok') { 41 if (respJson.enmsg != 'ok') {
99 - console.error(err);  
100 alert(respJson.cnmsg); 42 alert(respJson.cnmsg);
101 } else { 43 } else {
102 that.setState({ 44 that.setState({
103 ListData: respJson.data.data 45 ListData: respJson.data.data
104 }); 46 });
105 - console.log('state.testData',this.state.ListData); 47 + console.log('state.ListData',this.state.ListData);
106 } 48 }
107 }) 49 })
108 .catch((err) => console.error(err)) 50 .catch((err) => console.error(err))
@@ -18,11 +18,16 @@ export default class Login extends Component { @@ -18,11 +18,16 @@ export default class Login extends Component {
18 this.state = { 18 this.state = {
19 phone: "", 19 phone: "",
20 password: "", 20 password: "",
  21 + // 这个是注册用的nickname
21 nickname: "", 22 nickname: "",
  23 + profession: "",
22 id: "", 24 id: "",
23 - // 处于登录还是注册页面 25 + // 处于登录页面还是注册页面
24 isRegister: false, 26 isRegister: false,
25 - IS_LOGIN: "" 27 + IS_LOGIN: "",
  28 + USER_ID: "",
  29 + NICKNAME: "",
  30 + PROFESSION: "",
26 }; 31 };
27 } 32 }
28 componentWillMount() { 33 componentWillMount() {
@@ -104,8 +109,27 @@ export default class Login extends Component { @@ -104,8 +109,27 @@ export default class Login extends Component {
104 /> 109 />
105 </View> 110 </View>
106 ) : null} 111 ) : null}
107 - 112 + {/* 职业 */}
108 - {/* 登录/注册 按钮 */} 113 + {this.state.isRegister ? (
  114 + <View style={styles.inputField}>
  115 + <Image
  116 + style={styles.icon}
  117 + source={require("../assets/login/ic_password2.png")}
  118 + />
  119 + <TextInput
  120 + style={styles.textInput}
  121 + placeholder="请输入职业"
  122 + value={this.state.profession}
  123 + onChangeText={profession => this.setState({ profession })}
  124 + selectionColor="#1B9341"
  125 + clearTextOnFocus={true}
  126 + numberOfLines={1}
  127 + clearButtonMode="always"
  128 + keyboardType="default"
  129 + />
  130 + </View>
  131 + ) : null}
  132 + {/* 登录/注册 按钮 老师 */}
109 {!this.state.isRegister ? ( 133 {!this.state.isRegister ? (
110 <TouchableOpacity 134 <TouchableOpacity
111 style={styles.confirmBtnLogin} 135 style={styles.confirmBtnLogin}
@@ -164,14 +188,14 @@ export default class Login extends Component { @@ -164,14 +188,14 @@ export default class Login extends Component {
164 let that = this, 188 let that = this,
165 phone = this.state.phone, 189 phone = this.state.phone,
166 password = this.state.password; 190 password = this.state.password;
167 - // if (!/^1(3|4|5|7|8)\d{9}$/.test(phone)) { 191 + if (!/^1(3|4|5|7|8)\d{9}$/.test(phone)) {
168 - // alert("请正确输入手机号码"); 192 + alert("请正确输入手机号码");
169 - // return; 193 + return;
170 - // } 194 + }
171 - // if (password === "") { 195 + if (password === "") {
172 - // alert("请输入密码"); 196 + alert("请输入密码");
173 - // return; 197 + return;
174 - // } 198 + }
175 let formData = new FormData(); 199 let formData = new FormData();
176 formData.append("phone", phone); 200 formData.append("phone", phone);
177 formData.append("password", password); 201 formData.append("password", password);
@@ -195,19 +219,41 @@ export default class Login extends Component { @@ -195,19 +219,41 @@ export default class Login extends Component {
195 if (respJson.enmsg != "ok") { 219 if (respJson.enmsg != "ok") {
196 alert(respJson.cnmsg); 220 alert(respJson.cnmsg);
197 } else { 221 } else {
198 - that.setState( 222 + console.log("登录后拿到的ID和nickname",respJson.data);
199 - { 223 + let id = JSON.stringify(respJson.data.id),
200 - // testData: respJson.data 224 + nickname = respJson.data.nickname,
201 - } 225 + profession = respJson.data.profession;
202 - ); 226 + AsyncStorage.multiSet(
203 - AsyncStorage.setItem("IS_LOGIN", "yes", function(err) { 227 + [["IS_LOGIN", "yes"], ["USER_ID",id], ["NICKNAME",nickname], ["PROFESSION",profession]],
  228 + function(err) {
204 if (err) { 229 if (err) {
205 console.log("存储出错", err); 230 console.log("存储出错", err);
206 return false; 231 return false;
207 } 232 }
208 - // that.props.navigation.navigate("Mine"); 233 + AsyncStorage.multiGet(["IS_LOGIN","USER_ID","NICKNAME","PROFESSION"],(err, result) => {
209 - that.props.navigation.goBack(); 234 + if (err) {
  235 + console.error(err);
  236 + }
  237 + console.log("点击登录后的值",result)
  238 +
  239 + that.setState({
  240 + IS_LOGIN: result[0][1],
  241 + USER_ID: (result[1][1] != null) ? result[1][1] : "",
  242 + NICKNAME: (result[2][1] != null) ? result[2][1] : "",
  243 + PROFESSION: (result[3][1] != null) ? result[3][1] : "",
  244 + })
  245 + })
  246 + that.props.navigation.state.params.refreshCallback({
  247 + IS_LOGIN: "yes",
  248 + USER_ID: id,
  249 + NICKNAME: nickname,
  250 + PROFESSION: profession,
210 }); 251 });
  252 + setTimeout(function () {
  253 + that.props.navigation.goBack();
  254 + },0)
  255 + }
  256 + );
211 } 257 }
212 }) 258 })
213 .catch(err => console.error(err)); 259 .catch(err => console.error(err));
@@ -218,14 +264,16 @@ export default class Login extends Component { @@ -218,14 +264,16 @@ export default class Login extends Component {
218 phone = this.state.phone, 264 phone = this.state.phone,
219 password = this.state.password, 265 password = this.state.password,
220 nickname = this.state.nickname, 266 nickname = this.state.nickname,
  267 + profession = this.state.profession,
221 formData = new FormData(); 268 formData = new FormData();
222 - if (!phone || !password || !nickname) { 269 + if (!phone || !password || !nickname || !profession) {
223 alert("请完整填写信息"); 270 alert("请完整填写信息");
224 return false; 271 return false;
225 } 272 }
226 formData.append("phone", phone); 273 formData.append("phone", phone);
227 formData.append("password", password); 274 formData.append("password", password);
228 formData.append("nickname", nickname); 275 formData.append("nickname", nickname);
  276 + formData.append("profession", profession);
229 277
230 return fetch(`https://devpay.brae.co/test/insurance/register`, { 278 return fetch(`https://devpay.brae.co/test/insurance/register`, {
231 method: "POST", 279 method: "POST",
@@ -13,62 +13,57 @@ import { @@ -13,62 +13,57 @@ import {
13 import { StackNavigator, TabNavigator } from "react-navigation"; 13 import { StackNavigator, TabNavigator } from "react-navigation";
14 14
15 export default class Mine extends Component { 15 export default class Mine extends Component {
16 - // static navigationOptions = {  
17 - // title: '我的',  
18 - // };  
19 constructor(props) { 16 constructor(props) {
20 super(props); 17 super(props);
21 this.state = { 18 this.state = {
22 - IS_LOGIN: "no", 19 + IS_LOGIN: "",
23 - name: "哈哈哈", 20 + USER_ID: "",
24 - identity: "职业代理人" 21 + NICKNAME: "",
  22 + PROFESSION: "",
25 }; 23 };
26 this.saveResponse1 = this.saveResponse1.bind(this); 24 this.saveResponse1 = this.saveResponse1.bind(this);
27 this.saveResponse2 = this.saveResponse2.bind(this); 25 this.saveResponse2 = this.saveResponse2.bind(this);
28 } 26 }
29 componentWillMount() { 27 componentWillMount() {
30 var _that = this; 28 var _that = this;
31 - console.log("this", this); 29 + AsyncStorage.multiGet(["IS_LOGIN","USER_ID","NICKNAME","PROFESSION"],(err, result) => {
32 - AsyncStorage.getItem("IS_LOGIN", (err, result) => {  
33 if (err) { 30 if (err) {
34 console.error(err); 31 console.error(err);
35 } 32 }
  33 + console.log("最初始的四个个值",result)
36 _that.setState({ 34 _that.setState({
37 - IS_LOGIN: result 35 + IS_LOGIN: result[0][1],
38 - }); 36 + USER_ID: (result[1][1] != null) ? result[1][1].toString() : "",
39 - console.log("我的页面的IS_LOGIN", this.state.IS_LOGIN); 37 + NICKNAME: (result[2][1] != null) ? result[2][1].toString() : "",
40 - }); 38 + PROFESSION: (result[3][1] != null) ? result[3][1].toString() : "",
  39 + })
  40 + })
41 } 41 }
42 componentDidMount() { 42 componentDidMount() {
43 // console.log("hello,AsyncStorage"); 43 // console.log("hello,AsyncStorage");
44 } 44 }
45 - signIn() {  
46 - var _that = this;  
47 - AsyncStorage.setItem("IS_LOGIN", "yes", function(err) {  
48 - if (err) {  
49 - console.log("存储出错", err);  
50 - return false;  
51 - }  
52 - });  
53 - _that.setState({  
54 - IS_LOGIN: "yes"  
55 - });  
56 - }  
57 signOut() { 45 signOut() {
58 var _that = this; 46 var _that = this;
59 - AsyncStorage.setItem("IS_LOGIN", "no", function(err) { 47 + AsyncStorage.multiSet(
  48 + [["IS_LOGIN", "no"], ["USER_ID",""], ["NICKNAME",""],["PROFESSION",""]],
  49 + function (err) {
60 if (err) { 50 if (err) {
61 console.log("存储出错", err); 51 console.log("存储出错", err);
62 return false; 52 return false;
63 } 53 }
64 - });  
65 _that.setState({ 54 _that.setState({
66 - IS_LOGIN: "no" 55 + IS_LOGIN: "no",
67 - }); 56 + USER_ID: "",
  57 + NICKNAME: "",
  58 + PROFESSION: "",
  59 + })
  60 + console.log("退出登录后的值",_that.state)
  61 + }
  62 + )
68 } 63 }
69 saveResponse1(d) { 64 saveResponse1(d) {
70 if (this.state.IS_LOGIN == "yes") { 65 if (this.state.IS_LOGIN == "yes") {
71 - this.setState({ name: d }); 66 + this.setState({ NICKNAME: d });
72 } 67 }
73 } 68 }
74 saveResponse2(d) { 69 saveResponse2(d) {
@@ -101,13 +96,11 @@ export default class Mine extends Component { @@ -101,13 +96,11 @@ export default class Mine extends Component {
101 source={require("../../assets/tabbar/ic_circle_s.png")} 96 source={require("../../assets/tabbar/ic_circle_s.png")}
102 /> 97 />
103 <Text style={styles.leftTitle}>设置昵称</Text> 98 <Text style={styles.leftTitle}>设置昵称</Text>
104 - {/* {this.state.IS_LOGIN ? <Text style={styles.leftTitle}>昵称</Text> : null} */}  
105 </View> 99 </View>
106 <View style={styles.itemRight}> 100 <View style={styles.itemRight}>
107 {this.state.IS_LOGIN === "yes" ? ( 101 {this.state.IS_LOGIN === "yes" ? (
108 - <Text style={styles.itemRightContent}>{this.state.name}</Text> 102 + <Text style={styles.itemRightContent}>{this.state.NICKNAME}</Text>
109 ) : null} 103 ) : null}
110 - {/* <Text style={styles.itemRightContent}>{this.state.name}</Text> */}  
111 <Image 104 <Image
112 style={styles.itemRightImg} 105 style={styles.itemRightImg}
113 source={require("../../assets/Mine/rightArrow_gray.png")} 106 source={require("../../assets/Mine/rightArrow_gray.png")}
@@ -129,7 +122,7 @@ export default class Mine extends Component { @@ -129,7 +122,7 @@ export default class Mine extends Component {
129 <Text style={styles.leftTitle}>设置职业</Text> 122 <Text style={styles.leftTitle}>设置职业</Text>
130 </View> 123 </View>
131 <View style={styles.itemRight}> 124 <View style={styles.itemRight}>
132 - {/* <Text style={styles.itemRightContent}>{this.state.identity}</Text> */} 125 + <Text style={styles.itemRightContent}>{this.state.PROFESSION}</Text>
133 {this.state.IS_LOGIN === "yes" ? ( 126 {this.state.IS_LOGIN === "yes" ? (
134 <Text style={styles.itemRightContent}> 127 <Text style={styles.itemRightContent}>
135 {this.state.identity} 128 {this.state.identity}
@@ -150,7 +143,15 @@ export default class Mine extends Component { @@ -150,7 +143,15 @@ export default class Mine extends Component {
150 onPress={() => { 143 onPress={() => {
151 this.state.IS_LOGIN == "yes" 144 this.state.IS_LOGIN == "yes"
152 ? this.signOut() 145 ? this.signOut()
153 - : navigate("Login", { IS_LOGIN: this.state.IS_LOGIN }); 146 + : navigate("Login", { refreshCallback: (data)=>{
  147 + console.log("refreshCallback参数",data);
  148 + this.setState({
  149 + IS_LOGIN: data.IS_LOGIN,
  150 + USER_ID: data.USER_ID,
  151 + NICKNAME: data.NICKNAME,
  152 + PROFESSION: data.PROFESSION,
  153 + })
  154 + } });
154 }} 155 }}
155 > 156 >
156 <Text style={styles.loginOutText}> 157 <Text style={styles.loginOutText}>