|
|
@ -24,31 +24,21 @@ |
|
|
|
wxCodeImage: '', |
|
|
|
baseUrl: 'https://image.hhlm1688.com/', |
|
|
|
canvas: {}, |
|
|
|
details: {}, |
|
|
|
posterData: {}, |
|
|
|
} |
|
|
|
}, |
|
|
|
async onLoad({ thesisId }) { |
|
|
|
async onLoad() { |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中...' |
|
|
|
}); |
|
|
|
await this.getData(thesisId) |
|
|
|
await this.fetchQrCode(thesisId) |
|
|
|
this.posterData = uni.getStorageSync('posterData') |
|
|
|
await this.fetchQrCode(this.posterData.path) |
|
|
|
uni.hideLoading(); |
|
|
|
this.draw() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async getData(thesisId) { |
|
|
|
|
|
|
|
try { |
|
|
|
this.details = await this.$fetch('queryThesisById', { thesisId }) |
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
async fetchQrCode(thesisId) { |
|
|
|
async fetchQrCode(path) { |
|
|
|
try { |
|
|
|
const path = `pages_order/thesis/index?thesisId=${thesisId}` |
|
|
|
this.wxCodeImage = (await this.$fetch('getInviteCode', { path }))?.url |
|
|
|
|
|
|
|
} catch (err) { |
|
|
@ -152,12 +142,12 @@ |
|
|
|
const descY = 751 * Ratio / dpr |
|
|
|
const maxWidth = 677 * Ratio / dpr |
|
|
|
const lineHeight = 45 * Ratio / dpr |
|
|
|
const text = this.details.paperDesc || this.details.title |
|
|
|
const text = this.posterData.paperDesc |
|
|
|
this.drawTextWithManualLineBreaks(ctx, text, descX, descY, maxWidth, lineHeight) |
|
|
|
|
|
|
|
// 海报图片 |
|
|
|
const paperImage = canvas.createImage() |
|
|
|
paperImage.src = this.details.paperImage || this.details.image?.split?.(',')?.[0] |
|
|
|
paperImage.src = this.posterData.paperImage |
|
|
|
paperImage.onload = () => { |
|
|
|
const x = 37 * Ratio / dpr |
|
|
|
const y = 21 * Ratio / dpr |