罗广聪

调整发现入口

@@ -9,7 +9,8 @@ import { @@ -9,7 +9,8 @@ import {
9 ScrollView, 9 ScrollView,
10 Dimensions, 10 Dimensions,
11 TextInput, 11 TextInput,
12 - Alert 12 + Alert,
  13 + AsyncStorage
13 } from "react-native"; 14 } from "react-native";
14 import { StackNavigator, TabNavigator } from "react-navigation"; 15 import { StackNavigator, TabNavigator } from "react-navigation";
15 import post from "../../utils/fetch"; 16 import post from "../../utils/fetch";
@@ -32,18 +33,38 @@ export default class Home extends Component { @@ -32,18 +33,38 @@ export default class Home extends Component {
32 super(props); 33 super(props);
33 this.state = { 34 this.state = {
34 content: "", 35 content: "",
  36 + IS_LOGIN: "",
  37 + USER_ID: "",
35 }; 38 };
36 } 39 }
37 - componentWillMount() {} 40 + componentWillMount() {
  41 + this.getAsyncStorage();
  42 + }
38 43
39 componentDidMount() { 44 componentDidMount() {
40 this.props.navigation.setParams({ 45 this.props.navigation.setParams({
41 submit: this.submit.bind(this) 46 submit: this.submit.bind(this)
42 }); 47 });
43 } 48 }
44 - // 49 +
  50 + getAsyncStorage() {
  51 + const that = this;
  52 + AsyncStorage.multiGet(
  53 + ["IS_LOGIN", "USER_ID"],
  54 + (err, result) => {
  55 + if (err) {
  56 + console.error(err);
  57 + }
  58 + that.setState({
  59 + IS_LOGIN: result[0][1],
  60 + USER_ID: result[1][1] != null ? result[1][1] : "",
  61 + });
  62 + }
  63 + );
  64 + }
  65 +
45 submit() { 66 submit() {
46 - const { navigate,goBack } = this.props.navigation; 67 + const { goBack } = this.props.navigation;
47 if(!this.state.content){ 68 if(!this.state.content){
48 Alert.alert("请填写评论内容"); 69 Alert.alert("请填写评论内容");
49 } else { 70 } else {
@@ -354,6 +354,26 @@ export default class Mine extends Component { @@ -354,6 +354,26 @@ export default class Mine extends Component {
354 </TouchableOpacity> 354 </TouchableOpacity>
355 </View> 355 </View>
356 356
  357 + {/* 发现 */}
  358 + <View style={styles.midContainer}>
  359 + <TouchableOpacity
  360 + style={styles.itemContainer}
  361 + onPress={() => {
  362 + navigate("Discover");
  363 + }}
  364 + >
  365 + <View style={styles.itemLeft}>
  366 + <Text style={styles.leftTitle}>发现</Text>
  367 + </View>
  368 + <View style={styles.itemRight}>
  369 + <Image
  370 + style={styles.itemRightImg}
  371 + source={require("../../assets/Mine/rightArrow_gray.png")}
  372 + />
  373 + </View>
  374 + </TouchableOpacity>
  375 + </View>
  376 +
357 {/* 当前版本 */} 377 {/* 当前版本 */}
358 <View style={styles.midContainer}> 378 <View style={styles.midContainer}>
359 <TouchableOpacity style={styles.itemContainer}> 379 <TouchableOpacity style={styles.itemContainer}>