| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <!DOCTYPE html>
- <html xmlns:th="http://www.thymeleaf.org">
- <div th:replace="~{mobile/header :: header}"></div>
- <body>
- <header>
- <a class="back" href="javascript:history.go(-1);"> <i class="iconfont icon-fanhui"></i></a>
- <span >更改手机号</span>
- </header>
- <!-- 内容 -->
- <section class="content has_header">
- <div class="form">
- <div class="form_item">
- <input type="text" readonly id="oldMobile" placeholder="原始号码:">
- </div>
- <div class="form_item">
- <input type="text" id="newMobile" placeholder="新号码:">
- </div>
- <div class="form-btn">
- <button class="btn btn_yellow" onclick="submit()">提交</button>
- <button class="btn btn_yellow" onclick="javascript:history.go(-1);">取消</button>
- </div>
- </div>
-
- </section>
-
- <script>
- $(function(){
- bindInfo();
- });
-
- function bindInfo(){
- $.ajax({
- type: "Get",
- dataType: "json",
- url: pagePath+"/mobile/account/getUserMobile",
- data: {
- },
- success: function (result) {
- if (result.success) {
- var user = result.obj;
- $("#oldMobile").val(user.phone);
- } else {
- sadMessage(result.message);
- }
- },
- error: function () {
- sadMessage("系统错误!");
- }
- });
-
- }
-
-
- function submit(){
- var newMobileObj = $("#newMobile");
- $.ajax({
- type: "POST",
- dataType: "json",
- url: pagePath+"/mobile/account/updateMobile",
- data: {
- "mobile":$("#newMobile").val()
- },
- beforeSend: function () {
- if (!validateMobile(newMobileObj.val())) {
- sadMessage("请输入正确的手机号!");
- newMobileObj.focus();
- return false;
- }
- },
- success: function (result) {
- if (result.success) {
- smileMessage(result.message);
- location.href(history.go(-1));
- } else {
- sadMessage(result.message);
- }
- },
- error: function () {
- sadMessage("系统错误!");
- }
- });
- }
-
- function validateMobile(value){
- var length = value.length;
- var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
- return length == 11 && value.test(mobile);
- }
-
- </script>
-
-
- </body>
- </html>
|