Commit 609814e2 by 程智春

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

parents 3fc6ba20 cfcbb836
......@@ -37,6 +37,7 @@ export default {
},
data() {
return {
code: "",
session_key: "",
shopName: "",
logoUrl: "",
......@@ -66,13 +67,40 @@ export default {
};
},
created() {},
onShow() {
wx.checkSession({
success : () => {
//session_key 未过期,并且在本生命周期一直有效
wx.login({
success: res => {
this.code = res.code;
},
fail: err => {
reject(err);
}
}) //重新登录
},
fail : () => {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success: res => {
this.code = res.code;
},
fail: err => {
reject(err);
}
}) //重新登录
}
})
},
onLoad(options) {
Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化
if (options.back) {
this.backPath = options.back;
}
if (options.params) {
this.backParams = serialize(options.params);
this.defalutBackParams= serialize(options.params);
this.backParams = this.defalutBackParams;
let params = JSON.parse(options.params);
this.fromType = params.fromType;
}
......@@ -102,34 +130,26 @@ export default {
},
init() {
return new Promise((resolve, reject) => {
wx.login({
success: res => {
if (res.code) {
login
.miniLogin({ code: res.code,
spokesmanRelId : this.$store.state.spokesmanRelId,
spokesmanGroupId : this.$store.state.spokesmanGroupId,
spokesmanShopId : this.$store.state.spokesmanShopId
})
.then(res => {
if (res.data.code == 200) {
resolve(res);
} else {
reject(res.data.msg);
}
})
.catch(err => {
reject(err);
});
}
},
fail: err => {
reject(err);
login
.miniLogin({ code: this.code,
spokesmanRelId : this.$store.state.spokesmanRelId,
spokesmanGroupId : this.$store.state.spokesmanGroupId,
spokesmanShopId : this.$store.state.spokesmanShopId
})
.then(res => {
if (res.data.code == 200) {
resolve(res);
} else {
reject(res.data.msg);
}
})
.catch(err => {
reject(err);
});
});
},
getUserInfo: function(e) {
this.backParams=this.defalutBackParams
wx.showLoading({
title: "加载中"
});
......
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