罗广聪

我的 静态页面

... ... @@ -43,7 +43,7 @@ export default class Login extends Component {
_that.setState({
IS_LOGIN: result
});
console.log("Login页面的AsyncStorage", result);
// console.log("Login页面的AsyncStorage", result);
});
}
componentDidMount() {
... ...
... ... @@ -9,7 +9,8 @@ import {
Alert,
AlertIOS,
AsyncStorage,
Button
Button,
ScrollView
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
... ... @@ -20,7 +21,9 @@ export default class Mine extends Component {
IS_LOGIN: "",
USER_ID: "",
NICKNAME: "",
PROFESSION: ""
PROFESSION: "",
PHONT: "",
COMPONY: ""
};
this.saveResponse1 = this.saveResponse1.bind(this);
this.saveResponse2 = this.saveResponse2.bind(this);
... ... @@ -99,10 +102,10 @@ export default class Mine extends Component {
if (respJson.enmsg != "ok") {
alert(respJson.cnmsg);
} else {
AsyncStorage.setItem("NICKNAME",d).then(() => {
AsyncStorage.setItem("NICKNAME", d).then(() => {
console.log("保存修改成功");
that.setState({ NICKNAME: d });
})
});
}
})
.catch(err => console.error(err));
... ... @@ -136,18 +139,20 @@ export default class Mine extends Component {
if (respJson.enmsg != "ok") {
Alert.alert(respJson.cnmsg);
} else {
AsyncStorage.setItem("PROFESSION",d).then(() => {
AsyncStorage.setItem("PROFESSION", d).then(() => {
console.log("保存修改成功");
that.setState({ PROFESSION: d });
})
});
}
})
.catch(err => console.error(err));
}
render() {
const { navigate } = this.props.navigation;
return (
<View style={styles.container}>
<ScrollView>
{/* 头部头像 */}
<View style={styles.header}>
{this.state.IS_LOGIN == "yes" ? (
... ... @@ -161,9 +166,13 @@ export default class Mine extends Component {
style={styles.mineIcon}
/>
)}
{this.state.IS_LOGIN == "yes" ? null : (
<Text style={styles.headerText}>登录可享更多特权</Text>
)}
</View>
{/* 设置昵称和职业 */}
{this.state.IS_LOGIN == "yes" ? (
<View style={styles.midContainer}>
{/* 更改昵称 */}
<TouchableOpacity
... ... @@ -172,7 +181,7 @@ export default class Mine extends Component {
if (this.state.IS_LOGIN == "yes") {
AlertIOS.prompt("更改昵称", null, this.saveResponse1);
} else {
Alert.alert("请先登录账号")
Alert.alert("请先登录账号");
}
}}
>
... ... @@ -198,7 +207,7 @@ export default class Mine extends Component {
if (this.state.IS_LOGIN == "yes") {
AlertIOS.prompt("更改职业", null, this.saveResponse2);
} else {
Alert.alert("请先登录账号")
Alert.alert("请先登录账号");
}
}}
>
... ... @@ -206,12 +215,61 @@ export default class Mine extends Component {
<Text style={styles.leftTitle}>职业</Text>
</View>
<View style={styles.itemRight}>
{this.state.IS_LOGIN === "yes" ? (
<Text style={styles.itemRightContent}>
{this.state.PROFESSION}
</Text>
) : null}
<Image
style={styles.itemRightImg}
source={require("../../assets/Mine/rightArrow_gray.png")}
/>
</View>
</TouchableOpacity>
{/* 公司 */}
<TouchableOpacity
style={styles.itemContainer}
onPress={() => {
if (this.state.IS_LOGIN == "yes") {
AlertIOS.prompt("更改手机", null, this.saveResponse2);
} else {
Alert.alert("请先登录账号");
}
}}
>
<View style={styles.itemLeft}>
<Text style={styles.leftTitle}>手机</Text>
</View>
<View style={styles.itemRight}>
{this.state.IS_LOGIN === "yes" ? (
<Text style={styles.itemRightContent}>
{this.state.PHONT}
</Text>
) : null}
<Image
style={styles.itemRightImg}
source={require("../../assets/Mine/rightArrow_gray.png")}
/>
</View>
</TouchableOpacity>
{/* 手机 */}
<TouchableOpacity
style={styles.itemContainer}
onPress={() => {
if (this.state.IS_LOGIN == "yes") {
AlertIOS.prompt("更改公司", null, this.saveResponse2);
} else {
Alert.alert("请先登录账号");
}
}}
>
<View style={styles.itemLeft}>
<Text style={styles.leftTitle}>公司</Text>
</View>
<View style={styles.itemRight}>
{this.state.IS_LOGIN === "yes" ? (
<Text style={styles.itemRightContent}>
{this.state.identity}
{this.state.COMPONY}
</Text>
) : null}
<Image
... ... @@ -221,6 +279,46 @@ export default class Mine extends Component {
</View>
</TouchableOpacity>
</View>
) : null}
<View style={styles.midContainer}>
<TouchableOpacity style={styles.itemContainer}>
<View style={styles.itemLeft}>
<Text style={styles.leftTitle}>评价我们</Text>
</View>
<View style={styles.itemRight}>
<Image
style={styles.itemRightImg}
source={require("../../assets/Mine/rightArrow_gray.png")}
/>
</View>
</TouchableOpacity>
<TouchableOpacity style={styles.itemContainer}>
<View style={styles.itemLeft}>
<Text style={styles.leftTitle}>客服电话</Text>
</View>
<View style={styles.itemRight}>
<Text style={styles.itemRightContent}>4001-608876</Text>
<Image
style={styles.itemRightImg}
source={require("../../assets/Mine/rightArrow_gray.png")}
/>
</View>
</TouchableOpacity>
</View>
<View style={styles.midContainer}>
<TouchableOpacity style={styles.itemContainer}>
<View style={styles.itemLeft}>
<Text style={styles.leftTitle}>当前版本</Text>
</View>
<View style={styles.itemRight}>
<Text style={styles.itemRightContent}>
V1.0.0
</Text>
</View>
</TouchableOpacity>
</View>
{/* 登录 */}
<TouchableOpacity
... ... @@ -246,6 +344,7 @@ export default class Mine extends Component {
{this.state.IS_LOGIN == "yes" ? "退出登录" : "登录"}
</Text>
</TouchableOpacity>
</ScrollView>
</View>
);
}
... ... @@ -266,6 +365,11 @@ const styles = StyleSheet.create({
alignItems: "center",
marginBottom: 10
},
headerText: {
fontSize: 15,
color: "#fff",
marginLeft: 22
},
mineIcon: {
width: 86,
height: 86
... ... @@ -279,7 +383,9 @@ const styles = StyleSheet.create({
width: 14,
height: 14
},
midContainer: {},
midContainer: {
marginBottom: 10
},
itemContainer: {
height: 46,
paddingLeft: 16,
... ... @@ -315,7 +421,7 @@ const styles = StyleSheet.create({
height: 14
},
loginOut: {
marginTop: 10,
marginBottom: 10,
height: 46,
backgroundColor: "#fff",
justifyContent: "center"
... ... @@ -323,5 +429,5 @@ const styles = StyleSheet.create({
loginOutText: {
textAlign: "center",
fontSize: 15
},
}
});
... ...