罗广聪

评价 还没发送

@@ -7,8 +7,9 @@ import { @@ -7,8 +7,9 @@ import {
7 Image, 7 Image,
8 TouchableOpacity, 8 TouchableOpacity,
9 ScrollView, 9 ScrollView,
10 - ListView,  
11 Dimensions, 10 Dimensions,
  11 + TextInput,
  12 + Alert
12 } from "react-native"; 13 } from "react-native";
13 import { StackNavigator, TabNavigator } from "react-navigation"; 14 import { StackNavigator, TabNavigator } from "react-navigation";
14 import post from "../../utils/fetch"; 15 import post from "../../utils/fetch";
@@ -29,7 +30,9 @@ export default class Home extends Component { @@ -29,7 +30,9 @@ export default class Home extends Component {
29 }; 30 };
30 constructor(props) { 31 constructor(props) {
31 super(props); 32 super(props);
32 - this.state = {}; 33 + this.state = {
  34 + content: "",
  35 + };
33 } 36 }
34 componentWillMount() {} 37 componentWillMount() {}
35 38
@@ -39,7 +42,14 @@ export default class Home extends Component { @@ -39,7 +42,14 @@ export default class Home extends Component {
39 }); 42 });
40 } 43 }
41 // 44 //
42 - submit() { console.log("提交成功") } 45 + submit() {
  46 + const { navigate,goBack } = this.props.navigation;
  47 + if(!this.state.content){
  48 + Alert.alert("请填写评论内容");
  49 + } else {
  50 + Alert.alert("提交成功",null,() => goBack());
  51 + }
  52 + }
43 53
44 getListData() { 54 getListData() {
45 post("/test/insurance/article", {}, res => {}, err => {}); 55 post("/test/insurance/article", {}, res => {}, err => {});
@@ -49,7 +59,25 @@ export default class Home extends Component { @@ -49,7 +59,25 @@ export default class Home extends Component {
49 const { navigate } = this.props.navigation; 59 const { navigate } = this.props.navigation;
50 return ( 60 return (
51 <View style={styles.container}> 61 <View style={styles.container}>
52 - <Text>评价页面</Text> 62 + {/* <Text>评价页面</Text> */}
  63 + <View style={styles.inputContaier}>
  64 + <TextInput
  65 + style={styles.contentInput}
  66 + placeholder="填写评价内容"
  67 + onChangeText={content => this.setState({ content })}
  68 + value={this.state.content}
  69 + autoCapitalize="none"
  70 + multiline={true}
  71 + selectionColor="#1B9341"
  72 + clearButtonMode="always"
  73 + keyboardType="default"
  74 + enablesReturnKeyAutomatically={true}
  75 + returnKeyType="send"
  76 + onSubmitEditing={() => {
  77 + Keyboard.dismiss();
  78 + }}
  79 + />
  80 + </View>
53 </View> 81 </View>
54 ); 82 );
55 } 83 }
@@ -61,5 +89,23 @@ const styles = StyleSheet.create({ @@ -61,5 +89,23 @@ const styles = StyleSheet.create({
61 justifyContent: "flex-start", 89 justifyContent: "flex-start",
62 alignItems: "stretch", 90 alignItems: "stretch",
63 backgroundColor: "#EFEFEF" 91 backgroundColor: "#EFEFEF"
64 - } 92 + },
  93 + inputContaier: {
  94 + backgroundColor: "white",
  95 + paddingHorizontal: 15,
  96 + paddingVertical: 10,
  97 + marginVertical: 20,
  98 + marginHorizontal: 15,
  99 + borderStyle: "solid",
  100 + borderColor: "#EFEFEF",
  101 + borderTopWidth: 1,
  102 + flex: 1,
  103 + borderRadius: 8,
  104 + },
  105 + contentInput: {
  106 + fontSize: 15,
  107 + paddingTop: 8,
  108 + paddingBottom: 7,
  109 + flex: 1,
  110 + },
65 }); 111 });
@@ -315,7 +315,16 @@ export default class Mine extends Component { @@ -315,7 +315,16 @@ export default class Mine extends Component {
315 315
316 {/* 评价和客服 */} 316 {/* 评价和客服 */}
317 <View style={styles.midContainer}> 317 <View style={styles.midContainer}>
318 - <TouchableOpacity style={styles.itemContainer} onPress={() => navigate('Evaluate')}> 318 + <TouchableOpacity
  319 + style={styles.itemContainer}
  320 + onPress={() => {
  321 + if (this.state.IS_LOGIN != "yes") {
  322 + Alert.alert("请先登录账号");
  323 + } else {
  324 + navigate("Evaluate");
  325 + }
  326 + }}
  327 + >
319 <View style={styles.itemLeft}> 328 <View style={styles.itemLeft}>
320 <Text style={styles.leftTitle}>评价我们</Text> 329 <Text style={styles.leftTitle}>评价我们</Text>
321 </View> 330 </View>