This commit is contained in:
张成
2026-04-22 10:19:01 +08:00
parent 5a753e7822
commit b5081afb2c
4 changed files with 9 additions and 9 deletions

View File

@@ -57,4 +57,4 @@
"include": [] "include": []
}, },
"editorSetting": {} "editorSetting": {}
} }

View File

@@ -217,7 +217,7 @@ export class UserService {
// 处理人数统计 - 兼容不同的字段名 // 处理人数统计 - 兼容不同的字段名
const registered_count = const registered_count =
game.current_players || game.participant_count || 0; game.participant_count ?? game.current_players ?? 0;
const max_count = game.max_players || game.max_participants || 0; const max_count = game.max_players || game.max_participants || 0;
// 转换为 ListCard 期望的格式 // 转换为 ListCard 期望的格式

View File

@@ -319,8 +319,9 @@ export async function generatePosterImage(data: any): Promise<string> {
console.log("start !!!!"); console.log("start !!!!");
// const dpr = Taro.getWindowInfo().pixelRatio; const systemDpr =
const dpr = 1; Taro.getWindowInfo?.().pixelRatio || Taro.getSystemInfoSync().pixelRatio || 1;
const dpr = Math.min(Math.max(systemDpr, 1), 2);
// console.log(dpr, 'dpr') // console.log(dpr, 'dpr')
const width = 600; const width = 600;
const height = 1000; const height = 1000;
@@ -487,7 +488,7 @@ export async function generatePosterImage(data: any): Promise<string> {
const { tempFilePath } = await Taro.canvasToTempFilePath({ const { tempFilePath } = await Taro.canvasToTempFilePath({
canvas, canvas,
fileType: 'png', fileType: 'png',
quality: 0.7, quality: 1,
}); });
console.log('tempFilePath', tempFilePath) console.log('tempFilePath', tempFilePath)
return tempFilePath; return tempFilePath;

View File

@@ -26,10 +26,9 @@ const designHeight = 400
// 获取屏幕宽度如果没有传入width则使用屏幕宽度 // 获取屏幕宽度如果没有传入width则使用屏幕宽度
const windowWidth = Taro.getSystemInfoSync().windowWidth const windowWidth = Taro.getSystemInfoSync().windowWidth
// 获取 DPR - 使用系统像素比确保高清显示 // 获取 DPR - 使用系统像素比确保高清显示,限制上限避免内存占用过高
// const systemDpr = Taro.getSystemInfoSync().pixelRatio const systemDpr = Taro.getSystemInfoSync().pixelRatio || 1
const dpr = 1 const dpr = Math.min(Math.max(systemDpr, 1), 2)
// Math.min(systemDpr, 3) // 限制最大dpr为3避免过度放大
// 2. 计算缩放比例(设备宽度 / 设计稿宽度) // 2. 计算缩放比例(设备宽度 / 设计稿宽度)
const scale = windowWidth / designWidth const scale = windowWidth / designWidth