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": []
},
"editorSetting": {}
}
}

View File

@@ -217,7 +217,7 @@ export class UserService {
// 处理人数统计 - 兼容不同的字段名
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;
// 转换为 ListCard 期望的格式

View File

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

View File

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