groupon.js 2.6 KB

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