feat:1.0.2 bug修复,引导页优化

This commit is contained in:
2025-07-03 11:04:52 +08:00
parent fdf8a31f32
commit ef39c86d5f
9 changed files with 120 additions and 39 deletions
+2 -1
View File
@@ -9,6 +9,7 @@
"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"
"van-cell-group": "@vant/weapp/cell-group/index",
"van-switch": "@vant/weapp/switch/index"
}
}
+7
View File
@@ -4,6 +4,7 @@
background-color: #F6F6F6;
.debug-wrapper {
margin-top: 30rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
@@ -13,6 +14,12 @@
color: #666;
border-top: 0 none;
}
.debug-cell {
display: flex;
align-items: center;
justify-content: space-between;
}
}
.btn-area {
+13 -2
View File
@@ -1,11 +1,13 @@
Page({
data: {
header: 'wechat'
header: 'wechat',
enableDebug: false
},
onLoad() {
const header = getApp().getPrintHeader() || 'wechat';
this.setData({ header });
const enableDebug = wx.getStorageSync('enableDebug') || false;
this.setData({ header, enableDebug });
},
onChangeHeader(e: WechatMiniprogram.CustomEvent) {
@@ -20,6 +22,15 @@ Page({
onConfirm() {
getApp().setPrintHeader(this.data.header);
const enableDebug = this.data.enableDebug;
wx.setStorageSync('enableDebug', enableDebug);
wx.setEnableDebug({ enableDebug });
wx.navigateBack();
},
/** 真机调试线上包 */
toggleDebug() {
const enableDebug = !this.data.enableDebug;
this.setData({ enableDebug });
}
});
+20
View File
@@ -36,6 +36,26 @@
</van-cell>
</van-radio-group>
</van-cell-group>
<van-cell-group custom-class="debug-wrapper">
<van-cell
title="debug调整"
size="large"
custom-class="centered-title" />
<van-cell
custom-class="debug-cell"
title="真机调试线上包"
clickable
data-name="enableDebug"
border="{{ false }}"
bind:click="toggleDebug">
<van-switch
slot="right-icon"
name="enableDebug"
checked="{{enableDebug}}" />
</van-cell>
</van-cell-group>
<view class="btn-area">
<toy-button type="green" bind:click="onConfirm" width="360rpx">
确定
+2 -20
View File
@@ -1,6 +1,7 @@
import { WATER_COLORS, PAPER_SIZE } from '../../constants/colors';
import { WORDS } from '../../constants/words';
import TextDrawService from '../../service/textDrawService';
import { checkAndSaveImage } from '../../utils/saveImage';
Page({
canvas: null as Canvas | null,
@@ -196,26 +197,7 @@ Page({
/** 下载打印 */
exportToPrint() {
if (this.canvas && this.data.cardList.length > 0) {
wx.canvasToTempFilePath({
canvas: this.canvas,
fileType: 'png',
quality: 1,
success: (res) => {
wx.getImageInfo({
src: res.tempFilePath,
success: (res) =>
console.log(
'getImageInfo image size :',
res.width,
res.height,
), // 应输出2480x3508
});
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => wx.showToast({ title: '保存成功' }),
});
},
});
checkAndSaveImage(this.canvas);
return;
}
},