This commit is contained in:
2026-03-10 09:55:50 +08:00
parent 47594ed095
commit 3678cfe35f
2 changed files with 44 additions and 42 deletions

View File

@ -209,7 +209,6 @@ async saveCurrentImage() {
title: '生成图片中...',
mask: true
});
try {
// 获取 Canvas 节点
const query = tt.createSelectorQuery();
@ -252,29 +251,32 @@ async saveCurrentImage() {
ctx.fillStyle = '#FF19A0';
ctx.textAlign = 'center';
// 绘制证书标题
// 绘制证书标题 - 增加顶部间距
const title = currentItem.title || '为爱续航证书';
ctx.fillText(title, this.canvasWidth / 2, 50);
ctx.fillText(title, this.canvasWidth / 2, 65); // 从50改为65增加间距
// 绘制英文标题
ctx.font = '12px sans-serif';
const titleEn = currentItem.title_en || 'Certificate of Love Endurance';
ctx.fillText(titleEn, this.canvasWidth / 2, 70);
ctx.fillText(titleEn, this.canvasWidth / 2, 85); // 从70改为85增加间距
// 绘制用户名
ctx.font = '16px sans-serif';
const userName = this.userName || '周佳佳';
ctx.fillText(userName, this.canvasWidth / 2, 100);
ctx.fillText(userName, this.canvasWidth / 2, 110); // 从100改为110增加间距
// 绘制描述文本
ctx.font = '12px sans-serif';
ctx.fillStyle = '#333333';
ctx.textAlign = 'left';
const description = `您累计捐赠${currentItem.source_value || 0}克粮,为毛孩子奉献爱心,点燃希望,感谢您的捐赠让世界变得更温暖。`;
this.wrapText(ctx, description, 20, 130, this.canvasWidth - 40, 16);
this.wrapText(ctx, description, 20, 140, this.canvasWidth - 40, 16); // 从130改为140增加间距
// 绘制结尾文字
ctx.fillText('特发此证,以表谢忱!', 20, 200);
ctx.font = '12px sans-serif';
ctx.fillStyle = '#333333';
ctx.textAlign = 'left';
ctx.fillText('特发此证,以表谢忱!', 20, 180); // 从200改为180向上移动
// 绘制证书编号
ctx.font = '10px sans-serif';
@ -334,6 +336,7 @@ async saveCurrentImage() {
});
console.error('生成证书图片失败:', error);
}
},
generateCertificateTemplate() {
// 使用存储的证书信息

View File

@ -62,21 +62,21 @@
</view>
</view>
<view class="line" />
<view class="itemWrapper" @click="toPublicBenefit">
<text class="titlWrapper">关爱宠物,传递温情</text>
<view class="content">公益助力</view>
<view class="tips">帮我找个家</view>
<view class="itemWrapper" @click="toDogTraining">
<text class="titlWrapper">狗狗训练</text>
<view class="content">上门服务</view>
<view class="tips">上门训犬寄养喂猫遛狗</view>
<view class="itemImg">
<image class="menu-img-sm" :src="`${imgPrefix}h-public.png`" mode="aspectFill" />
<image class="menu-img-sm" :src="`${imgPrefix}home-dogTraining.png`" mode="aspectFill" />
</view>
</view>
</view>
<view class="secondMenu">
<scroll-view class="scrollWrapper" scroll-x enable-flex
<scroll-view class="scrollWrapper" :scroll-x="secondMenuItemList.length > 4" enable-flex
:scroll-with-animation="false"
@scroll="onSecondMenuScroll">
<view class="secondMenuInner">
<view class="secondMenuInner" :class="{ 'no-scroll': secondMenuItemList.length <= 4 }">
<view class="itemWrapper" v-for="(item, i) in secondMenuItemList" :key="i"
@click="handleNav(item)">
<view class="imgWrapper">
@ -92,19 +92,19 @@
</view>
</scroll-view>
<view class="custom-indicator">
<view class="custom-indicator" v-if="secondMenuItemList.length > 4">
<view class="itemLine" :class="{ active: secondMenuIndicatorIndex === 0 }"></view>
<view class="itemLine" :class="{ active: secondMenuIndicatorIndex === 1 }"></view>
</view>
</view>
<view class="thirdMenu">
<view class="itemWrapper" @click="toDogTraining">
<view class="itemWrapper" @click="toPublicBenefit">
<view>
<view class="title">上门服务</view>
<view class="tips">训犬寄养喂猫遛狗</view>
<view class="title">公益助力</view>
<view class="tips">帮我找个家</view>
</view>
<image class="third-icon1" :src="`${imgPrefix}h-door.png`" mode="aspectFill" />
<image class="third-icon" :src="`${imgPrefix}home-publicBenefit.png`" mode="aspectFill" />
</view>
<view class="itemWrapper" @click="toJoin">
<view>
@ -188,11 +188,6 @@ export default {
img: `${imgPrefix}home-openVip.png`,
naviUrl: "/pages/richText/member-interests"
},
{
title: "健康顾问",
tips: "宠物健康智能助手",
img: `${imgPrefix}healthConsultant.png`,
},
],
walletInfo: {}, // 钱包信息
secondMenuIndicatorIndex: 0, // 第二排菜单指示器当前页 0=第一页 1=第二页
@ -250,14 +245,9 @@ export default {
});
},
toDogTraining() {
uni.showToast({
title: '敬请期待',
icon: 'none',
duration: 2000
uni.navigateTo({
url: '/pageHome/service/index'
});
// uni.navigateTo({
// url: '/pageHome/service/index'
// });
},
// 我的钱包
buyService() {
@ -385,13 +375,8 @@ export default {
}
.menu-img-sm {
width: 160rpx;
height: 160rpx;
}
.third-icon1{
width: 96rpx;
height: 120rpx;
width: 120rpx;
height: 164rpx;
}
.second-icon,
@ -616,9 +601,13 @@ export default {
.scrollWrapper {
width: 100%;
height: auto; /* 由内容撑开;小程序 scroll-view 横向滚动时默认可能不随内容计算高度 */
min-height: 220rpx; /* 兜底:约等于 padding-top + 图标 + 标题 + 副标题 */
display: flex;
align-items: flex-start; /* 不拉伸子项,高度由内容决定 */
white-space: nowrap;
padding: 32rpx 0 20rpx 0;
padding-top: 24rpx;
padding-bottom: 24rpx;
box-sizing: border-box;
.secondMenuInner {
@ -626,6 +615,16 @@ export default {
flex-wrap: nowrap;
flex-shrink: 0;
width: 937.5rpx; /* 5 * 187.5 一屏4个共5项 */
&.no-scroll {
width: 100%; /* 四项时一屏排满,不滚动 */
.itemWrapper {
flex: 1;
width: 0; /* 均分宽度,避免被 menuBody padding 裁切 */
min-width: 0;
}
}
}
.itemWrapper {
@ -654,7 +653,7 @@ export default {
.custom-indicator {
display: flex;
margin-top:-150rpx;
margin-top: 12rpx;
justify-content: center;
margin-bottom: 20rpx;
gap: 12rpx;