first commit
This commit is contained in:
441
pages/mine/help.vue
Normal file
441
pages/mine/help.vue
Normal file
@@ -0,0 +1,441 @@
|
||||
<template>
|
||||
<view class="help-page">
|
||||
<NavBar title="帮助中心" />
|
||||
|
||||
<!-- Search Bar -->
|
||||
<!-- <view class="search-box">
|
||||
<view class="search-input-box">
|
||||
<uni-icons type="search" size="18" color="#999" />
|
||||
<text class="placeholder">搜索你遇到的问题</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="content-scroll">
|
||||
<!-- Quick Start -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<view class="red-bar"></view>
|
||||
<text class="section-title">快速上手</text>
|
||||
</view>
|
||||
<view class="steps-card">
|
||||
<view class="step-item">
|
||||
<view class="icon-circle">
|
||||
<uni-icons type="email-filled" size="30" color="#ff3b30" />
|
||||
</view>
|
||||
<text class="step-text">制作贺卡</text>
|
||||
</view>
|
||||
<view class="arrow">
|
||||
<uni-icons type="arrowright" size="16" color="#ffccc7" />
|
||||
</view>
|
||||
<view class="step-item">
|
||||
<view class="icon-circle">
|
||||
<uni-icons type="person-filled" size="30" color="#ff3b30" />
|
||||
</view>
|
||||
<text class="step-text">佩戴挂饰</text>
|
||||
</view>
|
||||
<view class="arrow">
|
||||
<uni-icons type="arrowright" size="16" color="#ffccc7" />
|
||||
</view>
|
||||
<view class="step-item">
|
||||
<view class="icon-circle">
|
||||
<uni-icons type="gift-filled" size="30" color="#ff3b30" />
|
||||
</view>
|
||||
<text class="step-text">送出祝福</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- FAQ -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<view class="red-bar"></view>
|
||||
<text class="section-title">常见问题</text>
|
||||
</view>
|
||||
|
||||
<view class="faq-list">
|
||||
<view
|
||||
v-for="(category, index) in faqList"
|
||||
:key="index"
|
||||
class="faq-category"
|
||||
>
|
||||
<view class="category-header" @click="toggleCategory(index)">
|
||||
<view class="cat-left">
|
||||
<uni-icons
|
||||
:type="category.icon"
|
||||
size="20"
|
||||
color="#ff3b30"
|
||||
class="cat-icon"
|
||||
/>
|
||||
<text class="cat-title">{{ category.title }}</text>
|
||||
</view>
|
||||
<uni-icons
|
||||
:type="category.expanded ? 'bottom' : 'right'"
|
||||
size="16"
|
||||
color="#ccc"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view v-if="category.expanded" class="category-content">
|
||||
<view
|
||||
v-for="(item, idx) in category.items"
|
||||
:key="idx"
|
||||
class="faq-item"
|
||||
>
|
||||
<view class="question" @click="toggleQuestion(index, idx)">
|
||||
<text>{{ item.q }}</text>
|
||||
<uni-icons type="right" size="14" color="#ccc" />
|
||||
</view>
|
||||
<view class="answer">
|
||||
<text>{{ item.a }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Contact Support -->
|
||||
<view class="contact-section">
|
||||
<view class="contact-card">
|
||||
<view class="contact-title">没找到答案?</view>
|
||||
<view class="contact-btns">
|
||||
<button class="c-btn" open-type="contact">
|
||||
<uni-icons type="chatbubbles-filled" size="20" color="#fff" />
|
||||
<text>在线客服</text>
|
||||
</button>
|
||||
<!-- <button class="c-btn">
|
||||
<uni-icons type="world-filled" size="20" color="#fff" />
|
||||
<text>官方公众号</text>
|
||||
</button> -->
|
||||
</view>
|
||||
<view class="bg-decor">
|
||||
<uni-icons
|
||||
type="help-filled"
|
||||
size="120"
|
||||
color="rgba(255,255,255,0.1)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Footer -->
|
||||
<view class="footer">
|
||||
<view class="footer-blessing">
|
||||
<uni-icons type="vip-filled" size="14" color="#ff3b30" />
|
||||
<text>祝您 万事大吉,万事如意</text>
|
||||
</view>
|
||||
<view class="footer-copy">官方出品</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
|
||||
onMounted(() => {
|
||||
trackRecord({
|
||||
eventName: "help_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
const faqList = ref([
|
||||
{
|
||||
title: "贺卡制作",
|
||||
icon: "compose",
|
||||
expanded: true,
|
||||
items: [
|
||||
{
|
||||
q: "如何分享给微信好友?",
|
||||
a: "制作完成后,点击右下角“分享给好友”按钮即可。您也可以保存为图片后在聊天对话框发送。",
|
||||
},
|
||||
{
|
||||
q: "生成速度太慢怎么办?",
|
||||
a: "生成速度受网络环境和服务器负载影响,请您耐心等待或尝试切换网络。",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "头像定制",
|
||||
icon: "person",
|
||||
expanded: false,
|
||||
items: [
|
||||
{
|
||||
q: "如何更换新的头像",
|
||||
a: "在头像定制页面,首先选择上传头像或系统头像,左边选择您喜欢的边框样式,右边选择头像挂饰,可移动位置,缩放大小,点击保存即可。",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "运势抽取",
|
||||
icon: "calendar",
|
||||
expanded: false,
|
||||
items: [
|
||||
{
|
||||
q: "每天可以抽取几次?",
|
||||
a: "每位用户每天有1次免费抽取机会,分享给好友可获得额外机会。",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "壁纸保存",
|
||||
icon: "image",
|
||||
expanded: false,
|
||||
items: [
|
||||
{
|
||||
q: "下载壁纸不清晰怎么办?",
|
||||
a: "请确保您下载的是原图。如果网络不稳定,可能会自动加载低清预览图,请等待加载完成后再保存。",
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const copyright = [
|
||||
"如有疑问,请通过“我的-使用说明”联系客服处理。",
|
||||
"最终解释权归 2026 助手团队所有。",
|
||||
];
|
||||
|
||||
const toggleCategory = (index) => {
|
||||
faqList.value[index].expanded = !faqList.value[index].expanded;
|
||||
};
|
||||
|
||||
const toggleQuestion = (catIndex, itemIndex) => {
|
||||
// Simple expansion for question details not implemented in design but structure is there
|
||||
// The design shows the answer directly under the question for the first item
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.help-page {
|
||||
min-height: 100vh;
|
||||
background-color: #fcfcfc;
|
||||
padding-bottom: 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
padding: 20rpx 30rpx;
|
||||
background: #fff;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.search-input-box {
|
||||
background: #f5f5f5;
|
||||
height: 72rpx;
|
||||
border-radius: 36rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24rpx;
|
||||
|
||||
.placeholder {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.content-scroll {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.section {
|
||||
padding: 30rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
.red-bar {
|
||||
width: 6rpx;
|
||||
height: 28rpx;
|
||||
background: #ff3b30;
|
||||
border-radius: 4rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #ff3b30;
|
||||
}
|
||||
}
|
||||
|
||||
.steps-card {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 40rpx 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.02);
|
||||
|
||||
.step-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.icon-circle {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background: #fff6f6;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.step-text {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.arrow {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.faq-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.faq-category {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.02);
|
||||
|
||||
.category-header {
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.cat-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
|
||||
.cat-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.category-content {
|
||||
background: #fcfcfc;
|
||||
padding: 0 30rpx 30rpx;
|
||||
|
||||
.faq-item {
|
||||
margin-top: 24rpx;
|
||||
|
||||
.question {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.answer {
|
||||
font-size: 26rpx;
|
||||
color: #888;
|
||||
line-height: 1.6;
|
||||
background: #f8f8f8;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.contact-section {
|
||||
padding: 0 30rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.contact-card {
|
||||
background: linear-gradient(135deg, #e52e2e 0%, #c61a1a 100%);
|
||||
border-radius: 30rpx;
|
||||
padding: 40rpx;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
|
||||
.contact-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.contact-btns {
|
||||
display: flex;
|
||||
gap: 30rpx;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
.c-btn {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bg-decor {
|
||||
position: absolute;
|
||||
right: -20rpx;
|
||||
bottom: -40rpx;
|
||||
opacity: 0.5;
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 60rpx;
|
||||
text-align: center;
|
||||
padding-bottom: 60rpx;
|
||||
|
||||
.footer-blessing {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #ff8888;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.footer-copy {
|
||||
font-size: 20rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
510
pages/mine/mine.vue
Normal file
510
pages/mine/mine.vue
Normal file
@@ -0,0 +1,510 @@
|
||||
<template>
|
||||
<view class="mine-page">
|
||||
<!-- Custom Navbar -->
|
||||
<view
|
||||
class="nav-bar"
|
||||
:style="{ paddingTop: navBarTop + 'px', height: navBarHeight + 'px' }"
|
||||
>
|
||||
<!-- <text class="nav-title">我的</text> -->
|
||||
</view>
|
||||
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="content-scroll"
|
||||
:style="{ paddingTop: navBarTop + navBarHeight + 'px' }"
|
||||
>
|
||||
<view class="content-wrap">
|
||||
<!-- User Card -->
|
||||
<view class="user-card" @tap="handleUserClick">
|
||||
<view class="avatar-box">
|
||||
<image :src="userInfo.avatarUrl" class="avatar" mode="aspectFill" />
|
||||
<!-- <view class="red-badge"><text class="fire">🔥</text></view> -->
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<view class="row-1">
|
||||
<text class="nickname">{{ userInfo.nickName }}</text>
|
||||
<view class="vip-tag" v-if="isLoggedIn && userInfo.isVip">
|
||||
<text class="vip-text">VIP 祥瑞会员</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row-2" v-if="isLoggedIn">
|
||||
<!-- <text class="arrow-icon">➤</text> -->
|
||||
<!-- <text class="stats-text"
|
||||
>已发送 <text class="num">3</text> 条新春祝福</text
|
||||
> -->
|
||||
</view>
|
||||
<view class="row-2" v-else>
|
||||
<text class="stats-text">点击登录解锁更多功能</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-arrow">›</view>
|
||||
</view>
|
||||
|
||||
<!-- VIP Banner -->
|
||||
<view v-if="!isIos" class="vip-banner" @tap="navTo('vip')">
|
||||
<view class="vip-left">
|
||||
<view class="vip-icon-box">
|
||||
<uni-icons type="vip-filled" size="32" color="#5d4037" />
|
||||
</view>
|
||||
<view class="vip-content">
|
||||
<view class="vip-title-row">
|
||||
<text class="vip-title">祥瑞会员中心</text>
|
||||
<view class="diamond-tag">DIAMOND</view>
|
||||
</view>
|
||||
<text class="vip-subtitle">开通会员解锁全部特权</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="vip-right">
|
||||
<text class="open-text">立即开通</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- My Creations -->
|
||||
<view class="section-title">我的xx</view>
|
||||
<view class="menu-group">
|
||||
<view class="menu-item" @tap="navTo('avatar')">
|
||||
<view class="icon-box pink-bg"><text>☺</text></view>
|
||||
<text class="menu-text">我的专属头像</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Other Actions -->
|
||||
<view class="menu-group mt-30">
|
||||
<button class="menu-item share-btn" open-type="share">
|
||||
<view class="icon-left"><text class="share-icon">🔗</text></view>
|
||||
<text class="menu-text">分享给好友</text>
|
||||
<text class="arrow">›</text>
|
||||
</button>
|
||||
<view class="menu-item" @tap="navTo('feedback')">
|
||||
<view class="icon-left"><text class="feedback-icon">📝</text></view>
|
||||
<text class="menu-text">意见反馈</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" @tap="navTo('help')">
|
||||
<view class="icon-left"><text class="help-icon">❓</text></view>
|
||||
<text class="menu-text">使用说明 / 帮助</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Footer -->
|
||||
<!-- <view class="version-info">2026 丙午马年 · 精美助手 v1.0.2</view> -->
|
||||
|
||||
|
||||
<view style="height: 120rpx"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- Login Popup -->
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { onShareAppMessage, onLoad } from "@dcloudio/uni-app";
|
||||
import { getShareToken } from "@/utils/common";
|
||||
import { getShareReward } from "@/api/system";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
|
||||
// Navigation Bar
|
||||
const navBarTop = ref(20);
|
||||
const navBarHeight = ref(44);
|
||||
|
||||
// User Info
|
||||
const defaultAvatarUrl =
|
||||
"https://file.lihailezzc.com/resource/d9b329082b32f8305101f708593a4882.png";
|
||||
|
||||
const userInfo = computed(() => ({
|
||||
nickName: userStore.userInfo.nickName || "点击登录",
|
||||
avatarUrl: userStore.userInfo.avatarUrl || defaultAvatarUrl,
|
||||
isVip: userStore.userInfo.isVip || false,
|
||||
}));
|
||||
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
|
||||
const isIos = computed(() => uni.getSystemInfoSync().osName === "ios");
|
||||
|
||||
onLoad((options) => {
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
navBarTop.value = sysInfo.statusBarHeight;
|
||||
navBarHeight.value = 44;
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
const shareToken = await getShareToken("mine");
|
||||
getShareReward({ scene: "mine" });
|
||||
return {
|
||||
title: "分享",
|
||||
path: "/pages/index/index?shareToken=" + shareToken,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const handleUserClick = () => {
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
} else {
|
||||
// Navigate to profile details
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/profile",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleLogind = async () => {
|
||||
// Logic after successful login if needed
|
||||
};
|
||||
|
||||
const navTo = (page) => {
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
uni.showToast({ title: "请先登录", icon: "none" });
|
||||
return;
|
||||
}
|
||||
|
||||
if (page === "avatar") {
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/avatar",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (page === "feedback") {
|
||||
uni.navigateTo({
|
||||
url: "/pages/feedback/index",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (page === "help") {
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/help",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (page === "vip") {
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/vip",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showToast({ title: "功能开发中", icon: "none" });
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mine-page {
|
||||
min-height: 100vh;
|
||||
background: #f9f9f9;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.nav-bar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
.nav-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.content-scroll {
|
||||
height: 100vh;
|
||||
}
|
||||
.content-wrap {
|
||||
padding: 20rpx 30rpx 40rpx;
|
||||
}
|
||||
|
||||
/* User Card */
|
||||
.user-card {
|
||||
background: #fff;
|
||||
border-radius: 30rpx;
|
||||
padding: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
position: relative;
|
||||
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
.avatar-box {
|
||||
position: relative;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
border: 4rpx solid #fff;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.red-badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: #ff3b30;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2rpx solid #fff;
|
||||
}
|
||||
.fire {
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
flex: 1;
|
||||
}
|
||||
.row-1 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.nickname {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
.vip-tag {
|
||||
background: #ffecec;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
.vip-text {
|
||||
color: #ff3b30;
|
||||
font-size: 20rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.row-2 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.arrow-icon {
|
||||
color: #ff3b30;
|
||||
font-size: 20rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.stats-text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
.num {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
.card-arrow {
|
||||
font-size: 40rpx;
|
||||
color: #ccc;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
/* VIP Banner */
|
||||
.vip-banner {
|
||||
background: linear-gradient(135deg, #2e2424 0%, #1a1616 100%);
|
||||
border-radius: 30rpx;
|
||||
padding: 30rpx 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 40rpx;
|
||||
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.vip-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.vip-icon-box {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background: #fceea9;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 24rpx;
|
||||
border: 4rpx solid #bfa46f;
|
||||
}
|
||||
|
||||
.vip-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.vip-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.vip-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #fceea9;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.diamond-tag {
|
||||
background: rgba(252, 238, 169, 0.15);
|
||||
color: #fceea9;
|
||||
font-size: 18rpx;
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid rgba(252, 238, 169, 0.4);
|
||||
}
|
||||
|
||||
.vip-subtitle {
|
||||
font-size: 22rpx;
|
||||
color: rgba(252, 238, 169, 0.6);
|
||||
}
|
||||
|
||||
.vip-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.open-text {
|
||||
font-size: 26rpx;
|
||||
color: #fceea9;
|
||||
margin-right: 4rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.vip-banner .arrow {
|
||||
color: #fceea9;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
/* Section Title */
|
||||
.section-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
color: #999;
|
||||
margin-bottom: 20rpx;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
/* Menu Group */
|
||||
.menu-group {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 40rpx;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
.menu-group.mt-30 {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
}
|
||||
.menu-item:active {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
/* For button reset */
|
||||
.menu-item.share-btn {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
line-height: normal;
|
||||
border-radius: 0;
|
||||
}
|
||||
.menu-item.share-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.icon-box {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 24rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.red-bg {
|
||||
background: #fff0f0;
|
||||
color: #ff3b30;
|
||||
}
|
||||
.orange-bg {
|
||||
background: #fff8e6;
|
||||
color: #ff9500;
|
||||
}
|
||||
.pink-bg {
|
||||
background: #fff0f5;
|
||||
color: #ff2d55;
|
||||
}
|
||||
.yellow-bg {
|
||||
background: #fffae0;
|
||||
color: #ffcc00;
|
||||
}
|
||||
.gray-bg {
|
||||
background: #f5f5f5;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.icon-left {
|
||||
width: 40rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-right: 24rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
.share-icon,
|
||||
.help-icon,
|
||||
.feedback-icon {
|
||||
font-size: 36rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.menu-text {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
.new-badge {
|
||||
background: #ff3b30;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
.arrow {
|
||||
color: #ccc;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
/* Version Info */
|
||||
.version-info {
|
||||
text-align: center;
|
||||
color: #ccc;
|
||||
font-size: 22rpx;
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
</style>
|
||||
372
pages/mine/profile.vue
Normal file
372
pages/mine/profile.vue
Normal file
@@ -0,0 +1,372 @@
|
||||
<template>
|
||||
<view class="profile-page">
|
||||
<NavBar title="个人信息" />
|
||||
|
||||
<!-- Content -->
|
||||
<view class="content">
|
||||
<!-- Avatar Section -->
|
||||
<view class="avatar-section">
|
||||
<view class="avatar-wrapper" @click="handleAvatarClick">
|
||||
<image
|
||||
class="avatar"
|
||||
:src="
|
||||
userInfo.avatarUrl ||
|
||||
'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
|
||||
"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="camera-badge">
|
||||
<uni-icons type="camera-filled" size="16" color="#ff3b30" />
|
||||
</view>
|
||||
</view>
|
||||
<text class="change-avatar-text">更换头像</text>
|
||||
</view>
|
||||
|
||||
<!-- Info List -->
|
||||
<view class="info-card">
|
||||
<view class="info-item" @click="handleEditName">
|
||||
<text class="label">昵称</text>
|
||||
<view class="value-box">
|
||||
<text class="value">{{ form.nickName || "微信用户" }}</text>
|
||||
<uni-icons type="right" size="14" color="#ccc" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="info-item" @click="handleEditGender">
|
||||
<text class="label">性别</text>
|
||||
<view class="value-box">
|
||||
<text class="value">{{ genderText }}</text>
|
||||
<uni-icons type="right" size="14" color="#ccc" />
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="info-item" @click="handleEditManifesto">
|
||||
<text class="label">个性宣言</text>
|
||||
<view class="value-box">
|
||||
<text class="value red-text">{{ form.bio || "点击选择" }}</text>
|
||||
<uni-icons type="compose" size="16" color="#ccc" />
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- Account Binding -->
|
||||
<!-- <view class="section-header">
|
||||
<text class="section-title">账号绑定</text>
|
||||
</view>
|
||||
<view class="info-card">
|
||||
<view class="info-item">
|
||||
<text class="label">手机号</text>
|
||||
<view class="value-box">
|
||||
<text class="value">138 **** 8888</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">微信号</text>
|
||||
<view class="value-box">
|
||||
<text class="value">WX_CN_2026</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- Trophy Decoration -->
|
||||
<view class="trophy-decoration">
|
||||
<uni-icons type="medal" size="60" color="#e0e0e0" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Bottom Action Bar -->
|
||||
<view class="bottom-bar safe-area-bottom">
|
||||
<button class="save-btn" @click="handleSave">
|
||||
<text>保存修改</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { updateUserInfo } from "@/api/auth.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
|
||||
const form = ref({
|
||||
nickName: "",
|
||||
gender: 1, // 1: 男, 2: 女
|
||||
bio: "",
|
||||
});
|
||||
|
||||
const genderText = computed(() => {
|
||||
if (form.value.gender === 1) return "男";
|
||||
if (form.value.gender === 2) return "女";
|
||||
return "未知";
|
||||
});
|
||||
|
||||
watch(
|
||||
userInfo,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
form.value.nickName = newVal.nickName || "";
|
||||
form.value.gender = newVal.gender || 1;
|
||||
form.value.bio = newVal.bio || "万事如意,岁岁平安";
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
|
||||
const handleAvatarClick = () => {
|
||||
// Navigate to avatar page or open picker
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/avatar",
|
||||
});
|
||||
};
|
||||
|
||||
const showEditNameModal = (content) => {
|
||||
uni.showModal({
|
||||
title: "修改昵称",
|
||||
editable: true,
|
||||
placeholderText: "请输入昵称(最多5个字)",
|
||||
content: content,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
if (res.content.length > 5) {
|
||||
uni.showToast({ title: "昵称最多5个字", icon: "none" });
|
||||
// 重新打开弹窗以模拟“不消失”,并保留用户输入
|
||||
setTimeout(() => {
|
||||
showEditNameModal(res.content);
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
form.value.nickName = res.content;
|
||||
handleSave();
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleEditName = () => {
|
||||
showEditNameModal(form.value.nickName);
|
||||
};
|
||||
|
||||
const handleEditGender = () => {
|
||||
uni.showActionSheet({
|
||||
itemList: ["男", "女"],
|
||||
success: (res) => {
|
||||
form.value.gender = res.tapIndex + 1;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const manifestoOptions = [
|
||||
"万事如意,岁岁平安",
|
||||
"龙马精神,财运亨通",
|
||||
"心想事成,大吉大利",
|
||||
"身体健康,阖家幸福",
|
||||
"吉星高照,福寿安康",
|
||||
];
|
||||
|
||||
const handleEditManifesto = () => {
|
||||
uni.showActionSheet({
|
||||
itemList: manifestoOptions,
|
||||
success: (res) => {
|
||||
form.value.bio = manifestoOptions[res.tapIndex];
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!form.value.nickName) {
|
||||
uni.showToast({ title: "请输入昵称", icon: "none" });
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({ title: "保存中...", mask: true });
|
||||
// 保存当前值,以便失败时恢复
|
||||
const originalForm = {
|
||||
nickName: userInfo.value.nickName || "",
|
||||
gender: userInfo.value.gender || 1,
|
||||
bio: userInfo.value.bio || "万事如意,岁岁平安",
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await updateUserInfo({
|
||||
nickname: form.value.nickName,
|
||||
gender: form.value.gender,
|
||||
bio: form.value.bio,
|
||||
});
|
||||
|
||||
// Check result
|
||||
if (res && res.success) {
|
||||
await userStore.fetchUserInfo();
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "保存成功", icon: "success" });
|
||||
} else {
|
||||
// 恢复之前的内容
|
||||
form.value = { ...originalForm };
|
||||
uni.showToast({ title: res.message || "修改失败", icon: "none" });
|
||||
uni.hideLoading();
|
||||
}
|
||||
} catch (e) {
|
||||
// 恢复之前的内容
|
||||
form.value = { ...originalForm };
|
||||
uni.hideLoading();
|
||||
// Error is handled by request usually if showError is true.
|
||||
// But we can show toast too.
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.profile-page {
|
||||
min-height: 100vh;
|
||||
background-color: #fcfcfc;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 200rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
/* Avatar Section */
|
||||
.avatar-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.avatar-wrapper {
|
||||
position: relative;
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
background: #f8cb8c;
|
||||
border-radius: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20rpx;
|
||||
border: 4rpx solid #fff;
|
||||
box-shadow: 0 10rpx 30rpx rgba(248, 203, 140, 0.4);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.camera-badge {
|
||||
position: absolute;
|
||||
bottom: -10rpx;
|
||||
right: -10rpx;
|
||||
background: #fff;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.change-avatar-text {
|
||||
font-size: 26rpx;
|
||||
color: #8a6d65;
|
||||
}
|
||||
|
||||
/* Info List */
|
||||
.info-card {
|
||||
background: #fff;
|
||||
border-radius: 30rpx;
|
||||
padding: 0 30rpx;
|
||||
margin-bottom: 40rpx;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 110rpx;
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.value-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
margin-right: 10rpx;
|
||||
font-weight: 500;
|
||||
|
||||
&.red-text {
|
||||
color: #ff3b30;
|
||||
}
|
||||
}
|
||||
|
||||
/* Section Header */
|
||||
.section-header {
|
||||
padding: 0 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #8a6d65;
|
||||
}
|
||||
|
||||
/* Trophy Decoration */
|
||||
.trophy-decoration {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 60rpx;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Bottom Bar */
|
||||
.bottom-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background: #fcfcfc;
|
||||
padding: 20rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
background: #d32f2f;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
box-shadow: 0 10rpx 20rpx rgba(211, 47, 47, 0.2);
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
529
pages/mine/vip.vue
Normal file
529
pages/mine/vip.vue
Normal file
@@ -0,0 +1,529 @@
|
||||
<template>
|
||||
<view class="vip-page">
|
||||
<NavBar title="会员中心" />
|
||||
|
||||
<!-- Content -->
|
||||
<view class="content">
|
||||
<!-- User Info Card -->
|
||||
<view class="user-card">
|
||||
<view class="avatar-box">
|
||||
<image
|
||||
class="avatar"
|
||||
:src="
|
||||
userInfo.avatarUrl ||
|
||||
'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
|
||||
"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="fire-badge">
|
||||
<uni-icons type="fire-filled" size="14" color="#fff" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<view class="name-row">
|
||||
<text class="username">{{ userInfo.nickName || "微信用户" }}</text>
|
||||
<view class="vip-tag" v-if="userInfo.isVip">VIP 祥瑞会员</view>
|
||||
<view class="vip-tag gray" v-else>普通用户</view>
|
||||
</view>
|
||||
<text class="expiry-date" v-if="userInfo.isVip">
|
||||
{{ userInfo.vipExpireAt }} 到期
|
||||
</text>
|
||||
<text class="expiry-date" v-else>开通会员解锁专属权益</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Plans -->
|
||||
<view class="section-title">选择会员方案</view>
|
||||
<view class="plans-grid">
|
||||
<view
|
||||
v-for="(plan, index) in plans"
|
||||
:key="index"
|
||||
class="plan-card"
|
||||
:class="{ active: selectedPlanIndex === index }"
|
||||
@click="selectPlan(index)"
|
||||
>
|
||||
<view v-if="plan.badge" class="plan-badge" :class="plan.badgeType">
|
||||
{{ plan.badge }}
|
||||
</view>
|
||||
<text class="plan-duration">{{ plan.name }}</text>
|
||||
<view class="plan-price">
|
||||
<text class="currency">¥</text>
|
||||
<text class="amount">{{ plan.price / 100 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Benefits -->
|
||||
<view class="benefits-card">
|
||||
<view class="card-header">
|
||||
<uni-icons type="vip-filled" size="20" color="#ff3b30" />
|
||||
<text class="card-title">会员专属权益</text>
|
||||
</view>
|
||||
<view class="benefits-grid">
|
||||
<view
|
||||
v-for="(benefit, index) in benefits"
|
||||
:key="index"
|
||||
class="benefit-item"
|
||||
>
|
||||
<view class="benefit-icon-box" :style="{ background: benefit.bg }">
|
||||
<uni-icons
|
||||
:type="benefit.icon"
|
||||
size="24"
|
||||
:color="benefit.color"
|
||||
/>
|
||||
</view>
|
||||
<text class="benefit-name">{{ benefit.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Purchase Notes -->
|
||||
<view class="notes-section">
|
||||
<text class="notes-title">购买说明</text>
|
||||
<view class="notes-list">
|
||||
<view class="note-item" v-for="(note, index) in notes" :key="index">
|
||||
<text class="dot">•</text>
|
||||
<text class="note-text">{{ note }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Bottom Action Bar -->
|
||||
<view class="bottom-bar safe-area-bottom">
|
||||
<button class="buy-btn" @click="handlePurchase">
|
||||
<text>立即开通</text>
|
||||
<uni-icons
|
||||
type="arrowright"
|
||||
size="18"
|
||||
color="#fff"
|
||||
style="margin-left: 4rpx"
|
||||
/>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { createOrder, getVipPlan } from "@/api/pay.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { getPlatformProvider } from "@/utils/system";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
|
||||
const selectedPlanIndex = ref(1);
|
||||
|
||||
const plans = ref([]);
|
||||
|
||||
const benefits = [
|
||||
{ name: "纯净无广", icon: "star-filled", color: "#ff3b30", bg: "#fff0f0" },
|
||||
{ name: "多次下载", icon: "image-filled", color: "#ff6b00", bg: "#fff7e6" },
|
||||
{
|
||||
name: "会员精选头像",
|
||||
icon: "medal-filled",
|
||||
color: "#bfa46f",
|
||||
bg: "#fffbe6",
|
||||
},
|
||||
{
|
||||
name: "会员精选模版",
|
||||
icon: "upload-filled",
|
||||
color: "#ff3b30",
|
||||
bg: "#fff0f0",
|
||||
},
|
||||
{
|
||||
name: "数据永久保存",
|
||||
icon: "paperplane-filled",
|
||||
color: "#409eff",
|
||||
bg: "#ecf5ff",
|
||||
},
|
||||
{ name: "1对1服务", icon: "headphones", color: "#9053fa", bg: "#f5f0ff" },
|
||||
];
|
||||
|
||||
const notes = [
|
||||
"会员服务为虚拟产品,支付后立即生效,不支持退款。",
|
||||
"会员权益在有效期内全平台通用。",
|
||||
"如有疑问,请通过“我的-使用说明”联系客服处理。",
|
||||
"最终解释权归 本平台所有。",
|
||||
];
|
||||
|
||||
onMounted(() => {
|
||||
getVipPlanList();
|
||||
});
|
||||
|
||||
const getVipPlanList = async () => {
|
||||
const planRes = await getVipPlan();
|
||||
plans.value = planRes;
|
||||
};
|
||||
|
||||
const selectPlan = (index) => {
|
||||
selectedPlanIndex.value = index;
|
||||
};
|
||||
|
||||
const handlePurchase = async () => {
|
||||
if (selectedPlanIndex.value < 0 || !plans.value[selectedPlanIndex.value]) {
|
||||
uni.showToast({ title: "请选择会员方案", icon: "none" });
|
||||
return;
|
||||
}
|
||||
|
||||
const plan = plans.value[selectedPlanIndex.value];
|
||||
|
||||
uni.showLoading({ title: "正在发起支付...", mask: true });
|
||||
|
||||
try {
|
||||
const orderRes = await createOrder({
|
||||
planId: plan.id,
|
||||
});
|
||||
|
||||
if (orderRes?.payParams) {
|
||||
const platform = getPlatformProvider();
|
||||
const provider = platform === "mp-alipay" ? "alipay" : "wxpay";
|
||||
|
||||
uni.requestPayment({
|
||||
provider: provider,
|
||||
...orderRes.payParams,
|
||||
success(res) {
|
||||
uni.showToast({ title: "支付成功", icon: "success" });
|
||||
// 支付成功后可以刷新用户信息
|
||||
userStore.fetchUserInfo();
|
||||
},
|
||||
fail(err) {
|
||||
console.log("payment fail", err);
|
||||
// 支付宝取消支付的错误码是 6001
|
||||
// 微信取消支付的错误信息包含 cancel
|
||||
if (err.errMsg.indexOf("cancel") > -1 || err.resultCode === "6001") {
|
||||
uni.showToast({ title: "支付已取消", icon: "none" });
|
||||
} else {
|
||||
uni.showToast({ title: "支付失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
complete() {
|
||||
uni.hideLoading();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "获取支付参数失败", icon: "none" });
|
||||
}
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "创建订单失败", icon: "none" });
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.vip-page {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f8f8;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 200rpx; // Space for bottom bar
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
/* User Card */
|
||||
.user-card {
|
||||
background: #fff;
|
||||
border-radius: 30rpx;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 10rpx 40rpx rgba(255, 59, 48, 0.08);
|
||||
margin-bottom: 40rpx;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
// Decorative gradient background hint
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
right: -20%;
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
background: radial-gradient(
|
||||
circle,
|
||||
rgba(255, 59, 48, 0.1) 0%,
|
||||
transparent 70%
|
||||
);
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
position: relative;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
border: 4rpx solid #fff;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.fire-badge {
|
||||
position: absolute;
|
||||
top: -6rpx;
|
||||
right: -6rpx;
|
||||
background: #ff3b30;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2rpx solid #fff;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.username {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.vip-tag {
|
||||
background: rgba(255, 59, 48, 0.1);
|
||||
color: #ff3b30;
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 20rpx;
|
||||
font-weight: 500;
|
||||
|
||||
&.gray {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.expiry-date {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* Plans Grid */
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.plans-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.plan-card {
|
||||
width: 330rpx; // (750 - 60 - 30 gap) / 2
|
||||
height: 180rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 30rpx;
|
||||
position: relative;
|
||||
border: 2rpx solid transparent;
|
||||
transition: all 0.2s;
|
||||
|
||||
&.active {
|
||||
border-color: #ff3b30;
|
||||
background: #fff5f5;
|
||||
|
||||
.plan-price {
|
||||
color: #ff3b30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.plan-badge {
|
||||
position: absolute;
|
||||
top: -16rpx;
|
||||
right: -10rpx;
|
||||
font-size: 20rpx;
|
||||
color: #fff;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 12rpx 0 12rpx 0;
|
||||
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
|
||||
&.hot {
|
||||
background: #ff3b30;
|
||||
}
|
||||
|
||||
&.best {
|
||||
background: #e6a23c;
|
||||
}
|
||||
}
|
||||
|
||||
.plan-duration {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.plan-price {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.currency {
|
||||
font-size: 28rpx;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.amount {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
|
||||
/* Benefits Card */
|
||||
.benefits-card {
|
||||
background: #fff;
|
||||
border-radius: 30rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
.benefits-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.benefit-item {
|
||||
width: 33.33%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
&:nth-last-child(-n + 3) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.benefit-icon-box {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.benefit-name {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* Notes */
|
||||
.notes-section {
|
||||
padding: 0 10rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.notes-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #666;
|
||||
margin-bottom: 16rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.notes-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.note-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.dot {
|
||||
color: #999;
|
||||
margin-right: 10rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.note-text {
|
||||
flex: 1;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* Bottom Bar */
|
||||
.bottom-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
padding: 20rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
|
||||
padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
background: linear-gradient(90deg, #ff3b30 0%, #ff1a1a 100%);
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user