fix: card content font size

This commit is contained in:
zzc
2026-01-22 15:08:26 +08:00
parent 9f5c5d2d1f
commit 303654b1e1

View File

@@ -22,6 +22,8 @@
:style="{ :style="{
color: selectedColor, color: selectedColor,
fontFamily: selectedFont.family, fontFamily: selectedFont.family,
fontSize: fontSize + 'rpx',
lineHeight: fontSize * 1.5 + 'rpx',
}" }"
>{{ targetName + "\n " + blessingText }}</text >{{ targetName + "\n " + blessingText }}</text
> >
@@ -29,8 +31,12 @@
<view class="user" :style="{ left: 160 + userOffsetX + 'rpx' }"> <view class="user" :style="{ left: 160 + userOffsetX + 'rpx' }">
<image class="avatar" :src="userAvatar" mode="aspectFill" /> <image class="avatar" :src="userAvatar" mode="aspectFill" />
<view class="user-info"> <view class="user-info">
<text class="user-name">{{ signatureName }}</text> <text class="user-name" :style="{ color: signatureColor }">{{
<text class="user-desc">送上祝福</text> signatureName
}}</text>
<text class="user-desc" :style="{ color: signatureColor }"
>送上祝福</text
>
</view> </view>
</view> </view>
</view> </view>
@@ -114,6 +120,7 @@
v-model="targetName" v-model="targetName"
placeholder="请输入称呼" placeholder="请输入称呼"
placeholder-style="color:#ccc" placeholder-style="color:#ccc"
maxlength="5"
/> />
</view> </view>
@@ -150,6 +157,7 @@
v-model="signatureName" v-model="signatureName"
placeholder="请输入署名" placeholder="请输入署名"
placeholder-style="color:#ccc" placeholder-style="color:#ccc"
maxlength="5"
/> />
<text class="edit-icon"></text> <text class="edit-icon"></text>
</view> </view>
@@ -175,9 +183,22 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- 字体大小 -->
<view class="form-item">
<text class="label">字体大小</text>
<slider
:value="fontSize"
min="24"
max="64"
show-value
@change="(e) => (fontSize = e.detail.value)"
activeColor="#ff3b30"
/>
</view>
<!-- 文字颜色 --> <!-- 文字颜色 -->
<view class="form-item"> <view class="form-item">
<text class="label">文字颜色</text> <text class="label">祝福语颜色</text>
<view class="color-list"> <view class="color-list">
<view <view
v-for="(color, index) in textColors" v-for="(color, index) in textColors"
@@ -190,6 +211,22 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 署名颜色 -->
<view class="form-item">
<text class="label">署名颜色</text>
<view class="color-list">
<view
v-for="(color, index) in textColors"
:key="index"
class="color-item"
:style="{ background: color }"
@tap="signatureColor = color"
>
<view v-if="signatureColor === color" class="color-check"></view>
</view>
</view>
</view>
</view> </view>
<!-- 位置调整 --> <!-- 位置调整 -->
@@ -262,9 +299,23 @@ const userAvatar = ref(
); );
const blessingText = ref(""); const blessingText = ref("");
const fontSize = ref(32);
const textColors = ["#ffffff", "#ff3b30", "#F5A623", "#8B572A", "#000000"]; const textColors = [
"#ffffff",
"#000000",
"#ff3b30",
"#F5A623",
"#8B572A",
"#D0021B",
"#F8E71C",
"#7ED321",
"#4A90E2",
"#9013FE",
"#FFC0CB",
];
const selectedColor = ref("#ffffff"); const selectedColor = ref("#ffffff");
const signatureColor = ref("#ffffff");
const fontList = [ const fontList = [
{ name: "默认", family: "PingFang SC", url: "" }, { name: "默认", family: "PingFang SC", url: "" },
@@ -578,8 +629,8 @@ const saveByCanvas = async (save = true) => {
x: 70, x: 70,
y: 260 + bubbleOffsetY.value, y: 260 + bubbleOffsetY.value,
maxWidth: 400, maxWidth: 400,
fontSize: 32, fontSize: fontSize.value,
lineHeight: 46, lineHeight: fontSize.value * 1.5,
backgroundColor: "rgba(255,255,255,0.85)", backgroundColor: "rgba(255,255,255,0.85)",
textColor: selectedColor.value, textColor: selectedColor.value,
fontFamily: selectedFont.value.family, fontFamily: selectedFont.value.family,
@@ -591,6 +642,7 @@ const saveByCanvas = async (save = true) => {
avatarImg: avatarImg, // 传入 Image 对象 avatarImg: avatarImg, // 传入 Image 对象
username: signatureName.value, username: signatureName.value,
desc: "送上祝福", desc: "送上祝福",
textColor: signatureColor.value,
}); });
// 6⃣ 输出 // 6⃣ 输出
@@ -1143,6 +1195,7 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
.color-list { .color-list {
display: flex; display: flex;
gap: 20rpx; gap: 20rpx;
flex-wrap: wrap;
} }
.color-item { .color-item {
width: 64rpx; width: 64rpx;