let ua = navigator.userAgent.toLowerCase()
let that = this
if (ua.match(/MicroMessenger/i) == "micromessenger") {
let code = this.GetQueryString('code');
if (code == null) {
window.location.href =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=w**********e&redirect_uri=http%3A%2F%2Fymh.frp.dzkandian.com%2F&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'
code = this.GetQueryString('code');
} else {
let obj = {
code: code
}
Logins(obj).then(res => {
uni.setStorageSync('token', res.data.token);
that.$isResolve()
})
}
} else {
uni.showModal({
title: '提示',
content: '非微信浏览器',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uniapp在微信环境内静默授权
最新推荐文章于 2024-05-22 15:46:46 发布