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

fix: 未登录可浏览商品/活动/文章详情 + 富页面预登录内容

InviteController: 匿名用户返回'请先登录'而非500
wealth/index.vue: 移除全屏登录墙,未登录显示商品推荐+登录引导,登录后显示完整内容
Sisyphus 3 месяцев назад
Родитель
Сommit
0b967b58b5

+ 3 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/InviteController.java

@@ -26,6 +26,9 @@ public class InviteController {
 
     @PostMapping("/code")
     public Result<String> getCode(@RequestAttribute("userId") Long userId) {
+        if (userId == null || userId <= 0) {
+            return Result.error("请先登录");
+        }
         String code = commissionService.getOrCreateReferralCode(userId);
         return Result.success(code);
     }

+ 35 - 31
cfc-frontend/pages/wealth/index.vue

@@ -3,13 +3,23 @@
     <!-- TabTransition overlay -->
     <tab-transition v-if="showTabTransition" dimCode="wealth" ref="tabTransition" @close="showTabTransition = false" />
 
-    <!-- 未登录 -->
-    <view v-if="!isLoggedIn" class="login-prompt">
-      <view class="prompt-icon">👤</view>
-      <text class="prompt-title">登录浠艾福</text>
-      <text class="prompt-desc">登录后查看财富能量详情</text>
-      <button class="login-btn" @click="goLogin">登录 / 注册</button>
-    </view>
+    <!-- 未登录时显示精简内容 -->
+    <template v-if="!isLoggedIn">
+      <PageBanner theme="wealth"
+        tagline="利他创富 · 价值共享"
+        quote="富足源于利他与坚持" />
+
+      <!-- 商品推荐 -->
+      <DimensionProductList
+        dimensionCode="wealth"
+        title="为你推荐" />
+
+      <!-- 登录引导 -->
+      <view class="login-guide-section">
+        <text class="login-guide-text">登录后查看财富能量、推广收益、邀请返利等更多内容</text>
+        <button class="login-btn" @click="goLogin">登录 / 注册</button>
+      </view>
+    </template>
 
     <template v-else>
       <!-- 品牌头部 -->
@@ -151,7 +161,6 @@
 
       <!-- 商品推荐 -->
       <DimensionProductList
-        v-if="isLoggedIn"
         dimensionCode="wealth"
         :familyId="activeChildId"
         title="为你推荐" />
@@ -713,37 +722,32 @@ export default {
 }
 
 /* 未登录 */
-.login-prompt {
+.login-guide-section {
   display: flex;
   flex-direction: column;
   align-items: center;
-  justify-content: center;
-  min-height: 80vh;
-  padding: 60rpx;
-}
-.prompt-icon {
-  font-size: 120rpx;
-  margin-bottom: 30rpx;
-  width: 160rpx;
-  height: 160rpx;
-  line-height: 160rpx;
-  text-align: center;
-  background: #f5f5f5;
-  border-radius: 50%;
-}
-.prompt-title {
-  font-size: 36rpx;
-  font-weight: bold;
-  color: #333;
-  margin-bottom: 16rpx;
+  padding: 60rpx 40rpx;
+  margin: 30rpx;
+  background: #fff;
+  border-radius: 20rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
 }
-.prompt-desc {
+.login-guide-text {
   font-size: 26rpx;
   color: #999;
   text-align: center;
-  margin-bottom: 40rpx;
+  margin-bottom: 30rpx;
+  line-height: 1.6;
+}
+.login-guide-section .login-btn {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  min-height: 80vh;
+  padding: 60rpx;
 }
-.login-prompt .login-btn {
+.login-guide-section .login-btn {
   width: 60%;
   height: 80rpx;
   line-height: 80rpx;