Commit fcf9e283 by liimin

调整生成卡片逻辑

1 parent 93cbfafe
......@@ -217,7 +217,6 @@ Page({
};
},
setShareInfo(data = {}) {
console.log(1111, data)
const canvasWidth = 208,
canvasHeight = 166,
textBaseline = "top";
......@@ -229,6 +228,9 @@ Page({
// });
const drawCard = (callBack) => {
// let index = 0;
const canvasWidth = 208,
canvasHeight = 166,
textBaseline = "top";
const iconWidth = 9,
iconHeight = 9,
iconX = 18,
......@@ -314,8 +316,8 @@ Page({
lineHeight: 9,
},
];
this.setData({ posterConfig: { width: 208,
height: 166,texts:textList,images:imgList} }, () => {
this.setData({ posterConfig: { width: canvasWidth,
height: canvasHeight,texts:textList,images:imgList} }, () => {
Poster.create();
});
// const drawImages = (callBack) => {
......@@ -352,21 +354,14 @@ Page({
*/
onPosterSuccess(src) {
const { detail } = src;
// wx.previewImage({
// current: detail,
// urls: [detail]
// })
this.setData({
shareImg: detail,
},()=>{
wx.hideLoading()
wx.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
});
wx.hideLoading()
wx.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
// setData配置数据
// this.setData({ posterConfig: {...} }, () => {
// Poster.create();
// });
},
// 获取用户昵称
getUserProfile(e) {
......@@ -413,10 +408,12 @@ Page({
duration: 2000
})
}
const cardInfo = data || this.data.defaultInfo
this.setData({
cardInfo: data || this.data.defaultInfo
cardInfo
},()=>{
this.setShareInfo(cardInfo);
})
this.setShareInfo(this.data.cardInfo);
});
},
});
......@@ -4,9 +4,7 @@
<import src="../../template/menu/menu.wxml" />
<import src="index.skeleton.wxml"/>
<template is="skeleton" wx:if="true" />
<poster id="poster" config="{{posterConfig}}" bind:success="onPosterSuccess" bind:fail="onPosterFail">
<button>点击生成海报</button>
</poster>
<poster id="poster" config="{{posterConfig}}" bind:success="onPosterSuccess" bind:fail="onPosterFail"></poster>
<view class="main-box" wx:if="{{cardInfo}}" >
<user-info data-skeleton-hide="cardInfo" shareDisabled="{{shareDisabled}}" cardInfo="{{cardInfo}}"></user-info>
<view class="main-bottom">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!