goods.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. "use strict";
  2. const sheep_index = require("../../../../index.js");
  3. require("./index.js");
  4. const goods = (poster) => {
  5. const width = poster.width;
  6. const userInfo = sheep_index.sheep.$store("user").userInfo;
  7. return {
  8. background: window.location.origin + "/static/goods-poster-bg.jpg",
  9. // background: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.goods_bg)),
  10. list: [
  11. {
  12. name: "nickname",
  13. type: "text",
  14. val: userInfo.nickname,
  15. x: width * 0.21,
  16. y: width * 0.06,
  17. paintbrushProps: {
  18. fillStyle: "#333",
  19. font: {
  20. fontSize: 16,
  21. fontFamily: "sans-serif"
  22. }
  23. }
  24. },
  25. {
  26. name: "avatar",
  27. type: "image",
  28. val: poster.avatar,
  29. x: width * 0.04,
  30. y: width * 0.04,
  31. width: width * 0.14,
  32. height: width * 0.14,
  33. d: width * 0.14
  34. },
  35. {
  36. name: "goodsBg",
  37. type: "rect",
  38. x: width * 0.03,
  39. y: width * 0.3,
  40. width: width * 0.94,
  41. height: width * 0.75,
  42. r: 5
  43. },
  44. {
  45. name: "goodsImage",
  46. type: "image",
  47. val: poster.shareInfo.poster.image,
  48. x: width * 0.03,
  49. y: width * 0.3,
  50. width: width * 0.94,
  51. height: width * 0.5,
  52. r: 5
  53. },
  54. {
  55. name: "goodsTitle",
  56. type: "text",
  57. val: poster.shareInfo.poster.title,
  58. x: width * 0.05,
  59. y: width * 0.83,
  60. maxWidth: width * 0.91,
  61. line: 5,
  62. lineHeight: 10,
  63. paintbrushProps: {
  64. fillStyle: "#333",
  65. font: {
  66. fontSize: 16
  67. }
  68. }
  69. },
  70. {
  71. name: "goodsIntroduction",
  72. type: "text",
  73. val: poster.shareInfo.poster.introduction,
  74. x: width * 0.05,
  75. y: width * 0.89,
  76. maxWidth: width * 0.9,
  77. height: width * 0.1,
  78. line: 3,
  79. lineHeight: 4,
  80. paintbrushProps: {
  81. fillStyle: "#333",
  82. font: {
  83. fontSize: 12,
  84. fontFamily: "OPPOSANS"
  85. }
  86. }
  87. },
  88. {
  89. name: "goodsOriginalPrice",
  90. type: "text",
  91. val: poster.shareInfo.poster.original_price > 0 ? "¥" + poster.shareInfo.poster.original_price : "",
  92. x: width * 0.3,
  93. y: width * 1.32,
  94. paintbrushProps: {
  95. fillStyle: "#999",
  96. font: {
  97. fontSize: 10,
  98. fontFamily: "OPPOSANS"
  99. }
  100. },
  101. textDecoration: {
  102. line: "line-through",
  103. style: "solide"
  104. }
  105. },
  106. {
  107. name: "wxacode",
  108. type: "image",
  109. val: sheep_index.sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
  110. x: width * 0.75,
  111. y: width * 1.3,
  112. width: width * 0.2,
  113. height: width * 0.2
  114. }
  115. ]
  116. };
  117. };
  118. exports.goods = goods;