修复更新通知跳转播放页缺少title参数
This commit is contained in:
@@ -323,7 +323,7 @@ async function refreshRecordAndFavorites() {
|
|||||||
|
|
||||||
// 收集更新信息用于邮件
|
// 收集更新信息用于邮件
|
||||||
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000';
|
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000';
|
||||||
const playUrl = `${siteUrl}/play?source=${source}&id=${id}`;
|
const playUrl = `${siteUrl}/play?source=${source}&id=${id}&title=${encodeURIComponent(fav.title)}`;
|
||||||
userUpdates.push({
|
userUpdates.push({
|
||||||
title: fav.title,
|
title: fav.title,
|
||||||
oldEpisodes: fav.total_episodes,
|
oldEpisodes: fav.total_episodes,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Bell, Check, Trash2, X } from 'lucide-react';
|
|||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import { getAuthInfoFromBrowserCookie } from '@/lib/auth';
|
||||||
import { Notification } from '@/lib/types';
|
import { Notification } from '@/lib/types';
|
||||||
|
|
||||||
interface NotificationPanelProps {
|
interface NotificationPanelProps {
|
||||||
@@ -118,8 +119,16 @@ export const NotificationPanel: React.FC<NotificationPanelProps> = ({
|
|||||||
|
|
||||||
// 根据通知类型跳转
|
// 根据通知类型跳转
|
||||||
if (notification.type === 'favorite_update' && notification.metadata) {
|
if (notification.type === 'favorite_update' && notification.metadata) {
|
||||||
const { source, id } = notification.metadata;
|
const { source, id, title } = notification.metadata;
|
||||||
router.push(`/play?source=${source}&id=${id}`);
|
router.push(`/play?source=${source}&id=${id}&title=${encodeURIComponent(title)}`);
|
||||||
|
onClose();
|
||||||
|
} else if (notification.type === 'movie_request') {
|
||||||
|
// 获取用户角色
|
||||||
|
const authInfo = getAuthInfoFromBrowserCookie();
|
||||||
|
const isAdmin = authInfo?.role === 'owner' || authInfo?.role === 'admin';
|
||||||
|
|
||||||
|
// 管理员跳转到管理面板,普通用户跳转到我的求片
|
||||||
|
router.push(isAdmin ? '/admin' : '/movie-request');
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user