update:对接会员限制次数

This commit is contained in:
2026-06-25 18:16:13 +08:00
parent 4bea563109
commit 4c32bbfb13
13 changed files with 351 additions and 52 deletions

View File

@@ -456,23 +456,29 @@ export const generateShareImage = async (canvasId, data) => {
// 2D 即时绘制,无需 ctx.draw()
} catch (e) {
console.error("generateShareImage 绘制失败:", e);
throw e;
}
};
// 顶部导入与工具方法
async function getCanvas2DContext(canvasId, targetWidth, targetHeight) {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
const query = uni.createSelectorQuery();
query
.select(`#${canvasId}`)
.fields({ node: true, size: true })
.exec((res) => {
const { node: canvas } = res[0] || {};
const canvasInfo = res && res[0];
const { node: canvas } = canvasInfo || {};
if (!canvas || typeof canvas.getContext !== "function") {
reject(new Error(`canvas ${canvasId} not found`));
return;
}
const ctx = canvas.getContext("2d");
const dpr = uni.getSystemInfoSync().pixelRatio || 1;
const w = targetWidth || res[0].width;
const h = targetHeight || res[0].height;
const w = targetWidth || canvasInfo.width;
const h = targetHeight || canvasInfo.height;
canvas.width = w * dpr;
canvas.height = h * dpr;
@@ -561,6 +567,7 @@ export const sharePointData = async (canvasId, data) => {
// 2D 即时绘制,无需 ctx.draw()
} catch (e) {
console.error("generateShareImage 绘制失败:", e);
throw e;
}
};
@@ -778,6 +785,7 @@ export async function sharePractiseData(canvasId, type, user, data) {
// 2D 模式下无需 ctx.draw()
} catch (err) {
console.log(err);
throw err;
}
}