Guide3Screen.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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, changeGuideStep } = useModel(
  33. "userModel",
  34. true
  35. );
  36. const {
  37. guide3_title1,
  38. guide3_title2,
  39. guide3_form_1,
  40. guide3_pla_1,
  41. guide3_form_2,
  42. guide3_pla_2,
  43. complete,
  44. } = useModel("wordsModel");
  45. const [aliName, changeAliName] = React.useState("");
  46. const [aliAccount, changeAliAccount] = React.useState("");
  47. useFocusEffect(
  48. React.useCallback(() => {
  49. changeBackground(theme["color-primary-500"]);
  50. checkInfo({
  51. aliAccountEvent: changeAliAccount,
  52. aliNameEvent: changeAliName,
  53. });
  54. }, [])
  55. );
  56. const canNext = React.useMemo(() => {
  57. if (aliAccount && aliName) {
  58. return true;
  59. } else {
  60. return false;
  61. }
  62. }, [aliName, aliAccount]);
  63. return (
  64. <>
  65. <GuideHeaderBar />
  66. <ScrollPage>
  67. <Layout style={styles.container}>
  68. <Card appearance='headFilled'>
  69. <Text category='s1'>{guide3_title1}</Text>
  70. <Text category='s1'>{guide3_title2}</Text>
  71. </Card>
  72. <Card appearance='formFilled'>
  73. {/* 支付宝账号 */}
  74. <FormInput
  75. label={guide3_form_1}
  76. placeholder={guide3_pla_1}
  77. value={aliName}
  78. onChange={changeAliName}
  79. style={{ paddingVertical: 3 }}
  80. />
  81. {/* 支付宝账户名 */}
  82. <FormInput
  83. label={guide3_form_2}
  84. placeholder={guide3_pla_2}
  85. value={aliAccount}
  86. onChange={changeAliAccount}
  87. style={{ paddingVertical: 3 }}
  88. />
  89. <Layout style={styles.layoutLeft} level='1'>
  90. <Button
  91. status='primary'
  92. disabled={!canNext}
  93. onPress={() =>
  94. saveMerchant({ aliName, aliAccount })
  95. }
  96. >
  97. {complete}
  98. </Button>
  99. </Layout>
  100. </Card>
  101. <ConnectButton />
  102. </Layout>
  103. </ScrollPage>
  104. </>
  105. );
  106. }
  107. const styles = StyleSheet.create({
  108. container: {
  109. flex: 1,
  110. paddingBottom: 33,
  111. },
  112. tabContent: {
  113. backgroundColor: "#fff",
  114. marginTop: 20,
  115. },
  116. img: {
  117. width: 100,
  118. height: 100,
  119. alignSelf: "center",
  120. },
  121. img2: {
  122. width: 97,
  123. height: 21,
  124. alignSelf: "center",
  125. marginTop: 2,
  126. },
  127. text: {
  128. marginTop: 16,
  129. },
  130. layoutLeft: {
  131. // flexDirection: "row",
  132. paddingVertical: 10,
  133. justifyContent: "center",
  134. alignItems: "center",
  135. marginTop: 50,
  136. },
  137. form: {
  138. paddingHorizontal: 26,
  139. paddingVertical: 20,
  140. },
  141. textareaContainer: {
  142. backgroundColor: "#F0F0F0",
  143. height: 100,
  144. borderRadius: 4,
  145. },
  146. textarea: {
  147. textAlignVertical: "top", // hack android
  148. fontSize: 13,
  149. color: "#333",
  150. paddingHorizontal: 14,
  151. paddingVertical: 10,
  152. height: 100,
  153. },
  154. });