Commit df434a62c5fe902f383d7361cfc1a7b427a412cc
1 parent
93ca5c87
分销我的小店
Showing
4 changed files
with
104 additions
and
15 deletions
packageA/pages/distribution/card/card.js
| 1 | 1 | // packageA//pages/distribution/card/card.js |
| 2 | 2 | const app = getApp(); |
| 3 | 3 | let self = null; |
| 4 | +var os = app.globalData.setting; | |
| 4 | 5 | |
| 5 | 6 | Page({ |
| 6 | 7 | |
| ... | ... | @@ -41,9 +42,11 @@ Page({ |
| 41 | 42 | imghost: app.globalData.setting.imghost, |
| 42 | 43 | isLogin: true, |
| 43 | 44 | }); |
| 45 | + | |
| 46 | + var user_id=app.globalData.userInfo.user_id; | |
| 44 | 47 | // 请求数据 |
| 45 | 48 | wx.getImageInfo({ |
| 46 | - src: 'https://test-weshop.xinda100.cn/api/wx/open/app/user/getWeAppEwm/1?sceneValue=6519836&pageValue=pages/index/index/index', | |
| 49 | + src: os.url+'/api/wx/open/app/user/getWeAppEwm/1?sceneValue='+user_id+'&pageValue=packageA/pages/distribution/shop/shop', | |
| 47 | 50 | success (res) { |
| 48 | 51 | self.setData({ |
| 49 | 52 | img: res.path, | ... | ... |
packageA/pages/distribution/shop/shop.js
| 1 | 1 | // packageA//pages/distribution/commision/commision.js |
| 2 | 2 | const app = getApp(); |
| 3 | 3 | let self = null; |
| 4 | - | |
| 4 | +var os = app.globalData.setting; | |
| 5 | + | |
| 5 | 6 | Page({ |
| 6 | 7 | |
| 7 | 8 | /** |
| ... | ... | @@ -35,6 +36,29 @@ Page({ |
| 35 | 36 | userInfo: data, |
| 36 | 37 | }); |
| 37 | 38 | }); |
| 39 | + | |
| 40 | + //从别人的分享的跳转过来 | |
| 41 | + var first_leader = decodeURIComponent(options.scene); | |
| 42 | + if(first_leader && first_leader!='undefined'){ | |
| 43 | + getApp().globalData.first_leader=first_leader; | |
| 44 | + this.data.first_leader=first_leader; | |
| 45 | + | |
| 46 | + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + first_leader, { | |
| 47 | + isShowLoading:false, | |
| 48 | + data:{r:Math.random()}, | |
| 49 | + success: function (e) { | |
| 50 | + if(e.data.code==0){ | |
| 51 | + self.setData({ | |
| 52 | + userInfo2: e.data.data, | |
| 53 | + }); | |
| 54 | + } ; | |
| 55 | + | |
| 56 | + }, | |
| 57 | + }); | |
| 58 | + | |
| 59 | + } | |
| 60 | + | |
| 61 | + | |
| 38 | 62 | // 判断会员是否授权登录, |
| 39 | 63 | // 没有登录则跳转到登录页, |
| 40 | 64 | // 已登录则设置已登录状态,请求加载签到数据 |
| ... | ... | @@ -65,15 +89,14 @@ Page({ |
| 65 | 89 | /** |
| 66 | 90 | * 生命周期函数--监听页面初次渲染完成 |
| 67 | 91 | */ |
| 68 | - onReady: function () { | |
| 69 | - | |
| 70 | - }, | |
| 92 | + onReady: function () {}, | |
| 71 | 93 | |
| 72 | 94 | /** |
| 73 | 95 | * 生命周期函数--监听页面显示 |
| 74 | 96 | */ |
| 75 | 97 | onShow: function () { |
| 76 | - if(app.globalData.userInfo) { | |
| 98 | + //自己登录的 | |
| 99 | + if(app.globalData.userInfo && !this.data.first_leader) { | |
| 77 | 100 | if(!this.data.isLogin) { |
| 78 | 101 | this.setData({ |
| 79 | 102 | userInfo: app.globalData.userInfo, |
| ... | ... | @@ -114,7 +137,46 @@ Page({ |
| 114 | 137 | }); |
| 115 | 138 | |
| 116 | 139 | }; |
| 117 | - }; | |
| 140 | + } | |
| 141 | + //被人分享点击开的 | |
| 142 | + else if(this.data.first_leader){ | |
| 143 | + this.setData({ | |
| 144 | + imghost: app.globalData.setting.imghost, | |
| 145 | + currentQuery: { | |
| 146 | + store_id: app.globalData.setting.stoid, | |
| 147 | + user_id: this.data.first_leader, | |
| 148 | + }, | |
| 149 | + isLogin: true, | |
| 150 | + }); | |
| 151 | + | |
| 152 | + // 请求数据 | |
| 153 | + this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); | |
| 154 | + // 新品 | |
| 155 | + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { | |
| 156 | + data: self.data.currentQuery, | |
| 157 | + }).then(res => { | |
| 158 | + self.setData({ | |
| 159 | + newList: res.data.data, | |
| 160 | + }); | |
| 161 | + }); | |
| 162 | + // 广告banner | |
| 163 | + app.request.promiseGet("/api/weshop/ad/page", { | |
| 164 | + data: { | |
| 165 | + pid: 401, | |
| 166 | + enabled: 1, | |
| 167 | + store_id: app.globalData.setting.stoid, | |
| 168 | + } | |
| 169 | + }).then(res => { | |
| 170 | + if(res.data.code == 0 && res.data.data) { | |
| 171 | + let item = res.data.data.pageData[0]; | |
| 172 | + if(item && item.ad_code) { | |
| 173 | + self.setData({ | |
| 174 | + ad_img: item.ad_code, | |
| 175 | + }); | |
| 176 | + }; | |
| 177 | + }; | |
| 178 | + }); | |
| 179 | + } | |
| 118 | 180 | |
| 119 | 181 | }, |
| 120 | 182 | |
| ... | ... | @@ -148,11 +210,29 @@ Page({ |
| 148 | 210 | |
| 149 | 211 | /** |
| 150 | 212 | * 用户点击右上角分享 |
| 151 | - */ | |
| 152 | - onShareAppMessage: function () { | |
| 153 | - | |
| 213 | + *--点击分享事件--分享我的小店 | |
| 214 | + *--*/ | |
| 215 | + onShareAppMessage: function(t) { | |
| 216 | + | |
| 217 | + var th = this; | |
| 218 | + var title= "我的小店"; | |
| 219 | + var user_id=this.data.first_leader; | |
| 220 | + if(!user_id){ | |
| 221 | + user_id=getApp().globalData.user_id | |
| 222 | + } | |
| 223 | + var url="/packageA/pages/distribution/shop/shop?scene=" + user_id; | |
| 224 | + if(getApp().globalData.user_id){ | |
| 225 | + url+="&first_leader="+getApp().globalData.user_id; | |
| 226 | + } | |
| 227 | + | |
| 228 | + var ob={ | |
| 229 | + title: title, | |
| 230 | + path:url, | |
| 231 | + }; | |
| 232 | + return ob; | |
| 233 | + | |
| 154 | 234 | }, |
| 155 | - | |
| 235 | + | |
| 156 | 236 | /** |
| 157 | 237 | * 点击下拉菜单 |
| 158 | 238 | */ | ... | ... |
packageA/pages/distribution/shop/shop.wxml
| ... | ... | @@ -5,10 +5,18 @@ |
| 5 | 5 | <!-- <view><image src="../../../images/jfbuy.jpg" mode="widthFix" class="banner"/></view> --> |
| 6 | 6 | <view><image src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}" mode="widthFix" class="banner"/></view> |
| 7 | 7 | <view class="flex bg-white pdh20 jc_sb pr"> |
| 8 | - <view class="avatar-container"> | |
| 8 | + <!-- 分享人的头像 --> | |
| 9 | + <view class="avatar-container" wx:if="{{userInfo2}}"> | |
| 10 | + <image class="avatar" src="{{userInfo2.head_pic}}"/> | |
| 11 | + <view class="pdt20"><text class="nickname">{{userInfo2.nickname}}</text></view> | |
| 12 | + </view> | |
| 13 | + <!-- 自己的头像 --> | |
| 14 | + <view class="avatar-container" wx:else> | |
| 9 | 15 | <image class="avatar" src="{{userInfo.head_pic}}"/> |
| 10 | 16 | <view class="pdt20"><text class="nickname">{{userInfo.nickname}}</text></view> |
| 11 | 17 | </view> |
| 18 | + | |
| 19 | + | |
| 12 | 20 | <view class="flex t-c fs24 f1 jc_fe"> |
| 13 | 21 | <view class="pdv20 pdh40"> |
| 14 | 22 | <view class="fs30">{{filter.show_default(list.total)}}</view> | ... | ... |
pages/index/index/index.js
| ... | ... | @@ -564,8 +564,6 @@ Page({ |
| 564 | 564 | }, |
| 565 | 565 | onPageScroll: function(e) { |
| 566 | 566 | this.data.scrollTop=e.scrollTop; |
| 567 | - | |
| 568 | - | |
| 569 | 567 | var t = getCurrentPages(); |
| 570 | 568 | "pages/index/index/index" == t[t.length - 1].route; |
| 571 | 569 | /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ |
| ... | ... | @@ -588,7 +586,7 @@ Page({ |
| 588 | 586 | url+="&first_leader="+getApp().globalData.user_id; |
| 589 | 587 | } |
| 590 | 588 | var ob={ |
| 591 | - title: getApp().globalData.config.store_name,, | |
| 589 | + title: getApp().globalData.config.store_name, | |
| 592 | 590 | path:url, |
| 593 | 591 | }; |
| 594 | 592 | return o.share; | ... | ... |