Files
JianSu-Naming/miniprogram/pages/index/index.wxml
2026-04-16 11:25:29 +08:00

74 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<view class="container">
<view class="card-stack" wx:if="{{!isLoading && nameList.length > 0}}">
<view
class="card-container"
style="transform: translateX({{translateX}}px) rotate({{rotate}}deg); transition: {{transition}};"
bindtouchstart="onTouchStart"
bindtouchmove="onTouchMove"
bindtouchend="onTouchEnd"
bindtransitionend="onTransitionEnd"
>
<view class="card {{isFlipped ? 'flipped' : ''}}">
<!-- 正面:名字与诗词 -->
<view class="card-face front" bindtap="onFlip">
<text class="name">{{nameList[currentIndex].name}}</text>
<view class="poem-container">
<text class="poem">{{nameList[currentIndex].origin}}</text>
</view>
</view>
<!-- 反面:故事化解读 -->
<view class="card-face back">
<view class="desc-container">
<text class="desc">{{nameList[currentIndex].description}}</text>
</view>
<view class="analysis-container">
<view class="tone-tag">声韵:{{nameList[currentIndex].tone}}</view>
<view class="score-tag">见素评分:{{nameList[currentIndex].score}}</view>
<view class="save-btn" catchtap="onSavePoster">
<text class="save-icon"></text>
<text>存为海报</text>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 海报生成画布 (隐藏在屏幕外) -->
<canvas type="2d" id="posterCanvas" style="width: 750px; height: 1334px; position: absolute; left: -9999px;"></canvas>
<!-- 底部操作提示 -->
<view class="footer" wx:if="{{!isLoading}}">
<view class="hint">左滑无感 · 右滑收藏</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>
<!-- 收藏锦囊 -->
<view class="collection-bag" bindtap="toggleCollectionView">
<text class="bag-icon">囊</text>
<view class="collection-count">{{collectedNames.length}}</view>
</view>
<!-- 收藏列表浮层 -->
<view class="collection-overlay {{showCollection ? 'visible' : ''}}" bindtap="toggleCollectionView">
<view class="collection-content" catchtap>
<view class="collection-title">见素锦囊</view>
<scroll-view scroll-y class="collection-scroll">
<view class="collection-item" wx:for="{{collectedNames}}" wx:key="name">
<view>
<view class="item-name">{{item.name}}</view>
<view class="item-origin">{{item.origin}}</view>
</view>
<view class="delete-btn" data-name="{{item.name}}" catchtap="onDeleteCollected">×</view>
</view>
<view wx:if="{{collectedNames.length === 0}}" class="collection-empty">
锦囊空空,静待灵感。
</view>
</scroll-view>
</view>
</view>
</view>