Просмотр исходного кода

feat: 个人中心 - 用户卡片可点击编辑 + 降低高度

- 整个用户卡片区域可点击跳转编辑页(移除了小铅笔图标)

- 布局改为水平行: 头像 → 信息(昵称/标签/简介) → ›箭头

- 头像68px→56px, padding缩减, 卡片高度大幅降低

- 修复avatar__edit删除后残留的多余闭合花括号
liaoxg 5 месяцев назад
Родитель
Сommit
51612967b3
1 измененных файлов с 142 добавлено и 86 удалено
  1. 142 86
      client/pages/profile/index.vue

+ 142 - 86
client/pages/profile/index.vue

@@ -11,34 +11,36 @@
         <text class="user-card__login-hint">点击登录 / 注册</text>
       </view>
 
-      <!-- Authenticated user card -->
-      <view v-else class="user-card__logged">
-        <view class="avatar">
-          <image :src="userStore.avatarUrl || '/static/default-avatar.png'" mode="aspectFill" />
-          <view class="avatar__edit" @click="goEditProfile">
-            <text class="avatar__edit-icon">✏</text>
+      <!-- Authenticated user card — tap to edit -->
+      <view v-else class="user-card__logged" @click="goEditProfile">
+        <view class="user-card__inner">
+          <view class="avatar">
+            <image :src="userStore.avatarUrl || '/static/default-avatar.png'" mode="aspectFill" />
           </view>
+          <view class="user-card__info">
+            <text class="user-card__nickname">{{ userStore.nickname }}</text>
+
+            <!-- Role tag -->
+            <view
+              class="user-card__tag"
+              :class="{
+                'user-card__tag--practitioner': userStore.vipType === 'practitioner',
+                'user-card__tag--annual': userStore.vipType === 'annual',
+                'user-card__tag--normal': !userStore.vipType
+              }"
+            >
+              <text v-if="!userStore.vipType">普通用户</text>
+              <text v-else-if="userStore.vipType === 'annual'">C端会员</text>
+              <text v-else>能量师 🌟</text>
+            </view>
+
+            <!-- Social summary (optional) -->
+            <text v-if="userStore.bio || userStore.city" class="user-card__summary">
+              {{ userStore.city || '' }}{{ userStore.city && userStore.bio ? ' · ' : '' }}{{ userStore.bio || '' }}
+            </text>
+          </view>
+          <text class="user-card__arrow">›</text>
         </view>
-        <text class="user-card__nickname">{{ userStore.nickname }}</text>
-
-        <!-- Role tag -->
-        <view
-          class="user-card__tag"
-          :class="{
-            'user-card__tag--practitioner': userStore.vipType === 'practitioner',
-            'user-card__tag--annual': userStore.vipType === 'annual',
-            'user-card__tag--normal': !userStore.vipType
-          }"
-        >
-          <text v-if="!userStore.vipType">普通用户</text>
-          <text v-else-if="userStore.vipType === 'annual'">C端会员</text>
-          <text v-else>能量师 🌟</text>
-        </view>
-
-        <!-- Social summary (optional) -->
-        <text v-if="userStore.bio || userStore.city" class="user-card__summary">
-          {{ userStore.city || '' }}{{ userStore.city && userStore.bio ? ' · ' : '' }}{{ userStore.bio || '' }}
-        </text>
       </view>
     </view>
 
@@ -101,18 +103,25 @@
       <text class="vip-card__action" @click="goPayment">重新开通</text>
     </view>
 
-    <!-- Case 4: Free user — upsell card -->
+    <!-- Case 4: Free user — two payment options -->
     <view v-else class="vip-card vip-card--upsell">
       <view class="vip-card__body">
-        <text class="vip-card__title">开通VIP · 解锁完整分析</text>
-        <view class="vip-card__benefits">
-          <text class="vip-card__benefit">✅ AI 完整五区解读</text>
-          <text class="vip-card__benefit">✅ 不限次 AI 追问互动</text>
-          <text class="vip-card__benefit">✅ 导出 PDF 报告</text>
-          <text class="vip-card__benefit">✅ 分销推广赚佣金</text>
+        <text class="vip-card__title">选择方案</text>
+        <view class="vip-card__dual">
+          <view class="vip-card__option" @click="goPayment">
+            <text class="option-title">C端会员</text>
+            <text class="option-price">¥131/年</text>
+            <text class="option-desc">无限AI解读</text>
+            <button class="option-btn light">开通</button>
+          </view>
+          <view class="vip-card__option vip-card__option--pro" @click="goUpgradePractitioner">
+            <text class="option-title">能量师</text>
+            <text class="option-price">¥1,314/年</text>
+            <text class="option-desc">完整功能+分销</text>
+            <button class="option-btn primary">申请</button>
+          </view>
         </view>
       </view>
-      <text class="vip-card__cta" @click="goPayment">立即开通 ¥131/年</text>
     </view>
 
     <!-- Daily quota (non-VIP only) -->
