Git Product home page Git Product logo

react-geetest's People

Contributors

xlsdg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-geetest's Issues

那个 reset 方法怎么操作?

initGeetest({
    // 省略配置参数
}, function (captchaObj) {
    // 省略其他方法的调用

    // 这里调用了 onSuccess 方法,该方法介绍见下文
    captchaObj.onSuccess(function () {
        var result = captchaObj.getValidate();

        // ajax 伪代码
        ajax('/api/gt-validate', {
            geetest_challenge: result.geetest_challenge,
            geetest_validate: result.geetest_validate,
            geetest_seccode: result.geetest_seccode,

            username: 'xxx',
            password: 'xxx'

            // 其他服务端需要的数据,比如登录时的用户名和密码
        }, function (data) {
            // 根据服务端二次验证的结果进行跳转等操作
            if (data.status === 'fail') {
                alert('用户名或密码错误,请重新输入并完成验证');
                captchaObj.reset(); // 调用该接口进行重置
            }
        });
    });
});

官网地址是这样额

可是我看你的代码里面

  onSuccess: function onSuccess() {},
  onError: function onError() {},
  onClose: function onClose() {},
  ins.appendTo(that.dom);
        ins.onReady(onReady);
        ins.onSuccess(function() {
          return onSuccess(ins.getValidate(), ins);
        });
        ins.onError(onError);
        ins.onClose(onClose);

并没有在onError给我仍和参数

作者你好, 我想请教一下, 为什么onSuccess生成的都是一样的呢? 比较困惑

react-geetest 版本是 4.0.3

import React from 'react';
import { request } from 'umi';
import Geetest from 'react-geetest';

export default () => {
  const gt = '0cb2301a6474506db6cabd271ae3976d';
  const challenge = 'c1caf3daf3feb384161de77ddc9bdf2c';

  const onSuccess = (isSuccess: any) => {
    const { geetest_challenge, geetest_seccode, geetest_validate } = isSuccess;

    console.log(isSuccess, '每次都是相同的');
  };

  return (
    <div>
      <Geetest
        gt={gt}
        challenge={challenge}
        offline
        product={"float"}
        newCaptcha
        nextWidth="90%"
        bgColor="#000"
        onSuccess={onSuccess}
      />
    </div>
  );
}

初始化后报错

初始化传了gt, challenge, onSuccess 进去, 控制台报错了, 说是 ins.onClose is not a function , 是我调用的问题吗 ? 我看你设置了默认值啊

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.