feat:完成自定义文字涂色卡

This commit is contained in:
2025-07-02 15:17:50 +08:00
parent 26af95b604
commit 8006695f65
19 changed files with 201 additions and 39 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"navigationBarTitleText": "Debug",
"navigationBarBackgroundColor": "#FFD719",
"homeButton": true,
"backgroundColor": "#F6F6F6",
"enablePullDownRefresh": false,
"usingComponents": {
"toy-button": "../../ui/button/button",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index"
}
}
+24
View File
@@ -0,0 +1,24 @@
.debug-page {
min-height: 100vh;
padding: 20rpx;
background-color: #F6F6F6;
.debug-wrapper {
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
.centered-title {
text-align: center;
color: #666;
border-top: 0 none;
}
}
.btn-area {
display: flex;
align-items: center;
justify-content: center;
margin-top: 40rpx;
}
}
+25
View File
@@ -0,0 +1,25 @@
Page({
data: {
header: 'wechat'
},
onLoad() {
const header = getApp().getPrintHeader() || 'wechat';
this.setData({ header });
},
onChangeHeader(e: WechatMiniprogram.CustomEvent) {
const header = e.detail.value as PrintHeader;
this.setData({ header });
},
onClickHeaderSetting(e: WechatMiniprogram.CustomEvent) {
const header = e.currentTarget.dataset.name as PrintHeader;
this.setData({ header });
},
onConfirm() {
getApp().setPrintHeader(this.data.header);
wx.navigateBack();
}
});
+44
View File
@@ -0,0 +1,44 @@
<view class="debug-page">
<van-cell-group custom-class="debug-wrapper">
<van-cell
title="打印图片Header设置"
size="large"
custom-class="centered-title" />
<van-radio-group value="{{header}}" bind:change="onChangeHeader">
<van-cell
title="微信小程序头(wechat)(默认)"
clickable
data-name="wechat"
bind:click="onClickHeaderSetting">
<van-radio slot="right-icon" name="wechat" />
</van-cell>
<van-cell
title="无Logo图片头(noLogo"
clickable
data-name="noLogoImage"
bind:click="onClickHeaderSetting">
<van-radio slot="right-icon" name="noLogoImage" />
</van-cell>
<van-cell
title="有Logo图片头(LogoImage"
clickable
data-name="LogoImage"
bind:click="onClickHeaderSetting">
<van-radio slot="right-icon" name="LogoImage" />
</van-cell>
<van-cell
title="最小Header头(minimal"
clickable
data-name="minimal"
bind:click="onClickHeaderSetting"
border="{{ false }}">
<van-radio slot="right-icon" name="minimal" />
</van-cell>
</van-radio-group>
</van-cell-group>
<view class="btn-area">
<toy-button type="green" bind:click="onConfirm" width="360rpx">
确定
</toy-button>
</view>
</view>
-1
View File
@@ -26,7 +26,6 @@ Page({
tapCard(e: WechatMiniprogram.TouchEvent) {
const { url } = e.currentTarget.dataset;
console.log('navigateTo url:', url);
wx.navigateTo({ url });
},
});
+1
View File
@@ -5,6 +5,7 @@
"backgroundColor": "#F6F6F6",
"enablePullDownRefresh": false,
"usingComponents": {
"van-cell": "@vant/weapp/cell/index",
"van-icon": "@vant/weapp/icon/index",
"van-popup": "@vant/weapp/popup/index",
"word-input": "../../components/word-input/word-input",
+8 -1
View File
@@ -10,12 +10,13 @@ Page({
textDrawService: null as TextDrawService | null,
data: {
cardList: [] as Array<{ color: string; word: string }>,
cardList: [] as CardList,
showColorPopup: false,
currentKey: 0,
currentColor: '',
showIntroductionPopup: false,
showSelectWordPopup: false, // 选择文字弹窗
env: getApp().globalData.env || 'release',
},
onLoad() {
@@ -345,4 +346,10 @@ Page({
this.setData({ showSelectWordPopup: false });
this.drawCanvas(cardList);
},
onDebugEntryTap() {
wx.navigateTo({
url: '/pages/debug/debug',
});
},
});
+6 -9
View File
@@ -70,6 +70,11 @@
style="width:{{boxWidth}}px;height:{{boxHeight}}px" />
</view>
</view>
<van-cell
is-link
title="debug页面"
link-type="navigateTo"
url="/pages/debug/debug" />
<view class="empty"></view>
<color-picker
show="{{showColorPopup}}"
@@ -78,7 +83,7 @@
bind:onChange="onChangeColor" />
<word-picker
show="{{showSelectWordPopup}}"
selectedWords="{{selectedWords}}"
cardList="{{cardList}}"
bind:onClose="closeSelectWordPopup"
bind:onChange="onChangeWord" />
</view>
@@ -92,14 +97,6 @@
icon-class-prefix="toy-icon">
下载打印
</toy-button>
<!-- <toy-button
type="green"
width="680rpx"
disabled="{{cardList.length <= 0}}"
icon="download"
icon-class-prefix="toy-icon">
下载打印
</toy-button> -->
</view>
<introduction-popup
wx:if="{{showIntroductionPopup}}"