fix(audit): 共拆分析页游客改静态引导视图,先浏览功能介绍再自主登录(审核拒因1)
This commit is contained in:
@@ -9,6 +9,7 @@ Page({
|
||||
loading: true,
|
||||
error: '',
|
||||
analysis: null,
|
||||
isLoggedIn: true,
|
||||
showDimensions: false, // 量化分析默认折叠
|
||||
},
|
||||
|
||||
@@ -19,17 +20,23 @@ Page({
|
||||
return;
|
||||
}
|
||||
this.setData({ targetUserId, activityId: activityId || '' });
|
||||
if (!wx.getStorageSync('userId')) {
|
||||
this.setData({ isLoggedIn: false, loading: false });
|
||||
return;
|
||||
}
|
||||
this.loadAnalysis();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (!this.data.isLoggedIn && wx.getStorageSync('userId')) {
|
||||
this.setData({ isLoggedIn: true });
|
||||
this.loadAnalysis();
|
||||
}
|
||||
},
|
||||
|
||||
async loadAnalysis() {
|
||||
this.setData({ loading: true, error: '' });
|
||||
const { targetUserId, activityId } = this.data;
|
||||
// 游客引导登录后再查看共拆分析
|
||||
if (!wx.getStorageSync('userId')) {
|
||||
this.promptLogin();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
@@ -52,7 +59,22 @@ Page({
|
||||
const analysis = this.prepareAnalysis(res.data);
|
||||
this.setData({ analysis, loading: false });
|
||||
} else if (res.code === 'LOGIN_REQUIRED') {
|
||||
this.promptLogin(res.message);
|
||||
// 登录态失效:转为游客引导视图,由用户自主选择登录
|
||||
this.setData({ isLoggedIn: false, loading: false, error: '' });
|
||||
} else if (res.code === 'EMAIL_REQUIRED') {
|
||||
// 已登录未绑邮箱:引导绑定(本页原生请求不走全局拦截器)
|
||||
this.setData({ loading: false, error: res.message || '请先绑定邮箱后查看共拆分析' });
|
||||
wx.showModal({
|
||||
title: '请先绑定邮箱',
|
||||
content: '邮箱是身份认定凭证,绑定后即可查看共拆分析',
|
||||
confirmText: '去绑定',
|
||||
cancelText: '暂不',
|
||||
success: (r) => {
|
||||
if (r.confirm) {
|
||||
wx.navigateTo({ url: '/pages/edit-profile/index?focus=email' });
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.setData({ loading: false, error: res.message || '分析失败' });
|
||||
}
|
||||
@@ -62,27 +84,9 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
// 游客引导:弹窗去登录,取消则返回上一页
|
||||
promptLogin(message) {
|
||||
this.setData({ loading: false, error: '' });
|
||||
wx.showModal({
|
||||
title: '登录后查看',
|
||||
content: message || '登录后即可查看与 TA 的共拆潜力分析,还能报名活动、结识书友',
|
||||
confirmText: '去登录',
|
||||
cancelText: '暂不',
|
||||
success: (r) => {
|
||||
if (r.confirm) {
|
||||
wx.navigateTo({ url: '/pages/login/index' });
|
||||
} else {
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
wx.navigateBack({ delta: 1 });
|
||||
} else {
|
||||
wx.switchTab({ url: '/pages/home/index' });
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
// 游客自主点击「去登录」
|
||||
goToLogin() {
|
||||
wx.navigateTo({ url: '/pages/login/index' });
|
||||
},
|
||||
|
||||
prepareAnalysis(data) {
|
||||
@@ -147,9 +151,4 @@ Page({
|
||||
success: () => wx.showToast({ title: '已复制', icon: 'success', duration: 1500 }),
|
||||
});
|
||||
},
|
||||
|
||||
// 发起私聊(暂未实现)
|
||||
startChat() {
|
||||
wx.showToast({ title: '功能开发中', icon: 'none' });
|
||||
},
|
||||
});
|
||||
|
||||
@@ -12,8 +12,36 @@
|
||||
<text class="error-text">{{error}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 游客引导:先浏览功能介绍,自主选择登录 -->
|
||||
<view class="guest-wrapper" wx:if="{{!loading && !isLoggedIn && !error}}">
|
||||
<view class="guest-card">
|
||||
<text class="guest-icon">🤝</text>
|
||||
<text class="guest-title">共拆潜力分析</text>
|
||||
<text class="guest-desc">登录后,AI 将基于你们双方的资料,生成专属共拆分析:</text>
|
||||
<view class="guest-feature-list">
|
||||
<view class="guest-feature">
|
||||
<text class="guest-feature-icon">💎</text>
|
||||
<text class="guest-feature-text">价值标签 — 快速了解 TA 能带来的资源与视角</text>
|
||||
</view>
|
||||
<view class="guest-feature">
|
||||
<text class="guest-feature-icon">💡</text>
|
||||
<text class="guest-feature-text">利益交集 — 找到你们共同关注的机会点</text>
|
||||
</view>
|
||||
<view class="guest-feature">
|
||||
<text class="guest-feature-icon">🎯</text>
|
||||
<text class="guest-feature-text">破冰策略 — 切入角度、首次话题与开场话术</text>
|
||||
</view>
|
||||
<view class="guest-feature">
|
||||
<text class="guest-feature-icon">✅</text>
|
||||
<text class="guest-feature-text">行动清单 — 下一步共拆行动建议</text>
|
||||
</view>
|
||||
</view>
|
||||
<button class="chat-btn" bindtap="goToLogin">去登录,查看分析</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分析结果 -->
|
||||
<view class="analysis-content" wx:if="{{!loading && analysis}}">
|
||||
<view class="analysis-content" wx:if="{{!loading && analysis && isLoggedIn}}">
|
||||
<!-- 1. 用户信息卡片 -->
|
||||
<view class="user-card">
|
||||
<image class="user-avatar" src="{{analysis.targetUser.avatarUrl || '/assets/icons/default-avatar.png'}}" mode="aspectFill" />
|
||||
@@ -147,10 +175,5 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="bottom-action">
|
||||
<button class="chat-btn" bindtap="startChat">发起私聊</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -209,6 +209,45 @@
|
||||
.action-title { display: block; font-size: 28rpx; font-weight: 600; color: #333; margin-bottom: 6rpx; }
|
||||
.action-desc { display: block; font-size: 26rpx; color: #666; line-height: 1.6; }
|
||||
|
||||
/* ========== 游客引导 ========== */
|
||||
.guest-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 60rpx 32rpx;
|
||||
}
|
||||
.guest-card {
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 48rpx 36rpx 40rpx;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.04);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.guest-icon { font-size: 80rpx; }
|
||||
.guest-title {
|
||||
font-size: 36rpx; font-weight: 700; color: #333;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.guest-desc {
|
||||
font-size: 26rpx; color: #666; line-height: 1.6;
|
||||
margin-top: 16rpx; text-align: center;
|
||||
}
|
||||
.guest-feature-list {
|
||||
width: 100%;
|
||||
display: flex; flex-direction: column; gap: 20rpx;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
.guest-feature {
|
||||
display: flex; align-items: flex-start;
|
||||
background: #f8f9fc; border-radius: 16rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
.guest-feature-icon { font-size: 30rpx; margin-right: 16rpx; flex-shrink: 0; }
|
||||
.guest-feature-text { font-size: 26rpx; color: #444; line-height: 1.6; }
|
||||
.guest-card .chat-btn { margin-top: 40rpx; }
|
||||
|
||||
/* ========== 底部按钮 ========== */
|
||||
.bottom-action { padding: 40rpx 24rpx; }
|
||||
.chat-btn {
|
||||
|
||||
Reference in New Issue
Block a user