zyejMAll-mobile/sheep/components/s-share-modal/canvas-poster/poster/user.js

91 lines
2.0 KiB
JavaScript
Raw Normal View History

2024-08-07 10:31:42 +08:00
import sheep from '@/sheep';
import { formatImageUrlProtocol, getWxaQrcode } from './index';
const user = async (poster) => {
const width = poster.width;
const userInfo = sheep.$store('user').userInfo;
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
return [
{
type: 'image',
2024-08-07 21:40:27 +08:00
src: formatImageUrlProtocol(
sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg),
),
2024-08-07 10:31:42 +08:00
css: {
width,
position: 'fixed',
'object-fit': 'contain',
top: '0',
left: '0',
zIndex: -1,
},
},
{
type: 'text',
text: userInfo.nickname,
css: {
color: '#333',
2024-10-21 17:47:58 +08:00
fontSize: 17,
fontWeight: 700,
2024-08-07 10:31:42 +08:00
textAlign: 'center',
fontFamily: 'sans-serif',
position: 'fixed',
2024-10-21 17:47:58 +08:00
top: width * 1.33,
left: width / 2.2,
2024-08-07 10:31:42 +08:00
},
},
2024-10-21 17:47:58 +08:00
{
type: 'text',
text: '邀请您加入众悦e家',
css: {
color: '#333',
fontSize: 14,
textAlign: 'center',
fontFamily: 'sans-serif',
position: 'fixed',
top: width * 1.41,
left: width / 2.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,
// height: width * 0.2,
// },
// },
2024-08-07 10:31:42 +08:00
// #ifndef MP-WEIXIN
{
type: 'qrcode',
text: poster.shareInfo.link,
css: {
position: 'fixed',
2024-10-21 17:47:58 +08:00
left: width * 0.25,
top: width * 1.3,
width: width * 0.2,
height: width * 0.2,
2024-08-07 10:31:42 +08:00
},
},
// #endif
// #ifdef MP-WEIXIN
{
type: 'image',
src: wxa_qrcode,
css: {
position: 'fixed',
2024-10-21 17:47:58 +08:00
left: width * 0.22,
top: width * 1.3,
2024-10-21 17:47:58 +08:00
width: width * 0.2,
height: width * 0.2,
2024-08-07 10:31:42 +08:00
},
},
// #endif
];
};
export default user;