Commit d16a56fe by 程智春

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents 9c0db73a f953e760
...@@ -146,6 +146,7 @@ export default { ...@@ -146,6 +146,7 @@ export default {
getDistributorHomepageName: '',//小店入口名称 getDistributorHomepageName: '',//小店入口名称
active:-1, active:-1,
toHomePage: false,//是否分销隔断 toHomePage: false,//是否分销隔断
options: 1,
}; };
}, },
components:{ components:{
...@@ -209,6 +210,13 @@ export default { ...@@ -209,6 +210,13 @@ export default {
} }
}, },
onLoad(options) { onLoad(options) {
//进页面存储需要绑定的信息
if(options.userId||options.spokesmanRelId) {
wx.setStorage({
key: "becomeInfo",
data: JSON.stringify(options)
});
}
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
if (options.from && options.from == "logout") { if (options.from && options.from == "logout") {
//来自用户登出 //来自用户登出
...@@ -219,7 +227,7 @@ export default { ...@@ -219,7 +227,7 @@ export default {
key: "openid" key: "openid"
}); });
} }
this.options = JSON.stringify(options);
this.changeLocation = options.changeLocation || '' this.changeLocation = options.changeLocation || ''
if(this.changeLocation == 1){ if(this.changeLocation == 1){
...@@ -234,7 +242,19 @@ export default { ...@@ -234,7 +242,19 @@ export default {
that.showMyCard = res; that.showMyCard = res;
}) })
//获取分销信息 //获取分销信息
this.getSpokesmanInit(options) this.getSpokesmanInit(wx.getStorage("becomeInfo"))
}else {
let footerVal = {...app.globalData.footerVal};
console.log('"分销员中心"',footerVal)
if (footerVal.componentData) {
footerVal.componentData.list.forEach(res=>{
if(res.link.name=="分销员中心"||res.link.name=="分销商中心") {
res.show = false
}
})
app.globalData.footerVal = footerVal;
this.$mp.page.selectComponent(".custom-tab-bar").init();
}
} }
// 来源 // 来源
if (options.from == "logout") { if (options.from == "logout") {
...@@ -335,25 +355,17 @@ export default { ...@@ -335,25 +355,17 @@ export default {
this.$mp.page.selectComponent(".custom-tab-bar").init(); this.$mp.page.selectComponent(".custom-tab-bar").init();
// that.applySucessEntry = res; // that.applySucessEntry = res;
}) })
}else {
let footerVal = {...app.globalData.footerVal};
console.log('"分销员中心"',footerVal)
if (footerVal.componentData) {
footerVal.componentData.list.forEach(res=>{
if(res.link.name=="分销员中心"||res.link.name=="分销商中心") {
res.show = false
}
})
app.globalData.footerVal = footerVal;
this.$mp.page.selectComponent(".custom-tab-bar").init();
}
} }
}, },
getSpokesmanInit(extConfig) { getSpokesmanInit(extConfig) {
//绑定上下级关系 //绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then(res=>{ app.fenxiaoModel.becomeRelation(extConfig).then(res=>{
if(!res) {
wx.removeStorage({
key: "becomeInfo"
});
}
//获取分销基本信息 //获取分销基本信息
console.log(res,333333344444444)
this.getSpokesmanInfo(extConfig) this.getSpokesmanInfo(extConfig)
}) })
}, },
...@@ -454,38 +466,54 @@ export default { ...@@ -454,38 +466,54 @@ export default {
}); });
} }
}, },
onShareAppMessage(res){ async onShareAppMessage(res){
app.fenxiaoModel.getSpokesmanidByShare().then(res=>{ console.log(res)
let newHref = '/pages/home/main'; let newHref = '/pages/home/main';
if (res.hasInvitationStatus == 1) { let title = app.globalData.shopInfo.shopName;
newHref = concatUrl(newHref,res) let hasInvitationStatus = 0;
} await app.fenxiaoModel.getSpokesmanidByShare().then(data=>{
let title = app.globalData.shopInfo.shopName; hasInvitationStatus = data.hasInvitationStatus;
console.log(newHref,3333555666,title) })
return { await app.fenxiaoModel.getSpokesmanInfo().then(data=>{
title: title, // 默认是小程序的名称 let newData = {}
path: newHref, // 默认是当前页面 if (hasInvitationStatus == 1) {
// imageUrl: this.shareLogoUrl, newData = {
success: function(res) { spokesmanGroupId: data.groupId,
// 转发成功之后的回调 spokesmanShopId: data.shopId,
if (res.errMsg == "shareAppMessage:ok") { spokesmanRelId: data.id,
console.log(res, "分享成功"); userId: data.userId
}
},
fail: function() {
// 转发失败之后的回调
if (res.errMsg == "shareAppMessage:fail cancel") {
// 用户取消转发
console.log(res, "分享失败");
} else if (res.errMsg == "shareAppMessage:fail") {
// 转发失败,其中 detail message 为详细失败信息
}
},
complete: function() {
// 转发结束之后的回调(转发成不成功都会执行)
} }
}; }else {
newData = {
userId: data.userId
}
}
newHref = concatUrl(newHref,newData)
}) })
console.log(newHref,3333555666,title,res)
return {
title: title, // 默认是小程序的名称
path: newHref, // 默认是当前页面
// imageUrl: this.shareLogoUrl,
success: function(res) {
// 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") {
console.log(res, "分享成功");
}
},
fail: function() {
// 转发失败之后的回调
if (res.errMsg == "shareAppMessage:fail cancel") {
// 用户取消转发
console.log(res, "分享失败");
} else if (res.errMsg == "shareAppMessage:fail") {
// 转发失败,其中 detail message 为详细失败信息
}
},
complete: function() {
// 转发结束之后的回调(转发成不成功都会执行)
}
};
}, },
onPullDownRefresh(){ onPullDownRefresh(){
console.log('onPullDownRefresh',this.$store.state.extConfig) console.log('onPullDownRefresh',this.$store.state.extConfig)
......
...@@ -33,6 +33,7 @@ import login from "@/api/login"; ...@@ -33,6 +33,7 @@ import login from "@/api/login";
import shop from "@/api/shop"; import shop from "@/api/shop";
import indexApi from "@/api/index.js"; import indexApi from "@/api/index.js";
var WXBizDataCrypt = require("@/utils/WXBizDataCrypt"); var WXBizDataCrypt = require("@/utils/WXBizDataCrypt");
const app = getApp();
export default { export default {
name:'login', name:'login',
components: { components: {
...@@ -311,6 +312,14 @@ export default { ...@@ -311,6 +312,14 @@ export default {
}, },
// 是否跳转h5或小程序 // 是否跳转h5或小程序
pushPageType(){ pushPageType(){
//绑定上下级关系
app.fenxiaoModel.becomeRelation(wx.getStorage("becomeInfo")).then(res=>{
if(!res) {
wx.removeStorage({
key: "becomeInfo"
});
}
})
if(this.fromType=='mini'){ if(this.fromType=='mini'){
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
......
...@@ -89,7 +89,7 @@ class fenxiaoModel{ ...@@ -89,7 +89,7 @@ class fenxiaoModel{
} }
}) })
}else { }else {
resolve() resolve(false)
} }
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment