Browse Source

Merge pull request 'feat: page-case-poster;' (#4) from fox into master

Reviewed-on: http://175.178.51.79:3000/Augcl/education-front/pulls/4
master
Fox 2 days ago
parent
commit
1a11b1a8cf
4 changed files with 86 additions and 27 deletions
  1. +2
    -2
      pages.json
  2. +61
    -2
      pages_order/case/index.vue
  3. +7
    -17
      pages_order/poster/index.vue
  4. +16
    -6
      pages_order/thesis/index.vue

+ 2
- 2
pages.json View File

@ -36,12 +36,12 @@
"path": "thesis/search" "path": "thesis/search"
}, { }, {
"path": "thesis/index" "path": "thesis/index"
}, {
"path": "thesis/poster"
}, { }, {
"path": "case/index" "path": "case/index"
}, { }, {
"path": "serve/index" "path": "serve/index"
}, {
"path": "poster/index"
} }
] ]
}], }],


+ 61
- 2
pages_order/case/index.vue View File

@ -63,6 +63,13 @@
<uv-parse :content="details.serviceFeeling"></uv-parse> <uv-parse :content="details.serviceFeeling"></uv-parse>
</view> </view>
</view> </view>
<view class="flex bottom">
<view class="flex btns">
<button class="btn" @click="jumpToPoster">保存海报</button>
<button class="btn btn-share" open-type="share">分享文章</button>
</view>
</view>
</view> </view>
</template> </template>
@ -82,11 +89,27 @@
onLoad({ articleId }) { onLoad({ articleId }) {
this.getData(articleId) this.getData(articleId)
}, },
onShareAppMessage(res) {
return {
title: this.posterData.paperDesc,
imageUrl: this.posterData.paperImage,
path: this.posterData.path,
}
},
computed: { computed: {
bannerList() { bannerList() {
const { image } = this.details || {} const { image } = this.details || {}
return (image || '').split(',').map(url => ({ image: url })) 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: { methods: {
async getData(articleId) { async getData(articleId) {
@ -98,6 +121,13 @@
} }
}, },
jumpToPoster() {
uni.setStorageSync('posterData', this.posterData)
uni.navigateTo({
url: `/pages_order/poster/index`
})
},
}, },
} }
</script> </script>
@ -106,8 +136,8 @@
.page__view { .page__view {
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 36rpx;
background: #FFFFFF; background: #FFFFFF;
padding-bottom: calc(36rpx + 110rpx + env(safe-area-inset-bottom));
} }
.swiper { .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;
}
}
}
</style> </style>

pages_order/thesis/poster.vue → pages_order/poster/index.vue View File

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

+ 16
- 6
pages_order/thesis/index.vue View File

@ -168,16 +168,25 @@
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
return { 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: { computed: {
bannerList() { bannerList() {
const { image } = this.details || {} const { image } = this.details || {}
return (image || '').split(',').map(url => ({ image: url })) 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: { methods: {
async getData(thesisId) { async getData(thesisId) {
@ -217,8 +226,10 @@
}); });
}, },
jumpToPoster() { jumpToPoster() {
uni.setStorageSync('posterData', this.posterData)
uni.navigateTo({ uni.navigateTo({
url: `/pages_order/thesis/poster?thesisId=${this.details.id}`
url: `/pages_order/poster/index`
}) })
}, },
}, },
@ -228,7 +239,6 @@
<style scoped lang="scss"> <style scoped lang="scss">
.page__view { .page__view {
padding-bottom: 62rpx;
background: #FFFFFF; background: #FFFFFF;
padding-bottom: calc(62rpx + 110rpx + env(safe-area-inset-bottom)); padding-bottom: calc(62rpx + 110rpx + env(safe-area-inset-bottom));
} }


Loading…
Cancel
Save