123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>更改手机号</title>
- <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
- <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
- <link rel="stylesheet" type="text/css" href="css/main.css" />
- <style>
- .mui-input-row label {
- width: 30%;
- }
-
- .mui-input-row label {
- padding: 5px 15px 7px 15px;
- position: relative;
- }
-
- .sex-group .mui-radio.mui-left label {
- padding: 13px 15px 11px 35px;
- }
-
- .mui-radio {
- display: inline-block;
- }
-
- .mui-input-group .mui-input-row {
- height: 46px;
- padding: 3px 0;
- }
-
- .mui-input-row label~input {
- width: 65%;
- font-size: 14px;
- }
-
- .mui-input-row label~input::-webkit-input-placeholder {
- color: #bbb;
- }
-
- .mui-radio.mui-left input[type=radio] {
- left: 0;
- top: 10px;
- }
-
- .sex-group {
- position: absolute;
- left: 35%;
- top: 0;
- width: 65%;
- }
-
- .mui-input-group:before,
- .mui-input-group:after {
- display: none;
- }
-
- .my-lable {
- position: absolute;
- left: 45px;
- top: 12px;
- white-space: nowrap;
- }
-
- .my-lable i {
- color: #ee5c5c;
- font-size: 15px;
- }
-
- .mui-input-row .iconfont {
- color: #727171;
- }
-
- .sex-group .mui-radio input[type=radio]::before {
- font-family: "iconfont" !important;
- font-size: 25px !important;
- font-style: normal;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- padding: 0 !important;
- color: #eee;
- }
-
- .sex-group .mui-radio input[type=radio].boy::before {
- content: '\e721';
- }
-
- .sex-group .mui-radio input[type=radio].girl::before {
- content: '\e72e';
- }
-
- .mui-radio input[type=radio].boy:checked:before,
- .mui-radio input[type=radio].girl:checked:before {
- color: #727171;
- }
-
- .pull-code {
- background: #727171;
- border-radius: 25px;
- border: 0;
- color: #fff;
- margin-top: 6px;
- font-size: 12px;
- padding: 5px 2px;
- float: right;
- width: 90px;
- white-space: nowrap;
- }
-
- .pull-code:disabled {
- background: #E5E5E5;
- color: #999;
- }
-
- .my-join-vip {
- display: block;
- width: 180px;
- margin: 60px auto 50px auto;
- padding: 10px 16px;
- border-radius: 25px;
- background: #727171;
- color: #fff;
- border: 0;
- font-size: 16px;
- }
-
- .my-join-vip:disabled {
- background: #e5e5e5;
- color: #999;
- }
-
- .mui-icon-arrowdown {
- position: absolute;
- right: 10px;
- top: 10px;
- color: #999;
- pointer-events: none;
- }
- .mui-input-group .mui-input-row:after{
- background-color: #e5e5e5;
- }
- </style>
- <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
- <script>
- //屏蔽分享
- document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
- WeixinJSBridge.call('hideOptionMenu');
- });
- </script>
- </head>
- <body style="background: #fff;">
- <div class="loading-bg">
- <div class="mui-loading">
- <div class="mui-spinner">
- </div>
- 加载中...
- </div>
- </div>
- <div class="mui-content" style="background: #fff;">
- <div style="margin:25px 20px;">
- <div style="margin:12px 16px;">
- <h4>修改手机号</h4>
- <p style="margin: 5px 0 20px 0;">请完善手机号信息</p>
- </div>
- <form class="mui-input-group">
- <div class="mui-input-row">
- <label><span class="iconfont icon-A-shoujihao"></span><span class="my-lable"><i>*</i>手机号</span></label>
- <input type="tel" placeholder="请输入您的手机号" id="ipt-phone" maxlength="11">
- </div>
- <div class="mui-input-row">
- <label><span class="iconfont icon-A-yanzhengma"></span><span class="my-lable"><i>*</i>验证码</span></label>
- <input style="width: 28% !important;float: none;padding-right: 0;margin-left: 5%;" type="tel" placeholder="短信验证码" maxlength="4" id="code"><button type="button" class="pull-code" disabled="disabled">获取验证码</button>
- </div>
- </form>
- <button type="button" class="mui-btn my-join-vip" disabled="disabled">修改</button>
- </div>
- </div>
- <script type="text/javascript" src="js/mui.min.js"></script>
- <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
- <script type="text/javascript" src="js/main.js"></script>
- <script type="text/javascript">
- var countdown = 60;
- mui.ready(function() {
- console.log("页面加载完毕")
- document.querySelector('.loading-bg').style.display = 'none';
- });
- //实时监听文本框字数
- document.getElementById("ipt-phone").addEventListener("input", function() {
- var phone = this.value;
- var mobile = /^(13|14|15|16|17|18|19)[0-9]{9}$/; //手机号码
- if(phone.length == 11) {
- if(mobile.test(phone) && countdown == 60) {
- $(".pull-code").removeAttr("disabled");
- } else {
- $(".pull-code").attr("disabled", "disabled");
- }
- } else {
- $(".pull-code").attr("disabled", "disabled");
- }
- });
- // 成为会员
- $(document).on('tap', '.my-join-vip', function() {
- validate();
- if(validate_flag) {
- var num = /^[0-9]{4,4}$/; //数字(4位)
- var code = $('#code').val();
- if(num.test(code)) {
- console.log('验证通过')
- var phone = $('#ipt-phone').val();
- var code = $('#code').val();
- $.ajax(base_path + '/wechat/agent/updateMemberPhone?dates=' + new Date().getTime(), {
- data: {
- userTel : phone,
- code : code
- },
- dataType: 'json',
- xhrFields: {
- withCredentials: true
- },
- crossDomain: true,
- type: 'get',
- timeout: 15000,
- success: function(dt) {
- if(dt.isRedirect) {
- location.href = dt.redirectURL;
- } else {
- if(dt.status){
- mui.alert(' ', '更改成功!', function() {
- location.href='my-center.html';
- });
- }else{
- mui.toast(dt.message);
- }
- }
- },
- error: function(xhr, type, errorThrown) {
- console.log(xhr);
- }
- });
- } else {
- if(code != '') {
- show_msg = '验证码格式不正确';
- } else {
- show_msg = '请输入短信验证码';
- }
- mui.alert(show_msg);
- }
- } else {
- mui.alert(show_msg);
- }
- });
- //发送验证码
- var validate_flag = false,
- show_msg = '';
- $(document).on('tap', '.pull-code', function() {
- validate();
- if(validate_flag) {
- settime($(this));
- $(".my-join-vip").removeAttr("disabled");
-
- var phone = $('#ipt-phone').val();
- $.ajax(base_path + '/wechat/agent/send_phone?dates=' + new Date().getTime(), {
- data: {
- phone: phone
- },
- dataType: 'json',
- xhrFields: {
- withCredentials: true
- },
- crossDomain: true,
- type: 'get',
- timeout: 15000,
- success: function(dt) {
- if(dt.isRedirect) {
- location.href = dt.redirectURL;
- } else {
- if(dt.status) {
- console.log("获取短信成功!");
- $(".my-join-vip").removeAttr("disabled");
- }
- }
- },
- error: function(xhr, type, errorThrown) {
- console.log(xhr);
- }
- });
-
- } else {
- mui.alert(show_msg);
- }
- });
- function settime(obj) {
- if(countdown == 0) {
- obj.removeAttr("disabled");
- obj.text("获取验证码");
- countdown = 60;
- return;
- } else {
- obj.attr("disabled", true);
- obj.text("重新发送" + countdown + "");
- countdown--;
- }
- setTimeout(function() {
- settime(obj)
- }, 1000)
- }
- function validate() {
- var mobile = /^(13|14|15|17|18)[0-9]{9}$/; //手机号码
- var phone = $("#ipt-phone").val();
- if(mobile.test(phone)) {
- validate_flag = true;
- } else {
- validate_flag = false;
- if(phone != '') {
- show_msg = '手机号码格式不正确';
- } else {
- show_msg = '请输入您的手机号';
- }
- return false;
- }
- }
- </script>
- </body>
- </html>
|