验证码公用组件
require(["component/verify_code"]);
$we.process.setData("phone", ""); var vm = $we.widget.add("comp.verify_code", "container", { getCodeUrl: "http://dev.weipic.com/common/js/test/business/api.php", verifyUrl: "http://dev.weipic.com/common/js/test/business/api.php", codeType: "digital", jsonp: true }); vm.render();
$we.process.setData("phone", "13601926693"); var vm = $we.widget.add("comp.verify_code", "container", { getCodeUrl: "http://dev.weipic.com/common/js/test/business/api.php", verifyUrl: "http://dev.weipic.com/common/js/test/business/api.php", verifier: "13601926693" // 通过该参数也可以设置手机号码, process.setData优先 }); vm.render();
$we.process.setData("email", ""); var vm = $we.widget.add("comp.verify_code", "container", { getCodeUrl: "http://dev.weipic.com/common/js/test/business/api.php", verifyUrl: "http://dev.weipic.com/common/js/test/business/api.php", verifyName: "email", label1: "邮箱", label1_empty: "请输入邮箱", label2: "邮箱验证码", label3: "输入邮箱验证码", cooldown: 120, cookieName: "_we_comp_ve" }); vm.render();
$we.process.setData("email", "zhang.gd@foxmail.com"); var vm = $we.widget.add("comp.verify_code", "container", { getCodeUrl: "http://dev.weipic.com/common/js/test/business/api.php", verifyUrl: "http://dev.weipic.com/common/js/test/business/api.php", verifyName: "email", label1: "邮箱", label1_empty: "请输入邮箱", label2: "邮箱验证码", label3: "输入邮箱验证码", cooldown: 120, cookieName: "_we_comp_ve" }); vm.render();
// interface // vm.verifyCode vm.verifyCode(function() { // 如果成功才会进行到这一步 alert("success!"); });
// interface // vm.getData var data = vm.getData(); for (var i in data) { alert("name: "+i+", value:"+data[i]); }