轻松聘
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.
 
 
 

194 lines
5.2 KiB

import { Ionicons } from '@expo/vector-icons';
import { LinearGradient } from 'expo-linear-gradient';
import { useRouter } from 'expo-router';
import { useRef, useState } from 'react';
import {
Pressable,
ScrollView,
StyleSheet,
Text,
useWindowDimensions,
View,
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { colors, headerGradientShort } from '../src/theme';
import { useAuth } from '../src/context/AuthContext';
interface GuideSlide {
icon: string;
title: string;
desc: string;
}
/** 引导页内容:聚焦有职四大差异化能力 */
const SLIDES: GuideSlide[] = [
{
icon: 'compass-outline',
title: '双向透明求职生态',
desc: '看真实公司评价与行业声誉,让信息差不再成为求职的障碍。',
},
{
icon: 'options-outline',
title: '自定义评价维度',
desc: '按你的关注点设置权重,实时算出综合得分,找到最匹配的公司。',
},
{
icon: 'game-controller-outline',
title: '通关小游戏',
desc: '7 关闯关引导你走完「认识自己 → 签约」的完整求职链路。',
},
{
icon: 'shield-checkmark-outline',
title: '阿布阿诺 AI 法律服务',
desc: '免费咨询与模板,付费律师与合同审核,求职权益有保障。',
},
];
export default function GuideScreen() {
const router = useRouter();
const { completeOnboarding } = useAuth();
const { width } = useWindowDimensions();
const [page, setPage] = useState(0);
const scrollRef = useRef<ScrollView>(null);
const isLast = page === SLIDES.length - 1;
const finish = () => {
completeOnboarding();
router.replace('/register');
};
const goNext = () => {
if (isLast) {
finish();
return;
}
const next = page + 1;
setPage(next);
scrollRef.current?.scrollTo({ x: next * width, animated: true });
};
return (
<SafeAreaView style={styles.container} edges={['top', 'bottom']}>
<View style={styles.topBar}>
<View style={styles.topSpacer} />
<Pressable onPress={finish} hitSlop={8}>
<Text style={styles.skipText}>跳过</Text>
</Pressable>
</View>
<ScrollView
ref={scrollRef}
horizontal
pagingEnabled
showsHorizontalScrollIndicator={false}
onMomentumScrollEnd={(e) => {
const index = Math.round(e.nativeEvent.contentOffset.x / width);
setPage(index);
}}
style={styles.pager}
>
{SLIDES.map((slide) => (
<View key={slide.title} style={[styles.slide, { width }]}>
<LinearGradient colors={[...headerGradientShort]} style={styles.illus}>
<Ionicons
name={slide.icon as keyof typeof Ionicons.glyphMap}
size={56}
color={colors.textInverse}
/>
</LinearGradient>
<Text style={styles.slideTitle}>{slide.title}</Text>
<Text style={styles.slideDesc}>{slide.desc}</Text>
</View>
))}
</ScrollView>
<View style={styles.bottom}>
<View style={styles.dots}>
{SLIDES.map((slide, i) => (
<View key={slide.title} style={[styles.dot, i === page && styles.dotActive]} />
))}
</View>
<Pressable style={styles.nextBtn} onPress={goNext} hitSlop={6}>
<LinearGradient colors={[...headerGradientShort]} style={styles.nextGradient}>
<Text style={styles.nextText}>{isLast ? '立即体验' : '下一步'}</Text>
</LinearGradient>
</Pressable>
<Text style={styles.pageHint}>
{page + 1} / {SLIDES.length}
</Text>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: { flex: 1, backgroundColor: colors.white },
topBar: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: 16,
paddingVertical: 10,
},
topSpacer: { width: 40 },
skipText: { fontSize: 14, color: colors.textSecondary, paddingHorizontal: 4 },
pager: { flex: 1 },
slide: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingHorizontal: 36,
},
illus: {
width: 132,
height: 132,
borderRadius: 36,
alignItems: 'center',
justifyContent: 'center',
marginBottom: 36,
},
slideTitle: {
fontSize: 22,
fontWeight: '800',
color: colors.textPrimary,
textAlign: 'center',
marginBottom: 14,
},
slideDesc: {
fontSize: 15,
color: colors.textSecondary,
textAlign: 'center',
lineHeight: 24,
},
bottom: {
alignItems: 'center',
paddingHorizontal: 36,
paddingBottom: 28,
},
dots: { flexDirection: 'row', gap: 8, marginBottom: 24 },
dot: {
width: 8,
height: 8,
borderRadius: 4,
backgroundColor: colors.border,
},
dotActive: { width: 22, backgroundColor: colors.primary },
nextBtn: {
width: '100%',
height: 50,
borderRadius: 25,
overflow: 'hidden',
},
nextGradient: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
nextText: { fontSize: 16, fontWeight: '700', color: colors.textInverse },
pageHint: {
marginTop: 16,
fontSize: 13,
color: colors.textHint,
},
});