调用、获取滑动验证码
由于部分接口需要传入滑动验证码返回值, WEB端可通过iframe嵌入指定路径来调用验证码组件,通过postMessage方式拿到成功、失败以及关闭的回调。APP端目前仅支持uniapp开发的APP,通过webview以及uniappSDK可进行验证码插件调用。
// 验证码插件路径
/captcha/html/index.html
// 例如您的用户端访问地址为:
http://127.0.0.1:3333/anquandizhi/
// 滑动验证码插件访问地址则为:
http://127.0.0.1:3333/anquandizhi/captcha/html/index.html// WEB端
<script>
window.addEventListener("message", (event) => {
if (event.origin !== window.location.origin) return;
const message = event.data;
if (typeof message === "object") {
console.log("CAPTCHA:", message);
}
});
<script>Last updated