personal_center.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. import React, {Component} from 'react';
  2. import {
  3. Image,
  4. Text,
  5. View,
  6. TouchableOpacity,
  7. DeviceEventEmitter,
  8. Alert,
  9. SafeAreaView,
  10. ScrollView,
  11. Linking,
  12. } from 'react-native';
  13. import {WhiteSpace, WingBlank, List, Modal} from '@ant-design/react-native';
  14. import personal_center_css from './personal_center_css';
  15. import public_css from '../../source/css/public_css';
  16. import {
  17. RetrieveData,
  18. ClearAll,
  19. IndividualStorageData,
  20. } from '../../data/storage';
  21. import Spinner from 'react-native-loading-spinner-overlay';
  22. import loading_css from '../../source/css/loading_css';
  23. import {RequestNetwork} from '../../data/encryption';
  24. import LinearGradient from 'react-native-linear-gradient';
  25. import {GetMonthDate} from '../../utils/date';
  26. import {ToastShow} from '../../components/toast/toast';
  27. import FastImage from 'react-native-fast-image';
  28. import { CleanAll } from "../../components/abnormalMessage/abnormal_message";
  29. const Item = List.Item;
  30. export default class personal_center extends Component {
  31. constructor(props) {
  32. super(props);
  33. this.state = {
  34. userName: '',
  35. userType: '',
  36. spinner: false,
  37. user: '',
  38. loginText: '点击登录',
  39. infoText: '立即登陆体验完整功能',
  40. telPhone: 'tel:0871-63193319',
  41. headImage: '',
  42. sex: '',
  43. invoiceNumber: '——',
  44. companyNumber: '——',
  45. messageNumber: '——',
  46. lastLoginDate: '——',
  47. membershipStatus: '请登录查看您的会员状态',
  48. isShowText: '展开',
  49. isShow: false,
  50. productList: [],
  51. productNumber: 0,
  52. isShowMore: false,
  53. };
  54. }
  55. render() {
  56. return (
  57. <SafeAreaView style={public_css.body}>
  58. <ScrollView style={{flex: 1}}>
  59. <View
  60. style={{
  61. height: 130,
  62. justifyContent: 'center',
  63. backgroundColor: '#F4F7FC',
  64. }}>
  65. <View style={{height: 100, flexDirection: 'row'}}>
  66. {this.state.headImage === '' || this.state.headImage === null ? (
  67. this.state.sex === 'F' ? (
  68. <View
  69. style={{
  70. justifyContent: 'center',
  71. }}>
  72. <Image
  73. source={require('../../source/img/personal/woman.png')}
  74. style={[personal_center_css.headImg]}
  75. />
  76. </View>
  77. ) : (
  78. <View
  79. style={{
  80. justifyContent: 'center',
  81. }}>
  82. <Image
  83. source={require('../../source/img/personal/man.png')}
  84. style={[personal_center_css.headImg]}
  85. />
  86. </View>
  87. )
  88. ) : (
  89. <View
  90. style={{
  91. justifyContent: 'center',
  92. }}>
  93. <Image
  94. source={{uri: this.state.headImage}}
  95. style={[personal_center_css.headImg]}
  96. />
  97. </View>
  98. )}
  99. <View>
  100. {this.state.userName === '' ? (
  101. <View style={{flex: 1, justifyContent: 'center'}}>
  102. <TouchableOpacity
  103. onPress={() =>
  104. this.props.navigation.navigate('login', {
  105. refresh: (type) => {
  106. this.refresh(type);
  107. },
  108. })
  109. }>
  110. <Text
  111. style={{
  112. color: '#06090E',
  113. fontSize: 20,
  114. fontWeight: 'bold',
  115. }}>
  116. {this.state.loginText}
  117. </Text>
  118. </TouchableOpacity>
  119. </View>
  120. ) : (
  121. <View style={{flex: 1, justifyContent: 'center'}}>
  122. <Text
  123. style={{
  124. color: '#06090E',
  125. fontSize: 20,
  126. fontWeight: 'bold',
  127. }}>
  128. {this.state.userName}
  129. </Text>
  130. </View>
  131. )}
  132. {this.state.userName === '' ? (
  133. <View style={{flex: 1}}>
  134. <Text style={{color: '#06090E', fontSize: 15}}>
  135. {this.state.infoText}
  136. </Text>
  137. </View>
  138. ) : (
  139. <View style={{flex: 1}}>
  140. <TouchableOpacity onPress={() => this.getLandingStatus(1)}>
  141. <Text style={{color: '#06090E', fontSize: 15}}>
  142. {this.state.infoText}
  143. </Text>
  144. </TouchableOpacity>
  145. </View>
  146. )}
  147. </View>
  148. </View>
  149. </View>
  150. <WingBlank>
  151. <View
  152. style={{
  153. flexDirection: 'row',
  154. justifyContent: 'space-around',
  155. height: 50,
  156. }}>
  157. <View style={{justifyContent: 'center', alignItems: 'center'}}>
  158. <Text style={{color: '#01020F', fontSize: 20}}>
  159. {this.state.invoiceNumber}
  160. </Text>
  161. <Text style={{color: '#787B84'}}>本月正数开具</Text>
  162. </View>
  163. <View
  164. style={{
  165. borderWidth: 0.5,
  166. height: 30,
  167. borderColor: '#D9D9D9',
  168. marginTop: 10,
  169. }}
  170. />
  171. <View style={{justifyContent: 'center', alignItems: 'center'}}>
  172. <Text style={{color: '#01020F', fontSize: 20}}>
  173. {this.state.companyNumber}
  174. </Text>
  175. <Text style={{color: '#787B84'}}>绑定企业</Text>
  176. </View>
  177. <View
  178. style={{
  179. borderWidth: 0.5,
  180. height: 30,
  181. borderColor: '#D9D9D9',
  182. marginTop: 10,
  183. }}
  184. />
  185. <View style={{justifyContent: 'center', alignItems: 'center'}}>
  186. <Text style={{color: '#01020F', fontSize: 20}}>
  187. {this.state.messageNumber}
  188. </Text>
  189. <Text style={{color: '#787B84'}}>短信剩余</Text>
  190. </View>
  191. {/*<View*/}
  192. {/* style={{*/}
  193. {/* borderWidth: 0.5,*/}
  194. {/* height: 30,*/}
  195. {/* borderColor: '#D9D9D9',*/}
  196. {/* marginTop: 10,*/}
  197. {/* }}*/}
  198. {/*/>*/}
  199. {/*<View style={{justifyContent: 'center', alignItems: 'center'}}>*/}
  200. {/* <Text style={{color: '#01020F', fontSize: 20}}>*/}
  201. {/* {this.state.lastLoginDate}*/}
  202. {/* </Text>*/}
  203. {/* <Text style={{color: '#787B84'}}>上次登录</Text>*/}
  204. {/*</View>*/}
  205. </View>
  206. </WingBlank>
  207. <WingBlank>
  208. <View
  209. style={{
  210. // height: 90,
  211. backgroundColor: '#2A2C44',
  212. marginTop: 10,
  213. }}>
  214. <View style={{height: 40, flexDirection: 'row'}}>
  215. <View style={{flex: 1}}>
  216. <Text
  217. style={{
  218. color: '#EAC47D',
  219. fontSize: 16,
  220. marginLeft: 11.5,
  221. marginTop: 8.5,
  222. fontWeight: 'bold',
  223. }}>
  224. 报税旗舰版
  225. </Text>
  226. </View>
  227. <View style={{width: 100, alignItems: 'flex-end'}}>
  228. <TouchableOpacity
  229. style={{marginTop: 8.5}}
  230. onPress={() => {
  231. this.getLandingStatus(3);
  232. }}>
  233. <LinearGradient
  234. colors={['#F6DDB5', '#EABC78']}
  235. style={{
  236. height: 24,
  237. width: 70,
  238. borderBottomLeftRadius: 99,
  239. borderTopLeftRadius: 99,
  240. justifyContent: 'center',
  241. }}
  242. start={{x: 0.25, y: 0.25}}
  243. end={{x: 0.7, y: 0.7}}>
  244. <Text style={{textAlign: 'center'}}>产品调整</Text>
  245. </LinearGradient>
  246. </TouchableOpacity>
  247. </View>
  248. </View>
  249. <View style={{flexDirection: 'row', flexWrap: 'wrap'}}>
  250. {this.state.productList.map((item) => {
  251. return (
  252. <View
  253. style={{
  254. flexDirection: 'row',
  255. justifyContent: 'center',
  256. alignItems: 'center',
  257. marginLeft: 10,
  258. marginRight: 10,
  259. marginTop: 10,
  260. marginBottom: 5,
  261. }}>
  262. <View style={{marginLeft: 5}}>
  263. <Image
  264. style={{width: 44, height: 44}}
  265. source={{uri: item.img}}
  266. resizeMode="cover"
  267. />
  268. </View>
  269. <View style={{marginLeft: 5}}>
  270. <Text style={{color: '#EABC78'}}>{item.title}</Text>
  271. <Text style={{color: '#ffffff'}}>{item.data}</Text>
  272. </View>
  273. </View>
  274. );
  275. })}
  276. </View>
  277. {this.state.isShowMore === true ? (
  278. <View
  279. style={{
  280. borderTopWidth: 0.5,
  281. borderColor: '#707070',
  282. marginLeft: 5.5,
  283. marginRight: 5.5,
  284. justifyContent: 'center',
  285. // alignItems: 'center',
  286. height: 29.5,
  287. marginTop: 10,
  288. }}>
  289. <TouchableOpacity
  290. style={{flexDirection: 'row', alignItems: 'center', justifyContent: 'center'}}
  291. onPress={() => {
  292. this.showProductInfo();
  293. }}>
  294. <Text
  295. style={{
  296. color: '#EDBE75',
  297. fontWeight: 'bold',
  298. fontSize: 13,
  299. }}>
  300. {this.state.isShowText}
  301. </Text>
  302. {this.state.isShow === true ? (
  303. <Image
  304. source={require('../../source/img/personal/up.png')}
  305. style={{
  306. width: 6.8,
  307. height: 9.93,
  308. marginLeft: 5,
  309. }}
  310. />
  311. ) : (
  312. <Image
  313. source={require('../../source/img/personal/down.png')}
  314. style={{
  315. width: 6.8,
  316. height: 9.93,
  317. marginLeft: 5,
  318. }}
  319. />
  320. )}
  321. </TouchableOpacity>
  322. </View>
  323. ) : (
  324. <View />
  325. )}
  326. </View>
  327. </WingBlank>
  328. <List style={{top: 10}}>
  329. <Item
  330. arrow="horizontal"
  331. onPress={() => {
  332. this.getLandingStatus(2);
  333. }}>
  334. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  335. <Image
  336. source={require('../../source/img/svg/enterprise.png')}
  337. />
  338. <Text style={{marginLeft: 5}}>绑定企业</Text>
  339. </View>
  340. </Item>
  341. <Item
  342. arrow="horizontal"
  343. onPress={() => {
  344. this.contactService();
  345. }}>
  346. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  347. <Image source={require('../../source/img/svg/customer.png')} />
  348. <Text style={{marginLeft: 5}}>联系客服</Text>
  349. </View>
  350. </Item>
  351. <Item
  352. arrow="horizontal"
  353. onPress={() => {
  354. this.props.navigation.navigate('about');
  355. }}>
  356. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  357. <Image source={require('../../source/img/svg/about.png')} />
  358. <Text style={{marginLeft: 5}}>关于</Text>
  359. </View>
  360. </Item>
  361. <Item
  362. arrow="horizontal"
  363. onPress={() => {
  364. this.props.navigation.navigate('set', {
  365. refresh: (type) => {
  366. this.refresh(type);
  367. },
  368. });
  369. }}>
  370. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  371. <Image source={require('../../source/img/svg/set.png')} />
  372. <Text style={{marginLeft: 5}}>设置</Text>
  373. </View>
  374. </Item>
  375. <Item />
  376. </List>
  377. </ScrollView>
  378. </SafeAreaView>
  379. );
  380. }
  381. //页面加载获取信息
  382. async componentDidMount(): void {
  383. await this.getSignIn();
  384. // 收到监听
  385. this.listener = DeviceEventEmitter.addListener(
  386. 'updateLoginInfo',
  387. (message) => {
  388. // 收到监听后想做的事情 // 监听
  389. this.refresh(message);
  390. },
  391. );
  392. // 收到监听
  393. this.listenerPersonal = DeviceEventEmitter.addListener(
  394. 'updatePersonal',
  395. (message) => {
  396. // 收到监听后想做的事情 // 监听
  397. this.refresh(message);
  398. },
  399. );
  400. }
  401. componentWillUnmount() {
  402. // 移除监听
  403. if (this.listener) {
  404. this.listener.remove();
  405. }
  406. if (this.listenerPersonal) {
  407. this.listenerPersonal.remove();
  408. }
  409. }
  410. refresh = async (type) => {
  411. if (type) {
  412. await this.getSignIn();
  413. } else {
  414. this.setState({
  415. userName: '',
  416. userType: '',
  417. user: '',
  418. loginText: '点击登录',
  419. infoText: '立即登陆体验完整功能',
  420. headImage: '',
  421. sex: '',
  422. invoiceNumber: '——',
  423. companyNumber: '——',
  424. messageNumber: '——',
  425. lastLoginDate: '——',
  426. membershipStatus: '请登录查看您的会员状态',
  427. isShowText: '展开',
  428. isShow: false,
  429. productList: [],
  430. productNumber: 0,
  431. isShowMore: false,
  432. });
  433. this.props.navigation.setOptions({
  434. headerTitle: '会员中心',
  435. });
  436. }
  437. };
  438. //获取登录信息
  439. getSignIn = async () => {
  440. let title = '会员中心';
  441. let company = await RetrieveData('company');
  442. if (company) {
  443. company = JSON.parse(company);
  444. title = company.entName;
  445. }
  446. this.props.navigation.setOptions({
  447. headerTitle: title,
  448. });
  449. let userHeadImg = JSON.parse(await RetrieveData('userHeadImg'));
  450. let userName = await RetrieveData('userName');
  451. let userType = await RetrieveData('usertype');
  452. let token = await RetrieveData('token');
  453. let account = await RetrieveData('account');
  454. if (userName && userType && token && account) {
  455. this.setState({
  456. userName: userName,
  457. userType: userType,
  458. infoText: '查看或编辑个人资料 >',
  459. membershipStatus: '您的服务到剩余日期:--天',
  460. });
  461. await this.getUserInformation(account, token);
  462. await this.getCompanyList();
  463. await this.getMessageNumber();
  464. await this.getInvoiceNumber();
  465. await this.getProductList();
  466. }
  467. if (userHeadImg) {
  468. this.setState({
  469. headImage: userHeadImg.headImage,
  470. sex: userHeadImg.sex,
  471. });
  472. } else {
  473. this.setState({
  474. headImage: '',
  475. sex: '',
  476. });
  477. }
  478. };
  479. //获取用户信息
  480. getUserInformation = async (account, token) => {
  481. const url = '/auth/comm/user/personalInfo/find';
  482. let response = await RequestNetwork(
  483. url,
  484. token,
  485. {
  486. mobile: account,
  487. },
  488. false,
  489. 2,
  490. );
  491. if (response) {
  492. if (response.code === 0) {
  493. console.log(response);
  494. await IndividualStorageData('userInfo', JSON.stringify(response.data));
  495. this.setState({
  496. user: response.data,
  497. });
  498. }
  499. }
  500. };
  501. //退出登录
  502. signOut = async () => {
  503. this.setLoadingStatus(true);
  504. await ClearAll();
  505. this.setLoadingStatus(false);
  506. DeviceEventEmitter.emit('updateCurMon', null);
  507. this.props.navigation.navigate('home_navigation');
  508. };
  509. // 联系客服
  510. contactService = () => {
  511. Modal.alert('提示', '0871-63193319', [
  512. {
  513. text: '取消',
  514. onPress: () => console.log('cancel'),
  515. style: 'cancel',
  516. },
  517. {
  518. text: '确认',
  519. onPress: () => {
  520. Linking.canOpenURL(this.state.telPhone)
  521. .then((supported) => {
  522. if (!supported) {
  523. console.log('Can not handle tel: ' + this.state.telPhone);
  524. } else {
  525. return Linking.openURL(this.state.telPhone);
  526. }
  527. })
  528. .catch((error) => console.log('tel error', error));
  529. },
  530. },
  531. ]);
  532. };
  533. //显示loading层
  534. setLoadingStatus(isLoading) {
  535. this.setState({
  536. spinner: isLoading,
  537. });
  538. }
  539. //判断是否登录
  540. getLandingStatus = async (type) => {
  541. const account = await RetrieveData('account');
  542. if (account) {
  543. if (type === 1) {
  544. this.props.navigation.navigate('personal_information', {
  545. user: this.state.user,
  546. refresh: (type) => {
  547. this.refresh(type);
  548. },
  549. });
  550. }
  551. if (type === 2) {
  552. this.props.navigation.navigate('enterprise_list');
  553. }
  554. if (type === 3) {
  555. this.props.navigation.navigate('service_handle');
  556. }
  557. } else {
  558. this.props.navigation.navigate('login');
  559. }
  560. };
  561. //获取企业数据
  562. getCompanyList = async () => {
  563. const entInfo = JSON.parse(await RetrieveData('company'));
  564. this.setState({entItem: entInfo});
  565. const token = await RetrieveData('token');
  566. const account = await RetrieveData('account');
  567. if (token && account) {
  568. const url = '/auth/ent/user/findManageInfoByMobile';
  569. let response = await RequestNetwork(
  570. url,
  571. token,
  572. {
  573. entUserMobile: account,
  574. pageNum: 1,
  575. pageSize: 10,
  576. },
  577. false,
  578. 2,
  579. );
  580. if (response) {
  581. if (response.code === 0) {
  582. this.setState({
  583. companyNumber: response.data.total,
  584. });
  585. } else {
  586. await this.abnormalMessage(response);
  587. }
  588. }
  589. }
  590. };
  591. //获取短信数量
  592. getMessageNumber = async () => {
  593. let company = JSON.parse(await RetrieveData('company'));
  594. let token = await RetrieveData('token');
  595. if (token && company) {
  596. const url = '/marketing/ent/features/findPage';
  597. let res = await RequestNetwork(
  598. url,
  599. token,
  600. {
  601. entTaxId: company.entTaxId,
  602. featureId: 'F0000001',
  603. featureName: '短信服务',
  604. pageNum: 1,
  605. pageSize: 10,
  606. },
  607. false,
  608. 2,
  609. );
  610. if (res) {
  611. if (res.code === 0) {
  612. res.data.records.map((item) => {
  613. if (item.featureId === 'F0000001') {
  614. this.setState({
  615. messageNumber: parseFloat(item.surplus),
  616. });
  617. }
  618. });
  619. } else {
  620. await this.abnormalMessage(res);
  621. }
  622. }
  623. }
  624. };
  625. //获取发票数量统计
  626. getInvoiceNumber = async () => {
  627. let company = await RetrieveData('company');
  628. if (company) {
  629. company = JSON.parse(company);
  630. }
  631. const token = await RetrieveData('token');
  632. const account = await RetrieveData('account');
  633. if (token && company) {
  634. let date = GetMonthDate();
  635. const url = '/sys/invoiceExt/reports';
  636. let response = await RequestNetwork(
  637. url,
  638. token,
  639. {
  640. entTaxId: company.entTaxId,
  641. deviceType: company.defaultDeviceInfo.deviceType,
  642. taxDiscId: company.defaultDeviceInfo.taxDiscId,
  643. mobile: account,
  644. invoiceDateBegin: date.startDateTime,
  645. invoiceDateEnd: date.endDateTime,
  646. reqChannel: 3,
  647. },
  648. false,
  649. 2,
  650. );
  651. if (response) {
  652. if (response.code === 0) {
  653. this.setState({
  654. invoiceNumber: response.data.blueInvoiceCnt,
  655. });
  656. } else {
  657. await this.abnormalMessage(response);
  658. }
  659. }
  660. }
  661. };
  662. // 产品信息展示状态变更
  663. showProductInfo = () => {
  664. if (this.state.isShow) {
  665. this.setState({
  666. isShow: false,
  667. isShowText: '展开',
  668. });
  669. } else {
  670. this.setState({
  671. isShow: true,
  672. isShowText: '收起',
  673. });
  674. }
  675. };
  676. //获取最近一次登录时间
  677. getLastLoginDate = async () => {
  678. const account = await RetrieveData('account');
  679. let token = await RetrieveData('token');
  680. console.log(123);
  681. console.log(account);
  682. if (token) {
  683. const url = '/auth/log/findPage';
  684. let res = await RequestNetwork(
  685. url,
  686. token,
  687. {
  688. mobile: account,
  689. opType: '用户登录',
  690. pageNum: 1,
  691. pageSize: 2,
  692. },
  693. false,
  694. 2,
  695. );
  696. if (res) {
  697. if (res.code === 0) {
  698. console.log('登录信息');
  699. console.log(res);
  700. // res.data.records.map((item) => {
  701. // if (item.featureId === 'F0000001') {
  702. // this.messageNumber = parseFloat(item.surplus);
  703. // }
  704. // });
  705. } else {
  706. await this.abnormalMessage(res);
  707. }
  708. }
  709. }
  710. };
  711. // 获取已开通产品列表
  712. getProductList = async () => {
  713. let company = await RetrieveData('company');
  714. if (company) {
  715. company = JSON.parse(company);
  716. }
  717. let token = await RetrieveData('token');
  718. if (token && company) {
  719. const url = '/marketing/ent/features/findPage';
  720. let res = await RequestNetwork(
  721. url,
  722. token,
  723. {
  724. entTaxId: company.entTaxId,
  725. },
  726. false,
  727. 2,
  728. );
  729. if (res) {
  730. if (res.code === 0) {
  731. let isShow = false;
  732. if (res.data.total > 2) {
  733. isShow = true;
  734. } else {
  735. isShow = false;
  736. }
  737. let list = [];
  738. res.data.records.map((item) => {
  739. let title: '';
  740. let data = '';
  741. if (item.limitType === '1') {
  742. title = item.featureName + '到期时间';
  743. data = item.endDate;
  744. }
  745. if (item.limitType === '2') {
  746. title = item.featureName + '剩余数量';
  747. if (item.surplus) {
  748. data = parseInt(item.surplus).toString() + '条';
  749. } else {
  750. data = 0;
  751. }
  752. }
  753. let productList = {
  754. title: title,
  755. data: data,
  756. img: item.featureImgUrl,
  757. };
  758. list = list.concat(productList);
  759. });
  760. this.setState({
  761. productList: list,
  762. productNumber: res.data.total,
  763. isShowMore: isShow,
  764. });
  765. } else {
  766. await this.abnormalMessage(res);
  767. }
  768. }
  769. }
  770. };
  771. // 处理网络请求数据
  772. abnormalMessage = async (jason) => {
  773. if (jason.code === 401) {
  774. await Alert.alert(
  775. '登录失效',
  776. '登录状态已失效,请重新登录!',
  777. [
  778. {
  779. text: '确定',
  780. onPress: () => {
  781. CleanAll();
  782. this.props.navigation.popToTop();
  783. },
  784. },
  785. ],
  786. {cancelable: false},
  787. );
  788. }
  789. if (jason.code === 403) {
  790. Alert.alert(
  791. '权限',
  792. '暂无权限操作此模块!',
  793. [
  794. {
  795. text: '确定',
  796. onPress: () => {
  797. this.props.navigation.goBack();
  798. },
  799. },
  800. ],
  801. {cancelable: false},
  802. );
  803. }
  804. if (jason.code !== 401 && jason.code !== 403) {
  805. ToastShow(1, jason.msg);
  806. }
  807. };
  808. }