refactor(wish-tree): 参考 wishing-tree-pages 重写许愿树
- 使用精美许愿树 PNG 图片作为背景 - 许愿标签用 CSS 动画实现摇摆效果 - 添加萤火虫和花瓣氛围动画 - 预设树冠挂载点,标签位置更自然 - 深色主题 + 金色/红色/绿色标签 - 边缘暗角让树从中心发光 - 最近心愿横向滚动列表
This commit is contained in:
@@ -1,34 +1,91 @@
|
||||
<view class="container">
|
||||
<!-- WebGL Canvas -->
|
||||
<canvas
|
||||
type="webgl"
|
||||
id="webgl-canvas"
|
||||
class="webgl-canvas"
|
||||
bindtouchstart="onCanvasTouch"
|
||||
bindtouchmove="onCanvasMove"
|
||||
bindtouchend="onCanvasEnd"
|
||||
></canvas>
|
||||
<!-- 背景氛围:萤火虫 -->
|
||||
<view class="ambiance">
|
||||
<view
|
||||
wx:for="{{fireflies}}"
|
||||
wx:key="index"
|
||||
class="firefly"
|
||||
style="left: {{item.left}}%; top: {{item.top}}%; width: {{item.size}}px; height: {{item.size}}px; animation-duration: {{item.duration}}s; animation-delay: {{item.delay}}s;"
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<!-- 顶部导航 -->
|
||||
<view class="top-bar">
|
||||
<view class="tree-info">
|
||||
<text class="tree-name">{{treeName}}</text>
|
||||
<text class="tree-desc">{{treeDesc}}</text>
|
||||
<!-- 背景氛围:花瓣 -->
|
||||
<view class="petals">
|
||||
<view
|
||||
wx:for="{{petals}}"
|
||||
wx:key="index"
|
||||
class="petal"
|
||||
style="left: {{item.left}}%; width: {{item.size}}px; height: {{item.size}}px; animation-duration: {{item.duration}}s; animation-delay: {{item.delay}}s;"
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<!-- 边缘暗角,让树从中心发光 -->
|
||||
<view class="vignette"></view>
|
||||
|
||||
<!-- 主内容 -->
|
||||
<view class="main-content">
|
||||
<!-- 头部 -->
|
||||
<view class="header">
|
||||
<text class="subtitle">MAKE A WISH</text>
|
||||
<text class="title">许愿树</text>
|
||||
<text class="description">月色微凉,灯火摇曳。写下心中所愿,挂上枝头,静待花开成真。</text>
|
||||
<text class="wish-count">已有 <text class="count">{{wishes.length}}</text> 个心愿挂满枝头</text>
|
||||
</view>
|
||||
|
||||
<!-- 传感器控制 -->
|
||||
<view class="sensor-controls">
|
||||
<view class="sensor-btn {{micEnabled ? 'active' : ''}}" bindtap="enableMicrophone">
|
||||
<text class="sensor-icon">🎤</text>
|
||||
|
||||
<!-- 许愿树 -->
|
||||
<view class="tree-container">
|
||||
<image
|
||||
src="/images/wish-tree.png"
|
||||
class="tree-image"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
|
||||
<!-- 许愿标签 -->
|
||||
<view
|
||||
wx:for="{{wishes}}"
|
||||
wx:key="id"
|
||||
class="wish-tag {{item.isNew ? 'new' : ''}}"
|
||||
style="left: {{item.x}}%; top: {{item.y}}%;"
|
||||
bindtap="viewWishDetail"
|
||||
data-id="{{item.id}}"
|
||||
>
|
||||
<view class="tag-sway" style="animation-duration: {{item.swayDuration}}s; animation-delay: {{item.swayDelay}}s;">
|
||||
<!-- 挂绳 -->
|
||||
<view class="tag-string" style="background: linear-gradient(to bottom, transparent, {{item.color}});"></view>
|
||||
<!-- 绳结 -->
|
||||
<view class="tag-knot" style="background: {{item.color}}; box-shadow: 0 0 8px {{item.color}};"></view>
|
||||
<!-- 标签 -->
|
||||
<view class="tag-content" style="background: {{item.bgColor}}; border: 1px solid {{item.borderColor}}; box-shadow: 0 4px 16px {{item.shadowColor}};">
|
||||
<text class="tag-text">{{item.content}}</text>
|
||||
<text class="tag-author">—— {{item.author}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 最近的心愿 -->
|
||||
<view class="recent-section">
|
||||
<text class="section-title">最 近 的 心 愿</text>
|
||||
<scroll-view class="recent-list" scroll-x enhanced show-scrollbar="{{false}}">
|
||||
<view
|
||||
wx:for="{{recentWishes}}"
|
||||
wx:key="id"
|
||||
class="recent-item"
|
||||
bindtap="viewWishDetail"
|
||||
data-id="{{item.id}}"
|
||||
>
|
||||
<text class="recent-text">{{item.content}}</text>
|
||||
<text class="recent-author">—— {{item.author}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 许愿按钮 -->
|
||||
<view class="action-bar">
|
||||
<button class="btn-wish" bindtap="openCreateModal">
|
||||
<text class="icon">🙏</text>
|
||||
<text>我要许愿</text>
|
||||
<text>写下心愿</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user