2.0.10 • Published 2 months ago

@ewt/ecaptcha v2.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

ECaptcha

EWT通用验证码工具

Usage

1. Introduce script eCaptcha.min.js to the html

  <script src="./eCaptcha.min.js"></script>
  <script>
    var dom = document.getElementById('test');
    var config = {
      bizCode: 'ewt',
      type: 1,
      env: 'sit'
    };
    var captcha = new ECaptcha(dom, config);
    captcha.success(function(token) {
      console.log(token);
    });
  </script>

2. Install package @ewt/ecaptcha and import it in js

  import ECaptcha from '@ewt/ecaptcha';

  const config = {
    bizCode: 'kkl',
    type: 1,
    env: 'sit'
  };
  const captcha = new ECaptcha('#captcha', config);

  captcha.success((token) => {
    console.log(token);
  });

Config

  interface captchaConf {
    bizCode: string;           // 业务编码;
    type: string;              // 验证码类型:1(点选验证码)、2(滑动验证码)
    env: string;               // 使用场景环境:sit(测试环境)、prod(线上环境),根据该配置生成相对应环境的接口请求地址;
    hasButton?: boolean;       // 是否需要点击验证按钮,可选配;
    onClose?: Function;        // 关闭验证码回调函数,可选配;
    onRefresh?: Function;      // 刷新验证码回调,可选配
    safe?: safeConf;            // 安全策略,为null或者undefined的时候不会经过安全策略
  }

  interface safeConf {
    mobile?: string;            // 手机号
    deviceToken?: string;       // 设备号
    userId?: number;            // userId
  }

License

ISC

2.0.10

2 months ago

3.0.2

2 months ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.4

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.6

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago