feat: 完善见素起名小程序功能
- 添加收藏锦囊功能,支持查看和删除收藏 - 实现积分系统,每日赠送5次灵感次数 - 添加静心阅读功能,阅读15秒可获得额外次数 - 实现灵感广场,展示用户分享的名字 - 添加字源溯源组件,长按汉字查看详情 - 优化空状态和结语卡片样式统一 - 添加音频控制(静音/风铃/雨落/古琴/白噪音/森林/溪流) - 优化名字生成逻辑,确保每次返回5个不重复名字 - 修复卡片翻转样式问题 - 移除首页动态提醒气泡
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<view class="card-stack" wx:if="{{!isLoading && nameList.length > 0}}">
|
||||
<view
|
||||
class="card-container"
|
||||
style="transform: translateX({{translateX}}px) rotate({{rotate}}deg); transition: {{transition}};"
|
||||
style="transform: translateX({{translateX}}px) translateY({{translateY}}px) rotate({{rotate}}deg); transition: {{transition}};"
|
||||
bindtouchstart="onTouchStart"
|
||||
bindtouchmove="onTouchMove"
|
||||
bindtouchend="onTouchEnd"
|
||||
@@ -27,7 +27,40 @@
|
||||
<view class="card {{isFlipped ? 'flipped' : ''}}">
|
||||
<!-- 正面:名字与诗词 -->
|
||||
<view class="card-face front" bindtap="onFlip">
|
||||
<text class="name">{{nameList[currentIndex].name}}</text>
|
||||
<!-- 音符按钮 -->
|
||||
<view class="music-btn {{currentAmbience !== 'silent' ? 'active' : ''}}" catchtap="onMusicTap">♪</view>
|
||||
<!-- 音频菜单 -->
|
||||
<view class="music-menu {{showMusicMenu ? 'show' : ''}}" catchtap="onMenuTap">
|
||||
<view class="menu-item {{currentAmbience === 'silent' ? 'active' : ''}}" data-type="silent" catchtap="onAmbienceChange">
|
||||
<text class="menu-icon">🔇</text>
|
||||
<text class="menu-text">静音</text>
|
||||
</view>
|
||||
<view class="menu-item {{currentAmbience === 'wind' ? 'active' : ''}}" data-type="wind" catchtap="onAmbienceChange">
|
||||
<text class="menu-icon">🎐</text>
|
||||
<text class="menu-text">风铃</text>
|
||||
</view>
|
||||
<view class="menu-item {{currentAmbience === 'rain' ? 'active' : ''}}" data-type="rain" catchtap="onAmbienceChange">
|
||||
<text class="menu-icon">🌧</text>
|
||||
<text class="menu-text">雨落</text>
|
||||
</view>
|
||||
<view class="menu-item {{currentAmbience === 'guqin' ? 'active' : ''}}" data-type="guqin" catchtap="onAmbienceChange">
|
||||
<text class="menu-icon">🎵</text>
|
||||
<text class="menu-text">古琴</text>
|
||||
</view>
|
||||
<view class="menu-item {{currentAmbience === 'white' ? 'active' : ''}}" data-type="white" catchtap="onAmbienceChange">
|
||||
<text class="menu-icon">🌫</text>
|
||||
<text class="menu-text">白噪音</text>
|
||||
</view>
|
||||
<view class="menu-item {{currentAmbience === 'forest' ? 'active' : ''}}" data-type="forest" catchtap="onAmbienceChange">
|
||||
<text class="menu-icon">🌲</text>
|
||||
<text class="menu-text">森林</text>
|
||||
</view>
|
||||
<view class="menu-item {{currentAmbience === 'stream' ? 'active' : ''}}" data-type="stream" catchtap="onAmbienceChange">
|
||||
<text class="menu-icon">💧</text>
|
||||
<text class="menu-text">溪流</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="name" bindlongpress="onNameLongPress">{{nameList[currentIndex].name}}</text>
|
||||
<view class="poem-container">
|
||||
<text class="poem">{{nameList[currentIndex].origin}}</text>
|
||||
</view>
|
||||
@@ -40,6 +73,10 @@
|
||||
<view class="analysis-container">
|
||||
<view class="tone-tag">声韵:{{nameList[currentIndex].tone}}</view>
|
||||
<view class="score-tag">见素评分:{{nameList[currentIndex].score}}</view>
|
||||
<view class="ai-btn" catchtap="onAskAI">
|
||||
<text class="ai-icon">✦</text>
|
||||
<text>问问 AI</text>
|
||||
</view>
|
||||
<view class="save-btn" catchtap="onSavePoster">
|
||||
<text class="save-icon">+</text>
|
||||
<text>存为海报</text>
|
||||
@@ -83,6 +120,9 @@
|
||||
<view class="poster-btn save-btn" bindtap="savePoster">
|
||||
<text>保存到相册</text>
|
||||
</view>
|
||||
<view class="poster-btn square-btn" bindtap="shareToSquare">
|
||||
<text>分享到广场</text>
|
||||
</view>
|
||||
<view class="poster-btn share-btn" bindtap="sharePoster">
|
||||
<text>分享给好友</text>
|
||||
</view>
|
||||
@@ -90,26 +130,53 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结语卡片:灵感耗尽或加载失败时显示 -->
|
||||
<view class="ending-card {{showEndingCard ? 'show' : ''}}" wx:if="{{showEndingCard}}">
|
||||
<view class="ending-ink"></view>
|
||||
<text class="ending-hint">此间灵感暂歇</text>
|
||||
<text class="ending-subhint">或寻他处,或待重来</text>
|
||||
<view class="ending-actions">
|
||||
<view class="ending-btn square-btn" bindtap="onGoToSquare">
|
||||
<text>进入灵感广场</text>
|
||||
</view>
|
||||
<view class="ending-btn back-btn" bindtap="onBack">
|
||||
<text>返回重试</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="action-bar" wx:if="{{!isLoading && nameList.length > 0}}">
|
||||
<view class="action-bar" wx:if="{{!isLoading && nameList.length > 0 && !showEndingCard}}">
|
||||
<view class="action-btn dislike-btn" bindtap="onDislike">
|
||||
<text class="action-icon">×</text>
|
||||
</view>
|
||||
<view class="action-btn square-btn" bindtap="onGoToSquare">
|
||||
<text class="action-icon">✦</text>
|
||||
</view>
|
||||
<view class="action-btn like-btn" bindtap="onLike">
|
||||
<text class="action-icon">♥</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" wx:if="{{!isLoading && nameList.length === 0}}">
|
||||
<text>暂无灵感,请重试</text>
|
||||
<button bindtap="onLoad" style="margin-top: 20px; font-weight: 300;">重新感悟</button>
|
||||
<!-- 空状态:和结语卡片样式一致 -->
|
||||
<view class="ending-card {{!isLoading && nameList.length === 0 ? 'show' : ''}}" wx:if="{{!isLoading && nameList.length === 0}}">
|
||||
<view class="ending-ink"></view>
|
||||
<text class="ending-hint">此间灵感暂歇</text>
|
||||
<text class="ending-subhint">或寻他处,或待重来</text>
|
||||
<view class="ending-actions">
|
||||
<view class="ending-btn square-btn" bindtap="onGoToSquare">
|
||||
<text>进入灵感广场</text>
|
||||
</view>
|
||||
<view class="ending-btn back-btn" bindtap="onBack">
|
||||
<text>返回重试</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 收藏锦囊 -->
|
||||
<!-- 收藏锦囊:始终显示 -->
|
||||
<view class="collection-bag" bindtap="toggleCollectionView">
|
||||
<text class="bag-icon">囊</text>
|
||||
<view class="collection-count">{{collectedNames.length}}</view>
|
||||
<view class="collection-count" wx:if="{{collectedNames.length > 0}}">{{collectedNames.length}}</view>
|
||||
</view>
|
||||
|
||||
<!-- 收藏列表浮层 -->
|
||||
@@ -130,4 +197,109 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 字源溯源弹窗 -->
|
||||
<view class="char-detail-modal {{showCharDetail ? 'visible' : ''}}" bindtap="closeCharDetail">
|
||||
<view class="char-detail-content" catchtap="preventBubble">
|
||||
<view class="char-detail-close" bindtap="closeCharDetail">×</view>
|
||||
|
||||
<!-- 磨砂玻璃背景 -->
|
||||
<view class="char-detail-glass"></view>
|
||||
|
||||
<!-- 篆书背景装饰 -->
|
||||
<view class="char-seal-bg">
|
||||
<text class="seal-char seal-1">{{selectedChar}}</text>
|
||||
<text class="seal-char seal-2">{{selectedChar}}</text>
|
||||
<text class="seal-char seal-3">{{selectedChar}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 大字展示 -->
|
||||
<view class="char-display">
|
||||
<text class="char-big">{{selectedChar}}</text>
|
||||
<text class="char-pinyin" wx:if="{{charDetailData}}">{{charDetailData.pinyin}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 字源信息 -->
|
||||
<scroll-view class="char-info-scroll" scroll-y wx:if="{{charDetailData}}">
|
||||
<!-- 基础信息 -->
|
||||
<view class="char-info-section">
|
||||
<view class="char-info-item">
|
||||
<text class="char-label">部首</text>
|
||||
<text class="char-value">{{charDetailData.radical || '未知'}}</text>
|
||||
</view>
|
||||
<view class="char-info-item">
|
||||
<text class="char-label">笔画</text>
|
||||
<text class="char-value">{{charDetailData.strokes || '未知'}}画</text>
|
||||
</view>
|
||||
<view class="char-info-item">
|
||||
<text class="char-label">五行</text>
|
||||
<text class="char-value">{{charDetailData.wuxing || '未知'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 本义 -->
|
||||
<view class="char-section">
|
||||
<view class="char-section-title">本义</view>
|
||||
<text class="char-section-text">{{charDetailData.meaning || '暂无解析'}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 起名意象 -->
|
||||
<view class="char-section">
|
||||
<view class="char-section-title">起名意象</view>
|
||||
<text class="char-section-text">{{charDetailData.imagery || '暂无解析'}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 诗词典故 -->
|
||||
<view class="char-section" wx:if="{{charDetailData.poetry}}">
|
||||
<view class="char-section-title">诗词典故</view>
|
||||
<text class="char-section-text poetry">{{charDetailData.poetry}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view class="char-loading" wx:if="{{!charDetailData}}">
|
||||
<text>正在溯源...</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 问问 AI 弹窗 -->
|
||||
<view class="ai-modal {{showAIModal ? 'show' : ''}}" bindtap="closeAIModal">
|
||||
<view class="ai-modal-content" catchtap="preventBubble">
|
||||
<!-- 磨砂玻璃背景 -->
|
||||
<view class="ai-modal-glass"></view>
|
||||
|
||||
<!-- 关闭按钮 -->
|
||||
<view class="ai-modal-close" bindtap="closeAIModal">×</view>
|
||||
|
||||
<!-- 标题 -->
|
||||
<view class="ai-modal-header">
|
||||
<text class="ai-modal-title">AI 深度解析</text>
|
||||
<text class="ai-modal-subtitle">{{nameList[currentIndex].name}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 输入框 -->
|
||||
<view class="ai-input-section">
|
||||
<text class="ai-input-label">你想了解这个名字在什么场景下的暗示?</text>
|
||||
<input class="ai-context-input" placeholder="例如:从事艺术行业、出国留学、创业..." value="{{aiContext}}" bindinput="onAIContextInput" />
|
||||
</view>
|
||||
|
||||
<!-- 解析结果 -->
|
||||
<scroll-view class="ai-result-scroll" scroll-y wx:if="{{aiExplanation}}">
|
||||
<text class="ai-explanation">{{aiExplanation}}</text>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view class="ai-loading" wx:if="{{aiLoading}}">
|
||||
<text>正在思考...</text>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="ai-actions" wx:if="{{!aiLoading}}">
|
||||
<view class="ai-action-btn" bindtap="requestAIExplanation">
|
||||
<text>{{aiExplanation ? '重新解析' : '开始解析'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user