| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- import { useEffect, useState } from 'react';
- import { useNavigate } from 'react-router-dom';
- import { setStorage, STORAGE_KEYS, getUserId, getVisitedRoutes, loadBackgroundImageConfig, getBackgroundImageUrlByIdSync } from '@/utils/storage';
- import { updateUserUIState } from '@/utils/api';
- import { px2vmin } from '@/utils/viewport';
- import { getOssUrl } from '@/utils/oss';
- // const fullProgressBar = getOssUrl('full-progress-bar.png'); // Unused
- const avatarAnimaZone = getOssUrl('Avatar-anima-zone-cap.png');
- const continueChatBtn = getOssUrl('continue-chat.png');
- // 新年背景图片 ID
- const NEW_YEAR_BACKGROUND_IMAGE_ID = 'happynewyear';
- export const ShareSuccessPage = () => {
- const navigate = useNavigate();
- const [backgroundImageUrl, setBackgroundImageUrl] = useState<string>('');
- useEffect(() => {
- // 记录用户当前所在页面
- setStorage(STORAGE_KEYS.CURRENT_PAGE, 'share-success');
- const visited = getVisitedRoutes();
- const userId = getUserId();
- if (userId) {
- updateUserUIState(userId, {
- current_page: 'share-success',
- visited_routes: visited,
- }).catch(() => {
- // 同步失败不影响前端流程
- });
- }
- // 加载背景图片配置并获取新年背景图片 URL
- const loadBackgroundImage = async () => {
- try {
- await loadBackgroundImageConfig();
- const url = getBackgroundImageUrlByIdSync(NEW_YEAR_BACKGROUND_IMAGE_ID);
- if (url) {
- setBackgroundImageUrl(url);
- } else {
- console.warn(`[ShareSuccessPage] 未找到背景图片: ${NEW_YEAR_BACKGROUND_IMAGE_ID}`);
- }
- } catch (error) {
- console.error('[ShareSuccessPage] 加载背景图片配置失败:', error);
- }
- };
- loadBackgroundImage();
- }, []);
- const handleContinueChat = () => {
- navigate('/chatbot');
- };
- return (
- <div
- style={{
- position: 'fixed',
- top: 0,
- left: 0,
- width: '100vw',
- height: '100vh',
- backgroundImage: backgroundImageUrl ? `url(${backgroundImageUrl})` : 'none',
- backgroundSize: 'cover',
- backgroundPosition: 'center',
- backgroundRepeat: 'no-repeat',
- overflow: 'hidden',
- }}
- >
- {/* 顶部进度条 */}
- <img
- src={getOssUrl('03-two-gift.gif')}
- alt="full progress bar"
- style={{
- position: 'absolute',
- left: '50%',
- top: px2vmin(64),
- width: px2vmin(195),
- transform: 'translateX(-50%)',
- }}
- />
- {/* 中部头像动画区域 */}
- <img
- src={avatarAnimaZone}
- alt="avatar anima zone"
- style={{
- position: 'absolute',
- left: '50%',
- top: px2vmin(192),
- width: px2vmin(343),
- transform: 'translateX(-50%)',
- }}
- />
- {/* 标题文案 */}
- <div
- style={{
- position: 'absolute',
- left: '50%',
- top: px2vmin(504),
- transform: 'translateX(-50%)',
- color: '#FFFFFF',
- fontSize: px2vmin(24),
- fontWeight: 'bold',
- whiteSpace: 'nowrap',
- }}
- >
- Happy New Year!
- </div>
- {/* 描述文案 */}
- <div
- style={{
- position: 'absolute',
- left: '50%',
- top: px2vmin(552),
- transform: 'translateX(-50%)',
- color: '#FFFFFF',
- fontSize: px2vmin(14),
- textAlign: 'center',
- width: px2vmin(230),
- }}
- >
- 感谢你将 Lumi 分享给更多朋友!新年限定背景已为你点亮,快带着新气象和 Lumi 继续新年的第一次对话吧
- </div>
- {/* 继续对话按钮 */}
- <button
- type="button"
- onClick={handleContinueChat}
- style={{
- position: 'absolute',
- left: '50%',
- top: px2vmin(656),
- transform: 'translateX(-50%)',
- border: 'none',
- padding: 0,
- background: 'none',
- width: px2vmin(279),
- }}
- >
- <img
- src={continueChatBtn}
- alt="Continue to chat"
- style={{
- width: '100%',
- display: 'block',
- }}
- />
- </button>
- </div>
- );
- };
|