Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
duoduo
daoyian5b8e4f5227d5
diff --git a/@types/resources.d.ts b/@types/resources.d.tsindex 9e810189..d7104cac 100644--- a/@types/resources.d.ts+++ b/@types/resources.d.ts@@ -815,6 +815,20 @@ interface Resources {"userRegister": "用户注册","noPointsRecords": "暂无积分记录","totalRecords": "共 {{total}} 条记录"+ },+ "freeTrial": {+ "title": "🎉 免费会员体验",+ "congratulations": "恭喜您获得7天免费会员体验!",+ "description": "作为新用户,您可以享受7天的免费会员权益,体验所有高级功能,包括:",+ "unlimitedAI": "✓ 无限制AI生成",+ "priorityProcessing": "✓ 优先处理",+ "advancedModels": "✓ 高级模型",+ "dedicatedSupport": "✓ 专属客服",+ "noAds": "✓ 无广告体验",+ "morePrivileges": "✓ 更多特权",+ "completelyFree": "🎁 完全免费,无需支付任何费用",+ "claimNow": "立即领取",+ "later": "稍后再说"}},"publish": {diff --git a/src/app/[lng]/profile/page.tsx b/src/app/[lng]/profile/page.tsxindex 3ee45876..3b2d22c4 100644--- a/src/app/[lng]/profile/page.tsx+++ b/src/app/[lng]/profile/page.tsx@@ -23,6 +23,18 @@ export default function ProfilePage() {const [isModalOpen, setIsModalOpen] = useState(false);const [form] = Form.useForm();+ // 免费会员提示弹框状态+ const [freeTrialModalVisible, setFreeTrialModalVisible] = useState(false);+ const [hasShownFreeTrial, setHasShownFreeTrial] = useState(false);++ // 检查是否已经显示过免费会员提示+ useEffect(() => {+ const hasShown = localStorage.getItem('freeTrialShown');+ if (hasShown) {+ setHasShownFreeTrial(true);+ }+ }, []);+// 订单相关状态const [orders, setOrders] = useState<Order[]>([]);const [subscriptions, setSubscriptions] = useState<Order[]>([]);@@ -70,6 +82,9 @@ export default function ProfilePage() {userInfo?.vipInfo?.expireTime ? new Date(userInfo.vipInfo.expireTime) > new Date() : false;const vipExpireTime = userInfo?.vipInfo?.expireTime ? new Date(userInfo.vipInfo.expireTime).toLocaleDateString() : '';+ // 检查用户是否从未开过会员+ const hasNeverBeenVip = !userInfo?.vipInfo || Object.keys(userInfo.vipInfo).length === 0;+// 获取会员类型显示文本const getVipCycleTypeText = (cycleType: number) => {switch (cycleType) {@@ -109,6 +124,16 @@ export default function ProfilePage() {if (response.code === 0 && response.data) {setUserInfo(response.data);++ // 检查是否需要显示免费会员提示+ const hasVipInfo = response.data.vipInfo && Object.keys(response.data.vipInfo).length > 0;+ if (!hasVipInfo && !hasShownFreeTrial) {+ // 延迟显示弹框,确保页面加载完成+ setTimeout(() => {+ setFreeTrialModalVisible(true);+ setHasShownFreeTrial(true);+ }, 2000); // 增加延迟时间,让用户先看到页面内容+ }} else {message.error(response.message || t('getUserInfoFailed'));}@@ -284,6 +309,18 @@ export default function ProfilePage() {router.push('/vip');};+ // 处理免费会员弹框+ const handleFreeTrialModalOk = () => {+ setFreeTrialModalVisible(false);+ localStorage.setItem('freeTrialShown', 'true');+ router.push('/vip');+ };++ const handleFreeTrialModalCancel = () => {+ setFreeTrialModalVisible(false);+ localStorage.setItem('freeTrialShown', 'true');+ };+// 订单状态标签const getOrderStatusTag = (status: OrderStatus) => {const statusMap = {@@ -866,6 +903,71 @@ export default function ProfilePage() {</Descriptions>)}</Modal>++ {/* 免费会员提示弹框 */}+ <Modal+ title={+ <div style={{ textAlign: 'center', fontSize: '18px', fontWeight: 'bold', color: '#C026D2' }}>+ {t('freeTrial.title')}+ </div>+ }+ open={freeTrialModalVisible}+ onOk={handleFreeTrialModalOk}+ onCancel={handleFreeTrialModalCancel}+ okText={t('freeTrial.claimNow')}+ cancelText={t('freeTrial.later')}+ okButtonProps={{+ style: {+ backgroundColor: '#C026D2',+ borderColor: '#C026D2',+ borderRadius: '8px',+ fontWeight: '600'+ }+ }}+ cancelButtonProps={{+ style: {+ borderRadius: '8px',+ fontWeight: '600'+ }+ }}+ width={500}+ centered+ maskClosable={false}+ closable={false}+ >+ <div style={{ textAlign: 'center', padding: '20px 0' }}>+ <div style={{ fontSize: '48px', marginBottom: '16px' }}>👑</div>+ <h3 style={{ color: '#1f2937', marginBottom: '12px', fontSize: '16px' }}>+ {t('freeTrial.congratulations')}+ </h3>+ <p style={{ color: '#6b7280', lineHeight: '1.6', marginBottom: '20px' }}>+ {t('freeTrial.description')}+ </p>+ <div style={{+ background: '#f8fafc',+ borderRadius: '12px',+ padding: '16px',+ marginBottom: '20px',+ border: '1px solid #e2e8f0'+ }}>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '8px' }}>+ <span style={{ color: '#374151', fontSize: '14px' }}>{t('freeTrial.unlimitedAI')}</span>+ <span style={{ color: '#374151', fontSize: '14px' }}>{t('freeTrial.priorityProcessing')}</span>+ </div>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '8px' }}>+ <span style={{ color: '#374151', fontSize: '14px' }}>{t('freeTrial.advancedModels')}</span>+ <span style={{ color: '#374151', fontSize: '14px' }}>{t('freeTrial.dedicatedSupport')}</span>+ </div>+ <div style={{ display: 'flex', justifyContent: 'space-between' }}>+ <span style={{ color: '#374151', fontSize: '14px' }}>{t('freeTrial.noAds')}</span>+ <span style={{ color: '#374151', fontSize: '14px' }}>{t('freeTrial.morePrivileges')}</span>+ </div>+ </div>+ <p style={{ color: '#C026D2', fontSize: '14px', fontWeight: '600' }}>+ {t('freeTrial.completelyFree')}+ </p>+ </div>+ </Modal></div>);}\ No newline at end of filediff --git a/src/app/[lng]/vip/page.tsx b/src/app/[lng]/vip/page.tsxindex 0389a5c8..bb81cff2 100644--- a/src/app/[lng]/vip/page.tsx+++ b/src/app/[lng]/vip/page.tsx@@ -141,18 +141,7 @@ export default function VipPage() {)}<div className={styles.priceOptions}>- <div- className={`${styles.priceCard} ${selectedPlan === 'onceMonth' ? styles.selected : ''}`}- onClick={() => setSelectedPlan('onceMonth')}- >- <span className={styles.badge}>{t('badge.onceMonth')}</span>- <h4>月度会员</h4>- <div>- <span className={styles.originalPrice}>$20</span>- <span className={styles.discount}>{t('badge.onceMonth')}</span>- </div>- <p className={styles.currentPrice}>$<span>20</span></p>- </div>+<divclassName={`${styles.priceCard} ${selectedPlan === 'month' ? styles.selected : ''}`}onClick={() => setSelectedPlan('month')}@@ -192,6 +181,18 @@ export default function VipPage() {<p className={styles.trialText}>{t('trialText.year')}</p>)}</div>+ <div+ className={`${styles.priceCard} ${selectedPlan === 'onceMonth' ? styles.selected : ''}`}+ onClick={() => setSelectedPlan('onceMonth')}+ >+ <span className={styles.badge}>{t('badge.onceMonth')}</span>+ <h4>月度会员</h4>+ <div>+ <span className={styles.originalPrice}>$20</span>+ <span className={styles.discount}>{t('badge.onceMonth')}</span>+ </div>+ <p className={styles.currentPrice}>$<span>20</span></p>+ </div></div><p className={styles.subscriptionInfo}>自动续订,随时取消</p>diff --git a/src/app/i18n/locales/en/profile.json b/src/app/i18n/locales/en/profile.jsonindex e5859181..69863a10 100644--- a/src/app/i18n/locales/en/profile.json+++ b/src/app/i18n/locales/en/profile.json@@ -104,5 +104,19 @@"userRegister": "User Register","noPointsRecords": "No points records","totalRecords": "{{total}} records total"+ },+ "freeTrial": {+ "title": "🎉 Free Member Trial",+ "congratulations": "Congratulations! You've earned a 7-day free member trial!",+ "description": "As a new user, you can enjoy 7 days of free member benefits and experience all premium features, including:",+ "unlimitedAI": "✓ Unlimited AI Generation",+ "priorityProcessing": "✓ Priority Processing",+ "advancedModels": "✓ Advanced Models",+ "dedicatedSupport": "✓ Dedicated Support",+ "noAds": "✓ Ad-Free Experience",+ "morePrivileges": "✓ More Privileges",+ "completelyFree": "🎁 Completely free, no payment required",+ "claimNow": "Claim Now",+ "later": "Later"}}\ No newline at end of filediff --git a/src/app/i18n/locales/zh-CN/profile.json b/src/app/i18n/locales/zh-CN/profile.jsonindex f8ca8ced..4fabc455 100644--- a/src/app/i18n/locales/zh-CN/profile.json+++ b/src/app/i18n/locales/zh-CN/profile.json@@ -104,5 +104,19 @@"userRegister": "用户注册","noPointsRecords": "暂无积分记录","totalRecords": "共 {{total}} 条记录"+ },+ "freeTrial": {+ "title": "🎉 免费会员体验",+ "congratulations": "恭喜您获得7天免费会员体验!",+ "description": "作为新用户,您可以享受7天的免费会员权益,体验所有高级功能,包括:",+ "unlimitedAI": "✓ 无限制AI生成",+ "priorityProcessing": "✓ 优先处理",+ "advancedModels": "✓ 高级模型",+ "dedicatedSupport": "✓ 专属客服",+ "noAds": "✓ 无广告体验",+ "morePrivileges": "✓ 更多特权",+ "completelyFree": "🎁 完全免费,无需支付任何费用",+ "claimNow": "立即领取",+ "later": "稍后再说"}}\ No newline at end of file