parent
f3c73df905
commit
a4a81a5873
@ -63,7 +63,7 @@
|
|||||||
"desc" : "获取您的位置"
|
"desc" : "获取您的位置"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requiredPrivateInfos" : [ "getLocation", "chooseAddress" , "chooseLocation" ]
|
"requiredPrivateInfos" : ["login" ,"getLocation", "chooseAddress" , "chooseLocation" ]
|
||||||
},
|
},
|
||||||
"mp-alipay" : {
|
"mp-alipay" : {
|
||||||
"usingComponents" : true
|
"usingComponents" : true
|
||||||
|
@ -121,7 +121,53 @@ function getCode () {
|
|||||||
uni.$u.toast('倒计时结束后再发送');
|
uni.$u.toast('倒计时结束后再发送');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function wechatLogin () {
|
async function wechatLogin () {
|
||||||
|
|
||||||
|
if (!isWechat.value) {
|
||||||
|
|
||||||
|
uni.login({
|
||||||
|
provider: 'weixin',
|
||||||
|
// onlyAuthorize: true,// 微信登录仅请求授权认证
|
||||||
|
success: function (event) {
|
||||||
|
console.log('微信登录', event);
|
||||||
|
// const { code } = event
|
||||||
|
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||||
|
// uni.request({
|
||||||
|
// url: 'https://www.example.com/loginByWeixin', //仅为示例,并非真实接口地址。
|
||||||
|
// data: {
|
||||||
|
// code: event.code
|
||||||
|
// },
|
||||||
|
// success: (res) => {
|
||||||
|
// //获得token完成登录
|
||||||
|
// uni.setStorageSync('token', res.token)
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
userStore.login({ account: account.value, code: event.code }).catch(() => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
// const token = res.data.token;
|
||||||
|
// if (token) {
|
||||||
|
// setToken(token.token_type+' '+token.token);
|
||||||
|
// }
|
||||||
|
uni.$u.toast('登录成功');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uni.$u.toast(`登录失败,${res.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
// 登录授权失败
|
||||||
|
// err.code是错误码
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!uni.$u.test.mobile(Number(account.value))) {
|
if (!uni.$u.test.mobile(Number(account.value))) {
|
||||||
uni.$u.toast('请输入正确的手机号');
|
uni.$u.toast('请输入正确的手机号');
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user