|
@@ -11,21 +11,20 @@ export default {
|
|
|
}
|
|
|
const res = await getWxUserInfo({ code: code, userId: localStorage.getItem("userId") })
|
|
|
console.log(res, '================================getWxUserInfo')
|
|
|
- if (res.body.code == '0') {
|
|
|
+ if (res.code == '0') {
|
|
|
console.log('直接走+======', res)
|
|
|
- localStorage.setItem("openid", res.body.openId);
|
|
|
- localStorage.setItem("headimgurl", res.body.headimgurl);
|
|
|
+ localStorage.setItem("openid", res.openId);
|
|
|
+ localStorage.setItem("headimgurl", res.headimgurl);
|
|
|
} else {
|
|
|
this.urlredirect();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- Vue.prototype.urlredirect = async function (page) {
|
|
|
+ Vue.prototype.urlredirect = async function () {
|
|
|
const res = await getWxConfig({})
|
|
|
const href = window.location.href
|
|
|
window.location.href =
|
|
|
- `https://open.weixin.qq.com/connect/oauth2/authorize?appid=&redirect_uri=${res.wxConfig.appId}&redirect_uri=${encodeURIComponent(href)}` + "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
|
|
|
+ `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.wxConfig.appId}&redirect_uri=${encodeURIComponent(href)}` + `&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect`;
|
|
|
}
|
|
|
Vue.prototype.getUrlParam = function (name) {
|
|
|
var vars = [],
|