Commit 7c9e9aecb60d1ae63c6443bd7bcd9db6ae50ec9d

Authored by vking
1 parent a63ecd00

welcome

... ... @@ -125,12 +125,16 @@ App({
})
})
},
async _getLiteOpenidByCode(code){
async _getLiteOpenidByCode(code,app_unionid){
return new Promise((success,fail)=>{
let params={code:code}
if(app_unionid){
params.unionid=app_unionid
}
wx.request({
url: uri_dc.HOST__LINE+'App.Reserve.GetLiteOpenid',
method: 'POST',
data: {code:code},
data: params,
header: {
'content-type': 'application/x-www-form-urlencoded'
},
... ... @@ -152,20 +156,20 @@ App({
})
})
},
async _getOpenid(){
async _getOpenid(app_unionid){
try{
let login_res=await this._login();
let openid=await this._getLiteOpenidByCode(login_res.code)
let openid=await this._getLiteOpenidByCode(login_res.code,app_unionid)
return openid
}catch(e){
console.log('_getOpenid.catch',e)
return this._getOpenid();
}
},
async getOpenid(){
async getOpenid(app_unionid=''){
let openid=wx.getStorageSync('customer_openid');
if(!openid){
openid= await this._getOpenid();
openid= await this._getOpenid(app_unionid);
}
this.openid=openid
return openid;
... ...
... ... @@ -12,7 +12,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.unionid){
getApp().getOpenid(options.unionid)
}
},
/**
... ...