123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- "use strict";
- const common_vendor = require("../../../../../common/vendor.js");
- const sheep_index = require("../../../../index.js");
- require("./index.js");
- async function getImagePath(imagePath) {
- return new Promise((resolve, reject) => {
- common_vendor.wx$1.getImageInfo({
- src: imagePath,
- success: (res) => {
- resolve(res.path);
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
- }
- const goods = async (poster) => {
- const width = poster.width;
- const userInfo = sheep_index.sheep.$store("user").userInfo;
- return {
- background: await getImagePath("/static/goods-poster-bg.jpg"),
- list: [
- {
- name: "nickname",
- type: "text",
- val: userInfo.nickname,
- x: width * 0.21,
- y: width * 0.06,
- paintbrushProps: {
- fillStyle: "#333",
- font: {
- fontSize: 16,
- fontFamily: "sans-serif"
- }
- }
- },
- {
- name: "avatar",
- type: "image",
- val: poster.avatar,
- x: width * 0.04,
- y: width * 0.04,
- width: width * 0.14,
- height: width * 0.14,
- d: width * 0.14
- },
- {
- name: "goodsBg",
- type: "rect",
- x: width * 0.03,
- y: width * 0.3,
- width: width * 0.94,
- height: width * 0.75,
- r: 5
- },
- {
- name: "goodsImage",
- type: "image",
- val: poster.shareInfo.poster.image,
- x: width * 0.03,
- y: width * 0.3,
- width: width * 0.94,
- height: width * 0.5,
- r: 5
- },
- {
- name: "goodsTitle",
- type: "text",
- val: poster.shareInfo.poster.title,
- x: width * 0.05,
- y: width * 0.83,
- maxWidth: width * 0.91,
- line: 5,
- lineHeight: 10,
- paintbrushProps: {
- fillStyle: "#333",
- font: {
- fontSize: 16
- }
- }
- },
- {
- name: "goodsIntroduction",
- type: "text",
- val: poster.shareInfo.poster.introduction,
- x: width * 0.05,
- y: width * 0.89,
- maxWidth: width * 0.9,
- height: width * 0.1,
- line: 3,
- lineHeight: 4,
- paintbrushProps: {
- fillStyle: "#333",
- font: {
- fontSize: 12,
- fontFamily: "OPPOSANS"
- }
- }
- },
- {
- name: "goodsOriginalPrice",
- type: "text",
- val: poster.shareInfo.poster.original_price > 0 ? "¥" + poster.shareInfo.poster.original_price : "",
- x: width * 0.3,
- y: width * 1.32,
- paintbrushProps: {
- fillStyle: "#999",
- font: {
- fontSize: 10,
- fontFamily: "OPPOSANS"
- }
- },
- textDecoration: {
- line: "line-through",
- style: "solide"
- }
- },
- {
- name: "wxacode",
- type: "image",
- val: sheep_index.sheep.$api.third.wechat.getWxacode(poster.shareInfo.path),
- x: width * 0.75,
- y: width * 1.3,
- width: width * 0.2,
- height: width * 0.2
- }
- ]
- };
- };
- exports.goods = goods;
|