goods.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. "use strict";
  2. const sheep_index = require("../../../../index.js");
  3. const sheep_components_sShareModal_canvasPoster_poster_index = 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: sheep_components_sShareModal_canvasPoster_poster_index.formatImageUrlProtocol(sheep_index.sheep.$url.cdn(sheep_index.sheep.$store("app").platform.share.posterInfo.goods_bg)),
  9. list: [
  10. {
  11. name: "nickname",
  12. type: "text",
  13. val: userInfo.nickname,
  14. x: width * 0.22,
  15. y: width * 0.06,
  16. paintbrushProps: {
  17. fillStyle: "#333",
  18. font: {
  19. fontSize: 16,
  20. fontFamily: "sans-serif"
  21. }
  22. }
  23. },
  24. {
  25. name: "avatar",
  26. type: "image",
  27. val: sheep_components_sShareModal_canvasPoster_poster_index.formatImageUrlProtocol(sheep_index.sheep.$url.cdn(userInfo.avatar)),
  28. x: width * 0.04,
  29. y: width * 0.04,
  30. width: width * 0.14,
  31. height: width * 0.14,
  32. d: width * 0.14
  33. },
  34. {
  35. name: "goodsImage",
  36. type: "image",
  37. val: sheep_components_sShareModal_canvasPoster_poster_index.formatImageUrlProtocol(poster.shareInfo.poster.image),
  38. x: width * 0.03,
  39. y: width * 0.21,
  40. width: width * 0.94,
  41. height: width * 0.94,
  42. r: 10
  43. },
  44. {
  45. name: "goodsTitle",
  46. type: "text",
  47. val: poster.shareInfo.poster.title,
  48. x: width * 0.04,
  49. y: width * 1.18,
  50. maxWidth: width * 0.91,
  51. line: 2,
  52. lineHeight: 5,
  53. paintbrushProps: {
  54. fillStyle: "#333",
  55. font: {
  56. fontSize: 14
  57. }
  58. }
  59. },
  60. {
  61. name: "goodsPrice",
  62. type: "text",
  63. val: "¥" + poster.shareInfo.poster.price,
  64. x: width * 0.04,
  65. y: width * 1.3,
  66. paintbrushProps: {
  67. fillStyle: "#ff0000",
  68. font: {
  69. fontSize: 20,
  70. fontFamily: "OPPOSANS"
  71. }
  72. }
  73. },
  74. {
  75. name: "goodsOriginalPrice",
  76. type: "text",
  77. val: poster.shareInfo.poster.original_price > 0 ? "¥" + poster.shareInfo.poster.original_price : "",
  78. x: width * 0.3,
  79. y: width * 1.32,
  80. paintbrushProps: {
  81. fillStyle: "#999",
  82. font: {
  83. fontSize: 10,
  84. fontFamily: "OPPOSANS"
  85. }
  86. },
  87. textDecoration: {
  88. line: "line-through",
  89. style: "solide"
  90. }
  91. },
  92. {
  93. name: "wxacode",
  94. type: "image",
  95. val: sheep_index.sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
  96. x: width * 0.75,
  97. y: width * 1.3,
  98. width: width * 0.2,
  99. height: width * 0.2
  100. }
  101. ]
  102. };
  103. };
  104. exports.goods = goods;