configure.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import React, {Component} from 'react';
  2. import {
  3. Image,
  4. Text,
  5. View,
  6. TouchableOpacity,
  7. StyleSheet,
  8. ScrollView,
  9. SafeAreaView,
  10. DeviceEventEmitter,
  11. Dimensions,
  12. } from 'react-native';
  13. import {WingBlank, WhiteSpace} from '@ant-design/react-native';
  14. import public_css from '../../source/css/public_css';
  15. import {RetrieveData} from '../../data/storage';
  16. import LinearGradient from 'react-native-linear-gradient';
  17. export default class configure extends Component {
  18. constructor(props) {
  19. super(props);
  20. this.state = {
  21. authority: '',
  22. landingStatus: 0, //登录状态,0:表示未登录,1:表示已登录
  23. };
  24. }
  25. render() {
  26. return (
  27. <SafeAreaView style={public_css.body}>
  28. <ScrollView style={{backgroundColor: '#F2F1F7'}}>
  29. <View style={styles.img_con}>
  30. <LinearGradient
  31. colors={['#628FFC', '#2965FA']}
  32. style={{
  33. height: '100%',
  34. display: 'flex',
  35. justifyContent: 'center',
  36. alignItems: 'center',
  37. }}>
  38. <Image
  39. style={styles.bg_img}
  40. source={require('../../source/img/set/set_bg.png')}
  41. resizeMode="cover"
  42. />
  43. </LinearGradient>
  44. </View>
  45. <View style={styles.bottom_con}>
  46. <View style={styles.nav_con}>
  47. <TouchableOpacity
  48. style={styles.nav_item}
  49. activeOpacity={1}
  50. onPress={() => {
  51. this.getLandingStatus(1);
  52. }}>
  53. <Image
  54. style={styles.icon}
  55. source={require('../../source/img/set/icon1.png')}
  56. resizeMode="contain"
  57. />
  58. <Text style={styles.text}>客户管理</Text>
  59. </TouchableOpacity>
  60. <TouchableOpacity
  61. style={styles.nav_item}
  62. activeOpacity={1}
  63. onPress={() => {
  64. this.getLandingStatus(2);
  65. }}>
  66. <Image
  67. style={styles.icon}
  68. source={require('../../source/img/set/icon2.png')}
  69. resizeMode="contain"
  70. />
  71. <Text style={styles.text}>商品管理</Text>
  72. </TouchableOpacity>
  73. </View>
  74. <View style={styles.nav_con}>
  75. <TouchableOpacity
  76. style={styles.nav_item}
  77. activeOpacity={1}
  78. onPress={() => {
  79. this.getLandingStatus(3);
  80. }}>
  81. <Image
  82. style={styles.icon}
  83. source={require('../../source/img/set/icon3.png')}
  84. resizeMode="contain"
  85. />
  86. <Text style={styles.text}>开票员管理</Text>
  87. </TouchableOpacity>
  88. <TouchableOpacity
  89. style={styles.nav_item}
  90. activeOpacity={1}
  91. onPress={() => {
  92. this.getLandingStatus(4);
  93. }}>
  94. <Image
  95. style={styles.icon}
  96. source={require('../../source/img/set/icon4.png')}
  97. resizeMode="contain"
  98. />
  99. <Text style={styles.text}>企业信息配置</Text>
  100. </TouchableOpacity>
  101. </View>
  102. </View>
  103. <View style={{height: 30}}></View>
  104. </ScrollView>
  105. </SafeAreaView>
  106. );
  107. }
  108. //加载数据
  109. componentDidMount() {
  110. this.getAuthority();
  111. }
  112. //判断是否登录
  113. getLandingStatus = async (type) => {
  114. const account = await RetrieveData('account');
  115. if (account) {
  116. if (type === 1) {
  117. this.props.navigation.navigate('customer_list');
  118. }
  119. if (type === 2) {
  120. this.props.navigation.navigate('product_list');
  121. }
  122. if (type === 3) {
  123. this.props.navigation.navigate('invoice_drawer');
  124. }
  125. if (type === 4) {
  126. this.props.navigation.navigate('enterprise_list');
  127. }
  128. } else {
  129. this.props.navigation.navigate('login', {
  130. refresh: (type) => {
  131. this.refresh(type);
  132. },
  133. });
  134. }
  135. };
  136. refresh = async (type) => {
  137. DeviceEventEmitter.emit('updateLoginInfo', type);
  138. DeviceEventEmitter.emit('updateCompany', null);
  139. };
  140. //获取权限信息
  141. getAuthority = async () => {
  142. const authority = await RetrieveData('authority');
  143. if (authority) {
  144. this.setState({
  145. authority: authority,
  146. landingStatus: 1,
  147. });
  148. }
  149. };
  150. }
  151. const windowWidth = Dimensions.get('window').width;
  152. const styles = StyleSheet.create({
  153. tapBtnBakCol: {
  154. flexDirection: 'column',
  155. alignItems: 'center',
  156. },
  157. tapBtnImg: {
  158. width: 49,
  159. height: 49,
  160. },
  161. tapBtnTips: {
  162. marginTop: 10,
  163. color: '#757374',
  164. },
  165. img_con: {
  166. borderBottomLeftRadius: 30,
  167. overflow: 'hidden',
  168. height: 280,
  169. },
  170. bg_img: {
  171. width: 335,
  172. height: 150,
  173. },
  174. bottom_con: {
  175. width: '100%',
  176. marginTop: -20,
  177. },
  178. nav_con: {
  179. width: '100%',
  180. display: 'flex',
  181. flexDirection: 'row',
  182. alignItems: 'center',
  183. justifyContent: 'center',
  184. },
  185. nav_item: {
  186. width: 150,
  187. height: 180,
  188. backgroundColor: '#FFF',
  189. display: 'flex',
  190. flexDirection: 'column',
  191. justifyContent: 'center',
  192. alignItems: 'center',
  193. marginLeft: 10,
  194. marginRight: 10,
  195. marginBottom: 20,
  196. },
  197. icon: {
  198. width: 65,
  199. height: 65,
  200. },
  201. text: {
  202. fontSize: 13,
  203. color: '#454545',
  204. marginTop: 15,
  205. },
  206. });