|
|
|
@ -65,6 +65,9 @@ |
|
|
|
this.href_str = JSON.stringify(location.href); |
|
|
|
let options = this.strToObj(); |
|
|
|
console.log("options", options) |
|
|
|
if(options.code){ |
|
|
|
this.login(options.code) |
|
|
|
} |
|
|
|
// #endif |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -74,15 +77,29 @@ |
|
|
|
if(!val) return obj; |
|
|
|
if(val.indexOf('?') < 0) return obj; |
|
|
|
let indexA = val.indexOf('?') + 1; |
|
|
|
let str = val.substr(indexA, val.length); |
|
|
|
let str = val.substr(indexA); |
|
|
|
str = str.substr(0, str.length - 1); |
|
|
|
let indexB = str.indexOf('#'); |
|
|
|
str = str.substr(0, indexB); |
|
|
|
if(indexB >= 0){ |
|
|
|
str = str.substr(0, indexB); |
|
|
|
} |
|
|
|
let arr = str.split('&'); |
|
|
|
arr.map(item => { |
|
|
|
let a = item.split('='); |
|
|
|
obj[a[0]] = a[1]; |
|
|
|
}); |
|
|
|
return obj; |
|
|
|
}, |
|
|
|
login(code){ |
|
|
|
this.$http(this.API.API_OFFICIAL_LOGIN, { |
|
|
|
code: code, |
|
|
|
scopes: 'snsapi_userinfo' |
|
|
|
}).then(res => { |
|
|
|
console.log(res) |
|
|
|
uni.setStorageSync('user_info', res?.data?.user); |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|