diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index ca07bb0..b5d2154 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -568,16 +568,16 @@ Page({ //--先判断会员登陆状态-- - var user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - - getApp().is_Single_page(th, function () { - 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().is_Single_page(th, function () { + // wx.navigateTo({ + // url: '/packageE/pages/togoin/togoin', + // }) + // return false; + // }) + // } }, //-- 获取直播的分享人的导购信息 -- @@ -5320,14 +5320,17 @@ Page({ context.setFillStyle('black'); context.fillText(shopName, 277 * unit, 60 * unit); // // 3.推荐来源 - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; - // let fromTextLen = context.measureText(fromText); - // let x_fromText = (375 - fromTextLen.width)/2; - // console.log('222222',fromTextLen,x_fromText); - context.setTextAlign('center'); - context.setFontSize(22 * unit); - context.setFillStyle('#96959a'); - context.fillText(fromText, 277 * unit, 105 * unit); + + if(getApp().globalData.userInfo) { + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; + // let fromTextLen = context.measureText(fromText); + // let x_fromText = (375 - fromTextLen.width)/2; + // console.log('222222',fromTextLen,x_fromText); + context.setTextAlign('center'); + context.setFontSize(22 * unit); + context.setFillStyle('#96959a'); + context.fillText(fromText, 277 * unit, 105 * unit); + } // 4.海报背景 // context.beginPath(); // context.setStrokeStyle('#f2f1f6'); @@ -5423,12 +5426,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; + // } if (this.data.share_hidden) { this.setData({ share_hidden: false, }); @@ -5497,7 +5500,7 @@ Page({ }; - + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:''; //-- 是自定义海报的情况下 -- if (th.data.share_b_img ) { @@ -5515,8 +5518,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); @@ -5870,9 +5873,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"); @@ -6917,10 +6920,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, }); diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index b24e93d..17ebafa 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -6355,12 +6355,15 @@ 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); + let nick=getApp().globalData.userInfo?getApp().globalData.userInfo.nickname:''; + if(nick) { + // 3.推荐来源 + let fromText = `来自${nick}的推荐`; + context.setTextAlign('center'); + context.setFontSize(22 * unit); + context.setFillStyle('#96959a'); + context.fillText(fromText, 277 * unit, 105 * unit); + } // 4.海报背景 context.setFillStyle('white'); @@ -6525,14 +6528,14 @@ 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; + // } if (this.data.share_hidden) { this.setData({ @@ -6619,6 +6622,7 @@ Page({ var act_time = ''; + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:''; //-- 是自定义海报的情况下 -- if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { @@ -6631,11 +6635,13 @@ Page({ var y = parseFloat(th.data.poster.head_y) * 2; var x1 = (x + 90) * unit; var y1 = (y + 50) * unit; + + //--昵称--- 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); @@ -6652,8 +6658,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); @@ -7282,7 +7288,7 @@ 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"; tt(func); @@ -8686,10 +8692,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, });