@@ -331,26 +340,35 @@ $danger: #EF4444;
 .user-card {
   background: linear-gradient(135deg, $blue-dark, darken($blue-dark, 6%));
   border-radius: 16px;
-  padding: 32px 20px 28px;
+  padding: 20px 18px;
   margin-bottom: 16px;
-  text-align: center;
 
   &__login {
     cursor: pointer;
+    text-align: center;
+    padding: 8px 0;
   }
 
   &__logged {
+    cursor: pointer;
+  }
+
+  &__inner {
     display: flex;
-    flex-direction: column;
     align-items: center;
+    gap: 14px;
+  }
+
+  &__info {
+    flex: 1;
+    min-width: 0;
   }
 
   &__nickname {
-    font-size: 18px;
+    font-size: 17px;
     font-weight: 600;
     color: $white;
     display: block;
-    margin-top: 12px;
   }
 
   &__login-hint {
@@ -362,10 +380,10 @@ $danger: #EF4444;
 
   &__tag {
     display: inline-flex;
-    padding: 3px 14px;
+    padding: 2px 12px;
     border-radius: 20px;
-    font-size: 12px;
-    margin-top: 8px;
+    font-size: 11px;
+    margin-top: 6px;
 
     &--practitioner {
       background: $gold;
@@ -385,29 +403,41 @@ $danger: #EF4444;
   }
 
   &__summary {
-    font-size: 12px;
+    font-size: 11px;
     color: rgba(255, 255, 255, 0.55);
-    margin-top: 6px;
+    margin-top: 4px;
+    display: block;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+
+  &__arrow {
+    font-size: 22px;
+    color: rgba(255, 255, 255, 0.3);
+    flex-shrink: 0;
+    padding-left: 4px;
   }
 }
 
 // Avatar
 .avatar {
-  width: 68px;
-  height: 68px;
+  width: 56px;
+  height: 56px;
   border-radius: 50%;
-  overflow: visible;
-  position: relative;
-  margin: 0 auto;
+  overflow: hidden;
+  flex-shrink: 0;
 
   image {
     width: 100%;
     height: 100%;
     border-radius: 50%;
-    border: 2px solid rgba(255, 255, 255, 0.3);
+    border: 2px solid rgba(255, 255, 255, 0.25);
   }
 
   &--empty {
+    width: 56px;
+    height: 56px;
     background: rgba(255, 255, 255, 0.12);
     display: flex;
     align-items: center;
@@ -416,30 +446,9 @@ $danger: #EF4444;
   }
 
   &__icon {
-    font-size: 28px;
+    font-size: 24px;
     color: rgba(255, 255, 255, 0.5);
   }
-
-  &__edit {
-    position: absolute;
-    right: -2px;
-    bottom: -2px;
-    width: 24px;
-    height: 24px;
-    border-radius: 50%;
-    background: $gold;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    z-index: 1;
-    cursor: pointer;
-
-    &-icon {
-      font-size: 12px;
-      color: $blue-dark;
-      font-weight: 700;
-    }
-  }
 }
 
 // ========== Region 2: Membership Status ==========
@@ -557,40 +566,87 @@ $danger: #EF4444;
     }
   }
 
-  // Upsell (free user)
+  // Upsell (free user — two options)
   &--upsell {
     background: linear-gradient(135deg, $blue-dark, darken($blue-dark, 4%));
     flex-direction: column;
     align-items: flex-start;
     gap: 14px;
 
+    .vip-card__body {
+      width: 100%;
+    }
+
     .vip-card__title {
       color: $gold;
       font-size: 16px;
+      margin-bottom: 8px;
     }
 
-    & .vip-card__benefits {
+    .vip-card__dual {
+      display: flex;
+      gap: 12px;
+      width: 100%;
+    }
+
+    .vip-card__option {
+      flex: 1;
+      background: rgba(255, 255, 255, 0.06);
+      border: 1px solid rgba(255, 255, 255, 0.08);
+      border-radius: 12px;
+      padding: 14px 12px;
       display: flex;
       flex-direction: column;
-      gap: 4px;
-      margin-top: 8px;
+      align-items: center;
+      gap: 6px;
+      cursor: pointer;
     }
 
-    .vip-card__benefit {
-      color: rgba(255, 255, 255, 0.8);
+    .vip-card__option:active {
+      background: rgba(255, 255, 255, 0.1);
+    }
+
+    .vip-card__option .option-title {
+      font-size: 15px;
+      font-weight: 600;
+      color: rgba(255, 255, 255, 0.9);
+    }
+
+    .vip-card__option .option-price {
+      font-size: 18px;
+      font-weight: 700;
+      color: $gold;
+    }
+
+    .vip-card__option .option-desc {
+      font-size: 11px;
+      color: rgba(255, 255, 255, 0.45);
+    }
+
+    .vip-card__option .option-btn {
+      width: 100%;
+      border: none;
+      border-radius: 8px;
+      padding: 8px 0;
       font-size: 13px;
+      font-weight: 600;
+      cursor: pointer;
+      margin-top: 4px;
+    }
+
+    .option-btn.light {
+      background: rgba(255, 255, 255, 0.12);
+      color: #fff;
     }
 
-    .vip-card__cta {
-      align-self: stretch;
-      text-align: center;
+    .option-btn.primary {
       background: $gold;
       color: $blue-dark;
-      font-weight: 600;
-      font-size: 15px;
-      padding: 12px;
-      border-radius: 10px;
-      cursor: pointer;
+    }
+
+    .vip-card__option--pro {
+      border-color: rgba($gold, 0.2);
+      background: rgba($gold, 0.06);
     }
   }
 }