diff --git a/packageA/pages/distribution/card/card.js b/packageA/pages/distribution/card/card.js index 85062bc..7b16f02 100644 --- a/packageA/pages/distribution/card/card.js +++ b/packageA/pages/distribution/card/card.js @@ -1,6 +1,7 @@ // packageA//pages/distribution/card/card.js const app = getApp(); let self = null; +var os = app.globalData.setting; Page({ @@ -41,9 +42,11 @@ Page({ imghost: app.globalData.setting.imghost, isLogin: true, }); + + var user_id=app.globalData.userInfo.user_id; // 请求数据 wx.getImageInfo({ - src: 'https://test-weshop.xinda100.cn/api/wx/open/app/user/getWeAppEwm/1?sceneValue=6519836&pageValue=pages/index/index/index', + src: os.url+'/api/wx/open/app/user/getWeAppEwm/1?sceneValue='+user_id+'&pageValue=packageA/pages/distribution/shop/shop', success (res) { self.setData({ img: res.path, diff --git a/packageA/pages/distribution/shop/shop.js b/packageA/pages/distribution/shop/shop.js index fd46085..da4a1d3 100644 --- a/packageA/pages/distribution/shop/shop.js +++ b/packageA/pages/distribution/shop/shop.js @@ -1,7 +1,8 @@ // packageA//pages/distribution/commision/commision.js const app = getApp(); let self = null; - +var os = app.globalData.setting; + Page({ /** @@ -35,6 +36,29 @@ Page({ userInfo: data, }); }); + + //从别人的分享的跳转过来 + var first_leader = decodeURIComponent(options.scene); + if(first_leader && first_leader!='undefined'){ + getApp().globalData.first_leader=first_leader; + this.data.first_leader=first_leader; + + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + first_leader, { + isShowLoading:false, + data:{r:Math.random()}, + success: function (e) { + if(e.data.code==0){ + self.setData({ + userInfo2: e.data.data, + }); + } ; + + }, + }); + + } + + // 判断会员是否授权登录, // 没有登录则跳转到登录页, // 已登录则设置已登录状态,请求加载签到数据 @@ -65,15 +89,14 @@ Page({ /** * 生命周期函数--监听页面初次渲染完成 */ - onReady: function () { - - }, + onReady: function () {}, /** * 生命周期函数--监听页面显示 */ onShow: function () { - if(app.globalData.userInfo) { + //自己登录的 + if(app.globalData.userInfo && !this.data.first_leader) { if(!this.data.isLogin) { this.setData({ userInfo: app.globalData.userInfo, @@ -114,7 +137,46 @@ Page({ }); }; - }; + } + //被人分享点击开的 + else if(this.data.first_leader){ + this.setData({ + imghost: app.globalData.setting.imghost, + currentQuery: { + store_id: app.globalData.setting.stoid, + user_id: this.data.first_leader, + }, + isLogin: true, + }); + + // 请求数据 + this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); + // 新品 + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { + data: self.data.currentQuery, + }).then(res => { + self.setData({ + newList: res.data.data, + }); + }); + // 广告banner + app.request.promiseGet("/api/weshop/ad/page", { + data: { + pid: 401, + enabled: 1, + store_id: app.globalData.setting.stoid, + } + }).then(res => { + if(res.data.code == 0 && res.data.data) { + let item = res.data.data.pageData[0]; + if(item && item.ad_code) { + self.setData({ + ad_img: item.ad_code, + }); + }; + }; + }); + } }, @@ -148,11 +210,29 @@ Page({ /** * 用户点击右上角分享 - */ - onShareAppMessage: function () { - + *--点击分享事件--分享我的小店 + *--*/ + onShareAppMessage: function(t) { + + var th = this; + var title= "我的小店"; + var user_id=this.data.first_leader; + if(!user_id){ + user_id=getApp().globalData.user_id + } + var url="/packageA/pages/distribution/shop/shop?scene=" + user_id; + if(getApp().globalData.user_id){ + url+="&first_leader="+getApp().globalData.user_id; + } + + var ob={ + title: title, + path:url, + }; + return ob; + }, - + /** * 点击下拉菜单 */ diff --git a/packageA/pages/distribution/shop/shop.wxml b/packageA/pages/distribution/shop/shop.wxml index 234e2ad..229b51e 100644 --- a/packageA/pages/distribution/shop/shop.wxml +++ b/packageA/pages/distribution/shop/shop.wxml @@ -5,10 +5,18 @@ - + + + + {{userInfo2.nickname}} + + + {{userInfo.nickname}} + + {{filter.show_default(list.total)}} diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 3ee0bab..7bb9f71 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -564,8 +564,6 @@ Page({ }, onPageScroll: function(e) { this.data.scrollTop=e.scrollTop; - - var t = getCurrentPages(); "pages/index/index/index" == t[t.length - 1].route; /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ @@ -588,7 +586,7 @@ Page({ url+="&first_leader="+getApp().globalData.user_id; } var ob={ - title: getApp().globalData.config.store_name,, + title: getApp().globalData.config.store_name, path:url, }; return o.share;