From 770c0c42bbf30d7766e1f083248027ecf97e0b0c Mon Sep 17 00:00:00 2001 From: kron Date: Sat, 28 Jun 2025 13:42:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index.vue | 6 +++--- src/pages/ranking.vue | 9 ++++++--- src/util.js | 7 ++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/pages/index.vue b/src/pages/index.vue index c6ce9b8..c21a67a 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -88,7 +88,7 @@ const comingSoon = () => { @@ -284,6 +284,9 @@ const toRankListPage = () => { border-radius: 10px; margin: 0 15px; } +.ranking-data { + margin-bottom: 20px; +} .ranking-my-data { margin-bottom: 15px; } @@ -452,7 +455,7 @@ const toRankListPage = () => { font-size: 14px; text-align: center; width: 100%; - margin-top: 10px; - margin-bottom: 20px; + margin-top: 5px; + margin-bottom: 10px; } diff --git a/src/util.js b/src/util.js index 1e21d74..e6146a2 100644 --- a/src/util.js +++ b/src/util.js @@ -85,7 +85,7 @@ export function renderRankTitle(ctx, text) { const textY = 50; const x = textX - padding - 10; // 文字 x 坐标减去内边距 const y = textY - fontSize - padding / 2 + 2; // 文字 y 坐标减去字体大小和内边距 - const width = textWidth + padding * 2 - 27; // 背景宽度 + const width = textWidth + padding * 2 - 25; // 背景宽度 const height = fontSize + padding - 2; // 背景高度 // 开始绘制圆角矩形 @@ -109,6 +109,7 @@ export function renderRankTitle(ctx, text) { ctx.fillStyle = "#5F51FF"; ctx.fill(); ctx.setFontSize(fontSize); + ctx.setTextAlign("center"); ctx.setFillStyle("rgba(255, 255, 255, 0.9)"); ctx.fillText(text, textX, textY); // 绘制文字 } @@ -156,8 +157,8 @@ export function generateCanvasImage(canvasId, type, user, data) { ctx.drawImage("../static/share-bg.png", 0, 0, width, height); drawRoundImage(ctx, user.avatar, 17, 20, 32, 32, 20); ctx.drawImage("../static/avatar-frame.png", 12, 15, 42, 42); - renderText(ctx, user.nickName, 13, "#fff", 72, 34, "center"); - renderRankTitle(ctx, user.lvlName, "center"); + renderText(ctx, user.nickName, 13, "#fff", 58, 34); + renderRankTitle(ctx, user.lvlName); let titleImage = "../static/first-try-title.png"; let subTitle = "正式开启弓箭手之路";