import setting from '../config'; import storage from './storage'; import { getWxPoster } from './http'; import { getShareUrl } from './utils'; export default { config(data){ let views = []; data.url = getShareUrl(data.url); views.push({ type: 'view', css: { left: '0rpx', top: '0rpx', background: '#eeeeee', width: '650rpx', height: '950rpx', borderRadius: '30rpx' } }); views.push({ type: 'image', src: data.goods_image, css: { left: '30rpx', top: '30rpx', width: '590rpx', height: '500rpx', radius: '5rpx' } }); views.push({ type: 'text', text: data.goods_name, css: { maxLines: 2, width: '590rpx', color: '#555555', left: '30rpx', top: '550rpx', fontSize: '30rpx', lineHeight: '40rpx' } }); views.push({ type: 'text', text: "¥"+data.sell_price, css: { color: '#FF0000', left: '30rpx', top: '670rpx', fontSize: '45rpx', fontWeight: 'bold' } }); views.push({ type: 'text', text: "¥"+data.market_price, css: { color: '#999999', left: (data.sell_price.length * 30 + 90)+'rpx', top: '680rpx', fontSize: '35rpx', textDecoration: 'line-through' } }); // #ifdef H5 || APP-PLUS views.push({ type: 'qrcode', text: setting.uni_app_web_url + data.url, css: { left: '472rpx', top: '750rpx', width: '150rpx', height: '150rpx', color: '#555555' } }); // #endif // #ifdef MP-WEIXIN || MP-TOUTIAO getWxPoster({ // #ifdef MP-WEIXIN client: "mp", // #endif // #ifdef MP-TOUTIAO client: "toutiao", // #endif type: data.goods_type, id: data.goods_id }).then(res=>{ views.push({ type: 'image', src: res.data, css: { left: '470rpx', top: '750rpx', width: '150rpx', height: '150rpx' } }); }); // #endif views.push({ type: 'text', text: '长按或扫一扫', css: { color: '#999999', left: '473rpx', top: '900rpx', fontSize: '25rpx' } }); return views; } };