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 {
getDistributorHomepageName: '',//小店入口名称
active:-1,
toHomePage: false,//是否分销隔断
options: 1,
};
},
components:{
......@@ -209,6 +210,13 @@ export default {
}
},
onLoad(options) {
//进页面存储需要绑定的信息
if(options.userId||options.spokesmanRelId) {
wx.setStorage({
key: "becomeInfo",
data: JSON.stringify(options)
});
}
Object.assign(this.$data, this.$options.data());
if (options.from && options.from == "logout") {
//来自用户登出
......@@ -219,7 +227,7 @@ export default {
key: "openid"
});
}
this.options = JSON.stringify(options);
this.changeLocation = options.changeLocation || ''
if(this.changeLocation == 1){
......@@ -234,7 +242,19 @@ export default {
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") {
......@@ -335,25 +355,17 @@ export default {
this.$mp.page.selectComponent(".custom-tab-bar").init();
// 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) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then(res=>{
if(!res) {
wx.removeStorage({
key: "becomeInfo"
});
}
//获取分销基本信息
console.log(res,333333344444444)
this.getSpokesmanInfo(extConfig)
})
},
......@@ -454,38 +466,54 @@ export default {
});
}
},
onShareAppMessage(res){
app.fenxiaoModel.getSpokesmanidByShare().then(res=>{
let newHref = '/pages/home/main';
if (res.hasInvitationStatus == 1) {
newHref = concatUrl(newHref,res)
}
let title = app.globalData.shopInfo.shopName;
console.log(newHref,3333555666,title)
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() {
// 转发结束之后的回调(转发成不成功都会执行)
async onShareAppMessage(res){
console.log(res)
let newHref = '/pages/home/main';
let title = app.globalData.shopInfo.shopName;
let hasInvitationStatus = 0;
await app.fenxiaoModel.getSpokesmanidByShare().then(data=>{
hasInvitationStatus = data.hasInvitationStatus;
})
await app.fenxiaoModel.getSpokesmanInfo().then(data=>{
let newData = {}
if (hasInvitationStatus == 1) {
newData = {
spokesmanGroupId: data.groupId,
spokesmanShopId: data.shopId,
spokesmanRelId: data.id,
userId: data.userId
}
};
}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(){
console.log('onPullDownRefresh',this.$store.state.extConfig)
......
......@@ -33,6 +33,7 @@ import login from "@/api/login";
import shop from "@/api/shop";
import indexApi from "@/api/index.js";
var WXBizDataCrypt = require("@/utils/WXBizDataCrypt");
const app = getApp();
export default {
name:'login',
components: {
......@@ -311,6 +312,14 @@ export default {
},
// 是否跳转h5或小程序
pushPageType(){
//绑定上下级关系
app.fenxiaoModel.becomeRelation(wx.getStorage("becomeInfo")).then(res=>{
if(!res) {
wx.removeStorage({
key: "becomeInfo"
});
}
})
if(this.fromType=='mini'){
wx.navigateBack({
delta: 1
......
......@@ -89,7 +89,7 @@ class fenxiaoModel{
}
})
}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