groupon.js 2.7 KB

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