|
|
@@ -8,6 +8,8 @@ import {
|
|
|
List,
|
|
|
ListItem,
|
|
|
Button,
|
|
|
+ Menu,
|
|
|
+ MenuItem,
|
|
|
} from "@ui-kitten/components";
|
|
|
import {
|
|
|
Image,
|
|
|
@@ -22,6 +24,9 @@ import { useFocusEffect } from "@react-navigation/native";
|
|
|
import { useModel } from "flooks";
|
|
|
import CommentCard from "../components/Comment";
|
|
|
import Badge from "../components/Badge";
|
|
|
+import UpLoadImage from "../components/UpLoadImage";
|
|
|
+import Textarea from "react-native-textarea";
|
|
|
+import * as RootNavigation from "../navigation/RootNavigation.js";
|
|
|
|
|
|
const width = Dimensions.get("window").width;
|
|
|
const height = Dimensions.get("window").height;
|
|
|
@@ -31,20 +36,169 @@ export default function HomePage3(props) {
|
|
|
const [commentList, setCommentList] = React.useState([{}, {}, {}]);
|
|
|
const [selectId, changeSelectId] = React.useState(0);
|
|
|
const { showDialog } = useModel("dialogModel", true);
|
|
|
+ const [text, changeText] = React.useState("");
|
|
|
+ const { img, updateMerchant, introduction } = useModel("userModel");
|
|
|
+ const { loading, success } = useModel("loadingModel");
|
|
|
|
|
|
- const { editText, autoBackText } = useModel("wordsModel");
|
|
|
+ const {
|
|
|
+ editText,
|
|
|
+ autoBackText,
|
|
|
+ home3Title1,
|
|
|
+ home3Title2,
|
|
|
+ confirm,
|
|
|
+ getWordsStr,
|
|
|
+ } = useModel("wordsModel");
|
|
|
|
|
|
+ const imgList = React.useMemo(() => {
|
|
|
+ let list = img ? img.split(",") : [];
|
|
|
+ list.push("");
|
|
|
+ console.log(list);
|
|
|
+ return [...new Set(list)];
|
|
|
+ }, [img]);
|
|
|
+
|
|
|
+ function changeImg(img, index) {
|
|
|
+ let _imgs = [...imgList];
|
|
|
+ _imgs.splice(index, 1, img);
|
|
|
+ let _img1 = new Set(_imgs);
|
|
|
+ updateMerchant({
|
|
|
+ img: [..._img1].join(","),
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function delImg(index) {
|
|
|
+ let _imgs = [...imgList];
|
|
|
+ _imgs.splice(index, 1);
|
|
|
+ let _img1 = new Set(_imgs);
|
|
|
+ updateMerchant({
|
|
|
+ img: [..._img1].join(","),
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ const showImgList = (list) => {
|
|
|
+ return list.map((item, index) => {
|
|
|
+ return (
|
|
|
+ <Layout key={index} style={styles.upload}>
|
|
|
+ <UpLoadImage
|
|
|
+ value={item}
|
|
|
+ changeIcon={(img) => changeImg(img, index)}
|
|
|
+ size={67}
|
|
|
+ hasCancel={true}
|
|
|
+ delEvent={() => {
|
|
|
+ delImg(index);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Layout>
|
|
|
+ );
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
return (
|
|
|
<Layout style={styles.tabContainer}>
|
|
|
<Layout style={styles.top}>
|
|
|
- <Layout style={styles.imgList}>
|
|
|
-
|
|
|
+ <Layout style={styles.imgList}>{showImgList(imgList)}</Layout>
|
|
|
+
|
|
|
+ <Layout>
|
|
|
+ <Text style={styles.text}>{home3Title1}</Text>
|
|
|
+ <Textarea
|
|
|
+ containerStyle={styles.textareaContainer}
|
|
|
+ style={styles.textarea}
|
|
|
+ onChangeText={changeText}
|
|
|
+ defaultValue={introduction}
|
|
|
+ maxLength={500}
|
|
|
+ placeholder={home3Title2}
|
|
|
+ placeholderTextColor={"#B4B4B4"}
|
|
|
+ underlineColorAndroid={"transparent"}
|
|
|
+ />
|
|
|
+ <Button
|
|
|
+ size='small'
|
|
|
+ style={styles.button}
|
|
|
+ onPress={() => {
|
|
|
+ updateMerchant({
|
|
|
+ introduction: text,
|
|
|
+ }).then((res) => {
|
|
|
+ success("成功");
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {confirm}
|
|
|
+ </Button>
|
|
|
</Layout>
|
|
|
</Layout>
|
|
|
+
|
|
|
+ <Menu style={styles.menu}>
|
|
|
+ <MenuItem
|
|
|
+ title={getWordsStr("register_form_1")}
|
|
|
+ accessoryRight={ForwardIcon}
|
|
|
+ style={styles.menuItem}
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate("Home", {
|
|
|
+ screen: "homeTab3",
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <MenuItem
|
|
|
+ title={getWordsStr("guideHome_form_1")}
|
|
|
+ accessoryRight={ForwardIcon}
|
|
|
+ style={styles.menuItem}
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate("Home", {
|
|
|
+ screen: "homeTab3",
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <MenuItem
|
|
|
+ title={getWordsStr("guideHome_form_2")}
|
|
|
+ accessoryRight={ForwardIcon}
|
|
|
+ style={styles.menuItem}
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate("Home", {
|
|
|
+ screen: "homeTab3",
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <MenuItem
|
|
|
+ title={getWordsStr("guideHome_form_3")}
|
|
|
+ accessoryRight={ForwardIcon}
|
|
|
+ style={styles.menuItem}
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate("Home", {
|
|
|
+ screen: "homeTab3",
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <MenuItem
|
|
|
+ title={getWordsStr("guideHome_form_4")}
|
|
|
+ accessoryRight={ForwardIcon}
|
|
|
+ style={styles.menuItem}
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate("Home", {
|
|
|
+ screen: "homeTab3",
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <MenuItem
|
|
|
+ title={getWordsStr("guideHome_form_5")}
|
|
|
+ accessoryRight={ForwardIcon}
|
|
|
+ style={styles.menuItem}
|
|
|
+ onPress={() => {
|
|
|
+ RootNavigation.navigate("EditBanner", {
|
|
|
+ type: "qualification",
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Menu>
|
|
|
</Layout>
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+const ForwardIcon = (props) => (
|
|
|
+ <Icon
|
|
|
+ {...props}
|
|
|
+ name='arrow-ios-forward'
|
|
|
+ fill='#B4B4B4'
|
|
|
+ style={{ width: 15, height: 15, fontWeight: 500 }}
|
|
|
+ />
|
|
|
+);
|
|
|
const classificationItem = ({ item, index }) => <CommentCard />;
|
|
|
const StarIcon = (props) => <Icon {...props} name='plus-outline' />;
|
|
|
|
|
|
@@ -59,9 +213,44 @@ const styles = StyleSheet.create({
|
|
|
},
|
|
|
top: {
|
|
|
paddingVertical: 20,
|
|
|
- paddingVertical: 13,
|
|
|
+ paddingHorizontal: 13,
|
|
|
},
|
|
|
imgList: {
|
|
|
flexDirection: "row",
|
|
|
},
|
|
|
+ upload: {
|
|
|
+ marginRight: 10,
|
|
|
+ width: 67,
|
|
|
+ width: 67,
|
|
|
+ flexShrink: 0,
|
|
|
+ },
|
|
|
+ textareaContainer: {
|
|
|
+ backgroundColor: "#F0F0F0",
|
|
|
+ height: 100,
|
|
|
+ alignSelf: "stretch",
|
|
|
+ borderRadius: 4,
|
|
|
+ },
|
|
|
+ textarea: {
|
|
|
+ textAlignVertical: "top", // hack android
|
|
|
+ fontSize: 13,
|
|
|
+ color: "#333",
|
|
|
+ paddingHorizontal: 14,
|
|
|
+ paddingVertical: 10,
|
|
|
+ height: 100,
|
|
|
+ },
|
|
|
+ text: {
|
|
|
+ paddingVertical: 10,
|
|
|
+ },
|
|
|
+ button: {
|
|
|
+ alignSelf: "flex-end",
|
|
|
+ marginTop: 10,
|
|
|
+ marginRight: 14,
|
|
|
+ },
|
|
|
+ menu: {
|
|
|
+ borderColor: "#EEEEEE",
|
|
|
+ borderTopWidth: 6,
|
|
|
+ backgroundColor: "#fff",
|
|
|
+ paddingHorizontal: 15,
|
|
|
+ },
|
|
|
+ menuItem: {},
|
|
|
});
|