Skip to content

Commit

Permalink
fix: captcha 2023.11.25
Browse files Browse the repository at this point in the history
  • Loading branch information
TRHX committed Nov 24, 2023
1 parent e9a00ae commit 1c9ab79
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions docs/07.验证码/02.国内验证码/15.友验 FastYotest.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,43 +91,45 @@ Demo 样例(随时有可能变化,以实际情况为准):
<p id="fastyotest-wait" class="fastyotest-show">正在加载验证码......</p>
</div>
</div>
<input class="fastyotest-submit" id="submit" type="submit" value="立即登录">
<input class="fastyotest-submit" id="fastyotest-submit" type="submit" value="立即登录">
</form>
</div>
<script src="https://static.fastyotest.com/assets/yotest.3b35648f.js"></script>
<!-- <script src="https://static.fastyotest.com/assets/yotest.3b35648f.js"></script> -->
<script>
var yoToken = '';
setTimeout(function() {
initYoTest.default({
accessId: '8a81edbda36d5acccc2510fc19886cb9',
}, function(captcha){
captcha.appendTo('#fastyotest-captcha');
captcha.onSuccess(function(result) {
// captcha.onSuccess(function(result) {
// yoToken = result.token;
// console.log(result.token, result.verified);
// });
captcha.onReady(function() {
console.log('FastYotest captcha is ready.');
$('#fastyotest-wait').hide();
}).onShow(function(){
// 当验证弹窗弹出时后会进行onShow的调用
console.log('FastYotest captcha showed.');
}).onSuccess(function(result) {
// 验证成功后通过onSuccess回调得到token和verified结果
yoToken = result.token;
console.log(result.token, result.verified);
}).onError(function(error) {
// 验证出现任何失败时,通过onError回调透传错误信息
console.log(error.code, error.message);
}).onClose(function() {
// 当验证弹窗关闭后会进行onClose的调用
console.log('FastYotest captcha closed.');
});
// captcha.onReady(function() {
// console.log('FastYotest captcha is ready.');
// }).onShow(function(){
// // 当验证弹窗弹出时后会进行onShow的调用
// console.log('captcha showed');
// }).onSuccess(function(result) {
// // 验证成功后通过onSuccess回调得到token和verified结果
// console.log(result.token, result.verified);
// }).onError(function(error) {
// // 验证出现任何失败时,通过onError回调透传错误信息
// console.log(error.code, error.message);
// }).onClose(function() {
// // 当验证弹窗关闭后会进行onClose的调用
// console.log('captcha closed');
// });
});
}, 500);
$('#submit').click(function (e) {
//if (!yoToken) {
// e.preventDefault();
// return alert('请先完成验证!');
//}
$('#fastyotest-submit').click(function (e) {
if (!yoToken) {
e.preventDefault();
return alert('请先完成验证!');
}
console.log('yoToken:', yoToken);
$.ajax({
url: 'https://api.spiderapi.cn/fastyotest/login',
Expand Down

0 comments on commit 1c9ab79

Please sign in to comment.