feat: 删除无用组件

This commit is contained in:
zdl
2025-10-20 13:34:19 +08:00
parent 44f9fea624
commit b2681231b0
24 changed files with 16 additions and 7877 deletions

View File

@@ -626,23 +626,15 @@ export default function HomeNavbar() {
// 加载订阅信息
React.useEffect(() => {
console.log('🔍 [HomeNavbar] 订阅徽章 - 认证状态:', isAuthenticated, 'userId:', user?.id);
if (isAuthenticated && user) {
const loadSubscriptionInfo = async () => {
try {
const base = getApiBase();
console.log('🌐 [HomeNavbar] 订阅徽章 - API:', base + '/api/subscription/current');
const response = await fetch(base + '/api/subscription/current', {
credentials: 'include',
});
console.log('📡 [HomeNavbar] 订阅徽章 - 响应:', response.status);
if (response.ok) {
const data = await response.json();
console.log('✅ [HomeNavbar] 订阅徽章 - 完整响应数据:', data);
console.log('🔍 [HomeNavbar] 订阅徽章 - data.data:', data.data);
console.log('🔍 [HomeNavbar] 订阅徽章 - type值:', data.data?.type, '类型:', typeof data.data?.type);
if (data.success && data.data) {
// 数据标准化处理确保type字段是小写的 'free', 'pro', 或 'max'
const normalizedData = {
@@ -652,20 +644,16 @@ export default function HomeNavbar() {
is_active: data.data.is_active !== false,
end_date: data.data.end_date || null
};
console.log('✨ [HomeNavbar] 订阅徽章 - 标准化后:', normalizedData);
setSubscriptionInfo(normalizedData);
}
} else {
console.warn('⚠️ [HomeNavbar] 订阅徽章 - API 失败,使用默认值');
}
} catch (error) {
console.error('❌ [HomeNavbar] 订阅徽章 - 错误:', error);
logger.error('HomeNavbar', '加载订阅信息失败', error);
}
};
loadSubscriptionInfo();
} else {
// 用户未登录时,重置为免费版
console.warn('🚫 [HomeNavbar] 订阅徽章 - 用户未登录,重置为免费版');
setSubscriptionInfo({
type: 'free',
status: 'active',
@@ -775,7 +763,6 @@ export default function HomeNavbar() {
/>
{/* 订阅状态徽章 - 仅登录用户可见 */}
{console.log('🎨 [HomeNavbar] 订阅徽章 - 渲染:', { isAuthenticated, user: !!user, subscriptionInfo })}
{isAuthenticated && user && (
<>
<SubscriptionBadge