|
|
@ -114,7 +114,8 @@ |
|
|
|
HandleCode, |
|
|
|
HandleCode, |
|
|
|
WXlogin, |
|
|
|
WXlogin, |
|
|
|
getCouponList, |
|
|
|
getCouponList, |
|
|
|
getH5UserInfo |
|
|
|
getH5UserInfo, |
|
|
|
|
|
|
|
getH5AccessToken |
|
|
|
} from "../../../Utils/Api.js"; //您的api路径 |
|
|
|
} from "../../../Utils/Api.js"; //您的api路径 |
|
|
|
let app = getApp(); |
|
|
|
let app = getApp(); |
|
|
|
export default { |
|
|
|
export default { |
|
|
@ -174,10 +175,13 @@ |
|
|
|
// #ifdef H5 |
|
|
|
// #ifdef H5 |
|
|
|
var arr1 = window.location.href; |
|
|
|
var arr1 = window.location.href; |
|
|
|
var arr2 = arr1.split('='); |
|
|
|
var arr2 = arr1.split('='); |
|
|
|
console.log(arr2); |
|
|
|
if (!app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '2#/') { |
|
|
|
if (!app.globalData.userInfo && arr2[1] != undefined) { |
|
|
|
|
|
|
|
this.getH5UserInfo(arr2[1]); |
|
|
|
this.getH5UserInfo(arr2[1]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '1#/') { |
|
|
|
|
|
|
|
this.getH5AccessToken(arr2[1]); |
|
|
|
|
|
|
|
} |
|
|
|
// #endif |
|
|
|
// #endif |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
onLoad() { |
|
|
@ -185,7 +189,6 @@ |
|
|
|
//微信内核支付 |
|
|
|
//微信内核支付 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1.wx获取登录用户code |
|
|
|
// 1.wx获取登录用户code |
|
|
|
// #ifdef MP |
|
|
|
// #ifdef MP |
|
|
|
uni.login({ |
|
|
|
uni.login({ |
|
|
@ -219,6 +222,15 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
fail: res => {} |
|
|
|
fail: res => {} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
// #ifdef H5 |
|
|
|
|
|
|
|
uni.getStorage({ |
|
|
|
|
|
|
|
key: "openId", |
|
|
|
|
|
|
|
success(e) { |
|
|
|
|
|
|
|
app.globalData.openId = e.data |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
fail: res => {} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
// #endif |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
@ -258,6 +270,22 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
//H5 获取openId |
|
|
|
|
|
|
|
getH5AccessToken(item) { |
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
|
|
code: item |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getH5AccessToken(params).then(res => { |
|
|
|
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
app.globalData.openId = res.return_data.openid; |
|
|
|
|
|
|
|
uni.setStorage({ |
|
|
|
|
|
|
|
key: "openId", |
|
|
|
|
|
|
|
data: res.return_data.openid |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//微信内核浏览器 |
|
|
|
//微信内核浏览器 |
|
|
|
isWeiXinLogin() { |
|
|
|
isWeiXinLogin() { |
|
|
|
var ua = navigator.userAgent.toLowerCase(); |
|
|
|
var ua = navigator.userAgent.toLowerCase(); |
|
|
@ -288,6 +316,12 @@ |
|
|
|
key: "token", |
|
|
|
key: "token", |
|
|
|
data: res.return_data.uniqueCode |
|
|
|
data: res.return_data.uniqueCode |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
uni.setStorage({ |
|
|
|
|
|
|
|
key: "openId", |
|
|
|
|
|
|
|
data: res.return_data |
|
|
|
|
|
|
|
.object |
|
|
|
|
|
|
|
.highUser.openIdH5 |
|
|
|
|
|
|
|
}) |
|
|
|
app.globalData.openId = res.return_data |
|
|
|
app.globalData.openId = res.return_data |
|
|
|
.object |
|
|
|
.object |
|
|
|
.highUser.openIdH5; |
|
|
|
.highUser.openIdH5; |
|
|
|