export default {
data() {
return {
openid:'',
}
},
onLoad(op) {
if(op.open_id!=undefined && op.open_id!=''&& typeof(op.open_id) != 'undefined'){
this.openid=op.open_id
this.$openid.setTest(this.openid)
}else{
this.openid=this.$openid.$openid;
this.getmsg()
}
console.log(op.open_id)
},
methods: {
// 授权
getmsg:function(){
var _self = this;
uni.request({
url: _self._apiurl + "app/auth/hasauth",
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
data: {
openid: _self.$openid.$openid,
},
success: (res) => {
console.log(res);
if(res.data.code==2){
//后台给的授权跳转页链接
window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx04b8e0c011bc547c&redirect_uri=http://saas.juwoxing.com/order/api.php?s=/api/share/mainauth&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect'
}
}
})
},
}
}