罗广聪

customer Main style

@@ -16,7 +16,10 @@ import post from "../../utils/fetch"; @@ -16,7 +16,10 @@ import post from "../../utils/fetch";
16 export default class Home extends Component { 16 export default class Home extends Component {
17 constructor(props) { 17 constructor(props) {
18 super(props); 18 super(props);
19 - this.state = {}; 19 + this.state = {
  20 + hasCustomer: true,
  21 + customersList: ["张某某", "周某某", "林某某", "李某某"]
  22 + };
20 } 23 }
21 componentWillMount() {} 24 componentWillMount() {}
22 25
@@ -52,10 +55,14 @@ export default class Home extends Component { @@ -52,10 +55,14 @@ export default class Home extends Component {
52 55
53 render() { 56 render() {
54 const { navigate } = this.props.navigation; 57 const { navigate } = this.props.navigation;
  58 + const { hasCustomer, customers } = this.state;
55 return ( 59 return (
56 <View style={styles.container}> 60 <View style={styles.container}>
57 - {/* <Begin /> */} 61 + {hasCustomer ? (
58 - <Main /> 62 + <Main customersList={this.state.customersList} />
  63 + ) : (
  64 + <Begin />
  65 + )}
59 </View> 66 </View>
60 ); 67 );
61 } 68 }
@@ -91,19 +98,37 @@ class Main extends Component { @@ -91,19 +98,37 @@ class Main extends Component {
91 super(props); 98 super(props);
92 this.state = {}; 99 this.state = {};
93 } 100 }
  101 +
94 render() { 102 render() {
  103 + const { customersList } = this.props;
95 return ( 104 return (
96 <View style={styles.mainContaier}> 105 <View style={styles.mainContaier}>
97 <View style={styles.mainBtnContaier}> 106 <View style={styles.mainBtnContaier}>
98 <TouchableOpacity style={styles.mainBtnContaierLeft}> 107 <TouchableOpacity style={styles.mainBtnContaierLeft}>
99 - <Image style={styles.mainBtnLeftImg} source={require("../../assets/customer/ic_add.png")} /> 108 + <Image
  109 + style={styles.mainBtnLeftImg}
  110 + source={require("../../assets/customer/ic_add.png")}
  111 + />
100 <Text style={styles.mainBtnLeftText}>手动添加</Text> 112 <Text style={styles.mainBtnLeftText}>手动添加</Text>
101 </TouchableOpacity> 113 </TouchableOpacity>
102 <TouchableOpacity style={styles.mainBtnContaierRight}> 114 <TouchableOpacity style={styles.mainBtnContaierRight}>
103 - <Image style={styles.mainBtnRightImg} source={require("../../assets/customer/ic_message.png")} /> 115 + <Image
  116 + style={styles.mainBtnRightImg}
  117 + source={require("../../assets/customer/ic_message.png")}
  118 + />
104 <Text style={styles.mainBtnRightText}>通信录导入</Text> 119 <Text style={styles.mainBtnRightText}>通信录导入</Text>
105 </TouchableOpacity> 120 </TouchableOpacity>
106 </View> 121 </View>
  122 + <ScrollView style={styles.mainSvcContainer}>
  123 + {customersList.map((item, index) => {
  124 + return (
  125 + <TouchableOpacity key={index} style={styles.mainCustomerItem}>
  126 + <Text style={styles.mainCustomerItemText}>{item}</Text>
  127 + <Image style={styles.mainCustomerItemImg} source={require("../../assets/customer/rightArrow_gray.png")} />
  128 + </TouchableOpacity>
  129 + );
  130 + })}
  131 + </ScrollView>
107 </View> 132 </View>
108 ); 133 );
109 } 134 }
@@ -159,40 +184,68 @@ const styles = StyleSheet.create({ @@ -159,40 +184,68 @@ const styles = StyleSheet.create({
159 fontSize: 16, 184 fontSize: 16,
160 color: "white" 185 color: "white"
161 }, 186 },
162 - mainContaier: {}, 187 + mainContaier: {
  188 + flex: 1,
  189 + justifyContent: "flex-start",
  190 + alignItems: "stretch",
  191 + backgroundColor: "#EFEFEF"
  192 + },
163 mainBtnContaier: { 193 mainBtnContaier: {
164 marginVertical: 10, 194 marginVertical: 10,
165 backgroundColor: "white", 195 backgroundColor: "white",
166 flexDirection: "row", 196 flexDirection: "row",
167 justifyContent: "space-around", 197 justifyContent: "space-around",
168 - paddingVertical: 13, 198 + paddingVertical: 13
169 }, 199 },
170 mainBtnContaierLeft: { 200 mainBtnContaierLeft: {
171 flexDirection: "row", 201 flexDirection: "row",
172 justifyContent: "center", 202 justifyContent: "center",
173 - alignItems: "center", 203 + alignItems: "center"
174 }, 204 },
175 mainBtnLeftImg: { 205 mainBtnLeftImg: {
176 width: 24, 206 width: 24,
177 - height: 24, 207 + height: 24
178 }, 208 },
179 mainBtnLeftText: { 209 mainBtnLeftText: {
180 marginLeft: 8, 210 marginLeft: 8,
181 fontSize: 15, 211 fontSize: 15,
182 - color: "#242424", 212 + color: "#242424"
183 }, 213 },
184 mainBtnContaierRight: { 214 mainBtnContaierRight: {
185 flexDirection: "row", 215 flexDirection: "row",
186 justifyContent: "center", 216 justifyContent: "center",
187 - alignItems: "center", 217 + alignItems: "center"
188 }, 218 },
189 mainBtnRightImg: { 219 mainBtnRightImg: {
190 width: 24, 220 width: 24,
191 - height: 24, 221 + height: 24
192 }, 222 },
193 mainBtnRightText: { 223 mainBtnRightText: {
194 marginLeft: 8, 224 marginLeft: 8,
195 fontSize: 15, 225 fontSize: 15,
196 - color: "#242424", 226 + color: "#242424"
  227 + },
  228 + mainSvcContainer: {
  229 + backgroundColor: "white",
  230 + },
  231 + mainCustomerItem: {
  232 + flexDirection: "row",
  233 + justifyContent: "space-between",
  234 + alignItems: "center",
  235 + backgroundColor: "white",
  236 + paddingVertical: 12,
  237 + marginLeft: 16,
  238 + marginRight: 10,
  239 + borderStyle: "solid",
  240 + borderColor: "#F2F2F2",
  241 + borderTopWidth: 1,
  242 + },
  243 + mainCustomerItemText: {
  244 + fontSize: 16,
  245 + color: "#202020",
  246 + },
  247 + mainCustomerItemImg: {
  248 + width: 14,
  249 + height: 14,
197 }, 250 },
198 }); 251 });