修复了课表周数硬编码

This commit is contained in:
2026-03-17 12:29:04 +08:00
parent 582589d252
commit b50bd9abb3
10 changed files with 605 additions and 43 deletions

View File

@@ -13,7 +13,6 @@ import { colors, spacing, borderRadius } from '../../theme';
import { SystemMessageResponse, SystemMessageType } from '../../types/dto';
import Text from '../common/Text';
import Avatar from '../common/Avatar';
import { useResponsive, useResponsiveValue } from '../../hooks/useResponsive';
interface SystemMessageItemProps {
message: SystemMessageResponse;
@@ -165,14 +164,6 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
onRequestAction,
requestActionLoading = false,
}) => {
// 响应式适配
const { isWideScreen, isDesktop } = useResponsive();
const containerPadding = useResponsiveValue({ xs: spacing.md, lg: spacing.lg, xl: spacing.xl });
const avatarSize = useResponsiveValue({ xs: 40, lg: 48, xl: 52 });
const iconSize = useResponsiveValue({ xs: 20, lg: 22, xl: 24 });
const contentFontSize = useResponsiveValue({ xs: 14, lg: 15, xl: 16 });
const titleFontSize = useResponsiveValue({ xs: 14, lg: 15, xl: 16 });
const timeFontSize = useResponsiveValue({ xs: 12, lg: 13, xl: 14 });
// 格式化时间
const formatTime = (dateString: string): string => {
try {
@@ -198,7 +189,15 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
requestStatus === 'pending' &&
!!onRequestAction;
const styles = React.useMemo(() => StyleSheet.create({
// 使用固定的响应式值兼容移动端和Web端
const containerPadding = spacing.md;
const avatarSize = 44;
const iconSize = 22;
const contentFontSize = 14;
const titleFontSize = 14;
const timeFontSize = 12;
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'flex-start',
@@ -208,7 +207,7 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
borderBottomColor: colors.divider,
},
iconContainer: {
marginRight: isWideScreen ? spacing.lg : spacing.md,
marginRight: spacing.md,
},
iconWrapper: {
width: avatarSize,
@@ -220,6 +219,7 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
content: {
flex: 1,
justifyContent: 'center',
minWidth: 0,
},
titleRow: {
flexDirection: 'row',
@@ -237,7 +237,7 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
fontSize: timeFontSize,
},
messageContent: {
lineHeight: isWideScreen ? 22 : 18,
lineHeight: 20,
fontSize: contentFontSize,
},
extraInfo: {
@@ -245,7 +245,7 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
alignItems: 'center',
marginTop: spacing.xs,
backgroundColor: colors.background.default,
paddingHorizontal: isWideScreen ? spacing.md : spacing.sm,
paddingHorizontal: spacing.sm,
paddingVertical: spacing.xs,
borderRadius: borderRadius.sm,
alignSelf: 'flex-start',
@@ -259,8 +259,8 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
marginTop: spacing.sm,
},
actionBtn: {
paddingVertical: isWideScreen ? spacing.sm : spacing.xs,
paddingHorizontal: isWideScreen ? spacing.lg : spacing.md,
paddingVertical: spacing.xs,
paddingHorizontal: spacing.md,
borderRadius: borderRadius.sm,
borderWidth: 1,
marginRight: spacing.sm,
@@ -278,8 +278,9 @@ const SystemMessageItem: React.FC<SystemMessageItemProps> = ({
justifyContent: 'center',
alignItems: 'center',
height: 20,
width: 24,
},
}), [containerPadding, isWideScreen, avatarSize, titleFontSize, timeFontSize, contentFontSize]);
});
// 判断是否显示操作者头像
const showOperatorAvatar = ['follow', 'like_post', 'like_comment', 'like_reply', 'favorite_post', 'comment', 'reply', 'mention', 'group_join_apply'].includes(