123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- import sheep from '@/sheep';
- import { formatImageUrlProtocol } from './index';
- async function getImagePath(imagePath) {
- return new Promise((resolve, reject) => {
- // #ifdef MP-WEIXIN
- console.log(imagePath);
- wx.getImageInfo({
- src: imagePath,
- success: (res) => {
- resolve(res.path);
- },
- fail: (err) => {
- reject(err);
- }
- });
- // #endif
- // #ifndef MP-WEIXIN
- const fullPath = window.location.origin + imagePath;
- resolve(fullPath);
- // #endif
- });
- }
- const user = async (poster) => {
- console.log("poster", poster)
- const width = poster.width;
- const userInfo = sheep.$store('user').userInfo;
-
- return {
- background: await getImagePath('/static/user-poster-bg.jpg'),
- // background: window.location.origin + '/static/user-poster-bg.jpg',
-
- 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: 'linkId',
- type: 'text',
- val: "邀请码:" + poster.shareInfo.linkId,
- x: width / 2,
- y: width * 0.65,
- paintbrushProps: {
- textAlign: 'center',
- fillStyle: '#333',
- font: {
- fontSize: 20,
- fontFamily: 'sans-serif',
- },
- },
- },
- {
- name: 'avatar',
- type: 'image',
- val: poster.avatar,
- x: width * 0.4,
- y: width * 0.16,
- width: width * 0.2,
- height: width * 0.2,
- d: width * 0.2,
- },
- // #ifndef MP-WEIXIN
- {
- name: 'qrcode',
- type: 'qrcode',
- val: poster.shareInfo.link,
- x: width * 0.35,
- y: width * 0.74,
- size: width * 0.3,
- },
- // #endif
- // #ifdef MP-WEIXIN
- {
- name: 'wxacode',
- type: 'image',
- val: sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
- x: width * 0.35,
- y: width * 0.84,
- width: width * 0.3,
- height: width * 0.3,
- },
- // #endif
- ],
- };
- };
- export default user;
|