海报:完善用户分享海报
parent
ccd033b15a
commit
03512800b2
|
|
@ -1,61 +1,75 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { formatImageUrlProtocol } from './index';
|
import { formatImageUrlProtocol } from './index';
|
||||||
|
import third from '@/sheep/api/migration/third';
|
||||||
|
|
||||||
const user = (poster) => {
|
const user = 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.user_bg)),
|
|
||||||
list: [
|
|
||||||
{
|
{
|
||||||
name: 'nickname',
|
|
||||||
type: 'text',
|
|
||||||
val: userInfo.nickname,
|
|
||||||
x: width / 2,
|
|
||||||
y: width * 0.4,
|
|
||||||
paintbrushProps: {
|
|
||||||
textAlign: 'center',
|
|
||||||
fillStyle: '#333',
|
|
||||||
font: {
|
|
||||||
fontSize: 14,
|
|
||||||
fontFamily: 'sans-serif',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'avatar',
|
|
||||||
type: 'image',
|
type: 'image',
|
||||||
val: formatImageUrlProtocol(sheep.$url.cdn(userInfo.avatar)),
|
src: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg)),
|
||||||
x: width * 0.4,
|
css: {
|
||||||
y: width * 0.16,
|
width,
|
||||||
|
position: 'fixed',
|
||||||
|
'object-fit': 'contain',
|
||||||
|
top: '0',
|
||||||
|
left: '0',
|
||||||
|
zIndex: -1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'text',
|
||||||
|
text: userInfo.nickname,
|
||||||
|
css: {
|
||||||
|
color: '#333',
|
||||||
|
fontSize: 14,
|
||||||
|
textAlign: 'center',
|
||||||
|
fontFamily: 'sans-serif',
|
||||||
|
position: 'fixed',
|
||||||
|
top: width * 0.4,
|
||||||
|
left: width / 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'image',
|
||||||
|
src: formatImageUrlProtocol(sheep.$url.cdn(userInfo.avatar)),
|
||||||
|
css: {
|
||||||
|
position: 'fixed',
|
||||||
|
left: width * 0.4,
|
||||||
|
top: width * 0.16,
|
||||||
width: width * 0.2,
|
width: width * 0.2,
|
||||||
height: width * 0.2,
|
height: width * 0.2,
|
||||||
d: width * 0.2,
|
},
|
||||||
},
|
},
|
||||||
// #ifndef MP-WEIXIN
|
// #ifndef MP-WEIXIN
|
||||||
{
|
{
|
||||||
name: 'qrcode',
|
|
||||||
type: 'qrcode',
|
type: 'qrcode',
|
||||||
val: poster.shareInfo.link,
|
text: poster.shareInfo.link,
|
||||||
x: width * 0.35,
|
css: {
|
||||||
y: width * 0.84,
|
position: 'fixed',
|
||||||
size: width * 0.3,
|
left: width * 0.35,
|
||||||
|
top: width * 0.84,
|
||||||
|
width: width * 0.3,
|
||||||
|
height: width * 0.3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
{
|
{
|
||||||
name: 'wxacode',
|
|
||||||
type: 'image',
|
type: 'image',
|
||||||
val: sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
|
src: wxa_qrcode,
|
||||||
x: width * 0.35,
|
css: {
|
||||||
y: width * 0.84,
|
position: 'fixed',
|
||||||
|
left: width * 0.35,
|
||||||
|
top: width * 0.84,
|
||||||
width: width * 0.3,
|
width: width * 0.3,
|
||||||
height: width * 0.3,
|
height: width * 0.3,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
// #endif
|
// #endif
|
||||||
],
|
];
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default user;
|
export default user;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue