groupon.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import sheep from '@/sheep';
  2. import { formatImageUrlProtocol, getWxaQrcode } from './index';
  3. const groupon = 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(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.groupon_bg)),
  11. css: {
  12. width,
  13. position: 'fixed',
  14. 'object-fit': 'contain',
  15. top: '0',
  16. left: '0',
  17. zIndex: -1,
  18. },
  19. },
  20. {
  21. type: 'text',
  22. text: userInfo.nickname,
  23. css: {
  24. color: '#333',
  25. fontSize: 16,
  26. fontFamily: 'sans-serif',
  27. position: 'fixed',
  28. top: width * 0.06,
  29. left: width * 0.22,
  30. },
  31. },
  32. {
  33. type: 'image',
  34. src: formatImageUrlProtocol(sheep.$url.cdn(userInfo.avatar)),
  35. css: {
  36. position: 'fixed',
  37. left: width * 0.04,
  38. top: width * 0.04,
  39. width: width * 0.14,
  40. height: width * 0.14,
  41. },
  42. },
  43. {
  44. type: 'image',
  45. src: formatImageUrlProtocol(poster.shareInfo.poster.image),
  46. css: {
  47. position: 'fixed',
  48. left: width * 0.03,
  49. top: width * 0.21,
  50. width: width * 0.94,
  51. height: width * 0.94,
  52. borderRadius: 10,
  53. },
  54. },
  55. {
  56. type: 'text',
  57. text: poster.shareInfo.poster.title,
  58. css: {
  59. color: '#333',
  60. fontSize: 14,
  61. position: 'fixed',
  62. top: width * 1.18,
  63. left: width * 0.04,
  64. maxWidth: width * 0.91,
  65. lineHeight: 5,
  66. },
  67. },
  68. {
  69. type: 'text',
  70. text: '¥' + poster.shareInfo.poster.price,
  71. css: {
  72. color: '#ff0000',
  73. fontSize: 20,
  74. fontFamily: 'OPPOSANS',
  75. position: 'fixed',
  76. top: width * 1.3,
  77. left: width * 0.04,
  78. },
  79. },
  80. {
  81. type: 'text',
  82. text: '2人团',
  83. css: {
  84. color: '#ff0000',
  85. fontSize: 30,
  86. fontFamily: 'OPPOSANS',
  87. position: 'fixed',
  88. left: width * 0.3,
  89. top: width * 1.32,
  90. },
  91. },
  92. // #ifndef MP-WEIXIN
  93. {
  94. type: 'qrcode',
  95. text: poster.shareInfo.link,
  96. css: {
  97. position: 'fixed',
  98. left: width * 0.75,
  99. top: width * 1.3,
  100. width: width * 0.2,
  101. height: width * 0.2,
  102. },
  103. },
  104. // #endif
  105. // #ifdef MP-WEIXIN
  106. {
  107. type: 'image',
  108. src: wxa_qrcode,
  109. css: {
  110. position: 'fixed',
  111. left: width * 0.75,
  112. top: width * 1.3,
  113. width: width * 0.2,
  114. height: width * 0.2,
  115. },
  116. },
  117. // #endif
  118. ];
  119. };
  120. export default groupon;