Commit 30fe44c82908e38d4b83896620a753cb7ebb324c
1 parent
194d8476
商品详情页面,和幸运购商品分享的优化
Showing
2 changed files
with
65 additions
and
56 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -568,16 +568,16 @@ Page({ |
568 | 568 | |
569 | 569 | |
570 | 570 | //--先判断会员登陆状态-- |
571 | - var user_info = getApp().globalData.userInfo; | |
572 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
573 | - | |
574 | - getApp().is_Single_page(th, function () { | |
575 | - wx.navigateTo({ | |
576 | - url: '/packageE/pages/togoin/togoin', | |
577 | - }) | |
578 | - return false; | |
579 | - }) | |
580 | - } | |
571 | + // var user_info = getApp().globalData.userInfo; | |
572 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
573 | + // | |
574 | + // getApp().is_Single_page(th, function () { | |
575 | + // wx.navigateTo({ | |
576 | + // url: '/packageE/pages/togoin/togoin', | |
577 | + // }) | |
578 | + // return false; | |
579 | + // }) | |
580 | + // } | |
581 | 581 | }, |
582 | 582 | |
583 | 583 | //-- 获取直播的分享人的导购信息 -- |
... | ... | @@ -5320,14 +5320,17 @@ Page({ |
5320 | 5320 | context.setFillStyle('black'); |
5321 | 5321 | context.fillText(shopName, 277 * unit, 60 * unit); |
5322 | 5322 | // // 3.推荐来源 |
5323 | - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | |
5324 | - // let fromTextLen = context.measureText(fromText); | |
5325 | - // let x_fromText = (375 - fromTextLen.width)/2; | |
5326 | - // console.log('222222',fromTextLen,x_fromText); | |
5327 | - context.setTextAlign('center'); | |
5328 | - context.setFontSize(22 * unit); | |
5329 | - context.setFillStyle('#96959a'); | |
5330 | - context.fillText(fromText, 277 * unit, 105 * unit); | |
5323 | + | |
5324 | + if(getApp().globalData.userInfo) { | |
5325 | + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | |
5326 | + // let fromTextLen = context.measureText(fromText); | |
5327 | + // let x_fromText = (375 - fromTextLen.width)/2; | |
5328 | + // console.log('222222',fromTextLen,x_fromText); | |
5329 | + context.setTextAlign('center'); | |
5330 | + context.setFontSize(22 * unit); | |
5331 | + context.setFillStyle('#96959a'); | |
5332 | + context.fillText(fromText, 277 * unit, 105 * unit); | |
5333 | + } | |
5331 | 5334 | // 4.海报背景 |
5332 | 5335 | // context.beginPath(); |
5333 | 5336 | // context.setStrokeStyle('#f2f1f6'); |
... | ... | @@ -5423,12 +5426,12 @@ Page({ |
5423 | 5426 | //--定义的保存图片方法,分享团--- |
5424 | 5427 | saveImageToPhotosAlbum: function () { |
5425 | 5428 | //--先判断会员状态-- |
5426 | - var user_info = getApp().globalData.userInfo; | |
5427 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
5428 | - //getApp().my_warnning("请先登录",0,this); | |
5429 | - wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | |
5430 | - return false; | |
5431 | - } | |
5429 | + // var user_info = getApp().globalData.userInfo; | |
5430 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
5431 | + // //getApp().my_warnning("请先登录",0,this); | |
5432 | + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | |
5433 | + // return false; | |
5434 | + // } | |
5432 | 5435 | |
5433 | 5436 | if (this.data.share_hidden) { |
5434 | 5437 | this.setData({ share_hidden: false, }); |
... | ... | @@ -5497,7 +5500,7 @@ Page({ |
5497 | 5500 | }; |
5498 | 5501 | |
5499 | 5502 | |
5500 | - | |
5503 | + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:''; | |
5501 | 5504 | |
5502 | 5505 | //-- 是自定义海报的情况下 -- |
5503 | 5506 | if (th.data.share_b_img ) { |
... | ... | @@ -5515,8 +5518,8 @@ Page({ |
5515 | 5518 | //--昵称--- |
5516 | 5519 | context.setFontSize(24 * unit) |
5517 | 5520 | context.setFillStyle("black") |
5518 | - context.fillText(app.globalData.userInfo.nickname, x1, y1); | |
5519 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | |
5521 | + context.fillText(nick, x1, y1); | |
5522 | + var width = 24 * nick.length * unit + 4 * unit; | |
5520 | 5523 | //强烈推荐 改许程 |
5521 | 5524 | var tj_path = "../../../../images/share/q_tj.png"; |
5522 | 5525 | context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); |
... | ... | @@ -5870,9 +5873,9 @@ Page({ |
5870 | 5873 | return false; |
5871 | 5874 | } |
5872 | 5875 | //---获取分享图片的本地地址,头像和商品图片---- |
5873 | - var path2 = getApp().globalData.userInfo.head_pic; | |
5876 | + var path2 =getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:''; | |
5874 | 5877 | if (path2 == "") { |
5875 | - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; | |
5878 | + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; | |
5876 | 5879 | tt(func); |
5877 | 5880 | } else { |
5878 | 5881 | path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); |
... | ... | @@ -6917,10 +6920,10 @@ Page({ |
6917 | 6920 | }, |
6918 | 6921 | |
6919 | 6922 | clickShare() { |
6920 | - if(!getApp().globalData.user_id){ | |
6921 | - getApp().goto("/packageE/pages/togoin/togoin"); | |
6922 | - return false; | |
6923 | - } | |
6923 | + // if(!getApp().globalData.user_id){ | |
6924 | + // getApp().goto("/packageE/pages/togoin/togoin"); | |
6925 | + // return false; | |
6926 | + // } | |
6924 | 6927 | this.setData({ |
6925 | 6928 | share_hidden: true, |
6926 | 6929 | }); | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -6355,12 +6355,15 @@ Page({ |
6355 | 6355 | context.setFillStyle('black'); |
6356 | 6356 | context.fillText(shopName, 277 * unit, 60 * unit); |
6357 | 6357 | |
6358 | - // 3.推荐来源 | |
6359 | - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | |
6360 | - context.setTextAlign('center'); | |
6361 | - context.setFontSize(22 * unit); | |
6362 | - context.setFillStyle('#96959a'); | |
6363 | - context.fillText(fromText, 277 * unit, 105 * unit); | |
6358 | + let nick=getApp().globalData.userInfo?getApp().globalData.userInfo.nickname:''; | |
6359 | + if(nick) { | |
6360 | + // 3.推荐来源 | |
6361 | + let fromText = `来自${nick}的推荐`; | |
6362 | + context.setTextAlign('center'); | |
6363 | + context.setFontSize(22 * unit); | |
6364 | + context.setFillStyle('#96959a'); | |
6365 | + context.fillText(fromText, 277 * unit, 105 * unit); | |
6366 | + } | |
6364 | 6367 | |
6365 | 6368 | // 4.海报背景 |
6366 | 6369 | context.setFillStyle('white'); |
... | ... | @@ -6525,14 +6528,14 @@ Page({ |
6525 | 6528 | //--定义的保存图片方法,分享团--- |
6526 | 6529 | saveImageToPhotosAlbum: function () { |
6527 | 6530 | //--先判断会员状态-- |
6528 | - var user_info = getApp().globalData.userInfo; | |
6529 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
6530 | - //getApp().my_warnning("请先登录",0,this); | |
6531 | - wx.navigateTo({ | |
6532 | - url: '/packageE/pages/togoin/togoin', | |
6533 | - }) | |
6534 | - return false; | |
6535 | - } | |
6531 | + // var user_info = getApp().globalData.userInfo; | |
6532 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
6533 | + // //getApp().my_warnning("请先登录",0,this); | |
6534 | + // wx.navigateTo({ | |
6535 | + // url: '/packageE/pages/togoin/togoin', | |
6536 | + // }) | |
6537 | + // return false; | |
6538 | + // } | |
6536 | 6539 | |
6537 | 6540 | if (this.data.share_hidden) { |
6538 | 6541 | this.setData({ |
... | ... | @@ -6619,6 +6622,7 @@ Page({ |
6619 | 6622 | |
6620 | 6623 | |
6621 | 6624 | var act_time = ''; |
6625 | + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:''; | |
6622 | 6626 | |
6623 | 6627 | //-- 是自定义海报的情况下 -- |
6624 | 6628 | if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { |
... | ... | @@ -6631,11 +6635,13 @@ Page({ |
6631 | 6635 | var y = parseFloat(th.data.poster.head_y) * 2; |
6632 | 6636 | var x1 = (x + 90) * unit; |
6633 | 6637 | var y1 = (y + 50) * unit; |
6638 | + | |
6639 | + | |
6634 | 6640 | //--昵称--- |
6635 | 6641 | context.setFontSize(24 * unit) |
6636 | 6642 | context.setFillStyle("black") |
6637 | - context.fillText(app.globalData.userInfo.nickname, x1, y1); | |
6638 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | |
6643 | + context.fillText(nick, x1, y1); | |
6644 | + var width = 24 * nick.length * unit + 4 * unit; | |
6639 | 6645 | //强烈推荐 改许程 |
6640 | 6646 | var tj_path = "../../../images/share/q_tj.png"; |
6641 | 6647 | context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); |
... | ... | @@ -6652,8 +6658,8 @@ Page({ |
6652 | 6658 | //--昵称--- |
6653 | 6659 | context.setFontSize(24 * unit); |
6654 | 6660 | context.setFillStyle("black"); |
6655 | - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); | |
6656 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | |
6661 | + context.fillText(nick, 152 * unit, 76 * unit); | |
6662 | + var width = 24 * nick.length * unit + 2 * unit; | |
6657 | 6663 | //强烈推荐 改许程 |
6658 | 6664 | var tj_path = "../../../images/share/q_tj.png"; |
6659 | 6665 | context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); |
... | ... | @@ -7282,7 +7288,7 @@ Page({ |
7282 | 7288 | return false; |
7283 | 7289 | } |
7284 | 7290 | //---获取分享图片的本地地址,头像和商品图片---- |
7285 | - var path2 = getApp().globalData.userInfo.head_pic; | |
7291 | + var path2 = getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:''; | |
7286 | 7292 | if (path2 == "") { |
7287 | 7293 | ee.data.share_head = "../../../images/share/hui_hear_pic.png"; |
7288 | 7294 | tt(func); |
... | ... | @@ -8686,10 +8692,10 @@ Page({ |
8686 | 8692 | }, |
8687 | 8693 | |
8688 | 8694 | clickShare() { |
8689 | - if (!getApp().globalData.user_id) { | |
8690 | - getApp().goto("/packageE/pages/togoin/togoin"); | |
8691 | - return false; | |
8692 | - } | |
8695 | + // if (!getApp().globalData.user_id) { | |
8696 | + // getApp().goto("/packageE/pages/togoin/togoin"); | |
8697 | + // return false; | |
8698 | + // } | |
8693 | 8699 | this.setData({ |
8694 | 8700 | share_hidden: true, |
8695 | 8701 | }); | ... | ... |