|
1、已在云之讯注册帐号,模板帐号都已经审核通过
2、已在控制台添加了模块
3、在云编译保持如下:
程度代码如下所示:
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=0, width=device-width"/>
- <title>app</title>
- <link rel="stylesheet" type="text/css" href="../css/api.css" />
- <link rel="stylesheet" type="text/css" href="../css/common.css" />
- <link rel="stylesheet" type="text/css" href="../css/aui.css" />
- <style>
-
- </style>
- </head>
- <body>
- <div class="aui-content">
- <p class="aui-padded-10"> 注册信息</p>
- <form class="aui-input-group">
- <div class="aui-input-row">
- <label> 手机号</label>
- <input type="text" name="mobelphone" id="mobelphone" placeholder="请输入手机号">
- </div>
- <div class="aui-input-row">
- <label> 密码</label>
- <input type="password" name="password" id="password" placeholder="请输入密码">
- </div>
- <div class="aui-input-row">
- <label> 验证码</label>
- <input type="text" name="code" id="code" placeholder="请输入验证码" style="width: 30%;">
- <button class="aui-btn-warning" style="margin-top:6px;" onclick="getCode();">获取验证码</button>
-
- </div>
- <div class="aui-button-row">
- <button class="aui-btn aui-btn-block aui-btn-primary" onclick="return false;">注册</button>
- <button class="aui-btn aui-btn-block aui-btn-warning" onclick="return false;">登录</button>
- </div>
- </form>
- </div>
- </body>
- <script type="text/javascript" src="../script/api.js"></script>
- <script type="text/javascript" src="../script/common.js"></script>
- <script type="text/javascript">
- apiready = function () {
-
- }
-
- var sid="a5752083e57684347818f9b40b364f85"; //Account Sid,用户申请
- var token="49454e69c2d4011f460bd592b0139eb7"; //同上
- var appid="e5d91e73b31948128de51cc86e4c441f"; //注册获得的应用程序ID
-
- function getCode() {
- // 获得签名
- var uzyzxVerification = api.require("yzxVerification");
-
- // uzyzxVerification.getSign({
- // url: 'https://mid**.**/vfs/demo/reg.do', // 自己可以实现
- // phonenum: '15652301163'
- // },function(ret,err){
- // if(ret.status){
- // api.alert({msg:'获得签名成功 sign='+ret.sign});
- // }else{
- // api.alert({msg:'获取签名失败 返回值:'+err.result});
- // }
- // });
- // 发送验证码
- uzyzxVerification.getVerificationCode({
- phonenum: '15652301163',
- sid: sid,
- appid: appid,
- appname: "yzxverification"
- },function(ret,err){
- if(ret.status){
- switch (ret.type){
- case 0:
- api.alert({msg:'验证成功'});
- break;
- case 1:
- api.alert({msg:'等待短信下发验证码'});
- break;
- case 2:
- api.alert({msg:'等待语音下发验证码'});
- break;
- }
- }else{
- api.alert({msg:'获取验证码失败 错误码:'+err.code});
- }
- });
-
- // 验证验证码
- // uzyzxVerification.doVerificationCode({
- // phonenum: "18612345678",
- // verifycode: "12345",
- // sid: "4c1990a5c1ad2674bc94bc39a6fd0699",
- // appid: "efb7e1de9da649fa83881afea2841cd7"
- // },function(ret,err){
- // if(ret.status){
- // api.alert({msg:'验证成功'});
- // }else{
- // api.alert({msg:'验证失败 错误码:'+err.code});
- // }
- // });
- }
-
- </script>
- </html>
复制代码
|
|