index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import React,{Component} from 'react';
  2. import { View ,Text,Image,StyleSheet} from 'react-native';
  3. import commonStyle from '../../styles/styles.js';
  4. import { connect } from 'react-redux';
  5. import { List } from 'antd-mobile-rn';
  6. import {Device,Icon} from '../../tool'
  7. const Item = List.Item;
  8. const Brief = Item.Brief;
  9. class Mine extends Component {
  10. constructor(props){
  11. super(props)
  12. }
  13. push(routeName){
  14. const { navigation } =this.props
  15. navigation.navigate({ routeName })
  16. }
  17. render(){
  18. const {UserAction } =this.props
  19. const {username,id,head} =UserAction
  20. let source={}
  21. if(head){
  22. source = {
  23. uri:head,
  24. cache: 'force-cache'
  25. }
  26. }else{
  27. source = Icon.icon
  28. }
  29. return (
  30. <View style={commonStyle.page} >
  31. <List style={styles.head}>
  32. <Item
  33. style={styles.headItem}
  34. onClick={()=>{this.push('Infomation')}}
  35. thumb={
  36. <View style={styles.thumb}>
  37. <Image
  38. source={source}
  39. style={styles.info}
  40. />
  41. </View>
  42. }
  43. extra={
  44. <Image
  45. source={Icon.Mine.code}
  46. style={styles.code}
  47. />
  48. }
  49. arrow="horizontal"
  50. >
  51. {username}
  52. <Brief style={styles.id}>ID:{id}</Brief>
  53. </Item>
  54. </List>
  55. <List style={commonStyle.list}>
  56. <Item
  57. style={commonStyle.item}
  58. onClick={()=>{this.push('Setting')}}
  59. thumb={
  60. <Image
  61. source={Icon.Mine.set}
  62. style={
  63. styles.icon
  64. }
  65. />
  66. }
  67. arrow="horizontal"
  68. >
  69. 设置
  70. </Item>
  71. </List>
  72. </View>
  73. )
  74. }
  75. }
  76. const styles = StyleSheet.create({
  77. head:{
  78. height:Device.scale(80),
  79. marginBottom:Device.scale(10),
  80. backgroundColor: '#fff',
  81. },
  82. headItem:{
  83. height:Device.scale(80),
  84. },
  85. thumb:{
  86. width:Device.scale(50),
  87. height:Device.scale(50),
  88. marginRight:Device.scale(12),
  89. borderRadius:Device.scale(5),
  90. overflow:'hidden'
  91. },
  92. info:{
  93. width: Device.scale(50),
  94. height: Device.scale(50)
  95. },
  96. code:{
  97. width: Device.scale(21),
  98. height: Device.scale(21)
  99. },
  100. id:{marginTop:Device.scale(4)},
  101. icon:{ width: Device.scale(21), height: Device.scale(21),marginRight:9 }
  102. });
  103. const mapStateToProps = ({UserAction} )=> {
  104. return {UserAction}
  105. }
  106. export default connect(mapStateToProps)(Mine);