|
@@ -64,6 +64,10 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
proclamation,
|
|
proclamation,
|
|
|
updateMerchant,
|
|
updateMerchant,
|
|
|
banner,
|
|
banner,
|
|
|
|
|
+ userLogout,
|
|
|
|
|
+ monthSales,
|
|
|
|
|
+ goodNum,
|
|
|
|
|
+ badNum,
|
|
|
} = useModel("userModel");
|
|
} = useModel("userModel");
|
|
|
|
|
|
|
|
const {
|
|
const {
|
|
@@ -85,17 +89,10 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
const [fullReductions, changeFllReduction] = React.useState([]);
|
|
const [fullReductions, changeFllReduction] = React.useState([]);
|
|
|
const { showDialog } = useModel("dialogModel", true);
|
|
const { showDialog } = useModel("dialogModel", true);
|
|
|
const { httpPost, httpGet } = useModel("httpModel", true);
|
|
const { httpPost, httpGet } = useModel("httpModel", true);
|
|
|
- const [selectedIndex, setSelectedIndex] = React.useState();
|
|
|
|
|
|
|
|
|
|
useFocusEffect(
|
|
useFocusEffect(
|
|
|
React.useCallback(() => {
|
|
React.useCallback(() => {
|
|
|
changeBackground(theme["color-primary-500"]);
|
|
changeBackground(theme["color-primary-500"]);
|
|
|
- if (route.params) {
|
|
|
|
|
- setSelectedIndex(parseInt(route.params.index));
|
|
|
|
|
- } else {
|
|
|
|
|
- setSelectedIndex(0);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
httpGet("/fullReduction/my").then((res) => {
|
|
httpGet("/fullReduction/my").then((res) => {
|
|
|
changeFllReduction(res);
|
|
changeFllReduction(res);
|
|
|
});
|
|
});
|
|
@@ -122,8 +119,17 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
visible={menuVisible}
|
|
visible={menuVisible}
|
|
|
onBackdropPress={toggleMenu}
|
|
onBackdropPress={toggleMenu}
|
|
|
>
|
|
>
|
|
|
- <MenuItem accessoryLeft={InfoIcon} title='About' />
|
|
|
|
|
- <MenuItem accessoryLeft={LogoutIcon} title='Logout' />
|
|
|
|
|
|
|
+ <MenuItem accessoryLeft={InfoIcon} title='切换语言' />
|
|
|
|
|
+ <MenuItem
|
|
|
|
|
+ accessoryLeft={LogoutIcon}
|
|
|
|
|
+ title='退出登录'
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ userLogout().then(() => {
|
|
|
|
|
+ toggleMenu();
|
|
|
|
|
+ RootNavigation.reset("LoadingModel");
|
|
|
|
|
+ });
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
</OverflowMenu>
|
|
</OverflowMenu>
|
|
|
</React.Fragment>
|
|
</React.Fragment>
|
|
|
);
|
|
);
|
|
@@ -197,7 +203,7 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
style={styles.zanImg}
|
|
style={styles.zanImg}
|
|
|
/>
|
|
/>
|
|
|
<Text category='c1' status='primary'>
|
|
<Text category='c1' status='primary'>
|
|
|
- 0
|
|
|
|
|
|
|
+ {goodNum || 0}
|
|
|
</Text>
|
|
</Text>
|
|
|
</Layout>
|
|
</Layout>
|
|
|
<Layout
|
|
<Layout
|
|
@@ -208,12 +214,12 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
style={styles.zanImg}
|
|
style={styles.zanImg}
|
|
|
/>
|
|
/>
|
|
|
<Text category='c1' status='info'>
|
|
<Text category='c1' status='info'>
|
|
|
- 0
|
|
|
|
|
|
|
+ {badNum || 0}
|
|
|
</Text>
|
|
</Text>
|
|
|
</Layout>
|
|
</Layout>
|
|
|
<Layout>
|
|
<Layout>
|
|
|
<Text category='c1' status='info'>
|
|
<Text category='c1' status='info'>
|
|
|
- {homeTip2}
|
|
|
|
|
|
|
+ {homeTip2}:{monthSales || 0}
|
|
|
</Text>
|
|
</Text>
|
|
|
</Layout>
|
|
</Layout>
|
|
|
</Layout>
|
|
</Layout>
|
|
@@ -222,9 +228,9 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
{badgeList(fullReductions)}
|
|
{badgeList(fullReductions)}
|
|
|
</Layout>
|
|
</Layout>
|
|
|
</Layout>
|
|
</Layout>
|
|
|
-
|
|
|
|
|
<Button
|
|
<Button
|
|
|
- appearance='labelButton'
|
|
|
|
|
|
|
+ appearance='ghost'
|
|
|
|
|
+ status='info'
|
|
|
accessoryRight={NextIcon}
|
|
accessoryRight={NextIcon}
|
|
|
children={(TextProps) => (
|
|
children={(TextProps) => (
|
|
|
<Text
|
|
<Text
|
|
@@ -232,7 +238,8 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
numberOfLines={1}
|
|
numberOfLines={1}
|
|
|
ellipsizeMode='tail'
|
|
ellipsizeMode='tail'
|
|
|
>
|
|
>
|
|
|
- {homeTip3}:{proclamation}
|
|
|
|
|
|
|
+ {homeTip3}:
|
|
|
|
|
+ {proclamation || "暂无通告,点击编辑"}
|
|
|
</Text>
|
|
</Text>
|
|
|
)}
|
|
)}
|
|
|
onPress={() => {
|
|
onPress={() => {
|
|
@@ -252,35 +259,41 @@ export default function HomeScreen({ navigation, route }) {
|
|
|
</Card>
|
|
</Card>
|
|
|
|
|
|
|
|
<Layout style={styles.mainContent}>
|
|
<Layout style={styles.mainContent}>
|
|
|
- <TabView
|
|
|
|
|
- tabBarStyle={styles.tab}
|
|
|
|
|
- appearance='homeTab'
|
|
|
|
|
- selectedIndex={selectedIndex}
|
|
|
|
|
- onSelect={(index) => setSelectedIndex(index)}
|
|
|
|
|
- indicatorStyle={styles.tabIndicator}
|
|
|
|
|
|
|
+ <Tab.Navigator
|
|
|
|
|
+ initialRouteName='homeTab1'
|
|
|
|
|
+ tabBarOptions={{
|
|
|
|
|
+ activeTintColor: "#FFC21C",
|
|
|
|
|
+ inactiveTintColor: "#000",
|
|
|
|
|
+ style: styles.tab,
|
|
|
|
|
+ indicatorStyle: styles.tabIndicator,
|
|
|
|
|
+ labelStyle: styles.tab,
|
|
|
|
|
+ }}
|
|
|
>
|
|
>
|
|
|
- <Tab
|
|
|
|
|
- title={homeTab1}
|
|
|
|
|
- appearance='homeTab'
|
|
|
|
|
- style={styles.tab}
|
|
|
|
|
- >
|
|
|
|
|
- <HomePage1 />
|
|
|
|
|
- </Tab>
|
|
|
|
|
- <Tab
|
|
|
|
|
- title={homeTab2}
|
|
|
|
|
- appearance='homeTab'
|
|
|
|
|
- style={styles.tab}
|
|
|
|
|
- >
|
|
|
|
|
- <HomePage2 />
|
|
|
|
|
- </Tab>
|
|
|
|
|
- <Tab
|
|
|
|
|
- title={homeTab3}
|
|
|
|
|
- appearance='homeTab'
|
|
|
|
|
- style={styles.tab}
|
|
|
|
|
- >
|
|
|
|
|
- <HomePage3 />
|
|
|
|
|
- </Tab>
|
|
|
|
|
- </TabView>
|
|
|
|
|
|
|
+ <Tab.Screen
|
|
|
|
|
+ name='homeTab1'
|
|
|
|
|
+ component={HomePage1}
|
|
|
|
|
+ options={{
|
|
|
|
|
+ tabBarLabel: ({ focused }) =>
|
|
|
|
|
+ labelText(focused, homeTab1),
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Tab.Screen
|
|
|
|
|
+ name='homeTab2'
|
|
|
|
|
+ component={HomePage2}
|
|
|
|
|
+ options={{
|
|
|
|
|
+ tabBarLabel: ({ focused }) =>
|
|
|
|
|
+ labelText(focused, homeTab2),
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Tab.Screen
|
|
|
|
|
+ name='homeTab3'
|
|
|
|
|
+ component={HomePage3}
|
|
|
|
|
+ options={{
|
|
|
|
|
+ tabBarLabel: ({ focused }) =>
|
|
|
|
|
+ labelText(focused, homeTab3),
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Tab.Navigator>
|
|
|
</Layout>
|
|
</Layout>
|
|
|
</Layout>
|
|
</Layout>
|
|
|
</ScrollPage>
|
|
</ScrollPage>
|
|
@@ -321,6 +334,7 @@ const styles = StyleSheet.create({
|
|
|
FlexRow: {
|
|
FlexRow: {
|
|
|
flexDirection: "row",
|
|
flexDirection: "row",
|
|
|
alignItems: "center",
|
|
alignItems: "center",
|
|
|
|
|
+ marginTop: 2,
|
|
|
},
|
|
},
|
|
|
zanImg: {
|
|
zanImg: {
|
|
|
width: 12,
|
|
width: 12,
|
|
@@ -348,8 +362,10 @@ const styles = StyleSheet.create({
|
|
|
marginRight: 15,
|
|
marginRight: 15,
|
|
|
},
|
|
},
|
|
|
labelText: {
|
|
labelText: {
|
|
|
- width: 223,
|
|
|
|
|
textAlign: "left",
|
|
textAlign: "left",
|
|
|
|
|
+ fontSize: 13,
|
|
|
|
|
+ paddingHorizontal: 10,
|
|
|
|
|
+ minWidth: 120,
|
|
|
},
|
|
},
|
|
|
homeCard: {
|
|
homeCard: {
|
|
|
position: "absolute",
|
|
position: "absolute",
|
|
@@ -363,19 +379,13 @@ const styles = StyleSheet.create({
|
|
|
backgroundColor: "transparent",
|
|
backgroundColor: "transparent",
|
|
|
},
|
|
},
|
|
|
tab: {
|
|
tab: {
|
|
|
- backgroundColor: "transparent",
|
|
|
|
|
- zIndex: 2,
|
|
|
|
|
|
|
+ backgroundColor: "#eee",
|
|
|
},
|
|
},
|
|
|
tabContainer: {
|
|
tabContainer: {
|
|
|
backgroundColor: "transparent",
|
|
backgroundColor: "transparent",
|
|
|
},
|
|
},
|
|
|
tabIndicator: {
|
|
tabIndicator: {
|
|
|
- height: 13,
|
|
|
|
|
- // borderRadius: "50%",
|
|
|
|
|
- bottom: 18,
|
|
|
|
|
- maxWidth: 27,
|
|
|
|
|
- marginHorizontal: 49,
|
|
|
|
|
- zIndex: 1,
|
|
|
|
|
|
|
+ backgroundColor: "#FFC21C",
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|