user.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import sheep from '@/sheep';
  2. import { formatImageUrlProtocol, getWxaQrcode } from './index';
  3. const user = async (poster) => {
  4. const width = poster.width;
  5. const userInfo = sheep.$store('user').userInfo;
  6. const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
  7. return [
  8. {
  9. type: 'image',
  10. src: formatImageUrlProtocol(
  11. sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg),
  12. ),
  13. css: {
  14. width,
  15. position: 'fixed',
  16. 'object-fit': 'contain',
  17. top: '0',
  18. left: '0',
  19. zIndex: -1,
  20. },
  21. },
  22. {
  23. type: 'text',
  24. text: userInfo.nickname,
  25. css: {
  26. color: '#333',
  27. fontSize: 14,
  28. textAlign: 'center',
  29. fontFamily: 'sans-serif',
  30. position: 'fixed',
  31. top: width * 0.4,
  32. left: width / 2,
  33. },
  34. },
  35. {
  36. type: 'image',
  37. src: formatImageUrlProtocol(sheep.$url.cdn(userInfo.avatar)),
  38. css: {
  39. position: 'fixed',
  40. left: width * 0.4,
  41. top: width * 0.16,
  42. width: width * 0.2,
  43. height: width * 0.2,
  44. },
  45. },
  46. // #ifndef MP-WEIXIN
  47. {
  48. type: 'qrcode',
  49. text: poster.shareInfo.link,
  50. css: {
  51. position: 'fixed',
  52. left: width * 0.35,
  53. top: width * 0.84,
  54. width: width * 0.3,
  55. height: width * 0.3,
  56. },
  57. },
  58. // #endif
  59. // #ifdef MP-WEIXIN
  60. {
  61. type: 'image',
  62. src: wxa_qrcode,
  63. css: {
  64. position: 'fixed',
  65. left: width * 0.35,
  66. top: width * 0.84,
  67. width: width * 0.3,
  68. height: width * 0.3,
  69. },
  70. },
  71. // #endif
  72. ];
  73. };
  74. export default user;