groupon.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.91,
  49. line: 2,
  50. lineHeight: 5,
  51. paintbrushProps: {
  52. fillStyle: '#333',
  53. font: {
  54. fontSize: 14,
  55. },
  56. },
  57. },
  58. {
  59. name: 'goodsPrice',
  60. type: 'text',
  61. val: '¥' + poster.shareInfo.poster.price,
  62. x: width * 0.04,
  63. y: width * 1.3,
  64. paintbrushProps: {
  65. fillStyle: '#ff0000',
  66. font: {
  67. fontSize: 20,
  68. fontFamily: 'OPPOSANS',
  69. },
  70. },
  71. },
  72. {
  73. name: 'grouponNum',
  74. type: 'text',
  75. val: '2人团',
  76. x: width * 0.3,
  77. y: width * 1.32,
  78. paintbrushProps: {
  79. fillStyle: '#ff0000',
  80. font: {
  81. fontSize: 10,
  82. fontFamily: 'OPPOSANS',
  83. },
  84. },
  85. },
  86. // #ifndef MP-WEIXIN
  87. {
  88. name: 'qrcode',
  89. type: 'qrcode',
  90. val: poster.shareInfo.link,
  91. x: width * 0.75,
  92. y: width * 1.3,
  93. size: width * 0.2,
  94. },
  95. // #endif
  96. // #ifdef MP-WEIXIN
  97. {
  98. name: 'wxacode',
  99. type: 'image',
  100. val: sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
  101. x: width * 0.75,
  102. y: width * 1.3,
  103. width: width * 0.2,
  104. height: width * 0.2,
  105. },
  106. // #endif
  107. ],
  108. };
  109. };
  110. export default groupon;