shenfenyz.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>更换手机号-验证原号码</title>
  6. <meta name="format-detection" content="telephone=no"/>
  7. <meta name="viewport"
  8. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
  9. <meta name="apple-mobile-web-app-capable" content="yes"/>
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
  11. <link rel="stylesheet" href="../../../css/cross.css" type="text/css"/>
  12. <link rel="stylesheet" href="../../../css/cross.ui.css" type="text/css"/>
  13. <link rel="stylesheet" type="text/css" href="../../../css/ss-style.css">
  14. <link rel="stylesheet" type="text/css" href="../../../iconfont/iconfont.css" />
  15. <style>
  16. .n-list-info{position: relative;}
  17. .searchbar-clear{position: absolute;width: 28px;height: 28px;right: 0;top:8px;opacity:0;pointer-events:none;background-position:center;background-repeat:no-repeat;background-image:url(../../../images/delete01_pre.png);-webkit-background-size:20px 20px;background-size:20px 20px;-webkit-transition-duration:300ms;transition-duration:300ms;cursor:pointer;}
  18. #div-yzm{width:80px;height:29px;border:1px solid #4DCD70;color:#4DCD70;font-size:14px;line-height:29px;text-align:center;border-radius:10px;margin-top:7px;}
  19. .c-btn-dcdcdc{background: #DCDCDC;}
  20. .c-btn.active{background: #4DCD70;}
  21. </style>
  22. </head>
  23. <body>
  24. <div class="main">
  25. <ul class="n-list edit-info registered c-border-tb mt15 c-f15 form-register">
  26. <li>
  27. <div class="n-list-key" style="width: 2.3em;">
  28. <i class="iconfont icon-shouji1"></i>
  29. </div>
  30. <div class="n-list-info">
  31. <input id="txtMobile" type="tel" readonly="readonly" class="width-100 c-f16 c-5b5b5b" maxlength="11" placeholder="请输入手机号码" onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>
  32. <!--<a href="#" class="searchbar-clear"></a>-->
  33. </div>
  34. </li>
  35. <li>
  36. <div class="n-list-key" style="width: 2.3em;">
  37. <i class="iconfont icon-yanzhengma01"></i>
  38. </div>
  39. <div class="n-list-info">
  40. <input id="txtCode" type="text" class="width-100 c-f16 c-5b5b5b" placeholder="请输入验证码"/>
  41. <a href="#" class="searchbar-clear"></a>
  42. </div>
  43. <div id="messageCode1" class="n-list-key pl15 c-17b3ec" onclick="sendCode()">
  44. <span>获取短信验证码</span>
  45. </div>
  46. <div id="messageCode2" class="n-list-key pl15 c-999999" style="display: none;">
  47. <span id="message"></span>
  48. </div>
  49. </li>
  50. </ul>
  51. <div class="mb15 mlr15 mt20">
  52. <a href="javascript:;" style="font-size: 18px;" class="c-btn c-btn-dcdcdc c-btn-full c-btn-radius c-f16">下一步</a>
  53. </div>
  54. </div>
  55. </body>
  56. <script type="text/javascript" src="../../../js/jquery/2.1.3/jquery.js" ></script>
  57. <script type="text/javascript" src="../../../js/common_http.js" ></script>
  58. <script type="text/javascript" src="../../../js/weixin_common.js" ></script>
  59. <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css">
  60. <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.js"></script>
  61. <script type="text/javascript" src="../../../js/commit_validate.js" ></script>
  62. <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
  63. <script type="text/javascript">
  64. var dd = dialog({contentType:'load', skin:'bk-popup', content:'验证中...'});
  65. var Request = new Object();
  66. Request = GetRequest();
  67. var openid = Request["openid"];
  68. var type = Number(Request["type"]);
  69. var mobile1 = Request["mobile"];
  70. var clock = "";
  71. var nums = 60;
  72. var loginParams = Request["loginParams"];
  73. isValueChange();//判断当前是否有输入值,有输入则登录按钮变亮
  74. bindEvents();
  75. if(loginParams) {
  76. loginParams = JSON.parse(decodeURIComponent( Request["loginParams"]));
  77. }
  78. $(function (){
  79. if(mobile1){
  80. $("#txtMobile").val(mobile1);
  81. }
  82. var userAgent = window.localStorage.getItem(agentName);
  83. if(userAgent){
  84. var paurl = "";
  85. if(type == 0){
  86. paurl = "wx/html/home/html/login.html?type=0&openid=" + openid;
  87. }
  88. else{
  89. if(mobile1){
  90. paurl = "wx/html/home/html/login.html?type=" + type + "&openid=" + openid + "&mobile=" + mobile1;
  91. }
  92. else{
  93. paurl = "wx/html/home/html/login.html?type=" + type + "&openid=" + openid;
  94. }
  95. }
  96. //从后台那边获取签名等信息
  97. var params = {};
  98. params.pageUrl = window.location.href;
  99. $.ajax(server + "weixin/getSign", {
  100. data: params,
  101. dataType: "json",
  102. type: "post",
  103. success: function(res){
  104. if (res.status == 200) {
  105. var t = res.data.timestamp;
  106. var noncestr = res.data.noncestr;
  107. var signature = res.data.signature;
  108. wx.config({
  109. //debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  110. appId: appId, // 必填,公众号的唯一标识
  111. timestamp: t, // 必填,生成签名的时间戳
  112. nonceStr: noncestr, // 必填,生成签名的随机串
  113. signature: signature,// 必填,签名,见附录1
  114. jsApiList: [
  115. 'closeWindow'
  116. ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
  117. });
  118. }
  119. }
  120. });
  121. /*wx.ready(function(){
  122. wx.closeWindow();
  123. }); */
  124. }
  125. else{
  126. if(!openid){
  127. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'openid获取失败'}).show();
  128. }
  129. }
  130. })
  131. function bindEvents(){
  132. $(".c-btn").on("click",function(){
  133. if($(this).hasClass("active")){
  134. commit();
  135. }
  136. })
  137. $("input").on("focus",function(){
  138. $(".searchbar-clear").css("pointer-events","none").css("opacity",0);
  139. if($(this).val()){
  140. $(this).next().css("pointer-events","auto").css("opacity",1);
  141. }
  142. }).on("input",function(){
  143. $(this).next().css("pointer-events","auto").css("opacity",1);
  144. });
  145. $(".n-list-info").on("click",".searchbar-clear",function(){
  146. $(this).prev().val("");
  147. $(this).css("pointer-events","none").css("opacity",0);
  148. $(this).prev().focus();
  149. return false;
  150. });
  151. }
  152. function isValueChange(){
  153. var self = this;
  154. var int= setInterval(function() {
  155. if($("#txtMobile").val()&&$("#txtCode").val()){
  156. clearInterval(int);
  157. int = null;
  158. $(".c-btn").addClass("active");
  159. }
  160. },300);
  161. }
  162. function sendCode(){
  163. var mobile = document.getElementById("txtMobile").value;
  164. if(!mobile){
  165. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请输入手机号'}).show();
  166. return;
  167. }
  168. if(!isphone(mobile)){
  169. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'手机号格式不正确'}).show();
  170. return;
  171. }
  172. $("#messageCode1").hide();
  173. document.getElementById("message").innerHTML = nums+'秒后可重新获取';
  174. $("#messageCode2").show();
  175. clock = setInterval(doLoop, 1000); //一秒执行一次
  176. var data = {};
  177. data.mobile = mobile;
  178. data.type = 7;
  179. sendPost("common/captcha", data, "json", "post", sendFailed, sendSuccesss);
  180. }
  181. //失败
  182. function sendFailed(res) {
  183. clearInterval(clock); //清除js定时器
  184. $("#messageCode1").show();
  185. $("#messageCode2").hide();
  186.    nums = 60; //重置时间
  187. if (res && res.msg) {
  188. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  189. } else {
  190. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'获取失败'}).show();
  191. }
  192. }
  193. function sendSuccesss(res){
  194. if (res.status == 200) {
  195. }
  196. else{
  197. sendFailed(res);
  198. }
  199. }
  200. function doLoop(){
  201. nums--;
  202. if(nums > 0){
  203. document.getElementById("message").innerHTML = nums+'秒后可重新获取';
  204. }else{
  205.    clearInterval(clock); //清除js定时器
  206. $("#messageCode1").show();
  207. $("#messageCode2").hide();
  208.    nums = 60; //重置时间
  209. }
  210. }
  211. var mobile;
  212. function commit(){
  213. mobile = document.getElementById("txtMobile").value;
  214. var captcha = document.getElementById("txtCode").value;
  215. if (!mobile || !captcha) {
  216. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'手机号和验证码不能为空'}).show();
  217. return;
  218. }
  219. if(!isphone(mobile)){
  220. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'手机号格式不正确'}).show();
  221. return;
  222. }
  223. dd.showModal();
  224. //拼请求内容
  225. var data = {};
  226. data.mobile = mobile;
  227. data.captcha = captcha;
  228. data.type = 7;
  229. sendPost("common/check_captcha", data, "json", "post", operateFailed, operateSuccesss);
  230. }
  231. //失败
  232. function operateFailed(res) {
  233. dd.close();
  234. if (res && res.msg) {
  235. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  236. } else {
  237. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'验证码验证失败'}).show();
  238. }
  239. }
  240. //成功调用登录接口
  241. function operateSuccesss(res) {
  242. if (res.status == 200) {
  243. window.location.href = "bangdingsj.html?type=" + type + "&openid=" + openid+ "&mobile="+ mobile;
  244. dd.close();
  245. } else {
  246. //非200则为失败
  247. operateFailed(res);
  248. }
  249. }
  250. </script>
  251. </html>