diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js index bdb5427..fda382d 100644 --- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js +++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js @@ -1598,12 +1598,12 @@ Page({ //--定义的保存图片方法,分享团--- saveImageToPhotosAlbum: function () { //--先判断会员状态-- - var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - //getApp().my_warnning("请先登录",0,this); - wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) - return false; - } + // var user_info = getApp().globalData.userInfo; + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + // //getApp().my_warnning("请先登录",0,this); + // wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) + // return false; + // } //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4积分购 var type = 2 @@ -1672,6 +1672,7 @@ Page({ context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:''; //-- 是自定义海报的情况下 -- if (th.data.poster && parseInt(th.data.poster.style) == 2) { //在线上分享人的情况下 @@ -1684,8 +1685,8 @@ Page({ //--昵称--- context.setFontSize(24 * unit) context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, x1, y1); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; + context.fillText(nick, x1, y1); + var width = 24 * nick.length * unit + 4 * unit; //强烈推荐 改许程 var tj_path = "../../../../images/share/q_tj.png"; context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); @@ -1699,8 +1700,8 @@ Page({ //--昵称--- context.setFontSize(24 * unit) context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; + context.fillText(nick, 152 * unit, 76 * unit); + var width = 24 * nick.length * unit + 2 * unit; //强烈推荐 改许程 var tj_path = "../../../../images/share/q_tj.png"; context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); @@ -2005,9 +2006,9 @@ Page({ return false; } //---获取分享图片的本地地址,头像和商品图片---- - var path2 = getApp().globalData.userInfo.head_pic; + var path2 = getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:''; if (path2 == "") { - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; tt(func); } else { path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); @@ -3559,10 +3560,10 @@ Page({ clickShare() { - if(!getApp().globalData.user_id){ - getApp().goto("/packageE/pages/togoin/togoin"); - return false; - } + // if(!getApp().globalData.user_id){ + // getApp().goto("/packageE/pages/togoin/togoin"); + // return false; + // } this.setData({ share_hidden: true, }); @@ -3589,12 +3590,14 @@ Page({ context.setFillStyle('black'); context.fillText(shopName, 277 * unit, 60 * unit); - // 3.推荐来源 - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; - context.setTextAlign('center'); - context.setFontSize(22 * unit); - context.setFillStyle('#96959a'); - context.fillText(fromText, 277 * unit, 105 * unit); + if(getApp().globalData.userInfo) { + // 3.推荐来源 + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; + context.setTextAlign('center'); + context.setFontSize(22 * unit); + context.setFillStyle('#96959a'); + context.fillText(fromText, 277 * unit, 105 * unit); + } // 4.海报背景 context.setFillStyle('white'); diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml index f042b28..904d6e7 100644 --- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml @@ -141,7 +141,7 @@ {{data.goods_name}} - + 分享