feat: 优化UI

This commit is contained in:
Blizzard
2026-03-05 17:04:40 +08:00
parent 0a61c4ddec
commit 7f51b2a0a8
28 changed files with 1773 additions and 964 deletions
-37
View File
@@ -9,7 +9,6 @@ Page({
data: {
isVip: false,
userInfo: null,
subscribedData: [],
menuItems: [
{ id: 'vip', label: '会员中心', icon: '👑', desc: '未开通', highlight: true },
{ id: 'help', label: '帮助与反馈', icon: '❓', desc: '', highlight: false },
@@ -39,24 +38,6 @@ Page({
userInfo: gd.userInfo
})
// 从后端获取已订阅频道
api.getSubscriptionList({ current: 1, pageSize: 50 }).then(function (res) {
if (res.code === 200 && res.data) {
var subList = res.data.list || res.data || []
// 适配封面 URL
subList = subList.map(function (ch) {
return Object.assign({}, ch, {
_coverUrl: (ch.cover && ch.cover.url) || ch.coverUrl || ''
})
})
self.setData({ subscribedData: subList })
}
}).catch(function (err) {
console.error('[Profile] 加载订阅失败:', err)
})
// 更新菜单VIP状态
var menuItems = this.data.menuItems.slice()
menuItems[0].desc = gd.isVip ? '已开通' : '未开通'
@@ -64,24 +45,6 @@ Page({
this.setData({ menuItems: menuItems })
},
onUnsubscribe(e) {
const id = e.currentTarget.dataset.id
const name = e.currentTarget.dataset.name
const self = this
wx.showModal({
title: '提示',
content: '确定要取消订阅【' + name + '】吗?',
success(res) {
if (res.confirm) {
app.unsubscribeFromDomain(id).then(function () {
self._refresh()
})
}
}
})
},
onMenuTap(e) {
const id = e.currentTarget.dataset.id
if (id === 'vip') {
+46 -58
View File
@@ -1,85 +1,73 @@
<!-- 个人中心 —— 用户信息 + 订阅管理 + 菜单 -->
<!-- 个人中心 - 全新极简温暖主题 -->
<view class="profile-page">
<!-- 橙色头部背景 -->
<view class="header-bg">
<view class="user-info">
<!-- 头像 -->
<view class="avatar-wrap">
<!-- 沉浸式头部区域 -->
<view class="header-section">
<!-- 装饰背景 -->
<view class="header-bg-shape"></view>
<!-- 用户信息块 -->
<view class="user-info-box">
<view class="avatar-container">
<image wx:if="{{userInfo && userInfo.avatarId}}" src="{{userInfo.avatar.url || ''}}" class="avatar-img" mode="aspectFill" />
<text wx:else class="avatar-emoji">😊</text>
</view>
<text class="user-name">
{{userInfo.nickName || userInfo.name || '微信用户'}}
<text wx:if="{{isVip}}" class="vip-crown">👑</text>
</text>
<text class="user-desc">
{{isVip ? '全频道会员' : '免费用户 · 开通会员畅听全频道'}}
</text>
</view>
</view>
<!-- 订阅管理卡片(上移覆盖) -->
<view class="sub-card-wrap">
<view class="card sub-card">
<!-- 空状态 -->
<view wx:if="{{subscribedData.length === 0}}" class="sub-empty">
<text class="sub-empty-text">暂未订阅任何频道</text>
<button class="btn-ghost" bindtap="goDiscover">去广场添加</button>
</view>
<!-- 订阅列表 -->
<view wx:else>
<view
wx:for="{{subscribedData}}"
wx:key="id"
class="sub-item"
>
<view class="sub-item-left">
<view class="sub-icon" style="background: {{item.bgColor || '#F0F0F0'}};">
<image wx:if="{{item._coverUrl}}" src="{{item._coverUrl}}" class="sub-cover-img" mode="aspectFill" />
<text wx:else class="sub-emoji">{{item.icon || '📻'}}</text>
</view>
<view class="sub-info">
<text class="sub-name">{{item.name}}</text>
<text class="sub-tag {{item.isFree === 1 ? 'free' : ''}}">
{{item.isFree === 1 ? '免费' : '已订阅'}}
</text>
</view>
</view>
<view class="sub-del tap-active" bindtap="onUnsubscribe" data-id="{{item.id}}" data-name="{{item.name}}">
<text class="del-icon">🗑</text>
<view class="user-details">
<view class="name-line">
<text class="user-name">{{userInfo.nickName || userInfo.name || '你好,收听者'}}</text>
<view wx:if="{{isVip}}" class="vip-badge">
<text class="vip-badge-icon">👑</text>
<text class="vip-badge-text">VIP会员</text>
</view>
</view>
<text class="user-id">今日也要元气满满哦</text>
</view>
</view>
</view>
<!-- 菜单列表 -->
<view class="menu-card-wrap">
<view class="card menu-card">
<!-- 内容区 -->
<view class="content-section">
<!-- VIP 专属引导卡片 (若未开通) -->
<view wx:if="{{!isVip}}" class="vip-promo-card tap-active" bindtap="onMenuTap" data-id="vip">
<view class="promo-left">
<text class="promo-icon">✨</text>
<view class="promo-text">
<text class="promo-title">开通全频道会员</text>
<text class="promo-desc">畅听无阻 · 专属标识 · 尊贵体验</text>
</view>
</view>
<view class="promo-right">
<text class="promo-btn">立即开通</text>
</view>
</view>
<!-- 菜单列表卡片 -->
<view class="menu-list-card">
<view
wx:for="{{menuItems}}"
wx:key="id"
class="menu-item tap-active"
class="menu-row tap-active"
bindtap="onMenuTap"
data-id="{{item.id}}"
>
<view class="menu-item-left">
<view class="menu-icon-wrap {{item.highlight ? 'highlight' : ''}}">
<view class="menu-left">
<view class="menu-icon-box {{item.id === 'vip' ? 'is-vip-icon' : ''}}">
<text class="menu-emoji">{{item.icon}}</text>
</view>
<text class="menu-label">{{item.label}}</text>
<text class="menu-title">{{item.label}}</text>
</view>
<view class="menu-item-right">
<text class="menu-desc {{item.highlight ? 'highlight' : ''}}">{{item.desc}}</text>
<view class="menu-right">
<text class="menu-status {{item.highlight ? 'highlight-text' : ''}}">{{item.desc}}</text>
<text class="menu-arrow"></text>
</view>
</view>
</view>
</view>
<view style="height: 200rpx;"></view>
<!-- 底部留白以防遮挡播放器 -->
<view class="bottom-spacer"></view>
<global-player />
</view>
+198 -159
View File
@@ -1,223 +1,262 @@
/* 个人中心样式 */
/* 个人中心 - 全新极简温暖主题 */
:root {
--primary-color: #F38600;
--bg-color: #F7F8FA;
--card-bg: #FFFFFF;
--text-main: #2C2C2C;
--text-sub: #8E8E93;
}
.profile-page {
min-height: 100vh;
background: var(--color-bg-page);
background-color: #F9F9F9;
position: relative;
overflow-x: hidden;
}
/* 橙色头部 */
.header-bg {
background: #F38600;
border-radius: 0 0 48rpx 48rpx;
padding-bottom: 200rpx;
/* 沉浸式头部 */
.header-section {
position: relative;
width: 100%;
padding-top: 140rpx;
padding-bottom: 80rpx;
z-index: 1;
}
.user-info {
.header-bg-shape {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(135deg, #FFF0E0 0%, #FFDFB8 100%);
border-bottom-left-radius: 64rpx;
border-bottom-right-radius: 64rpx;
z-index: -1;
box-shadow: 0 4rpx 24rpx rgba(243, 134, 0, 0.08);
}
.user-info-box {
display: flex;
flex-direction: column;
align-items: center;
padding: 32rpx 40rpx;
padding: 0 48rpx;
}
.avatar-wrap {
width: 128rpx;
height: 128rpx;
.avatar-container {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
border: 6rpx solid rgba(255, 255, 255, 0.3);
background: linear-gradient(135deg, #FFB366, #FFE0B2);
border: 6rpx solid rgba(255, 255, 255, 0.6);
background: #FFF;
box-shadow: 0 12rpx 32rpx rgba(243, 134, 0, 0.15);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
overflow: hidden;
flex-shrink: 0;
}
.avatar-emoji {
font-size: 64rpx;
}
.avatar-img {
width: 100%;
height: 100%;
border-radius: 50%;
}
.user-name {
font-size: 32rpx;
font-weight: 700;
color: #FFF;
letter-spacing: 2rpx;
}
.vip-crown {
font-size: 28rpx;
margin-left: 8rpx;
}
.user-desc {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.9);
margin-top: 8rpx;
font-weight: 500;
text-align: center;
object-fit: cover;
}
/* 订阅卡片 */
.sub-card-wrap {
.avatar-emoji {
font-size: 72rpx;
}
.user-details {
margin-left: 36rpx;
display: flex;
flex-direction: column;
justify-content: center;
}
.name-line {
display: flex;
align-items: center;
margin-bottom: 12rpx;
}
.user-name {
font-size: 40rpx;
font-weight: 800;
color: #333333;
letter-spacing: 2rpx;
}
.vip-badge {
display: flex;
align-items: center;
background: linear-gradient(90deg, #333333 0%, #1A1A1A 100%);
padding: 4rpx 16rpx;
border-radius: 999rpx;
margin-left: 16rpx;
}
.vip-badge-icon {
font-size: 20rpx;
margin-right: 6rpx;
}
.vip-badge-text {
font-size: 20rpx;
font-weight: 700;
color: #FDF1C2;
}
.user-id {
font-size: 24rpx;
color: #8C6F50;
font-weight: 500;
}
/* 内容区 */
.content-section {
padding: 0 32rpx;
margin-top: -140rpx;
margin-top: -30rpx;
position: relative;
z-index: 10;
}
.sub-card {
padding: 32rpx;
}
/* 空状态 */
.sub-empty {
text-align: center;
padding: 40rpx 0;
}
.sub-empty-text {
display: block;
font-size: 26rpx;
color: #999;
margin-bottom: 24rpx;
}
/* 订阅列表项 */
.sub-item {
/* VIP宣发引导卡片 */
.vip-promo-card {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx;
background: linear-gradient(135deg, #FFEFD5 0%, #FFE4B5 100%);
padding: 32rpx 40rpx;
border-radius: 32rpx;
background: #FEFEFE;
border: 1rpx solid rgba(0,0,0,0.04);
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.02);
margin-bottom: 16rpx;
}
.sub-item-left {
display: flex;
align-items: center;
flex: 1;
overflow: hidden;
}
.sub-icon {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1);
}
.sub-emoji {
font-size: 36rpx;
}
.sub-cover-img {
width: 100%;
height: 100%;
border-radius: 50%;
}
.sub-info {
margin-left: 24rpx;
overflow: hidden;
}
.sub-name {
display: block;
font-size: 28rpx;
font-weight: 700;
color: #333;
}
.sub-tag {
display: inline-block;
margin-top: 8rpx;
padding: 4rpx 12rpx;
border-radius: 6rpx;
font-size: 20rpx;
font-weight: 700;
}
.sub-tag.free {
background: rgba(45, 90, 39, 0.1);
color: #2D5A27;
box-shadow: 0 8rpx 24rpx rgba(217, 119, 6, 0.08);
margin-bottom: 32rpx;
border: 1rpx solid rgba(255, 255, 255, 0.5);
}
.sub-del {
width: 56rpx;
height: 56rpx;
border-radius: 50%;
background: #F5F5F5;
border: 1rpx solid #EEE;
.promo-left {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.del-icon {
font-size: 24rpx;
}
.sub-notice {
display: block;
font-size: 20rpx;
color: rgba(255, 157, 66, 0.7);
text-align: center;
margin-top: 12rpx;
.promo-icon {
font-size: 48rpx;
margin-right: 24rpx;
}
.promo-text {
display: flex;
flex-direction: column;
}
.promo-title {
font-size: 30rpx;
font-weight: 800;
color: #8B4513;
margin-bottom: 6rpx;
}
.promo-desc {
font-size: 22rpx;
color: #AA7A55;
font-weight: 500;
}
/* 菜单卡片 */
.menu-card-wrap {
padding: 24rpx 32rpx 0;
.promo-btn {
background: #333333;
color: #FDF1C2;
font-size: 24rpx;
font-weight: 700;
padding: 12rpx 28rpx;
border-radius: 999rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}
.menu-card {
padding: 8rpx 0;
/* 列表菜单 */
.menu-list-card {
background: #FFFFFF;
border-radius: 32rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.02);
padding: 16rpx 0;
}
.menu-item {
.menu-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28rpx 32rpx;
border-bottom: 1rpx solid rgba(0,0,0,0.03);
padding: 32rpx 40rpx;
position: relative;
}
.menu-item:last-child {
border-bottom: none;
.menu-row::after {
content: '';
position: absolute;
bottom: 0;
left: 110rpx;
right: 40rpx;
border-bottom: 1rpx solid #F5F5F5;
}
.menu-item-left {
.menu-row:last-child::after {
display: none;
}
.menu-left {
display: flex;
align-items: center;
}
.menu-icon-wrap {
width: 52rpx;
height: 52rpx;
border-radius: 50%;
background: #F5F5F5;
.menu-icon-box {
width: 60rpx;
height: 60rpx;
background: #F8F9FA;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
margin-right: 28rpx;
}
.menu-icon-wrap.highlight {
background: rgba(251, 191, 36, 0.1);
.menu-icon-box.is-vip-icon {
background: rgba(251, 191, 36, 0.15);
}
.menu-emoji {
font-size: 24rpx;
font-size: 32rpx;
}
.menu-label {
font-size: 28rpx;
font-weight: 700;
color: #333;
letter-spacing: 2rpx;
.menu-title {
font-size: 30rpx;
font-weight: 600;
color: #333333;
}
.menu-item-right {
.menu-right {
display: flex;
align-items: center;
gap: 12rpx;
}
.menu-desc {
font-size: 22rpx;
color: #999;
font-weight: 500;
.menu-status {
font-size: 24rpx;
color: #999999;
margin-right: 12rpx;
}
.menu-desc.highlight {
.menu-status.highlight-text {
color: #D97706;
font-weight: 600;
}
.menu-arrow {
font-size: 28rpx;
color: #CCC;
font-size: 32rpx;
color: #CCCCCC;
}
.bottom-spacer {
height: 240rpx;
}
/* 点击态 */
.tap-active:active {
opacity: 0.7;
transform: scale(0.98);
transition: all 0.2s;
}