Files
doodle-mini/miniprogram/pages/copyBook/copyBook.wxml
T
2025-11-20 17:54:16 +08:00

107 lines
3.5 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="410rpx" />
<toy-button
type="green"
bind:click="openSelectWordPopup"
width="200rpx">
选择文字
</toy-button>
</view>
<view class="word-card-box">
<view class="word-cards-grid" wx:if="{{words.length > 0}}">
<word-card
disabledColor="{{true}}"
wx:key="index"
wx:for="{{words}}"
wx:for-item="word"
wx:for-index="index"
word="{{word}}"
key="{{index}}"
bind:onDelete="deleteWordCard"
bind:onColorTap="onColorTap" />
</view>
<empty-state
wx:if="{{!words.length}}"
title="还没有添加文字"
desc="请在上方输入文字或点击“选择文字”按钮,开始创建你的练字田字格吧!"
hint="提示:最多可以同时添加 11 个文字" />
</view>
<view class="operation-box">
<toy-button
type="primary"
bind:click="refreshWords"
width="410rpx"
icon="refresh"
icon-class-prefix="toy-icon">
随机生成
</toy-button>
<toy-button
disabled="{{words.length <= 0}}"
type="white"
bind:click="clearWords"
width="200rpx"
icon="clear"
icon-class-prefix="toy-icon">
清空
</toy-button>
</view>
</view>
<view id="previewWrapper" class="wrapper">
<text class="wrapper-title">预览练字田字格</text>
<view id="canvasWrapper" class="canvas-wrapper">
<canvas
type="2d"
id="canvasContent"
class="canvas-content"
style="width:{{boxWidth}}px;height:{{boxHeight}}px" />
</view>
</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"
icon="download"
icon-class-prefix="toy-icon">
下载打印
</toy-button>
</view>
<word-picker
show="{{showSelectWordPopup}}"
selectedWords="{{words}}"
max="11"
bind:onClose="closeSelectWordPopup"
bind:onChange="onChangeWord" />
<van-dialog
show="{{showShareDialog}}"
title="分享解锁下载"
message="今日免费下载次数已用完,分享给好友或朋友圈后即可继续免费下载"
show-cancel-button
confirm-button-text="转发给好友"
cancel-button-text="分享到朋友圈"
bind:confirm="onShareToFriend"
bind:cancel="onShareToTimeline"
bind:close="onCloseShareDialog" />
<view class="empty"></view>
</view>