You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
263 lines
7.1 KiB
263 lines
7.1 KiB
import { Ionicons } from '@expo/vector-icons';
|
|
import { useRouter } from 'expo-router';
|
|
import { ActivityIndicator, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
import { useAboutInfo } from '../../src/hooks';
|
|
import { colors } from '../../src/theme';
|
|
|
|
/* ===================== 子组件:顶部导航 ===================== */
|
|
|
|
function Header({ onBack }: { onBack: () => void }) {
|
|
return (
|
|
<View style={styles.header}>
|
|
<Pressable style={styles.headerBtn} onPress={onBack} hitSlop={8}>
|
|
<Ionicons name="chevron-back" size={24} color={colors.textPrimary} />
|
|
</Pressable>
|
|
<Text style={styles.headerTitle}>关于我们</Text>
|
|
<View style={styles.headerBtn} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
/* ===================== 页面 ===================== */
|
|
|
|
export default function AboutScreen() {
|
|
const router = useRouter();
|
|
const { about, loading, error, refresh } = useAboutInfo();
|
|
|
|
return (
|
|
<SafeAreaView style={styles.safeArea} edges={['top']}>
|
|
<Header onBack={() => router.back()} />
|
|
|
|
{loading ? (
|
|
<View style={styles.stateBox}>
|
|
<ActivityIndicator size="large" color={colors.primary} />
|
|
</View>
|
|
) : error ? (
|
|
<View style={styles.stateBox}>
|
|
<Text style={styles.stateText}>加载失败,请重试</Text>
|
|
<Pressable style={styles.retryBtn} onPress={refresh}>
|
|
<Text style={styles.retryText}>重试</Text>
|
|
</Pressable>
|
|
</View>
|
|
) : !about ? (
|
|
<View style={styles.stateBox}>
|
|
<Ionicons name="information-circle-outline" size={48} color={colors.textHint} />
|
|
<Text style={styles.stateText}>暂无应用信息</Text>
|
|
</View>
|
|
) : (
|
|
<ScrollView
|
|
style={styles.scroll}
|
|
contentContainerStyle={styles.content}
|
|
showsVerticalScrollIndicator={false}
|
|
>
|
|
{/* 品牌区 */}
|
|
<View style={styles.brandCard}>
|
|
<View style={styles.brandLogo}>
|
|
<Ionicons name="briefcase" size={34} color={colors.primary} />
|
|
</View>
|
|
<Text style={styles.appName}>{about.appName}</Text>
|
|
<Text style={styles.version}>{about.version}</Text>
|
|
</View>
|
|
|
|
{/* 简介 */}
|
|
<View style={styles.card}>
|
|
<Text style={styles.cardTitle}>应用简介</Text>
|
|
<Text style={styles.desc}>{about.description}</Text>
|
|
<View style={styles.companyRow}>
|
|
<Text style={styles.companyLabel}>运营主体</Text>
|
|
<Text style={styles.companyValue}>{about.company}</Text>
|
|
</View>
|
|
</View>
|
|
|
|
{/* 协议与链接 */}
|
|
<View style={styles.card}>
|
|
{about.links.map((link, index) => {
|
|
const isLast = index === about.links.length - 1;
|
|
const route = link.route;
|
|
|
|
/*
|
|
* 无 route 的条目**不做成可点**。
|
|
* 原先是「有 onPress、但函数体里什么都不做」—— 点了毫无反应,
|
|
* 既没有跳转也没有提示;审计脚本也看不见这一类(它有处理函数)。
|
|
* 现改为:保持可见 + 如实标注「待开放」,而不是给一个静默失效的箭头。
|
|
*/
|
|
if (!route) {
|
|
return (
|
|
<View key={link.id} style={[styles.row, isLast && styles.rowLast]}>
|
|
<Text style={styles.rowTitle}>{link.title}</Text>
|
|
<Text style={styles.rowPending}>待开放</Text>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Pressable
|
|
key={link.id}
|
|
style={[styles.row, isLast && styles.rowLast]}
|
|
onPress={() => router.push(route)}
|
|
hitSlop={4}
|
|
>
|
|
<Text style={styles.rowTitle}>{link.title}</Text>
|
|
<Ionicons name="chevron-forward" size={18} color={colors.textHint} />
|
|
</Pressable>
|
|
);
|
|
})}
|
|
</View>
|
|
|
|
<Text style={styles.copyright}>
|
|
Copyright © 2026 {about.company}
|
|
{'\n'}All rights reserved.
|
|
</Text>
|
|
</ScrollView>
|
|
)}
|
|
</SafeAreaView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
safeArea: {
|
|
flex: 1,
|
|
backgroundColor: colors.pageBg,
|
|
},
|
|
header: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
paddingHorizontal: 8,
|
|
height: 48,
|
|
backgroundColor: colors.white,
|
|
borderBottomWidth: 1,
|
|
borderBottomColor: colors.borderLight,
|
|
},
|
|
headerBtn: {
|
|
width: 40,
|
|
height: 40,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
headerTitle: {
|
|
fontSize: 17,
|
|
fontWeight: '700',
|
|
color: colors.textPrimary,
|
|
},
|
|
scroll: {
|
|
flex: 1,
|
|
},
|
|
content: {
|
|
padding: 8,
|
|
paddingBottom: 24,
|
|
},
|
|
brandCard: {
|
|
alignItems: 'center',
|
|
paddingVertical: 28,
|
|
backgroundColor: colors.white,
|
|
borderRadius: 8,
|
|
marginBottom: 8,
|
|
},
|
|
brandLogo: {
|
|
width: 72,
|
|
height: 72,
|
|
borderRadius: 36,
|
|
backgroundColor: colors.primaryLight,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
marginBottom: 12,
|
|
},
|
|
appName: {
|
|
fontSize: 20,
|
|
fontWeight: '700',
|
|
color: colors.textPrimary,
|
|
},
|
|
version: {
|
|
marginTop: 4,
|
|
fontSize: 13,
|
|
color: colors.textSecondary,
|
|
},
|
|
card: {
|
|
backgroundColor: colors.white,
|
|
borderRadius: 8,
|
|
paddingHorizontal: 14,
|
|
paddingVertical: 14,
|
|
marginBottom: 8,
|
|
},
|
|
cardTitle: {
|
|
fontSize: 15,
|
|
fontWeight: '700',
|
|
color: colors.textPrimary,
|
|
marginBottom: 8,
|
|
},
|
|
desc: {
|
|
fontSize: 13,
|
|
lineHeight: 20,
|
|
color: colors.textSecondary,
|
|
},
|
|
companyRow: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
marginTop: 12,
|
|
paddingTop: 12,
|
|
borderTopWidth: 1,
|
|
borderTopColor: colors.borderLight,
|
|
},
|
|
companyLabel: {
|
|
fontSize: 13,
|
|
color: colors.textSecondary,
|
|
marginRight: 8,
|
|
},
|
|
companyValue: {
|
|
flex: 1,
|
|
fontSize: 13,
|
|
fontWeight: '600',
|
|
color: colors.textPrimary,
|
|
},
|
|
row: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
paddingVertical: 14,
|
|
borderBottomWidth: 1,
|
|
borderBottomColor: colors.borderLight,
|
|
},
|
|
rowLast: {
|
|
borderBottomWidth: 0,
|
|
},
|
|
rowTitle: {
|
|
fontSize: 15,
|
|
color: colors.textPrimary,
|
|
},
|
|
/* 无 route 的条目:如实标注,不用箭头假装可点 */
|
|
rowPending: {
|
|
fontSize: 13,
|
|
color: colors.textHint,
|
|
},
|
|
copyright: {
|
|
marginTop: 20,
|
|
fontSize: 12,
|
|
lineHeight: 18,
|
|
color: colors.textHint,
|
|
textAlign: 'center',
|
|
},
|
|
stateBox: {
|
|
flex: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
stateText: {
|
|
marginTop: 12,
|
|
fontSize: 14,
|
|
color: colors.textSecondary,
|
|
},
|
|
retryBtn: {
|
|
marginTop: 16,
|
|
paddingHorizontal: 24,
|
|
paddingVertical: 8,
|
|
borderRadius: 18,
|
|
backgroundColor: colors.primaryBtn,
|
|
},
|
|
retryText: {
|
|
fontSize: 13,
|
|
fontWeight: '600',
|
|
color: colors.white,
|
|
},
|
|
});
|
|
|