Files
doodle-mini/miniprogram/pages/index/index.wxml
T
2025-07-23 11:05:55 +08:00

121 lines
4.0 KiB
Plaintext

<view class="page-container">
<view class="wrapper">
<text class="wrapper-title">自定义涂鸦卡</text>
<view class="word-input-box">
<word-input bind:onConfirm="onConfirmInput" width="420rpx" />
<toy-button
type="green"
bind:click="openSelectWordPopup"
width="220rpx">
选择文字
</toy-button>
</view>
<view class="word-card-box">
<block wx:if="{{cardList.length > 0}}">
<block
wx:for="{{cardList}}"
wx:for-item="item"
wx:for-index="index">
<view class="word-card-list" wx:if="{{index % 2 === 0}}">
<word-card
key="{{index}}"
word="{{item.word}}"
color="{{item.color}}"
bind:onDelete="deleteWordCard"
bind:onColorTap="onColorTap" />
<word-card
wx:if="{{cardList[index + 1]}}"
key="{{index + 1}}"
word="{{cardList[index + 1].word}}"
color="{{cardList[index + 1].color}}"
bind:onDelete="deleteWordCard"
bind:onColorTap="onColorTap" />
</view>
</block>
</block>
<block wx:if="{{!cardList.length}}">
<view class="word-list-empty">
请选择或输入文字,生成涂鸦卡
</view>
</block>
</view>
<view class="operation-box">
<toy-button
type="primary"
bind:click="refreshCardList"
width="420rpx"
icon="refresh"
icon-class-prefix="toy-icon">
随机生成
</toy-button>
<toy-button
disabled="{{cardList.length <= 0}}"
type="white"
bind:click="clearCardList"
width="220rpx"
icon="clear"
icon-class-prefix="toy-icon">
清空
</toy-button>
</view>
</view>
<view id="previewWrapper" class="wrapper">
<text class="wrapper-title">预览打印效果</text>
<view
wx:if="{{!isPCDevtool}}"
id="canvasWrapper"
class="canvas-wrapper">
<canvas
type="2d"
id="canvasContent"
class="canvas-content"
style="width:{{boxWidth}}px;height:{{boxHeight}}px" />
</view>
</view>
<van-cell
wx:if="{{env !== 'release'}}"
is-link
title="debug页面"
link-type="navigateTo"
url="/pages/debug/debug" />
<view class="empty"></view>
<color-picker
show="{{showColorPopup}}"
currentColor="{{currentColor}}"
bind:onClose="onCloseColorPopup"
bind:onChange="onChangeColor" />
<word-picker
show="{{showSelectWordPopup}}"
cardList="{{cardList}}"
bind:onClose="closeSelectWordPopup"
bind:onChange="onChangeWord" />
</view>
<view class="bottom-btn-box">
<toy-button
openType="share"
type="green"
flat="{{true}}"
bind:click="onShareAppMessage"
width="220rpx"
height="80rpx"
icon="wechat"
icon-class-prefix="toy-icon">
分享
</toy-button>
<toy-button
type="primary"
flat="{{true}}"
bind:click="exportToPrint"
width="420rpx"
height="80rpx"
disabled="{{cardList.length <= 0}}"
icon="download"
icon-class-prefix="toy-icon">
下载打印
</toy-button>
</view>
<introduction-popup
wx:if="{{showIntroductionPopup}}"
bind:onClose="onCloseIntroductionPopup" />