feat(detail): 活动详情双 Tab(拆约助理/活动描述)+ 主题价值自绘弹窗(复制文字/我知道了)
This commit is contained in:
@@ -8,11 +8,13 @@ Page({
|
||||
data: {
|
||||
activityId: '',
|
||||
activity: null,
|
||||
activeTab: 'assistant',
|
||||
aiRecommendation: null,
|
||||
aiLoading: true,
|
||||
aiRefreshing: false,
|
||||
themeAnalysis: '',
|
||||
themeLoading: false,
|
||||
themeModalVisible: false,
|
||||
loading: false,
|
||||
isLoggedIn: false,
|
||||
isJoined: false,
|
||||
@@ -152,50 +154,63 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 组织者卡片上的「主题分析 ›」入口
|
||||
// Tab 切换:拆约助理 / 活动描述
|
||||
onTabChange(e) {
|
||||
const tab = e.currentTarget.dataset.tab;
|
||||
if (tab && tab !== this.data.activeTab) {
|
||||
this.setData({ activeTab: tab });
|
||||
}
|
||||
},
|
||||
|
||||
// 组织者卡片上的「主题价值」入口
|
||||
onThemeTap() {
|
||||
this.showThemeAnalysis();
|
||||
},
|
||||
|
||||
// 组织者主题分析(有缓存用缓存,无则请求)
|
||||
// 打开主题价值弹窗(有缓存用缓存,无则请求)
|
||||
async showThemeAnalysis() {
|
||||
if (this.data.themeAnalysis) {
|
||||
wx.showModal({
|
||||
title: '主题分析',
|
||||
content: this.data.themeAnalysis,
|
||||
showCancel: false,
|
||||
confirmText: '知道了',
|
||||
});
|
||||
this.setData({ themeModalVisible: true });
|
||||
return;
|
||||
}
|
||||
if (this.data.themeLoading) return;
|
||||
this.setData({ themeLoading: true });
|
||||
wx.showLoading({ title: '分析中...', mask: true });
|
||||
wx.showLoading({ title: '生成中...', mask: true });
|
||||
try {
|
||||
const res = await getThemeAnalysis(this.data.activityId);
|
||||
wx.hideLoading();
|
||||
if (res.success && res.data && res.data.analysis) {
|
||||
this.setData({ themeAnalysis: res.data.analysis });
|
||||
wx.showModal({
|
||||
title: '主题分析',
|
||||
content: res.data.analysis,
|
||||
showCancel: false,
|
||||
confirmText: '知道了',
|
||||
});
|
||||
this.setData({ themeAnalysis: res.data.analysis, themeModalVisible: true });
|
||||
} else {
|
||||
wx.showToast({ title: (res.data && res.data.message) || '分析失败', icon: 'none' });
|
||||
wx.showToast({ title: (res.data && res.data.message) || '生成失败', icon: 'none' });
|
||||
}
|
||||
} catch (err) {
|
||||
wx.hideLoading();
|
||||
console.error('主题分析失败:', err);
|
||||
console.error('主题价值生成失败:', err);
|
||||
if (!err.silent) {
|
||||
wx.showToast({ title: '主题分析失败', icon: 'none' });
|
||||
wx.showToast({ title: '主题价值生成失败', icon: 'none' });
|
||||
}
|
||||
} finally {
|
||||
this.setData({ themeLoading: false });
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭主题价值弹窗
|
||||
onThemeModalClose() {
|
||||
this.setData({ themeModalVisible: false });
|
||||
},
|
||||
|
||||
// 复制主题价值文字到剪贴板
|
||||
onCopyThemeAnalysis() {
|
||||
if (!this.data.themeAnalysis) return;
|
||||
wx.setClipboardData({
|
||||
data: this.data.themeAnalysis,
|
||||
success: () => {
|
||||
wx.showToast({ title: '已复制', icon: 'success' });
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
async handleJoinOrCancel() {
|
||||
// 报名属于需要身份的操作:游客可浏览详情,仅报名时弹窗引导登录,可取消
|
||||
if (!this.data.isLoggedIn) {
|
||||
|
||||
@@ -30,41 +30,28 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 活动描述 -->
|
||||
<view class="section">
|
||||
<text class="section-title">活动描述</text>
|
||||
<text class="section-content">{{activity.description}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 活动图片 -->
|
||||
<view class="section" wx:if="{{activity.images && activity.images.length > 0}}">
|
||||
<view class="image-list">
|
||||
<image
|
||||
class="activity-image"
|
||||
wx:for="{{activity.images}}"
|
||||
wx:key="index"
|
||||
src="{{item}}"
|
||||
mode="aspectFill"
|
||||
data-url="{{item}}"
|
||||
bindtap="previewImage"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 拆约推荐:组织者 + 参与者 + 匹配度,点击进入详细分析 -->
|
||||
<view class="section ai-section">
|
||||
<view class="ai-section-header">
|
||||
<view class="ai-header-title">
|
||||
<view class="ai-title-bar"></view>
|
||||
<text class="section-title">拆约推荐</text>
|
||||
<text class="ai-title-badge">AI</text>
|
||||
<!-- 详情 Tabs:拆约助理 / 活动描述 -->
|
||||
<view class="detail-tabs">
|
||||
<view class="tabs-bar">
|
||||
<view class="tab-item {{activeTab === 'assistant' ? 'active' : ''}}" data-tab="assistant" bindtap="onTabChange">
|
||||
<text class="tab-text">拆约助理</text>
|
||||
</view>
|
||||
<view class="tab-item {{activeTab === 'description' ? 'active' : ''}}" data-tab="description" bindtap="onTabChange">
|
||||
<text class="tab-text">活动描述</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Tab:拆约助理(默认,AI 推荐内容) -->
|
||||
<view class="tab-panel" wx:if="{{activeTab === 'assistant'}}">
|
||||
<view class="ai-section">
|
||||
<view class="ai-section-header">
|
||||
<text class="ai-header-caption">拆约推荐</text>
|
||||
<view class="ai-header-actions">
|
||||
<button class="refresh-btn" bindtap="onRefreshAI" disabled="{{aiRefreshing || aiLoading}}">
|
||||
<text wx:if="{{!aiRefreshing}}">刷新</text>
|
||||
<text wx:else>刷新中...</text>
|
||||
</button>
|
||||
<button class="theme-btn" bindtap="onThemeTap" disabled="{{themeLoading}}">主题分析</button>
|
||||
<button class="theme-btn" bindtap="onThemeTap" disabled="{{themeLoading}}">主题价值</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -140,6 +127,31 @@
|
||||
<view class="ai-empty" wx:if="{{!aiLoading && (!aiRecommendation || !aiRecommendation.participants || aiRecommendation.participants.length === 0)}}">
|
||||
<text class="ai-empty-text">暂无参与者,等伙伴加入后再来看看</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Tab:活动描述 -->
|
||||
<view class="tab-panel" wx:if="{{activeTab === 'description'}}">
|
||||
<view class="section desc-section">
|
||||
<text class="section-title">活动描述</text>
|
||||
<text class="section-content">{{activity.description}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 活动图片 -->
|
||||
<view class="section" wx:if="{{activity.images && activity.images.length > 0}}">
|
||||
<view class="image-list">
|
||||
<image
|
||||
class="activity-image"
|
||||
wx:for="{{activity.images}}"
|
||||
wx:key="index"
|
||||
src="{{item}}"
|
||||
mode="aspectFill"
|
||||
data-url="{{item}}"
|
||||
bindtap="previewImage"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -168,6 +180,23 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 主题价值弹窗 -->
|
||||
<view class="theme-modal-mask" wx:if="{{themeModalVisible}}" bindtap="onThemeModalClose">
|
||||
<view class="theme-modal" catchtap="">
|
||||
<view class="theme-modal-header">
|
||||
<view class="theme-modal-icon">✦</view>
|
||||
<text class="theme-modal-title">主题价值</text>
|
||||
</view>
|
||||
<scroll-view class="theme-modal-body" scroll-y>
|
||||
<text class="theme-modal-text">{{themeAnalysis}}</text>
|
||||
</scroll-view>
|
||||
<view class="theme-modal-footer">
|
||||
<button class="theme-modal-btn theme-modal-btn-copy" bindtap="onCopyThemeAnalysis">复制文字</button>
|
||||
<button class="theme-modal-btn theme-modal-btn-ok" bindtap="onThemeModalClose">我知道了</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view class="loading-wrapper" wx:if="{{loading}}">
|
||||
<text>加载中...</text>
|
||||
|
||||
@@ -104,6 +104,54 @@
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
/* ========== 详情 Tabs ========== */
|
||||
.detail-tabs {
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.tabs-bar {
|
||||
display: flex;
|
||||
background: #f5f6f8;
|
||||
border-radius: 16rpx;
|
||||
padding: 6rpx;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 16rpx 0;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
background: #ffffff;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
.tab-item.active .tab-text {
|
||||
color: #333333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tab-panel {
|
||||
padding-top: 24rpx;
|
||||
}
|
||||
|
||||
.desc-section {
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* ========== AI 建议区域 ========== */
|
||||
.ai-section {
|
||||
background-color: #ffffff;
|
||||
@@ -120,36 +168,22 @@
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.ai-header-title {
|
||||
.ai-header-caption {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ai-title-bar {
|
||||
width: 8rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 4rpx;
|
||||
background: linear-gradient(180deg, #4A90E2, #7AB3F0);
|
||||
margin-right: 14rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ai-section-header .section-title {
|
||||
margin-bottom: 0;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #4A90E2;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ai-title-badge {
|
||||
font-size: 18rpx;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
background: linear-gradient(135deg, #722ed1, #eb2f96);
|
||||
border-radius: 8rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
margin-left: 10rpx;
|
||||
line-height: 1.5;
|
||||
flex-shrink: 0;
|
||||
.ai-header-caption::before {
|
||||
content: '';
|
||||
width: 8rpx;
|
||||
height: 28rpx;
|
||||
border-radius: 4rpx;
|
||||
background: linear-gradient(180deg, #4A90E2, #7AB3F0);
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.ai-header-actions {
|
||||
@@ -589,3 +623,96 @@
|
||||
padding: 2rpx 12rpx;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
|
||||
/* ========== 主题价值弹窗 ========== */
|
||||
.theme-modal-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.theme-modal {
|
||||
width: 620rpx;
|
||||
max-width: 90%;
|
||||
background: #ffffff;
|
||||
border-radius: 24rpx;
|
||||
padding: 40rpx 36rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.theme-modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.theme-modal-icon {
|
||||
font-size: 32rpx;
|
||||
color: #b8860b;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.theme-modal-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.theme-modal-body {
|
||||
max-height: 560rpx;
|
||||
background: linear-gradient(160deg, #fdf9ef 0%, #f7f4fc 100%);
|
||||
border-radius: 16rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.theme-modal-text {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #444444;
|
||||
line-height: 1.8;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.theme-modal-footer {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.theme-modal-btn {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0;
|
||||
padding: 18rpx 0;
|
||||
font-size: 28rpx;
|
||||
border-radius: 999rpx;
|
||||
border: none;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.theme-modal-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.theme-modal-btn-copy {
|
||||
background: #f0f4ff;
|
||||
color: #4A90E2;
|
||||
}
|
||||
|
||||
.theme-modal-btn-ok {
|
||||
background: linear-gradient(135deg, #b8860b, #d4a017);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user