AuditResultScreen.tsx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import * as React from 'react';
  2. import { StackScreenProps } from '@react-navigation/stack';
  3. import { StackActions } from '@react-navigation/native';
  4. import { RefreshControl } from 'react-native';
  5. import { Div, Button, Image, Text, Avatar } from 'react-native-magnus';
  6. import { ScrollView } from 'react-native-gesture-handler';
  7. import { useTranslation } from 'react-i18next';
  8. import { useRequest } from 'ahooks';
  9. import { connect } from '../utils/SystemUtils';
  10. import {
  11. addAsyncStorage,
  12. removeAsyncStorage,
  13. } from '../utils/AsyncStorageUtils';
  14. const img1 = require('../assets/images/autoimg1.png');
  15. const img2 = require('../assets/images/autoimg2.png');
  16. export default function AuditResultScreen({ navigation }: StackScreenProps) {
  17. const { t } = useTranslation();
  18. const { data, refresh, loading } = useRequest('/rider/my');
  19. const { status, jobNumber } = data || {};
  20. React.useEffect(() => {
  21. if (status === 'PENDING') {
  22. addAsyncStorage('riderIsApply', 'true');
  23. }
  24. }, [status]);
  25. return (
  26. <Div bg="white" flex={1}>
  27. <ScrollView
  28. contentContainerStyle={{
  29. flexGrow: 1,
  30. backgroundColor: '#fff',
  31. alignItems: 'center',
  32. }}
  33. refreshControl={
  34. <RefreshControl refreshing={loading} onRefresh={refresh} />
  35. }
  36. >
  37. <Image source={status === 'PASS' ? img2 : img1} w={91} h={78} mt={40} />
  38. {status === 'PENDING' && (
  39. <Div alignItems="center" py={30}>
  40. <Text color="gray600" fontSize="xl">
  41. {t('nin-de-shen-qing-yi-ti-jiao-cheng-gong')}
  42. </Text>
  43. <Text color="gray600" fontSize="xl">
  44. {t('qing-nai-xin-deng-dai')}...
  45. </Text>
  46. </Div>
  47. )}
  48. {status === 'DENY' && (
  49. <>
  50. <Div alignItems="center" py={30}>
  51. <Text color="gray600" fontSize="xl">
  52. {t('failresult')}
  53. </Text>
  54. <Text color="gray600" fontSize="xl">
  55. {t('failresult2')}
  56. </Text>
  57. </Div>
  58. <Button
  59. bg="yellow500"
  60. fontSize="sm"
  61. w={112}
  62. alignSelf="center"
  63. onPress={() => {
  64. navigation.navigate('Certification');
  65. }}
  66. >
  67. {t('zhong-xin-shen-qing')}
  68. </Button>
  69. </>
  70. )}
  71. {status === 'PASS' && (
  72. <>
  73. <Div alignItems="center" py={30}>
  74. <Text color="yellow500" fontSize="xl">
  75. {t('gong-xi-nin-de-shen-qing-yi-tong-guo')}
  76. </Text>
  77. <Text color="yellow500" fontSize="xl">
  78. {t('nin-de-gong-hao-wei')}:{jobNumber}
  79. </Text>
  80. </Div>
  81. <Button
  82. bg="yellow500"
  83. fontSize="sm"
  84. w={112}
  85. alignSelf="center"
  86. onPress={() => {
  87. removeAsyncStorage('riderIsApply');
  88. navigation.dispatch(StackActions.replace('MainStack'));
  89. }}
  90. >
  91. 完成
  92. </Button>
  93. </>
  94. )}
  95. <Div flex={1} w={10} />
  96. <Button
  97. w={112}
  98. color="yellow500"
  99. bg="none"
  100. borderColor="gray100"
  101. borderWidth={1}
  102. alignSelf="center"
  103. fontSize="sm"
  104. my={20}
  105. onPress={() => connect(navigation)}
  106. >
  107. {t('lian-xi-ke-fu')}
  108. </Button>
  109. </ScrollView>
  110. </Div>
  111. );
  112. }