Skip to content

Let's use AI to Earn!

vip7天

daoyian1d9bd2587003
diff --git a/@types/resources.d.ts b/@types/resources.d.ts
index 57b71f77..9e810189 100644
--- a/@types/resources.d.ts
+++ b/@types/resources.d.ts
@@ -935,6 +935,21 @@ interface Resources {
"paymentLinkNotFound": "未获取到支付链接",
"createPaymentOrderFailed": "创建支付订单失败",
"createPaymentOrderError": "创建支付订单失败,请稍后重试",
+ "trialNotice": {
+ "badge": "🎉 新用户专享",
+ "description": "选择连续包月或连续包年,可享受7天免费试用期!"
+ },
+ "trialText": {
+ "month": "前7天免费,之后$15/月",
+ "year": "前7天免费,之后$120/年"
+ },
+ "badge": {
+ "onceMonth": "一次性",
+ "month": "7天免费试用",
+ "year": "7天免费试用",
+ "monthOld": "25%优惠",
+ "yearOld": "50%优惠"
+ },
"vipBenefits": {
"exclusiveBadge": "专属标识",
"advancedFeatures": "高级功能",
diff --git a/src/api/vip.ts b/src/api/vip.ts
index bb38a553..3d8bbbb5 100644
--- a/src/api/vip.ts
+++ b/src/api/vip.ts
@@ -19,6 +19,7 @@ export interface CreatePaymentOrderParams {
success_url: string;
mode: string;
payment: PaymentType;
+ flagTrialPeriodDays?: number; // 订阅模式下是否给七天免费试用时长, 0 - 不给, 1-给
metadata: {
userId: string;
};
diff --git a/src/app/[lng]/pricing/pricing.module.scss b/src/app/[lng]/pricing/pricing.module.scss
index 70ec2268..9ee39334 100644
--- a/src/app/[lng]/pricing/pricing.module.scss
+++ b/src/app/[lng]/pricing/pricing.module.scss
@@ -1,6 +1,5 @@
.pricingPage {
- min-height: 100vh;
- background: #ffffff;
+ background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
padding: 40px 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@@ -14,23 +13,25 @@
.header {
text-align: center;
margin-bottom: 60px;
- color: #333;
+ color: #1f2937;
.title {
font-size: 3rem;
- font-weight: 700;
+ font-weight: 800;
margin-bottom: 16px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
+ letter-spacing: -1px;
}
.subtitle {
font-size: 1.25rem;
- color: #666;
+ color: #6b7280;
max-width: 600px;
margin: 0 auto;
+ font-weight: 500;
}
}
@@ -40,21 +41,22 @@
margin-bottom: 60px;
.toggleContainer {
- background: #f5f5f5;
+ background: #ffffff;
border-radius: 50px;
- padding: 4px;
+ padding: 6px;
display: flex;
- border: 1px solid #e0e0e0;
+ border: 2px solid #e5e7eb;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
.toggleButton {
background: transparent;
border: none;
- color: #666;
+ color: #6b7280;
padding: 12px 24px;
border-radius: 50px;
cursor: pointer;
font-size: 1rem;
- font-weight: 500;
+ font-weight: 600;
transition: all 0.3s ease;
position: relative;
display: flex;
@@ -62,23 +64,25 @@
gap: 8px;
&.active {
- background: #667eea;
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
color: white;
- box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
+ box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
}
&:hover:not(.active) {
- background: #e8e8e8;
+ background: #f3f4f6;
+ color: #374151;
}
.saveBadge {
- background: #ff6b6b;
+ background: #ef4444;
color: white;
- padding: 2px 8px;
+ padding: 4px 10px;
border-radius: 12px;
font-size: 0.75rem;
- font-weight: 600;
+ font-weight: 700;
margin-left: 4px;
+ box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
}
}
@@ -86,39 +90,40 @@
.pricingCards {
display: grid;
- grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
+ grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
gap: 30px;
margin-bottom: 80px;
}
.pricingCard {
background: white;
- border-radius: 20px;
+ border-radius: 24px;
padding: 40px;
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
position: relative;
transition: all 0.3s ease;
border: 2px solid transparent;
&:hover {
- transform: translateY(-5px);
- box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
+ transform: translateY(-8px);
+ box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
}
// Free套餐特殊样式
&:not(.popular) {
- border: 2px solid #e0e0e0;
- box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
+ border: 2px solid #e5e7eb;
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
&:hover {
- border-color: #667eea;
- box-shadow: 0 15px 40px rgba(102, 126, 234, 0.15);
+ border-color: #4f46e5;
+ box-shadow: 0 15px 40px rgba(79, 70, 229, 0.15);
}
}
&.popular {
- border-color: #667eea;
+ border-color: #4f46e5;
transform: scale(1.05);
+ box-shadow: 0 25px 50px rgba(79, 70, 229, 0.15);
&::before {
content: '';
@@ -127,8 +132,8 @@
left: -2px;
right: -2px;
bottom: -2px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- border-radius: 20px;
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
+ border-radius: 24px;
z-index: -1;
}
}
@@ -137,13 +142,13 @@
position: absolute;
top: -12px;
right: 20px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
color: white;
- padding: 8px 16px;
+ padding: 10px 18px;
border-radius: 20px;
font-size: 0.875rem;
- font-weight: 600;
- box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
+ font-weight: 700;
+ box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}
}
@@ -153,8 +158,8 @@
.planName {
font-size: 2rem;
- font-weight: 700;
- color: #333;
+ font-weight: 800;
+ color: #1f2937;
margin-bottom: 16px;
}
@@ -162,15 +167,15 @@
.originalPrice {
display: block;
font-size: 1.125rem;
- color: #999;
+ color: #9ca3af;
text-decoration: line-through;
margin-bottom: 4px;
}
.price {
font-size: 2.5rem;
- font-weight: 700;
- color: #667eea;
+ font-weight: 800;
+ color: #4f46e5;
display: flex;
align-items: baseline;
justify-content: center;
@@ -178,8 +183,8 @@
.period {
font-size: 1rem;
- color: #666;
- font-weight: 400;
+ color: #6b7280;
+ font-weight: 500;
}
}
}
@@ -188,28 +193,30 @@
.planFeatures {
.mainFeatures {
margin-bottom: 30px;
- padding: 20px;
- background: #f8f9ff;
- border-radius: 12px;
+ padding: 24px;
+ background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
+ border-radius: 16px;
+ border: 1px solid #e5e7eb;
.featureItem {
display: flex;
justify-content: space-between;
align-items: center;
- margin-bottom: 12px;
+ margin-bottom: 16px;
&:last-child {
margin-bottom: 0;
}
.featureLabel {
- font-weight: 500;
- color: #666;
+ font-weight: 600;
+ color: #374151;
}
.featureValue {
- font-weight: 600;
- color: #333;
+ font-weight: 700;
+ color: #1f2937;
+ font-size: 1.1rem;
}
}
}
@@ -220,29 +227,37 @@
.featureRow {
display: flex;
align-items: center;
- margin-bottom: 12px;
+ margin-bottom: 16px;
gap: 12px;
.checkIcon {
- color: #52c41a;
+ color: #10b981;
font-size: 1.125rem;
flex-shrink: 0;
+ background: #ecfdf5;
+ padding: 4px;
+ border-radius: 50%;
}
.closeIcon {
- color: #ff4d4f;
+ color: #ef4444;
font-size: 1.125rem;
flex-shrink: 0;
+ background: #fef2f2;
+ padding: 4px;
+ border-radius: 50%;
}
.featureText {
font-size: 0.95rem;
- color: #333;
- line-height: 1.4;
+ color: #1f2937;
+ line-height: 1.5;
+ font-weight: 500;
&.disabled {
- color: #999;
+ color: #9ca3af;
text-decoration: line-through;
+ font-weight: 400;
}
}
}
@@ -251,46 +266,52 @@
.ctaButton {
width: 100%;
- height: 48px;
- border-radius: 12px;
+ height: 52px;
+ border-radius: 16px;
font-size: 1.125rem;
- font-weight: 600;
+ font-weight: 700;
border: none;
transition: all 0.3s ease;
&.ant-btn-primary {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
+ box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
&:hover {
transform: translateY(-2px);
- box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
+ box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
+ background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
}
}
&.ant-btn-default {
- background: #f5f5f5;
- color: #333;
- border: 2px solid #e0e0e0;
+ background: #ffffff;
+ color: #374151;
+ border: 2px solid #d1d5db;
+ font-weight: 600;
&:hover {
- background: #e8e8e8;
- border-color: #d0d0d0;
+ background: #f9fafb;
+ border-color: #4f46e5;
+ color: #4f46e5;
+ transform: translateY(-2px);
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
}
}
.faqSection {
background: white;
- border-radius: 20px;
+ border-radius: 24px;
padding: 60px 40px;
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
+ border: 1px solid #e5e7eb;
.faqTitle {
text-align: center;
font-size: 2.5rem;
- font-weight: 700;
- color: #333;
+ font-weight: 800;
+ color: #1f2937;
margin-bottom: 40px;
}
@@ -300,10 +321,11 @@
.faqItem {
margin-bottom: 30px;
- padding: 20px;
- background: #f8f9ff;
- border-radius: 12px;
- border-left: 4px solid #667eea;
+ padding: 24px;
+ background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
+ border-radius: 16px;
+ border-left: 4px solid #4f46e5;
+ border: 1px solid #e5e7eb;
&:last-child {
margin-bottom: 0;
@@ -311,15 +333,16 @@
.faqQuestion {
font-size: 1.125rem;
- font-weight: 600;
- color: #333;
+ font-weight: 700;
+ color: #1f2937;
margin-bottom: 8px;
}
.faqAnswer {
- color: #666;
+ color: #6b7280;
line-height: 1.6;
margin: 0;
+ font-weight: 500;
}
}
}
diff --git a/src/app/[lng]/vip/page.tsx b/src/app/[lng]/vip/page.tsx
index e1437da1..0389a5c8 100644
--- a/src/app/[lng]/vip/page.tsx
+++ b/src/app/[lng]/vip/page.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState } from "react";
+import { useState, useEffect } from "react";
import { CrownOutlined, TrophyOutlined, GiftOutlined, StarOutlined, RocketOutlined, DollarOutlined, HistoryOutlined, ThunderboltOutlined } from "@ant-design/icons";
import { message } from "antd";
import { useRouter } from "next/navigation";
@@ -13,8 +13,18 @@ export default function VipPage() {
const router = useRouter();
const { userInfo, lang } = useUserStore();
const { t } = useTransClient('vip');
- const [selectedPlan, setSelectedPlan] = useState('onceMonth'); // 'onceMonth', 'month', 'year'
+ const [selectedPlan, setSelectedPlan] = useState('month'); // 默认选择连续月费会员
const [loading, setLoading] = useState(false);
+ const [canUseTrial, setCanUseTrial] = useState(false); // 是否可以使用免费试用
+
+ // 检查用户是否可以享受免费试用
+ useEffect(() => {
+ if (userInfo) {
+ // 如果用户没有vipInfo,说明从未开过会员,可以享受免费试用
+ const hasVipInfo = userInfo.vipInfo && Object.keys(userInfo.vipInfo).length > 0;
+ setCanUseTrial(!hasVipInfo);
+ }
+ }, [userInfo]);
// 会员权益数据 (8个)
const vipBenefits = [
@@ -42,6 +52,8 @@ export default function VipPage() {
// 根据选择的计划映射到支付类型
let paymentType;
let paymentMethod;
+ let flagTrialPeriodDays = 0; // 默认不给免费试用
+
switch (selectedPlan) {
case 'onceMonth':
paymentType = PaymentType.ONCE_MONTH;
@@ -50,14 +62,19 @@ export default function VipPage() {
case 'month':
paymentType = PaymentType.MONTH;
paymentMethod = 'subscription';
+ // 如果是订阅模式且用户从未开过会员,给免费试用
+ flagTrialPeriodDays = canUseTrial ? 1 : 0;
break;
case 'year':
paymentType = PaymentType.YEAR;
paymentMethod = 'subscription';
+ // 如果是订阅模式且用户从未开过会员,给免费试用
+ flagTrialPeriodDays = canUseTrial ? 1 : 0;
break;
default:
- paymentType = PaymentType.ONCE_MONTH;
- paymentMethod = 'payment';
+ paymentType = PaymentType.MONTH;
+ paymentMethod = 'subscription';
+ flagTrialPeriodDays = canUseTrial ? 1 : 0;
}
// 创建支付订单
@@ -65,6 +82,7 @@ export default function VipPage() {
success_url: lang === 'zh-CN' ? "/zh-CN/profile" : "/en/profile",
mode: paymentMethod,
payment: paymentType,
+ flagTrialPeriodDays,
metadata: {
userId: userInfo.id
}
@@ -113,16 +131,25 @@ export default function VipPage() {
</div>
<h3 className={styles.title}>选择开通时长</h3>
+
+ {/* 免费试用提示 */}
+ {canUseTrial && (
+ <div className={styles.trialNotice}>
+ <span className={styles.trialBadge}>{t('trialNotice.badge')}</span>
+ <p>{t('trialNotice.description')}</p>
+ </div>
+ )}
+
<div className={styles.priceOptions}>
<div
className={`${styles.priceCard} ${selectedPlan === 'onceMonth' ? styles.selected : ''}`}
onClick={() => setSelectedPlan('onceMonth')}
>
- <span className={styles.badge}>一次性</span>
+ <span className={styles.badge}>{t('badge.onceMonth')}</span>
<h4>月度会员</h4>
<div>
<span className={styles.originalPrice}>$20</span>
- <span className={styles.discount}>一次性</span>
+ <span className={styles.discount}>{t('badge.onceMonth')}</span>
</div>
<p className={styles.currentPrice}>$<span>20</span></p>
</div>
@@ -130,26 +157,40 @@ export default function VipPage() {
className={`${styles.priceCard} ${selectedPlan === 'month' ? styles.selected : ''}`}
onClick={() => setSelectedPlan('month')}
>
- <span className={styles.badge}>25%优惠</span>
+ <span className={styles.badge}>
+ {canUseTrial ? t('badge.month') : t('badge.monthOld')}
+ </span>
<h4>月费会员</h4>
<div>
<span className={styles.originalPrice}>$20</span>
- <span className={styles.discount}>25%优惠</span>
+ <span className={styles.discount}>
+ {canUseTrial ? t('badge.month') : t('badge.monthOld')}
+ </span>
</div>
<p className={styles.currentPrice}>$<span>15</span>/月</p>
+ {canUseTrial && (
+ <p className={styles.trialText}>{t('trialText.month')}</p>
+ )}
</div>
<div
className={`${styles.priceCard} ${selectedPlan === 'year' ? styles.selected : ''}`}
onClick={() => setSelectedPlan('year')}
>
- <span className={styles.badge}>50%优惠</span>
+ <span className={styles.badge}>
+ {canUseTrial ? t('badge.year') : t('badge.yearOld')}
+ </span>
<h4>年费会员</h4>
<div>
<span className={styles.originalPrice}>$180</span>
- <span className={styles.discount}>50%优惠</span>
+ <span className={styles.discount}>
+ {canUseTrial ? t('badge.year') : t('badge.yearOld')}
+ </span>
</div>
<p className={styles.currentPrice}>$<span>10</span>/月</p>
<p className={styles.monthlyPrice}>$120/年</p>
+ {canUseTrial && (
+ <p className={styles.trialText}>{t('trialText.year')}</p>
+ )}
</div>
</div>
diff --git a/src/app/[lng]/vip/vip.module.css b/src/app/[lng]/vip/vip.module.css
index cf06956f..ffb663c4 100644
--- a/src/app/[lng]/vip/vip.module.css
+++ b/src/app/[lng]/vip/vip.module.css
@@ -1,7 +1,5 @@
.container {
padding: 24px;
- max-width: 1440px;
- margin: 0 auto;
text-align: center;
}
@@ -19,6 +17,44 @@
color: #666;
}
+/* 免费试用提示样式 */
+.trialNotice {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+ padding: 16px 24px;
+ border-radius: 12px;
+ margin-bottom: 24px;
+ text-align: center;
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
+}
+
+.trialBadge {
+ display: inline-block;
+ background: rgba(255, 255, 255, 0.2);
+ padding: 4px 12px;
+ border-radius: 20px;
+ font-size: 14px;
+ font-weight: 600;
+ margin-bottom: 8px;
+}
+
+.trialNotice p {
+ margin: 0;
+ font-size: 16px;
+ font-weight: 500;
+}
+
+.trialText {
+ font-size: 12px;
+ color: #10b981;
+ font-weight: 600;
+ margin-top: 8px;
+ background: #ecfdf5;
+ padding: 4px 8px;
+ border-radius: 6px;
+ display: inline-block;
+}
+
/* 会员卡片样式 */
.vipCard {
background: url('/assets/images/vipcard.png') no-repeat center center;
diff --git a/src/app/i18n/locales/en/vip.json b/src/app/i18n/locales/en/vip.json
index 178dfc74..ad6d5682 100644
--- a/src/app/i18n/locales/en/vip.json
+++ b/src/app/i18n/locales/en/vip.json
@@ -7,6 +7,21 @@
"paymentLinkNotFound": "Payment link not found",
"createPaymentOrderFailed": "Failed to create payment order",
"createPaymentOrderError": "Failed to create payment order, please try again",
+ "trialNotice": {
+ "badge": "🎉 New User Exclusive",
+ "description": "Choose monthly or yearly subscription to enjoy 7-day free trial!"
+ },
+ "trialText": {
+ "month": "Free for first 7 days, then $15/month",
+ "year": "Free for first 7 days, then $120/year"
+ },
+ "badge": {
+ "onceMonth": "One-time",
+ "month": "7-day Free Trial",
+ "year": "7-day Free Trial",
+ "monthOld": "25% Off",
+ "yearOld": "50% Off"
+ },
"vipBenefits": {
"exclusiveBadge": "Badge",
"advancedFeatures": "Advanced",
diff --git a/src/app/i18n/locales/zh-CN/vip.json b/src/app/i18n/locales/zh-CN/vip.json
index 5aed5eff..c51ca6ad 100644
--- a/src/app/i18n/locales/zh-CN/vip.json
+++ b/src/app/i18n/locales/zh-CN/vip.json
@@ -7,6 +7,21 @@
"paymentLinkNotFound": "未获取到支付链接",
"createPaymentOrderFailed": "创建支付订单失败",
"createPaymentOrderError": "创建支付订单失败,请稍后重试",
+ "trialNotice": {
+ "badge": "🎉 新用户专享",
+ "description": "选择连续包月或连续包年,可享受7天免费试用期!"
+ },
+ "trialText": {
+ "month": "前7天免费,之后$15/月",
+ "year": "前7天免费,之后$120/年"
+ },
+ "badge": {
+ "onceMonth": "一次性",
+ "month": "7天免费试用",
+ "year": "7天免费试用",
+ "monthOld": "25%优惠",
+ "yearOld": "50%优惠"
+ },
"vipBenefits": {
"exclusiveBadge": "专属标识",
"advancedFeatures": "高级功能",