|
|
@@ -28,8 +28,25 @@ 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;
|
|
|
+import OpenTimeUtil from "../Utils/OpenTimeUtil";
|
|
|
+import ListUtil from "../Utils/ListUtil";
|
|
|
+
|
|
|
+const Label = (props, title, value) => (
|
|
|
+ <Layout style={[styles.lable]}>
|
|
|
+ <Text {...props} style={[styles.lableName]}>
|
|
|
+ {title}
|
|
|
+ </Text>
|
|
|
+ <Text
|
|
|
+ {...props}
|
|
|
+ style={[props.style, styles.lableText]}
|
|
|
+ numberOfLines={1}
|
|
|
+ ellipsizeMode='tail'
|
|
|
+ >
|
|
|
+ {value}
|
|
|
+ </Text>
|
|
|
+ </Layout>
|
|
|
+);
|
|
|
+
|
|
|
export default function HomePage3(props) {
|
|
|
const theme = useTheme();
|
|
|
const { httpPost, httpGet } = useModel("httpModel", true);
|
|
|
@@ -37,7 +54,19 @@ export default function HomePage3(props) {
|
|
|
const [selectId, changeSelectId] = React.useState(0);
|
|
|
const { showDialog } = useModel("dialogModel", true);
|
|
|
const [text, changeText] = React.useState("");
|
|
|
- const { img, updateMerchant, introduction } = useModel("userModel");
|
|
|
+ const {
|
|
|
+ img,
|
|
|
+ updateMerchant,
|
|
|
+ introduction,
|
|
|
+ name,
|
|
|
+ phone,
|
|
|
+ address,
|
|
|
+ category,
|
|
|
+ week,
|
|
|
+ endTime,
|
|
|
+ startTime,
|
|
|
+ } = useModel("userModel");
|
|
|
+ const categoryList = new ListUtil(category);
|
|
|
const { loading, success } = useModel("loadingModel");
|
|
|
|
|
|
const {
|
|
|
@@ -47,6 +76,7 @@ export default function HomePage3(props) {
|
|
|
home3Title2,
|
|
|
confirm,
|
|
|
getWordsStr,
|
|
|
+ weekWords,
|
|
|
} = useModel("wordsModel");
|
|
|
|
|
|
const imgList = React.useMemo(() => {
|
|
|
@@ -56,6 +86,15 @@ export default function HomePage3(props) {
|
|
|
return [...new Set(list)];
|
|
|
}, [img]);
|
|
|
|
|
|
+ const openTime = React.useMemo(() => {
|
|
|
+ if (startTime && endTime && week && weekWords) {
|
|
|
+ let _o = new OpenTimeUtil(startTime, endTime, week, weekWords());
|
|
|
+ return _o.getShowStr();
|
|
|
+ } else {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }, [startTime, endTime, week, weekWords]);
|
|
|
+
|
|
|
function changeImg(img, index) {
|
|
|
let _imgs = [...imgList];
|
|
|
_imgs.splice(index, 1, img);
|
|
|
@@ -74,13 +113,13 @@ export default function HomePage3(props) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- const showImgList = (list) => {
|
|
|
+ const showImgList = list => {
|
|
|
return list.map((item, index) => {
|
|
|
return (
|
|
|
<Layout key={index} style={styles.upload}>
|
|
|
<UpLoadImage
|
|
|
value={item}
|
|
|
- changeIcon={(img) => changeImg(img, index)}
|
|
|
+ changeIcon={img => changeImg(img, index)}
|
|
|
size={67}
|
|
|
hasCancel={true}
|
|
|
delEvent={() => {
|
|
|
@@ -92,6 +131,21 @@ export default function HomePage3(props) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ function showChange(key, val, title, max, type) {
|
|
|
+ showDialog({
|
|
|
+ pla: "",
|
|
|
+ maxLength: max || 50,
|
|
|
+ defaultValue: val,
|
|
|
+ InputType: type,
|
|
|
+ isEdit: true,
|
|
|
+ title: title,
|
|
|
+ cancelable: true,
|
|
|
+ confirmCallback: info => {
|
|
|
+ updateMerchant({ [key]: info });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<Layout style={styles.tabContainer}>
|
|
|
<Layout style={styles.top}>
|
|
|
@@ -115,7 +169,7 @@ export default function HomePage3(props) {
|
|
|
onPress={() => {
|
|
|
updateMerchant({
|
|
|
introduction: text,
|
|
|
- }).then((res) => {
|
|
|
+ }).then(res => {
|
|
|
success("成功");
|
|
|
});
|
|
|
}}
|
|
|
@@ -127,54 +181,70 @@ export default function HomePage3(props) {
|
|
|
|
|
|
<Menu style={styles.menu}>
|
|
|
<MenuItem
|
|
|
- title={getWordsStr("register_form_1")}
|
|
|
+ title={props =>
|
|
|
+ Label(props, getWordsStr("register_form_1"), name)
|
|
|
+ }
|
|
|
accessoryRight={ForwardIcon}
|
|
|
style={styles.menuItem}
|
|
|
- onPress={() => {
|
|
|
- navigation.navigate("Home", {
|
|
|
- screen: "homeTab3",
|
|
|
- });
|
|
|
- }}
|
|
|
+ onPress={() =>
|
|
|
+ showChange(
|
|
|
+ "name",
|
|
|
+ name,
|
|
|
+ getWordsStr("register_form_1"),
|
|
|
+ 25,
|
|
|
+ "text"
|
|
|
+ )
|
|
|
+ }
|
|
|
/>
|
|
|
<MenuItem
|
|
|
- title={getWordsStr("guideHome_form_1")}
|
|
|
+ title={props =>
|
|
|
+ Label(
|
|
|
+ props,
|
|
|
+ getWordsStr("guideHome_form_1"),
|
|
|
+ categoryList.getKey("name")
|
|
|
+ )
|
|
|
+ }
|
|
|
accessoryRight={ForwardIcon}
|
|
|
style={styles.menuItem}
|
|
|
- onPress={() => {
|
|
|
- navigation.navigate("Home", {
|
|
|
- screen: "homeTab3",
|
|
|
- });
|
|
|
- }}
|
|
|
+ onPress={() => {}}
|
|
|
/>
|
|
|
<MenuItem
|
|
|
- title={getWordsStr("guideHome_form_2")}
|
|
|
+ title={props =>
|
|
|
+ Label(props, getWordsStr("guideHome_form_2"), address)
|
|
|
+ }
|
|
|
accessoryRight={ForwardIcon}
|
|
|
style={styles.menuItem}
|
|
|
- onPress={() => {
|
|
|
- navigation.navigate("Home", {
|
|
|
- screen: "homeTab3",
|
|
|
- });
|
|
|
- }}
|
|
|
+ onPress={() =>
|
|
|
+ showChange(
|
|
|
+ "address",
|
|
|
+ address,
|
|
|
+ getWordsStr("guideHome_form_2")
|
|
|
+ )
|
|
|
+ }
|
|
|
/>
|
|
|
<MenuItem
|
|
|
- title={getWordsStr("guideHome_form_3")}
|
|
|
+ title={props =>
|
|
|
+ Label(props, getWordsStr("guideHome_form_3"), phone)
|
|
|
+ }
|
|
|
accessoryRight={ForwardIcon}
|
|
|
style={styles.menuItem}
|
|
|
- onPress={() => {
|
|
|
- navigation.navigate("Home", {
|
|
|
- screen: "homeTab3",
|
|
|
- });
|
|
|
- }}
|
|
|
+ onPress={() =>
|
|
|
+ showChange(
|
|
|
+ "phone",
|
|
|
+ phone,
|
|
|
+ getWordsStr("guideHome_form_3"),
|
|
|
+ 11,
|
|
|
+ "phone"
|
|
|
+ )
|
|
|
+ }
|
|
|
/>
|
|
|
<MenuItem
|
|
|
- title={getWordsStr("guideHome_form_4")}
|
|
|
+ title={props =>
|
|
|
+ Label(props, getWordsStr("guideHome_form_4"), openTime)
|
|
|
+ }
|
|
|
accessoryRight={ForwardIcon}
|
|
|
style={styles.menuItem}
|
|
|
- onPress={() => {
|
|
|
- navigation.navigate("Home", {
|
|
|
- screen: "homeTab3",
|
|
|
- });
|
|
|
- }}
|
|
|
+ onPress={() => {}}
|
|
|
/>
|
|
|
<MenuItem
|
|
|
title={getWordsStr("guideHome_form_5")}
|
|
|
@@ -183,7 +253,7 @@ export default function HomePage3(props) {
|
|
|
onPress={() => {
|
|
|
RootNavigation.navigate("EditBanner", {
|
|
|
type: "qualification",
|
|
|
- })
|
|
|
+ });
|
|
|
}}
|
|
|
/>
|
|
|
</Menu>
|
|
|
@@ -191,7 +261,7 @@ export default function HomePage3(props) {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-const ForwardIcon = (props) => (
|
|
|
+const ForwardIcon = props => (
|
|
|
<Icon
|
|
|
{...props}
|
|
|
name='arrow-ios-forward'
|
|
|
@@ -200,7 +270,7 @@ const ForwardIcon = (props) => (
|
|
|
/>
|
|
|
);
|
|
|
const classificationItem = ({ item, index }) => <CommentCard />;
|
|
|
-const StarIcon = (props) => <Icon {...props} name='plus-outline' />;
|
|
|
+const StarIcon = props => <Icon {...props} name='plus-outline' />;
|
|
|
|
|
|
const goodsItem = ({ item, index }) => (
|
|
|
<GoodsCardLarge appearance='classification' />
|
|
|
@@ -209,7 +279,7 @@ const goodsItem = ({ item, index }) => (
|
|
|
const styles = StyleSheet.create({
|
|
|
tabContainer: {
|
|
|
backgroundColor: "#fff",
|
|
|
- height: "100%",
|
|
|
+ flex: 1,
|
|
|
},
|
|
|
top: {
|
|
|
paddingVertical: 20,
|
|
|
@@ -253,4 +323,15 @@ const styles = StyleSheet.create({
|
|
|
paddingHorizontal: 15,
|
|
|
},
|
|
|
menuItem: {},
|
|
|
+ lable: {
|
|
|
+ flexDirection: "row",
|
|
|
+ flex: 1,
|
|
|
+ },
|
|
|
+ lableName: {
|
|
|
+ flexShrink: 0,
|
|
|
+ flexBasis: "50%",
|
|
|
+ marginHorizontal: 8,
|
|
|
+ fontSize: 13,
|
|
|
+ },
|
|
|
+ lableText: {},
|
|
|
});
|