修改样式问题

This commit is contained in:
al 2025-01-21 15:22:50 +08:00
parent 4f74578d82
commit 58f94ac646
3 changed files with 45 additions and 31 deletions

View File

@ -89,35 +89,37 @@ export default function SystemNotice({ navigation, route, ...props }) {
}
};
return (
<ScrollView style={tailwind("p-4")}>
{data.map((it) => (
<NoticeItem
key={it.id}
data={it}
navigation={navigation}
hasLink={{ url: it.url, text: it.link_text }}
leftIcon={
<View>
<Image
source={
it.n_type === 0
? systemIcon
: it.n_type === 1
? examIcon
: it.n_type === 2
? payIcon
: activeIcon
}
contentFit="cover"
cachePolicy="disk"
transition={1000}
style={{ width: 32, height: 32 }}
/>
</View>
}
/>
))}
{!data.length && <Empty type="nodata" />}
<ScrollView>
<View style={tailwind("p-4")}>
{data.map((it) => (
<NoticeItem
key={it.id}
data={it}
navigation={navigation}
hasLink={{ url: it.url, text: it.link_text }}
leftIcon={
<View>
<Image
source={
it.n_type === 0
? systemIcon
: it.n_type === 1
? examIcon
: it.n_type === 2
? payIcon
: activeIcon
}
contentFit="cover"
cachePolicy="disk"
transition={1000}
style={{ width: 32, height: 32 }}
/>
</View>
}
/>
))}
{!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>