帖子
帖子
用户
博客
课程
显示全部楼层
216
帖子
5
勋章
5909
Y币

gt3geetest模块demo示例

[复制链接]
发表于 2019-6-24 09:32:19
gt3geetest用原生代码实现了在极验的行为验证功能,可以快速接入登陆验证码的逻辑。





点击进入模块详情

  1. <!DOCTYPE html>
  2. <html>

  3. <head>
  4.     <title>Module Develop</title>
  5.     <meta charset="utf-8">
  6.     <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  7.     <style type="text/css">
  8.         html,
  9.         body {
  10.             height: 100%
  11.         }

  12.         body {
  13.             background-color: #fff;
  14.             margin: 0;
  15.         }

  16.         #wrap {
  17.             height: 100%;
  18.             position: relative;
  19.         }

  20.         #header {
  21.             padding-top: 20px;
  22.             background-color: #5082c2;
  23.             height: 44px;
  24.             position: relative;
  25.         }

  26.         #header h1 {
  27.             font-size: 20px;
  28.             height: 44px;
  29.             line-height: 44px;
  30.             margin: 0em;
  31.             color: #fff;
  32.             margin-left: 100px;
  33.             margin-right: 100px;
  34.             text-align: center;
  35.         }

  36.         #main {
  37.             display: -webkit-box;
  38.             -webkit-box-orient: vertical;
  39.             -webkit-box-pack: center;
  40.         }

  41.         a.button {
  42.             display: -webkit-box;
  43.             -webkit-box-orient: vertical;
  44.             -webkit-box-pack: center;
  45.             -webkit-box-align: center;
  46.             height: 32px;
  47.             margin: 8px;
  48.             background-color: rgba(240, 240, 240, 1.0);
  49.             border-color: rgba(220, 220, 220, 1.0);
  50.             border-width: 2px;
  51.             border-style: solid;
  52.         }

  53.         a.active {
  54.             background-color: rgba(240, 240, 240, 0.7);
  55.         }
  56.     </style>
  57. </head>

  58. <body>
  59.     <div id="wrap">
  60.         <div id="main">
  61.             <a class="button" tapmode="active" onclick="gt3TestOpen()">打开验证码界面</a>
  62.             <a class="button" tapmode="active" onclick="gt3Dismiss()">关闭验证码界面</a>
  63.         </div>
  64.     </div>
  65. </body>
  66. <script type="text/javascript">
  67.     var demo = null;
  68.     apiready = function() {
  69.         demo = api.require('gt3geetest');
  70.         if (!demo) {
  71.             alert("请添加模块后编译");
  72.             return;
  73.         }
  74.     }

  75.     function gt3TestOpen() {
  76.         demo.gt3TestOpen({
  77.             api1Url: "http://www**.**/demo/gt/register-slide",
  78.             api2Url: "http://www**.**/demo/gt/validate-slide", //设置二次验证的URL
  79.             isCustomApi2: true //设置是否自定义第二次验证(true 开启 false 不开启)
  80.         }, function(ret, err) {
  81.             //ret.evenType  == gt3CloseDialog  data ->  1 点击验证码的关闭按钮来关闭验证码 3 点击返回键关闭验证码
  82.             //ret.evenType  == gt3GetDialogResult 拿到第二个url(API2)需要的数据(isCustomApi2为true时需要)
  83.             //ret.evenType  == gt3DialogSuccessResult 验证完成的回调(isCustomApi2为false时才会有值)
  84.             //ret.evenType  == gt3DialogOnError 验证过程错误
  85.             alert(JSON.stringify(ret) + "  " + JSON.stringify(err));
  86.             //api.toast({ msg : JSON.stringify(ret) });
  87.         });
  88.     }

  89.     function gt3Dismiss() {
  90.         demo.gt3Dismiss();
  91.     }
  92. </script>

  93. </html>
复制代码



50
帖子
2
勋章
1327
Y币
膜拜大佬
42
帖子
4
勋章
1万+
Y币
感谢分享
您需要登录后才可以回帖 登录

本版积分规则