user.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import sheep from '@/sheep';
  2. import { formatImageUrlProtocol } from './index';
  3. const user = (poster) => {
  4. const width = poster.width;
  5. const userInfo = sheep.$store('user').userInfo;
  6. return {
  7. background: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg)),
  8. list: [
  9. {
  10. name: 'nickname',
  11. type: 'text',
  12. val: userInfo.nickname,
  13. x: width / 2,
  14. y: width * 0.4,
  15. paintbrushProps: {
  16. textAlign: 'center',
  17. fillStyle: '#333',
  18. font: {
  19. fontSize: 14,
  20. fontFamily: 'sans-serif',
  21. },
  22. },
  23. },
  24. {
  25. name: 'avatar',
  26. type: 'image',
  27. val: formatImageUrlProtocol(sheep.$url.cdn(userInfo.avatar)),
  28. x: width * 0.4,
  29. y: width * 0.16,
  30. width: width * 0.2,
  31. height: width * 0.2,
  32. d: width * 0.2,
  33. },
  34. // #ifndef MP-WEIXIN
  35. {
  36. name: 'qrcode',
  37. type: 'qrcode',
  38. val: poster.shareInfo.link,
  39. x: width * 0.35,
  40. y: width * 0.84,
  41. size: width * 0.3,
  42. },
  43. // #endif
  44. // #ifdef MP-WEIXIN
  45. {
  46. name: 'wxacode',
  47. type: 'image',
  48. val: sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
  49. x: width * 0.35,
  50. y: width * 0.84,
  51. width: width * 0.3,
  52. height: width * 0.3,
  53. },
  54. // #endif
  55. ],
  56. };
  57. };
  58. export default user;