海报:完善拼团分享海报

pull/53/head
puhui999 2024-05-16 16:53:03 +08:00
parent 03512800b2
commit f46bfc6ee1
1 changed files with 100 additions and 91 deletions

View File

@ -1,114 +1,123 @@
import sheep from '@/sheep'; import sheep from '@/sheep';
import { formatImageUrlProtocol } from './index'; import { formatImageUrlProtocol } from './index';
import third from '@/sheep/api/migration/third';
const groupon = (poster) => { const groupon = async (poster) => {
const width = poster.width; const width = poster.width;
const userInfo = sheep.$store('user').userInfo; const userInfo = sheep.$store('user').userInfo;
const wxa_qrcode = (await third.wechat.getWxacode(poster.shareInfo.path, poster.shareInfo.query)).data;
return { return [
background: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.groupon_bg)), {
list: [ type: 'image',
{ src: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.groupon_bg)),
name: 'nickname', css: {
type: 'text', width,
val: userInfo.nickname, position: 'fixed',
x: width * 0.22, 'object-fit': 'contain',
y: width * 0.06, top: '0',
paintbrushProps: { left: '0',
fillStyle: '#333', zIndex: -1,
font: {
fontSize: 16,
fontFamily: 'sans-serif',
},
},
}, },
{ },
name: 'avatar', {
type: 'image', type: 'text',
val: formatImageUrlProtocol(sheep.$url.cdn(userInfo.avatar)), text: userInfo.nickname,
x: width * 0.04, css: {
y: width * 0.04, color: '#333',
fontSize: 16,
fontFamily: 'sans-serif',
position: 'fixed',
top: width * 0.06,
left: width * 0.22,
},
},
{
type: 'image',
src: formatImageUrlProtocol(sheep.$url.cdn(userInfo.avatar)),
css: {
position: 'fixed',
left: width * 0.04,
top: width * 0.04,
width: width * 0.14, width: width * 0.14,
height: width * 0.14, height: width * 0.14,
d: width * 0.14,
}, },
{ },
name: 'goodsImage', {
type: 'image', type: 'image',
val: formatImageUrlProtocol(poster.shareInfo.poster.image), src: formatImageUrlProtocol(poster.shareInfo.poster.image),
x: width * 0.03, css: {
y: width * 0.21, position: 'fixed',
left: width * 0.03,
top: width * 0.21,
width: width * 0.94, width: width * 0.94,
height: width * 0.94, height: width * 0.94,
r: 10, borderRadius: 10,
}, },
{ },
name: 'goodsTitle', {
type: 'text', type: 'text',
val: poster.shareInfo.poster.title, text: poster.shareInfo.poster.title,
x: width * 0.04, css: {
y: width * 1.18, color: '#333',
fontSize: 14,
position: 'fixed',
top: width * 1.18,
left: width * 0.04,
maxWidth: width * 0.91, maxWidth: width * 0.91,
line: 2,
lineHeight: 5, lineHeight: 5,
paintbrushProps: {
fillStyle: '#333',
font: {
fontSize: 14,
},
},
}, },
{ },
name: 'goodsPrice', {
type: 'text', type: 'text',
val: '¥' + poster.shareInfo.poster.price, text: '¥' + poster.shareInfo.poster.price,
x: width * 0.04, css: {
y: width * 1.3, color: '#ff0000',
paintbrushProps: { fontSize: 20,
fillStyle: '#ff0000', fontFamily: 'OPPOSANS',
font: { position: 'fixed',
fontSize: 20, top: width * 1.3,
fontFamily: 'OPPOSANS', left: width * 0.04,
},
},
}, },
{ },
name: 'grouponNum', {
type: 'text', type: 'text',
val: '2人团', text: '2人团',
x: width * 0.3, css: {
y: width * 1.32, color: '#ff0000',
paintbrushProps: { fontSize: 30,
fillStyle: '#ff0000', fontFamily: 'OPPOSANS',
font: { position: 'fixed',
fontSize: 10, left: width * 0.3,
fontFamily: 'OPPOSANS', top: width * 1.32,
},
},
}, },
// #ifndef MP-WEIXIN },
{ // #ifndef MP-WEIXIN
name: 'qrcode', {
type: 'qrcode', type: 'qrcode',
val: poster.shareInfo.link, text: poster.shareInfo.link,
x: width * 0.75, css: {
y: width * 1.3, position: 'fixed',
size: width * 0.2, left: width * 0.75,
}, top: width * 1.3,
// #endif
// #ifdef MP-WEIXIN
{
name: 'wxacode',
type: 'image',
val: sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
x: width * 0.75,
y: width * 1.3,
width: width * 0.2, width: width * 0.2,
height: width * 0.2, height: width * 0.2,
}, },
// #endif },
], // #endif
}; // #ifdef MP-WEIXIN
{
type: 'image',
src: wxa_qrcode,
css: {
position: 'fixed',
left: width * 0.75,
top: width * 1.3,
width: width * 0.2,
height: width * 0.2,
},
},
// #endif
];
}; };
export default groupon; export default groupon;