提交 d60b42ea 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新一键登录示例

上级 a6eda289
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
}, },
fail(err : PreLoginFail) { fail(err : PreLoginFail) {
console.error("pre login fail => " + JSON.stringify(err)); console.error("pre login fail => " + JSON.stringify(err));
uni.showModal({
title: '预登录失败',
content: JSON.parseObject(err.cause?.cause?.message ?? "")?.getString("errorDesc") ?? err.errMsg,
showCancel: false
});
} }
} as PreLoginOptions); } as PreLoginOptions);
}, },
...@@ -48,6 +53,11 @@ ...@@ -48,6 +53,11 @@
}, },
fail: (err : PreLoginFail) => { fail: (err : PreLoginFail) => {
console.error("pre login fail => " + JSON.stringify(err)); console.error("pre login fail => " + JSON.stringify(err));
uni.showModal({
title: '预登录失败',
content: JSON.parseObject(err.cause?.cause?.message ?? "")?.getString("errorDesc") ?? err.errMsg,
showCancel: false
});
} }
} as PreLoginOptions); } as PreLoginOptions);
} }
...@@ -71,26 +81,34 @@ ...@@ -71,26 +81,34 @@
openid: res.openId // 客户端一键登录接口返回的openid openid: res.openId // 客户端一键登录接口返回的openid
} }
}).then(res => { }).then(res => {
uni.showModal({ // 关闭登录页
title: '取号成功', this.univerifyManager?.close();
content: res.result.getJSON("res")?.getString("phoneNumber"), setTimeout(() => {
showCancel: false, uni.showModal({
success: (_) => { title: '取号成功',
// 关闭登录页 content: res.result.getJSON("res")?.getString("phoneNumber"),
this.univerifyManager?.close(); showCancel: false
} });
}); }, 100);
}).catch(err => { }).catch(err => {
console.error(JSON.stringify(err)); console.error(JSON.stringify(err));
// 关闭登录页 // 关闭登录页
this.univerifyManager?.close(); this.univerifyManager?.close();
setTimeout(() => {
uni.showModal({
title: '取号失败',
content: (err as Error).message,
showCancel: false
});
}, 100);
}); });
}, },
fail: (err : LoginFail) => { fail: (err : LoginFail) => {
console.error("login fail => " + err); console.error("login fail => " + err);
uni.showToast({ uni.showModal({
title: "登录失败", title: '登录失败',
icon: "error" content: JSON.parseObject(err.cause?.cause?.message ?? "")?.getString("errorDesc") ?? err.errMsg,
showCancel: false
}); });
} }
} as LoginOptions); } as LoginOptions);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册