|
|
/* eslint-disable no-undef */
|
|
|
import Taro from '@tarojs/taro'
|
|
|
import Taro, { getStorageSync } from '@tarojs/taro'
|
|
|
import event from '../../../utils/event.js'
|
|
|
import {getImgUrl} from '../../../utils';
|
|
|
import {globalData} from '../../../actions/globalData.js';
|
...
|
...
|
@@ -155,7 +155,7 @@ Component({ |
|
|
creatProductDetailSnapShoot() {
|
|
|
var that = this;
|
|
|
const app = getApp() || {};
|
|
|
let userInfo = app.props.globalData.userInfo;
|
|
|
let userInfo = wx.getStorageSync('userInfo');
|
|
|
var product = that.properties.shareData;
|
|
|
if(!product){
|
|
|
return
|
...
|
...
|
@@ -200,28 +200,33 @@ Component({ |
|
|
pCtx.setStrokeStyle('#e0e0e0');
|
|
|
|
|
|
/*---------开始新的作画-----------*/
|
|
|
//圆形头像
|
|
|
if (userInfo.avatarUrl) {
|
|
|
wx.getImageInfo({
|
|
|
src: userInfo.avatarUrl,
|
|
|
success:function(res){
|
|
|
pCtx.beginPath();
|
|
|
pCtx.arc(logoLeft+logoWidth/2, logoTop+logoHeight/2, logoWidth/2, 0, 2*Math.PI, false)
|
|
|
pCtx.stroke();//画空心圆
|
|
|
pCtx.closePath();
|
|
|
pCtx.save();
|
|
|
pCtx.clip(); //裁剪上面的圆形
|
|
|
pCtx.drawImage(res.path, logoLeft , logoTop, logoWidth, logoHeight)
|
|
|
pCtx.restore(); //恢复之前保存的绘图上下文,以便可以继续绘制
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//昵称
|
|
|
if (userInfo.nickName) {
|
|
|
pCtx.setFillStyle('#000')
|
|
|
pCtx.setFontSize(20*scale)
|
|
|
pCtx.fillText(userInfo.nickName, nameLeft, nameTop)
|
|
|
if (userInfo) {
|
|
|
//圆形头像
|
|
|
let avatarUrl = getImgUrl(userInfo.avatarUrl, logoWidth, logoHeight);
|
|
|
if (avatarUrl) {
|
|
|
userInfo.avatarUrl = avatarUrl;
|
|
|
|
|
|
wx.getImageInfo({
|
|
|
src: avatarUrl,
|
|
|
success:function(res){
|
|
|
pCtx.beginPath();
|
|
|
pCtx.arc(logoLeft+logoWidth/2, logoTop+logoHeight/2, logoWidth/2, 0, 2*Math.PI, false)
|
|
|
pCtx.stroke();//画空心圆
|
|
|
pCtx.closePath();
|
|
|
pCtx.save();
|
|
|
pCtx.clip(); //裁剪上面的圆形
|
|
|
pCtx.drawImage(res.path, logoLeft , logoTop, logoWidth, logoHeight)
|
|
|
pCtx.restore(); //恢复之前保存的绘图上下文,以便可以继续绘制
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//昵称
|
|
|
if (userInfo.nickName) {
|
|
|
pCtx.setFillStyle('#000')
|
|
|
pCtx.setFontSize(20*scale)
|
|
|
pCtx.fillText(userInfo.nickName, nameLeft, nameTop)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
pCtx.setFillStyle('#000')
|
...
|
...
|
|