修改banner间距

This commit is contained in:
al 2025-01-21 15:18:14 +08:00
parent 6bfd91dc29
commit 972ca91c4e
3 changed files with 45 additions and 31 deletions

View File

@ -89,7 +89,8 @@ export default function SystemNotice({ navigation, route, ...props }) {
}
};
return (
<ScrollView style={tailwind("p-4")}>
<ScrollView>
<View style={tailwind("p-4")}>
{data.map((it) => (
<NoticeItem
key={it.id}
@ -118,6 +119,7 @@ export default function SystemNotice({ navigation, route, ...props }) {
/>
))}
{!data.length && <Empty type="nodata" />}
</View>
</ScrollView>
);
}

View File

@ -6,6 +6,7 @@ import { formatDate, goToPage } from "../../../../utils/tools";
import { Image } from "expo-image";
import Toast from "react-native-toast-message";
import * as Linking from "expo-linking";
import dayjs from "dayjs";
export default function NoticeItem({ navigation, leftIcon, hasLink, data }) {
const tailwind = useTailwind();
// const currentLink = useMemo(() => {
@ -16,6 +17,17 @@ export default function NoticeItem({ navigation, leftIcon, hasLink, data }) {
// return hasAppLink ?? null;
// }
// }, [data]);
//
const renderDay = (time) => {
const now = dayjs();
if (now.diff(dayjs(time * 1000), "hour") - now.hour() < 1) {
return dayjs(time * 1000).format("HH:mm");
} else if (now.diff(dayjs(time * 1000), "hour") - now.hour() < 24) {
return "昨天" + dayjs(time * 1000).format("HH:mm");
} else {
return dayjs(time * 1000).format("MM-DD");
}
};
return (
<View
style={{
@ -201,7 +213,7 @@ export default function NoticeItem({ navigation, leftIcon, hasLink, data }) {
{/* 时间 */}
<View>
<Text style={{ ...tailwind("text-xs"), color: "#FFFFFF80" }}>
{formatDate(data?.push_time || data?.ct)}
{renderDay(data?.push_time || data?.ct)}
</Text>
</View>
</View>

View File

@ -247,7 +247,7 @@ export default function HostList() {
))}
</View>
{/* Banner预留位置 */}
<View style={tailwind("mt-4")}>
<View style={tailwind("mt-4 mb-10")}>
<Banner banners={bannerList} navigation={navigation} />
</View>
</View>