码迷,mamicode.com
首页 > 移动开发 > 详细

Appcan使用Mob短信验证码

时间:2017-09-28 15:58:13      阅读:499      评论:0      收藏:0      [点我收藏+]

标签:dev   短信   one   手机   device   ready   cli   comm   country   

<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-color.css">
        <link rel="stylesheet" href="css/appcan.icon.css">
        <link rel="stylesheet" href="css/appcan.control.css">
    </head>
    <body class="um-vp bc-bg" ontouchstart>
        <div class="btn ub ub-ac bc-text-head ub-pc bc-btn"  id="btn1">
            初始化已完成
        </div>
        <br />
        <div class="sc-bg-active uinput ub ub-f1  bc-border uba">
            <input type="text" class="ub-f1" placeholder="输入手机号"id="phone">
        </div>
        <div class="btn ub ub-ac bc-text-head ub-pc bc-btn"  id="btn2">
            发送验证码
        </div>
        <br />
        <div class="sc-bg-active uinput ub ub-f1  bc-border uba">
            <input type="text" class="ub-f1" placeholder="填写验证码"id="yanzheng">
        </div>

        <div class="btn ub ub-ac bc-text-head ub-pc bc-btn"  id="btn3">
            提交验证码
        </div>

    </body>
    <script src="js/appcan.js"></script>
    <script src="js/main.js"></script>
    <script src="js/appcan.control.js"></script>
    </body>
    <script>
        appcan.ready(function() {
            var params = {
                "uexMobSMS_APPKey" : "2154a551b5a28",
                "uexMobSMS_APPSecret" : "a6d511b5e2cdf78537731e0b1a4ca20b"
            };
            uexMobSMS.init(JSON.stringify(params));
            $toast("初始化成功", 2000)
        });
        var phone = "";
        // appcan.button("#btn1", "ani-act", function() {
        // $toast("初始化成功", 2000)
        // var params = {
        // "uexMobSMS_APPKey" : "2154a551b5a28",
        // "uexMobSMS_APPSecret" : "a6d511b5e2cdf78537731e0b1a4ca20b"
        // };
        // uexMobSMS.init(JSON.stringify(params));
        // })

        appcan.button("#btn2", "ani-act", function() {
            phone = $(#phone).val();
            //alert(phone)
            var params = {
                "phoneNum" : phone,
                "countryCode" : "86"
            };
            uexMobSMS.sendCode(JSON.stringify(params));
            uexMobSMS.cbSendClick = function(data) {
                if (JSON.stringify(data)) {
                    $toast("验证码发送成功,请在120s内验证", 2000)
                } else {
                    $toast("验证码发送失败", 2000)
                }
            }
        })
        appcan.button("#btn3", "ani-act", function() {
            var yanzheng = $(#yanzheng).val();
            //alert(yanzheng + "===" + phone)
            var params = {
                "phoneNum" : phone,
                "countryCode" : "86",
                "validCode" : yanzheng
            };
            uexMobSMS.commitCode(JSON.stringify(params));
            uexMobSMS.cbCommitClick = function(data) {
                if (JSON.stringify(data)) {
                    $toast("验证成功", 2000)
                } else {
                    $toast("验证失败", 2000)
                }
            }
        })


    </script>
</html>

插件收藏。。

Appcan使用Mob短信验证码

标签:dev   短信   one   手机   device   ready   cli   comm   country   

原文地址:http://www.cnblogs.com/1ming/p/7607013.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!