From 1119d5679459192d2efa7545017ade6de5f31a5c Mon Sep 17 00:00:00 2001 From: Fox-33 <1466778434@qq.com> Date: Thu, 31 Jul 2025 13:47:48 +0800 Subject: [PATCH] feat: page-case-poster; --- pages.json | 4 +- pages_order/case/index.vue | 63 +++++++++++++++++++++- .../{thesis/poster.vue => poster/index.vue} | 24 +++------ pages_order/thesis/index.vue | 22 +++++--- 4 files changed, 86 insertions(+), 27 deletions(-) rename pages_order/{thesis/poster.vue => poster/index.vue} (91%) diff --git a/pages.json b/pages.json index fa9633b..d98687e 100644 --- a/pages.json +++ b/pages.json @@ -36,12 +36,12 @@ "path": "thesis/search" }, { "path": "thesis/index" - }, { - "path": "thesis/poster" }, { "path": "case/index" }, { "path": "serve/index" + }, { + "path": "poster/index" } ] }], diff --git a/pages_order/case/index.vue b/pages_order/case/index.vue index 2c1b802..a8d8f66 100644 --- a/pages_order/case/index.vue +++ b/pages_order/case/index.vue @@ -63,6 +63,13 @@ + + + + + + + @@ -82,11 +89,27 @@ onLoad({ articleId }) { this.getData(articleId) }, + onShareAppMessage(res) { + return { + title: this.posterData.paperDesc, + imageUrl: this.posterData.paperImage, + path: this.posterData.path, + } + }, computed: { bannerList() { const { image } = this.details || {} return (image || '').split(',').map(url => ({ image: url })) - } + }, + posterData() { + const { id, title, paperDesc, paperImage } = this.details || {} + + return { + paperDesc: paperDesc || title, + paperImage: paperImage || this.bannerList?.[0]?.image || '', + path: `pages_order/case/index?articleId=${id}` + } + }, }, methods: { async getData(articleId) { @@ -98,6 +121,13 @@ } }, + jumpToPoster() { + uni.setStorageSync('posterData', this.posterData) + + uni.navigateTo({ + url: `/pages_order/poster/index` + }) + }, }, } @@ -106,8 +136,8 @@ .page__view { box-sizing: border-box; - padding-bottom: 36rpx; background: #FFFFFF; + padding-bottom: calc(36rpx + 110rpx + env(safe-area-inset-bottom)); } .swiper { @@ -157,4 +187,33 @@ } } + .bottom { + position: fixed; + left: 0; + bottom: 0; + width: 100vw; + height: 110rpx; + padding-bottom: env(safe-area-inset-bottom); + background: #FFFFFF; + box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16); + + .btns { + column-gap: 34rpx; + } + + .btn { + padding: 20rpx 90rpx; + font-size: 28rpx; + color: #FFFFFF; + background: #4883F9; + border-radius: 42rpx; + + &-share { + background: #FFD019; + } + + } + + } + \ No newline at end of file diff --git a/pages_order/thesis/poster.vue b/pages_order/poster/index.vue similarity index 91% rename from pages_order/thesis/poster.vue rename to pages_order/poster/index.vue index c232b7f..997fcb4 100644 --- a/pages_order/thesis/poster.vue +++ b/pages_order/poster/index.vue @@ -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 diff --git a/pages_order/thesis/index.vue b/pages_order/thesis/index.vue index b9d8819..8459cad 100644 --- a/pages_order/thesis/index.vue +++ b/pages_order/thesis/index.vue @@ -168,16 +168,25 @@ }, onShareAppMessage(res) { return { - title: this.details.paperDesc || this.details.title, - imageUrl: this.details.paperImage || this.bannerList?.[0]?.image || '', - path: `/pages_order/thesis/index?thesisId=${this.details.id}` + title: this.posterData.paperDesc, + imageUrl: this.posterData.paperImage, + path: this.posterData.path, } }, computed: { bannerList() { const { image } = this.details || {} return (image || '').split(',').map(url => ({ image: url })) - } + }, + posterData() { + const { id, title, paperDesc, paperImage } = this.details || {} + + return { + paperDesc: paperDesc || title, + paperImage: paperImage || this.bannerList?.[0]?.image || '', + path: `pages_order/thesis/index?thesisId=${id}` + } + }, }, methods: { async getData(thesisId) { @@ -217,8 +226,10 @@ }); }, jumpToPoster() { + uni.setStorageSync('posterData', this.posterData) + uni.navigateTo({ - url: `/pages_order/thesis/poster?thesisId=${this.details.id}` + url: `/pages_order/poster/index` }) }, }, @@ -228,7 +239,6 @@