feat: 添加许愿树功能和Go后端服务

- 新增许愿树页面(Canvas绘制、许愿条展示)
- 新增许愿详情页面
- 新增许愿创建弹窗(免费/付费两种模式)
- 新增网络请求封装 utils/request.js
- 新增Go后端项目结构(Gin + Inertia.js)
- 新增用户、订单、许愿数据模型
- 新增数据库迁移脚本
- 更新.gitignore补全忽略规则
- 更新.env.local配置(robot=2, 版本1.0.1)
- 添加secrets目录说明文档
This commit is contained in:
gouki
2026-08-06 12:26:29 +00:00
parent 9c178e6d49
commit 11bfc15141
31 changed files with 2025 additions and 1 deletions
+117
View File
@@ -0,0 +1,117 @@
<view class="container">
<!-- 许愿树画布 -->
<view class="canvas-container">
<canvas
canvas-id="wishTree"
class="wish-tree-canvas"
style="width: {{canvasWidth}}px; height: {{canvasHeight}}px;"
></canvas>
<!-- 许愿条覆盖层 -->
<view class="wishes-overlay">
<view
wx:for="{{wishes}}"
wx:key="id"
class="wish-tag {{item.type}} {{item.isRobot ? 'robot' : ''}}"
style="left: {{item.x}}px; top: {{item.y}}px;"
bindtap="viewWishDetail"
data-id="{{item.id}}"
>
<text class="wish-text">{{item.content}}</text>
<view class="wish-badge" wx:if="{{item.type === 'paid'}}">VIP</view>
</view>
</view>
</view>
<!-- 许愿按钮 -->
<view class="action-bar">
<button class="btn-primary btn-wish" bindtap="openCreateModal">
<text class="icon">🙏</text>
<text>我要许愿</text>
</button>
</view>
<!-- 许愿说明 -->
<view class="tips-section">
<view class="tip-item">
<text class="tip-icon">🎋</text>
<text class="tip-text">免费许愿:20字以内,可能被覆盖</text>
</view>
<view class="tip-item">
<text class="tip-icon">✨</text>
<text class="tip-text">付费许愿:100字以内,优先展示,长期保留</text>
</view>
</view>
<!-- 许愿弹窗 -->
<view class="modal" wx:if="{{showCreateModal}}">
<view class="modal-mask" bindtap="closeCreateModal"></view>
<view class="modal-content">
<view class="modal-header">
<text class="modal-title">许下心愿</text>
<text class="modal-close" bindtap="closeCreateModal">×</text>
</view>
<view class="modal-body">
<!-- 许愿类型选择 -->
<view class="type-selector">
<view
class="type-item {{wishType === 'free' ? 'active' : ''}}"
bindtap="selectType"
data-type="free"
>
<text class="type-name">免费许愿</text>
<text class="type-desc">20字以内</text>
</view>
<view
class="type-item {{wishType === 'paid' ? 'active' : ''}}"
bindtap="selectType"
data-type="paid"
>
<text class="type-name">付费许愿</text>
<text class="type-desc">更多特权</text>
</view>
</view>
<!-- 许愿内容输入 -->
<textarea
class="wish-input"
placeholder="请输入你的愿望..."
maxlength="{{wishType === 'free' ? maxFreeLength : maxPaidLength}}"
bindinput="onInputContent"
value="{{wishContent}}"
></textarea>
<view class="input-count">
{{wishContent.length}}/{{wishType === 'free' ? maxFreeLength : maxPaidLength}}
</view>
<!-- 付费商品选择 -->
<view class="product-section" wx:if="{{wishType === 'paid'}}">
<view class="section-title">选择许愿商品</view>
<view class="product-list">
<view
wx:for="{{products}}"
wx:key="id"
class="product-item {{selectedProduct && selectedProduct.id === item.id ? 'active' : ''}}"
bindtap="selectProduct"
data-id="{{item.id}}"
>
<view class="product-info">
<text class="product-name">{{item.name}}</text>
<text class="product-desc">展示{{item.duration}}天</text>
</view>
<view class="product-price">¥{{item.price / 100}}</view>
</view>
</view>
</view>
</view>
<view class="modal-footer">
<button class="btn-outline" bindtap="closeCreateModal">取消</button>
<button class="btn-primary" bindtap="submitWish">
{{wishType === 'paid' ? '支付并许愿' : '提交许愿'}}
</button>
</view>
</view>
</view>
</view>