user.js 1.7 KB

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