...
|
...
|
@@ -634,31 +634,76 @@ export default { |
|
|
},
|
|
|
|
|
|
// 第三方登录
|
|
|
async thirdLogin(provider, payload = null) {
|
|
|
thirdLogin(provider, payload = null) {
|
|
|
let that = this
|
|
|
if (this.platform === 'wxMiniProgram' && payload === null) return;
|
|
|
if (!this.protocol) {
|
|
|
this.$u.toast("请同意用户协议");
|
|
|
return false;
|
|
|
}
|
|
|
const that = this;
|
|
|
let token = "";
|
|
|
switch (provider) {
|
|
|
case "wechat":
|
|
|
token = await wechat.login(payload);
|
|
|
break;
|
|
|
case "alipay":
|
|
|
break;
|
|
|
case "apple":
|
|
|
token = await apple.appleIdOauth();
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
if (token) {
|
|
|
that.closeAuthModal();
|
|
|
that.getUserInfo(token);
|
|
|
}
|
|
|
},
|
|
|
}
|
|
|
if(provider == 'wechat'){
|
|
|
uni.getProvider({
|
|
|
service: 'oauth',
|
|
|
success: function (res) {
|
|
|
console.log(res)
|
|
|
if(res.providers[0].isAppExist){
|
|
|
that.continue(provider,payload)
|
|
|
}else{
|
|
|
uni.showModal({
|
|
|
content:'尚未安装微信,请先安装微信',
|
|
|
success: (res) => {
|
|
|
if(res.confirm){}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else{
|
|
|
that.continue(provider,payload)
|
|
|
}
|
|
|
|
|
|
// const that = this;
|
|
|
// let token = "";
|
|
|
// switch (provider) {
|
|
|
// case "wechat":
|
|
|
// token = await wechat.login(payload);
|
|
|
// break;
|
|
|
// case "alipay":
|
|
|
// break;
|
|
|
// case "apple":
|
|
|
// token = await apple.appleIdOauth();
|
|
|
// break;
|
|
|
// default:
|
|
|
// break;
|
|
|
// }
|
|
|
// if (token) {
|
|
|
// that.closeAuthModal();
|
|
|
// that.getUserInfo(token);
|
|
|
// }
|
|
|
|
|
|
},
|
|
|
|
|
|
async continue(provider,payload){
|
|
|
const that = this;
|
|
|
let token = "";
|
|
|
switch (provider) {
|
|
|
case "wechat":
|
|
|
token = await wechat.login(payload);
|
|
|
break;
|
|
|
case "alipay":
|
|
|
break;
|
|
|
case "apple":
|
|
|
token = await apple.appleIdOauth();
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
if (token) {
|
|
|
that.closeAuthModal();
|
|
|
that.getUserInfo(token);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
// 1.账号登录
|
|
|
async accountLoginSubmit() {
|
...
|
...
|
|