Guide3Screen.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import * as WebBrowser from "expo-web-browser";
  2. import * as React from "react";
  3. import {
  4. Image,
  5. Platform,
  6. StyleSheet,
  7. TouchableOpacity,
  8. View,
  9. ImageBackground,
  10. } from "react-native";
  11. import scrollPage from "../decorator/scrollPage";
  12. import { useModel } from "flooks";
  13. import {
  14. Layout,
  15. Tab,
  16. TabView,
  17. Text,
  18. useTheme,
  19. Button,
  20. Card,
  21. } from "@ui-kitten/components";
  22. import FormInput from "../components/FormInput";
  23. import { useFocusEffect } from "@react-navigation/native";
  24. import ScrollPage from "../components/ScrollPage";
  25. import ConnectButton from "../components/ConnectButton";
  26. import GuideHeaderBar from "../components/GuideHeaderBar";
  27. import Textarea from "react-native-textarea";
  28. export default function Guide1Screen({ navigation, route }) {
  29. const theme = useTheme();
  30. const { changeBackground } = useModel("barModel");
  31. const { httpGet } = useModel("httpModel", true);
  32. const { saveMerchant, guideStep, checkInfo } = useModel("userModel", true);
  33. const {
  34. guide3_title1,
  35. guide3_title2,
  36. guide3_form_1,
  37. guide3_pla_1,
  38. guide3_form_2,
  39. guide3_pla_2,
  40. complete,
  41. } = useModel("wordsModel");
  42. const [aliName, changeAliName] = React.useState("");
  43. const [aliAccount, changeAliAccount] = React.useState("");
  44. useFocusEffect(
  45. React.useCallback(() => {
  46. changeBackground(theme["color-primary-500"]);
  47. checkInfo({
  48. aliAccountEvent: changeAliAccount,
  49. aliNameEvent: changeAliName,
  50. });
  51. }, [])
  52. );
  53. const canNext = React.useMemo(() => {
  54. if(aliAccount&&aliName){
  55. return true;
  56. }
  57. else{
  58. return false;
  59. }
  60. }, [aliName,aliAccount]);
  61. return (
  62. <>
  63. <GuideHeaderBar />
  64. <ScrollPage>
  65. <Layout style={styles.container}>
  66. <Card appearance='headFilled'>
  67. <Text category='s1'>{guide3_title1}</Text>
  68. <Text category='s1'>{guide3_title2}</Text>
  69. </Card>
  70. <Card appearance='formFilled'>
  71. {/* 支付宝账号 */}
  72. <FormInput
  73. label={guide3_form_1}
  74. placeholder={guide3_pla_1}
  75. value={aliName}
  76. onChange={changeAliName}
  77. style={{ paddingVertical: 3 }}
  78. />
  79. {/* 支付宝账户名 */}
  80. <FormInput
  81. label={guide3_form_2}
  82. placeholder={guide3_pla_2}
  83. value={aliAccount}
  84. onChange={changeAliAccount}
  85. style={{ paddingVertical: 3 }}
  86. />
  87. <Layout style={styles.layoutLeft} level='1'>
  88. <Button
  89. status='primary'
  90. disabled={!canNext}
  91. onPress={() =>
  92. saveMerchant({ aliName, aliAccount })
  93. }
  94. >
  95. {complete}
  96. </Button>
  97. </Layout>
  98. </Card>
  99. <ConnectButton />
  100. </Layout>
  101. </ScrollPage>
  102. </>
  103. );
  104. }
  105. const styles = StyleSheet.create({
  106. container: {
  107. flex: 1,
  108. paddingBottom: 33,
  109. },
  110. tabContent: {
  111. backgroundColor: "#fff",
  112. marginTop: 20,
  113. },
  114. img: {
  115. width: 100,
  116. height: 100,
  117. alignSelf: "center",
  118. },
  119. img2: {
  120. width: 97,
  121. height: 21,
  122. alignSelf: "center",
  123. marginTop: 2,
  124. },
  125. text: {
  126. marginTop: 16,
  127. },
  128. layoutLeft: {
  129. // flexDirection: "row",
  130. paddingVertical: 10,
  131. justifyContent: "center",
  132. alignItems: "center",
  133. marginTop: 50,
  134. },
  135. form: {
  136. paddingHorizontal: 26,
  137. paddingVertical: 20,
  138. },
  139. textareaContainer: {
  140. backgroundColor: "#F0F0F0",
  141. height: 100,
  142. borderRadius: 4,
  143. },
  144. textarea: {
  145. textAlignVertical: "top", // hack android
  146. fontSize: 13,
  147. color: "#333",
  148. paddingHorizontal: 14,
  149. paddingVertical: 10,
  150. height: 100,
  151. },
  152. });