Guide2Screen.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 { setNavigation, pushRouter } = useModel("routersModel", true);
  32. const { httpGet } = useModel("httpModel", true);
  33. const { registerSecend, changeGuideStep } = useModel("userModel", true);
  34. const {
  35. guide2_title1,
  36. guide2_title2,
  37. guide2_form_1,
  38. guide2_pla_1,
  39. guide2_pla_2,
  40. guide1_pla_2,
  41. guide2_form_2,
  42. guide2_form_3,
  43. guide1_form_4,
  44. guide1_pla_4,
  45. guide1_form_5,
  46. guide1_pla_5,
  47. next,
  48. pass,
  49. passTips,
  50. } = useModel("wordsModel");
  51. const { showDialog } = useModel("dialogModel");
  52. useFocusEffect(
  53. React.useCallback(() => {
  54. changeBackground(theme["color-primary-500"]);
  55. setNavigation(navigation);
  56. }, [])
  57. );
  58. const [name, changeName] = React.useState("");
  59. const [sort, changeSort] = React.useState("");
  60. const [goodsIds, changeGoodsIds] = React.useState("");
  61. const canNext = React.useMemo(() => {
  62. return true;
  63. }, [name]);
  64. return (
  65. <>
  66. <GuideHeaderBar />
  67. <ScrollPage>
  68. <Layout style={styles.container}>
  69. <Card appearance='headFilled'>
  70. <Text category='s1'>{guide2_title1}</Text>
  71. <Text category='s1'>{guide2_title2}</Text>
  72. </Card>
  73. <Card appearance='formFilled'>
  74. {/* 类别名称 */}
  75. <FormInput
  76. label={guide2_form_1}
  77. placeholder={guide2_pla_1}
  78. value={name}
  79. onChange={changeName}
  80. style={{ paddingVertical: 3 }}
  81. />
  82. {/* 显示排序 */}
  83. <FormInput
  84. label={guide2_form_2}
  85. value={sort}
  86. type='actionSheet'
  87. list={[1, 2, 3, 4, 5, 6, 7, 8, 9]}
  88. onChange={changeSort}
  89. textAlign='right'
  90. />
  91. {/* 商品 */}
  92. <FormInput
  93. label={guide2_form_3}
  94. value={goodsIds}
  95. type='url'
  96. changePath={() => {
  97. pushRouter("AddGoods");
  98. }}
  99. textAlign='right'
  100. />
  101. </Card>
  102. <ConnectButton>
  103. <Layout style={styles.layoutLeft} level='1'>
  104. <Button
  105. status='primary'
  106. disabled={!canNext}
  107. onPress={() => registerSecend({})}
  108. >
  109. {next}
  110. </Button>
  111. <Button
  112. style={{ marginTop: 10 }}
  113. appearance='ghost'
  114. status='primary'
  115. onPress={() => {
  116. showDialog({
  117. bodyText: passTips,
  118. cancelable: true,
  119. confirmCallback: () => {
  120. changeGuideStep(2, "Guide3");
  121. },
  122. });
  123. }}
  124. >
  125. {pass}
  126. </Button>
  127. </Layout>
  128. </ConnectButton>
  129. </Layout>
  130. </ScrollPage>
  131. </>
  132. );
  133. }
  134. const styles = StyleSheet.create({
  135. container: {
  136. flex: 1,
  137. paddingBottom: 33,
  138. },
  139. tabContent: {
  140. backgroundColor: "#fff",
  141. marginTop: 20,
  142. },
  143. img: {
  144. width: 100,
  145. height: 100,
  146. alignSelf: "center",
  147. },
  148. img2: {
  149. width: 97,
  150. height: 21,
  151. alignSelf: "center",
  152. marginTop: 2,
  153. },
  154. text: {
  155. marginTop: 16,
  156. },
  157. layoutLeft: {
  158. // flexDirection: "row",
  159. paddingVertical: 10,
  160. justifyContent: "center",
  161. alignItems: "center",
  162. },
  163. form: {
  164. paddingHorizontal: 26,
  165. paddingVertical: 20,
  166. },
  167. textareaContainer: {
  168. backgroundColor: "#F0F0F0",
  169. height: 100,
  170. borderRadius: 4,
  171. },
  172. textarea: {
  173. textAlignVertical: "top", // hack android
  174. fontSize: 13,
  175. color: "#333",
  176. paddingHorizontal: 14,
  177. paddingVertical: 10,
  178. height: 100,
  179. },
  180. });