Skip to content

Let's use AI to Earn!

会员界面

daoyian40e38a818882
diff --git a/src/app/[lng]/profile/page.tsx b/src/app/[lng]/profile/page.tsx
index e7e039c1..9b312311 100644
--- a/src/app/[lng]/profile/page.tsx
+++ b/src/app/[lng]/profile/page.tsx
@@ -2,6 +2,7 @@
import { useEffect, useState } from "react";
import { Card, Descriptions, Button, message, Modal, Form, Input } from "antd";
+import { CrownOutlined, TrophyOutlined, GiftOutlined, StarOutlined, RocketOutlined } from "@ant-design/icons";
import { useRouter } from "next/navigation";
import { useUserStore } from "@/store/user";
import { getUserInfoApi, updateUserInfoApi } from "@/api/apiReq";
@@ -14,6 +15,18 @@ export default function ProfilePage() {
const [isModalOpen, setIsModalOpen] = useState(false);
const [form] = Form.useForm();
+ // 模拟会员状态,实际应从 userInfo 或其他接口获取
+ const isVip = userInfo?.isVip || false; // 假设 userInfo 中有一个 isVip 字段
+
+ // 会员权益数据
+ const vipBenefits = [
+ { icon: <CrownOutlined />, name: "专属标识" },
+ { icon: <TrophyOutlined />, name: "高级功能" },
+ { icon: <GiftOutlined />, name: "会员礼包" },
+ { icon: <StarOutlined />, name: "优先支持" },
+ { icon: <RocketOutlined />, name: "更多特权" },
+ ];
+
// 获取用户信息
const fetchUserInfo = async () => {
try {
@@ -59,7 +72,7 @@ export default function ProfilePage() {
}
if (response.code === 0 && response.data) {
- setUserInfo(response.data);
+ fetchUserInfo();
message.success('更新成功');
setIsModalOpen(false);
} else {
@@ -70,12 +83,45 @@ export default function ProfilePage() {
}
};
+ const handleGoToVipPage = () => {
+ router.push('/vip'); // 跳转到开通会员页面
+ };
+
if (loading) {
return null;
}
return (
<div className={styles.container}>
+ <div className={styles.vipCard}>
+ <div className={styles.vipContent}>
+ <div className={styles.vipHeader}>
+ <span className={styles.vipIcon}><CrownOutlined /></span>
+ <h2 className={styles.vipTitle}>PLUS会员</h2>
+ </div>
+ <p className={styles.vipDescription}>
+ 开通会员解锁全部功能,立享8种权益
+ </p>
+ <div className={styles.benefitsGrid}>
+ {vipBenefits.map((benefit, index) => (
+ <div key={index} className={styles.benefitItem}>
+ <div className={styles.benefitIcon}>{benefit.icon}</div>
+ <p className={styles.benefitName}>{benefit.name}</p>
+ </div>
+ ))}
+ </div>
+ {isVip ? (
+ <Button className={styles.activateButton} disabled>
+ 已开通会员
+ </Button>
+ ) : (
+ <button className={styles.activateButton} onClick={handleGoToVipPage}>
+ 立即开通
+ </button>
+ )}
+ </div>
+ </div>
+
<Card
title="个人信息"
className={styles.card}
@@ -97,15 +143,18 @@ export default function ProfilePage() {
<Descriptions.Item label="账号状态">
{userInfo?.status === 1 ? '正常' : '禁用'}
</Descriptions.Item>
- <Descriptions.Item label="创建时间">
- {new Date(userInfo?.createTime || '').toLocaleString()}
- </Descriptions.Item>
- <Descriptions.Item label="最后更新">
- {new Date(userInfo?.updateTime || '').toLocaleString()}
- </Descriptions.Item>
</Descriptions>
</Card>
+ {!isVip && (
+ <div className={styles.normalUserCallToAction}>
+ <p>开通PLUS会员,体验更多高级功能!</p>
+ <button className={styles.activateButton} onClick={handleGoToVipPage}>
+ 立即开通PLUS会员
+ </button>
+ </div>
+ )}
+
<Modal
title="修改用户名"
open={isModalOpen}
diff --git a/src/app/[lng]/profile/profile.module.css b/src/app/[lng]/profile/profile.module.css
index e7aa72e2..5fa10dac 100644
--- a/src/app/[lng]/profile/profile.module.css
+++ b/src/app/[lng]/profile/profile.module.css
@@ -1,17 +1,11 @@
.container {
padding: 24px;
- background-color: var(--background-color);
- display: flex;
- justify-content: center;
- align-items: flex-start;
+ max-width: 800px;
+ margin: 0 auto;
}
.card {
- width: 100%;
- max-width: 800px;
- margin-top: 24px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
- border-radius: 16px;
+ margin-bottom: 24px;
}
.actions {
@@ -19,6 +13,129 @@
gap: 12px;
}
+/* 会员卡片样式 */
+.vipCard {
+ background: url('/assets/images/vipcard.png') no-repeat center center;
+ background-size: cover;
+ border-radius: 12px;
+ padding: 24px;
+ margin-bottom: 24px;
+ color: #fff;
+ position: relative;
+ overflow: hidden;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+}
+
+.vipCard::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: linear-gradient(to right, #2B2F36, #4E4C4D);
+ z-index: 0;
+ border-radius: 12px;
+}
+
+.vipContent {
+ position: relative;
+ z-index: 1;
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+.vipHeader {
+ display: flex;
+ align-items: center;
+ margin-bottom: 16px;
+}
+
+.vipIcon {
+ width: 32px;
+ height: 32px;
+ margin-right: 8px;
+ background-color: rgba(255, 255, 255, 0.2);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 20px;
+}
+
+.vipTitle {
+ font-size: 24px;
+ font-weight: bold;
+ color: #fce2a9; /* 金色 */
+}
+
+.vipDescription {
+ font-size: 14px;
+ color: rgba(255, 255, 255, 0.8);
+ margin-bottom: 24px;
+}
+
+.benefitsGrid {
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 16px;
+ margin-bottom: 32px;
+}
+
+.benefitItem {
+ text-align: center;
+}
+
+.benefitIcon {
+ width: 48px;
+ height: 48px;
+ background-color: rgba(255, 255, 255, 0.15);
+ border-radius: 8px;
+ margin: 0 auto 8px auto;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 24px;
+}
+
+.benefitName {
+ font-size: 13px;
+ color: rgba(255, 255, 255, 0.9);
+}
+
+.activateButton {
+ background: linear-gradient(to right, #6a5acd, #a64dd8); /* 紫色渐变 */
+ border: none;
+ color: white;
+ padding: 12px 24px;
+ border-radius: 8px;
+ font-size: 18px;
+ font-weight: bold;
+ cursor: pointer;
+ width: 100%;
+ transition: all 0.3s ease;
+
+ &:hover {
+ opacity: 0.9;
+ transform: translateY(-2px);
+ }
+}
+
+.normalUserCallToAction {
+ background-color: #f0f2f5;
+ padding: 20px;
+ border-radius: 8px;
+ text-align: center;
+ margin-top: 24px;
+}
+
+.normalUserCallToAction p {
+ font-size: 16px;
+ color: #555;
+ margin-bottom: 16px;
+}
+
/* 移动端适配 */
@media (max-width: 768px) {
.container {
diff --git a/src/app/[lng]/vip/page.tsx b/src/app/[lng]/vip/page.tsx
new file mode 100644
index 00000000..101088c0
--- /dev/null
+++ b/src/app/[lng]/vip/page.tsx
@@ -0,0 +1,84 @@
+"use client";
+
+import { useState } from "react";
+import { CrownOutlined, TrophyOutlined, GiftOutlined, StarOutlined, RocketOutlined, DollarOutlined, HistoryOutlined, ThunderboltOutlined } from "@ant-design/icons";
+import styles from "./vip.module.css";
+
+export default function VipPage() {
+ const [selectedPlan, setSelectedPlan] = useState('month'); // 'month' or 'year'
+
+ // 会员权益数据 (8个)
+ const vipBenefits = [
+ { icon: <CrownOutlined />, name: "专属标识" },
+ { icon: <TrophyOutlined />, name: "高级功能" },
+ { icon: <GiftOutlined />, name: "会员礼包" },
+ { icon: <StarOutlined />, name: "优先支持" },
+ { icon: <DollarOutlined />, name: "优惠折扣" },
+ { icon: <HistoryOutlined />, name: "无限时长" },
+ { icon: <ThunderboltOutlined />, name: "极速体验" },
+ { icon: <RocketOutlined />, name: "更多特权" }, // 重新排序,因为 RocketOutlined 之前已经用过
+ ];
+
+ const handleActivate = () => {
+ // 这里可以添加实际的开通逻辑,例如跳转到支付页面或调用支付接口
+ alert(`您选择了${selectedPlan === 'month' ? '月度会员' : '年度会员'},即将开通。`);
+ };
+
+ return (
+ <div className={styles.container}>
+ <div className={styles.vipCard}>
+ <div className={styles.vipContent}>
+ <div className={styles.vipHeader}>
+ <span className={styles.vipIcon}><CrownOutlined /></span>
+ <h2 className={styles.vipTitle}>PLUS会员</h2>
+ </div>
+ <p className={styles.vipDescription}>
+ 开通会员解锁全部功能,立享8种权益
+ </p>
+ <div className={styles.benefitsGrid}>
+ {vipBenefits.map((benefit, index) => (
+ <div key={index} className={styles.benefitItem}>
+ <div className={styles.benefitIcon}>{benefit.icon}</div>
+ <p className={styles.benefitName}>{benefit.name}</p>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+
+ <h3 className={styles.title}>选择开通时长</h3>
+ <div className={styles.priceOptions}>
+ <div
+ className={`${styles.priceCard} ${selectedPlan === 'month' ? styles.selected : ''}`}
+ onClick={() => setSelectedPlan('month')}
+ >
+ <span className={styles.badge}>最多选择</span>
+ <h4>月度会员</h4>
+ <div>
+ <span className={styles.originalPrice}>¥198</span>
+ <span className={styles.discount}>6折</span>
+ </div>
+ <p className={styles.currentPrice}>¥<span>128</span></p>
+ </div>
+ <div
+ className={`${styles.priceCard} ${selectedPlan === 'year' ? styles.selected : ''}`}
+ onClick={() => setSelectedPlan('year')}
+ >
+ <span className={styles.badge}>最高优惠</span>
+ <h4>年度会员</h4>
+ <div>
+ <span className={styles.originalPrice}>¥1938</span>
+ <span className={styles.discount}>5折</span>
+ </div>
+ <p className={styles.currentPrice}>¥<span>998</span></p>
+ </div>
+ </div>
+
+ <p className={styles.subscriptionInfo}>自动续订,随时取消</p>
+
+ <button className={styles.activateButton} onClick={handleActivate}>
+ 立即开通
+ </button>
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/src/app/[lng]/vip/vip.module.css b/src/app/[lng]/vip/vip.module.css
new file mode 100644
index 00000000..db6572f6
--- /dev/null
+++ b/src/app/[lng]/vip/vip.module.css
@@ -0,0 +1,202 @@
+.container {
+ padding: 24px;
+ max-width: 800px;
+ margin: 0 auto;
+ text-align: center;
+}
+
+.title {
+ font-size: 32px;
+ color: #333;
+ margin-bottom: 24px;
+}
+
+.placeholder {
+ background-color: #f0f2f5;
+ padding: 48px;
+ border-radius: 8px;
+ font-size: 18px;
+ color: #666;
+}
+
+/* 会员卡片样式 */
+.vipCard {
+ background: url('/assets/images/vipcard.png') no-repeat center center;
+ background-size: cover;
+ border-radius: 12px;
+ padding: 24px;
+ margin-bottom: 24px;
+ color: #fff;
+ position: relative;
+ overflow: hidden;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+}
+
+.vipCard::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: linear-gradient(to right, #2B2F36, #4E4C4D);
+ z-index: 0;
+ border-radius: 12px;
+}
+
+.vipContent {
+ position: relative;
+ z-index: 1;
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+.vipHeader {
+ display: flex;
+ align-items: center;
+ margin-bottom: 16px;
+}
+
+.vipIcon {
+ width: 32px;
+ height: 32px;
+ margin-right: 8px;
+ background-color: rgba(255, 255, 255, 0.2);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 20px;
+}
+
+.vipTitle {
+ font-size: 24px;
+ font-weight: bold;
+ color: #fce2a9; /* 金色 */
+}
+
+.vipDescription {
+ font-size: 14px;
+ color: rgba(255, 255, 255, 0.8);
+ margin-bottom: 24px;
+}
+
+.benefitsGrid {
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 16px;
+ margin-bottom: 32px;
+}
+
+.benefitItem {
+ text-align: center;
+}
+
+.benefitIcon {
+ width: 48px;
+ height: 48px;
+ background-color: rgba(255, 255, 255, 0.15);
+ border-radius: 8px;
+ margin: 0 auto 8px auto;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 24px;
+}
+
+.benefitName {
+ font-size: 13px;
+ color: rgba(255, 255, 255, 0.9);
+}
+
+.activateButton {
+ background: linear-gradient(to right, #6a5acd, #a64dd8); /* 紫色渐变 */
+ border: none;
+ color: white;
+ padding: 12px 24px;
+ border-radius: 8px;
+ font-size: 18px;
+ font-weight: bold;
+ cursor: pointer;
+ width: 100%;
+ transition: all 0.3s ease;
+
+ &:hover {
+ opacity: 0.9;
+ transform: translateY(-2px);
+ }
+}
+
+.priceOptions {
+ display: flex;
+ justify-content: center;
+ gap: 24px;
+ margin-bottom: 32px;
+}
+
+.priceCard {
+ border: 2px solid #eee;
+ border-radius: 12px;
+ padding: 24px;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ width: 100%;
+ max-width: 280px;
+ position: relative;
+ text-align: left;
+}
+
+.priceCard.selected {
+ border-color: #6a5acd;
+ box-shadow: 0 4px 12px rgba(106, 90, 205, 0.2);
+}
+
+.badge {
+ position: absolute;
+ top: 0;
+ right: 0;
+ background: linear-gradient(to right, #ff7e5f, #feb47b);
+ color: white;
+ font-size: 12px;
+ padding: 4px 12px;
+ border-bottom-left-radius: 8px;
+ border-top-right-radius: 10px;
+}
+
+.priceCard h4 {
+ font-size: 18px;
+ margin-top: 0;
+ margin-bottom: 8px;
+ color: #333;
+}
+
+.originalPrice {
+ font-size: 14px;
+ color: #999;
+ text-decoration: line-through;
+ margin-right: 8px;
+}
+
+.discount {
+ font-size: 14px;
+ color: #e91e63;
+ font-weight: bold;
+}
+
+.currentPrice {
+ font-size: 32px;
+ font-weight: bold;
+ color: #6a5acd;
+ margin-top: 16px;
+}
+
+.currentPrice span {
+ font-size: 20px;
+}
+
+.subscriptionInfo {
+ font-size: 14px;
+ color: #999;
+ margin-bottom: 24px;
+}
\ No newline at end of file
diff --git a/src/assets/images/vipcard.png b/src/assets/images/vipcard.png
new file mode 100644
index 00000000..ed556b66
Binary files /dev/null and b/src/assets/images/vipcard.png differ
diff --git a/src/store/user.ts b/src/store/user.ts
index aa074e46..d7493ec6 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -12,6 +12,7 @@ export interface UserInfo {
updateTime: string;
_id: string;
avatar?: string;
+ isVip?: boolean;
}
export interface IUserStore {