groupon.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import sheep from '@/sheep';
  2. const groupon = (poster) => {
  3. const width = poster.width;
  4. const userInfo = sheep.$store('user').userInfo;
  5. return {
  6. background: sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.groupon_bg),
  7. list: [
  8. {
  9. name: 'nickname',
  10. type: 'text',
  11. val: userInfo.nickname,
  12. x: width * 0.22,
  13. y: width * 0.06,
  14. paintbrushProps: {
  15. fillStyle: '#333',
  16. font: {
  17. fontSize: 16,
  18. fontFamily: 'sans-serif',
  19. },
  20. },
  21. },
  22. {
  23. name: 'avatar',
  24. type: 'image',
  25. val: sheep.$url.cdn(userInfo.avatar),
  26. x: width * 0.04,
  27. y: width * 0.04,
  28. width: width * 0.14,
  29. height: width * 0.14,
  30. d: width * 0.14,
  31. },
  32. {
  33. name: 'goodsImage',
  34. type: 'image',
  35. val: poster.shareInfo.poster.image,
  36. x: width * 0.03,
  37. y: width * 0.21,
  38. width: width * 0.94,
  39. height: width * 0.94,
  40. r: 10,
  41. },
  42. {
  43. name: 'goodsTitle',
  44. type: 'text',
  45. val: poster.shareInfo.poster.title,
  46. x: width * 0.04,
  47. y: width * 1.18,
  48. maxWidth: width * 0.92,
  49. lineHeight: 5,
  50. paintbrushProps: {
  51. fillStyle: '#333',
  52. font: {
  53. fontSize: 14,
  54. },
  55. },
  56. },
  57. {
  58. name: 'goodsPrice',
  59. type: 'text',
  60. val: '¥' + poster.shareInfo.poster.price,
  61. x: width * 0.04,
  62. y: width * 1.3,
  63. paintbrushProps: {
  64. fillStyle: '#ff0000',
  65. font: {
  66. fontSize: 20,
  67. fontFamily: 'OPPOSANS',
  68. },
  69. },
  70. },
  71. {
  72. name: 'grouponNum',
  73. type: 'text',
  74. val: '2人团',
  75. x: width * 0.3,
  76. y: width * 1.32,
  77. paintbrushProps: {
  78. fillStyle: '#ff0000',
  79. font: {
  80. fontSize: 10,
  81. fontFamily: 'OPPOSANS',
  82. },
  83. },
  84. },
  85. // #ifndef MP-WEIXIN
  86. {
  87. name: 'qrcode',
  88. type: 'qrcode',
  89. val: poster.shareInfo.link,
  90. x: width * 0.75,
  91. y: width * 1.3,
  92. size: width * 0.2,
  93. },
  94. // #endif
  95. // #ifdef MP-WEIXIN
  96. {
  97. name: 'wxacode',
  98. type: 'image',
  99. val: sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
  100. x: width * 0.75,
  101. y: width * 1.3,
  102. width: width * 0.2,
  103. height: width * 0.2,
  104. },
  105. // #endif
  106. ],
  107. };
  108. };
  109. export default groupon;