Commit fa16d750335c5f4839fee57a18c922a1bd2ee5b7
1 parent
3afbb00c
活动分享的优化
Showing
1 changed file
with
37 additions
and
35 deletions
packageA/pages/activity_share/activity_share.js
@@ -673,12 +673,12 @@ Page({ | @@ -673,12 +673,12 @@ Page({ | ||
673 | //--定义的保存图片方法,分享团--- | 673 | //--定义的保存图片方法,分享团--- |
674 | saveImageToPhotosAlbum: function() { | 674 | saveImageToPhotosAlbum: function() { |
675 | //--先判断会员状态-- | 675 | //--先判断会员状态-- |
676 | - var user_info = getApp().globalData.userInfo; | ||
677 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
678 | - //getApp().my_warnning("请先登录",0,this); | ||
679 | - wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
680 | - return false; | ||
681 | - } | 676 | + // var user_info = getApp().globalData.userInfo; |
677 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
678 | + // //getApp().my_warnning("请先登录",0,this); | ||
679 | + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
680 | + // return false; | ||
681 | + // } | ||
682 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 | 682 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 |
683 | var type = 0; | 683 | var type = 0; |
684 | wx.showLoading({ | 684 | wx.showLoading({ |
@@ -752,6 +752,8 @@ Page({ | @@ -752,6 +752,8 @@ Page({ | ||
752 | pg_path=th.data.share_b_img; | 752 | pg_path=th.data.share_b_img; |
753 | } | 753 | } |
754 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | 754 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
755 | + | ||
756 | + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:''; | ||
755 | 757 | ||
756 | //-- 是自定义海报的情况下 -- | 758 | //-- 是自定义海报的情况下 -- |
757 | if(th.data.poster && parseInt(th.data.poster.style)==2){ | 759 | if(th.data.poster && parseInt(th.data.poster.style)==2){ |
@@ -765,8 +767,8 @@ Page({ | @@ -765,8 +767,8 @@ Page({ | ||
765 | //--昵称--- | 767 | //--昵称--- |
766 | context.setFontSize(24 * unit) | 768 | context.setFontSize(24 * unit) |
767 | context.setFillStyle("black") | 769 | context.setFillStyle("black") |
768 | - context.fillText(app.globalData.userInfo.nickname, x1, y1); | ||
769 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | 770 | + context.fillText(nick, x1, y1); |
771 | + var width = 24 * nick.length * unit + 4 * unit; | ||
770 | //强烈推荐 改许程 | 772 | //强烈推荐 改许程 |
771 | var tj_path = "../../../images/share/q_tj.png"; | 773 | var tj_path = "../../../images/share/q_tj.png"; |
772 | context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); | 774 | context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); |
@@ -779,8 +781,8 @@ Page({ | @@ -779,8 +781,8 @@ Page({ | ||
779 | //--昵称--- | 781 | //--昵称--- |
780 | context.setFontSize(24 * unit) | 782 | context.setFontSize(24 * unit) |
781 | context.setFillStyle("black") | 783 | context.setFillStyle("black") |
782 | - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); | ||
783 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | 784 | + context.fillText(nick, 152 * unit, 76 * unit); |
785 | + var width = 24 * nick.length * unit + 2 * unit; | ||
784 | //强烈推荐 改许程 | 786 | //强烈推荐 改许程 |
785 | var tj_path = "../../../images/share/q_tj.png"; | 787 | var tj_path = "../../../images/share/q_tj.png"; |
786 | context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); | 788 | context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); |
@@ -1085,12 +1087,12 @@ Page({ | @@ -1085,12 +1087,12 @@ Page({ | ||
1085 | share_index:function(e){ | 1087 | share_index:function(e){ |
1086 | 1088 | ||
1087 | //--先判断会员状态-- | 1089 | //--先判断会员状态-- |
1088 | - var user_info = getApp().globalData.userInfo; | ||
1089 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1090 | - //getApp().my_warnning("请先登录",0,this); | ||
1091 | - wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1092 | - return false; | ||
1093 | - } | 1090 | + // var user_info = getApp().globalData.userInfo; |
1091 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1092 | + // //getApp().my_warnning("请先登录",0,this); | ||
1093 | + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1094 | + // return false; | ||
1095 | + // } | ||
1094 | 1096 | ||
1095 | var index=e.currentTarget.dataset.index; | 1097 | var index=e.currentTarget.dataset.index; |
1096 | var item=this.data.list[index]; | 1098 | var item=this.data.list[index]; |
@@ -1104,12 +1106,12 @@ Page({ | @@ -1104,12 +1106,12 @@ Page({ | ||
1104 | //---点击分享商品--- | 1106 | //---点击分享商品--- |
1105 | share_good:function(e){ | 1107 | share_good:function(e){ |
1106 | //--先判断会员状态-- | 1108 | //--先判断会员状态-- |
1107 | - var user_info = getApp().globalData.userInfo; | ||
1108 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1109 | - //getApp().my_warnning("请先登录",0,this); | ||
1110 | - wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1111 | - return false; | ||
1112 | - } | 1109 | + // var user_info = getApp().globalData.userInfo; |
1110 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1111 | + // //getApp().my_warnning("请先登录",0,this); | ||
1112 | + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1113 | + // return false; | ||
1114 | + // } | ||
1113 | var index=e.currentTarget.dataset.index; | 1115 | var index=e.currentTarget.dataset.index; |
1114 | var item=this.data.list[index]; | 1116 | var item=this.data.list[index]; |
1115 | //如果是搭配购 | 1117 | //如果是搭配购 |
@@ -1126,12 +1128,12 @@ Page({ | @@ -1126,12 +1128,12 @@ Page({ | ||
1126 | //----活动详情里面的分享--- | 1128 | //----活动详情里面的分享--- |
1127 | share_good2:function(e){ | 1129 | share_good2:function(e){ |
1128 | //--先判断会员状态-- | 1130 | //--先判断会员状态-- |
1129 | - var user_info = getApp().globalData.userInfo; | ||
1130 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1131 | - //getApp().my_warnning("请先登录",0,this); | ||
1132 | - wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1133 | - return false; | ||
1134 | - } | 1131 | + // var user_info = getApp().globalData.userInfo; |
1132 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1133 | + // //getApp().my_warnning("请先登录",0,this); | ||
1134 | + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1135 | + // return false; | ||
1136 | + // } | ||
1135 | 1137 | ||
1136 | var index=e.currentTarget.dataset.index; | 1138 | var index=e.currentTarget.dataset.index; |
1137 | var item=this.data.list2[index]; | 1139 | var item=this.data.list2[index]; |
@@ -1144,12 +1146,12 @@ Page({ | @@ -1144,12 +1146,12 @@ Page({ | ||
1144 | share_detail:function(e){ | 1146 | share_detail:function(e){ |
1145 | 1147 | ||
1146 | //--先判断会员状态-- | 1148 | //--先判断会员状态-- |
1147 | - var user_info = getApp().globalData.userInfo; | ||
1148 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1149 | - //getApp().my_warnning("请先登录",0,this); | ||
1150 | - wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1151 | - return false; | ||
1152 | - } | 1149 | + // var user_info = getApp().globalData.userInfo; |
1150 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1151 | + // //getApp().my_warnning("请先登录",0,this); | ||
1152 | + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1153 | + // return false; | ||
1154 | + // } | ||
1153 | 1155 | ||
1154 | var com = this.selectComponent("#share_button"); //组件的id | 1156 | var com = this.selectComponent("#share_button"); //组件的id |
1155 | com.set_type(0); | 1157 | com.set_type(0); |
@@ -1171,7 +1173,7 @@ Page({ | @@ -1171,7 +1173,7 @@ Page({ | ||
1171 | return false; | 1173 | return false; |
1172 | } | 1174 | } |
1173 | //---获取分享图片的本地地址,头像和商品图片---- | 1175 | //---获取分享图片的本地地址,头像和商品图片---- |
1174 | - var path2 = getApp().globalData.userInfo.head_pic; | 1176 | + var path2 = getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:''; |
1175 | if (path2 == "") { | 1177 | if (path2 == "") { |
1176 | ee.data.share_head = "../../../images/share/hui_hear_pic.png"; | 1178 | ee.data.share_head = "../../../images/share/hui_hear_pic.png"; |
1177 | tt(func); | 1179 | tt(func); |