execReplace.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>更换管理员</title>
  6. <link href="/css/admin/style.css?version=<?= $this->context->version ?>" rel="stylesheet" type="text/css">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
  9. <meta name="apple-mobile-web-app-capable" content="yes" />
  10. <meta name="format-detection" content="telephone=no, email=no" />
  11. <link rel="stylesheet" href="/css/bootstrap.css?version=<?= $this->context->version ?>">
  12. <script src="/js/jquery-1.11.1.min.js?version=<?= $this->context->version ?>"></script>
  13. <style>
  14. label{
  15. font-weight:normal;
  16. }
  17. .xhMask{
  18. position:fixed;
  19. left:0;top:0;
  20. width:100%;
  21. height:100%;
  22. z-index:99;
  23. background-color:gray;
  24. filter:alpha(opacity=50);
  25. opacity:0.5;
  26. display:none;
  27. }
  28. .xhPop{
  29. position:fixed;
  30. width:20%;
  31. font-size:12px;
  32. height:auto;
  33. background:wheat;
  34. padding:10px;
  35. z-index:9999;
  36. display:none;
  37. width:160px;
  38. text-align:center;
  39. }
  40. .xhBeCenterBox{
  41. position:fixed;
  42. width:80%;
  43. height:auto;
  44. background:#DBE4EB;
  45. display:none;
  46. border-radius:2px;
  47. z-index:999;
  48. }
  49. .xhCenterModal{
  50. background-color: #8dc63f;
  51. border-color: #8dc63f;
  52. color: #ffffff;
  53. position:fixed;
  54. width:20%;
  55. font-size:12px;
  56. height:auto;
  57. padding:15px;
  58. z-index:999;
  59. display:none;
  60. width:180px;
  61. text-align:center;
  62. border-radius:4px;
  63. }
  64. </style>
  65. </head>
  66. <body>
  67. <div name="xhTempModal" style="background-color: #8dc63f;border-radius:2px;border-color: #8dc63f;color: #ffffff;position:fixed;width:20%;font-size:12px;height:auto;padding:15px;z-index:9999;display:none;width:180px;text-align:center;" ></div>
  68. <div name="xhCenterModal" class="xhCenterModal"></div>
  69. <div class="panel panel-default" style="border:none;-webkit-box-shadow:none;">
  70. <div class="panel-body" style="margin-top:15px;">
  71. <form role="form">
  72. <div class="form-group">
  73. <label class="col-sm-2 control-label" for="field-1">*新管理员:</label>
  74. <div class="col-sm-10">
  75. <input type="text" class="form-control" name="userName" value="<?= $admin['adminName'] ?>" disabled placeholder="">
  76. <p></p>
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label class="col-sm-2 control-label">*手机号:</label>
  81. <div class="col-sm-10">
  82. <input type="tel" class="form-control" name="newBindMobile" placeholder="也是登陆后台的帐号">
  83. <p></p>
  84. </div>
  85. </div>
  86. <div class="form-group">
  87. <label class="col-sm-2 control-label">*验证码:</label>
  88. <div class="col-sm-10">
  89. <input type="tel" class="form-control" name="newBindAuthCode" placeholder="" style="width:30%;display:inline">
  90. <button type="button" name="createAuthCode" getMobileMsgStatus="yes" class="btn btn-info btn-single">
  91. <span name="getAuthCodeText">获取验证码</span>
  92. <span style="display:none;font-size:12px;" name="reGetAuthCode"><i style="font-size:12px;font-style:normal;">120</i> 秒后重新获取</span>
  93. </button>
  94. <p name="authHint"></p>
  95. </div>
  96. </div>
  97. <div class="form-group">
  98. <label class="col-sm-2 control-label">*密码:</label>
  99. <div class="col-sm-10">
  100. <input type="password" class="form-control" name="newBindPassword" placeholder="登陆后台的密码,不少于6位数">
  101. <p></p>
  102. </div>
  103. </div>
  104. <div class="form-group-separator"></div>
  105. <div class="form-group" style="text-align:center;">
  106. <button type="button" onclick="newBindSubmit('click',this)" class="btn btn-info btn-single">确认</button>
  107. </div>
  108. </form>
  109. </div>
  110. </div>
  111. <script>
  112. var newBindMobile = $("input[name=newBindMobile]");
  113. var newBindAuthCode = $("input[name=newBindAuthCode]");
  114. var newBindPassword = $("input[name=newBindPassword]");
  115. var newBindCheck = [newBindMobile,newBindPassword,newBindAuthCode];
  116. newBindSubmit();
  117. function newBindSubmit()
  118. {
  119. setRelateStats(newBindMobile,'请填写手机号',function(val,msg){
  120. var info = [false,msg];
  121. val = $.trim(val);
  122. if(val.length <= 0){
  123. info[1] = '请填写手机号';
  124. }else if((/^1[0-9]\d{9}$/.test(val)) == false){
  125. info[1] = '手机号填写不正确';
  126. }else{
  127. $.ajax({type:"GET",url:"/admin/check-mobile?mobile="+val+"&account=<?= $_GET['account'] ?>",dataType:'json',async:false,success:function(data){
  128. if(data.code == 'A0001'){
  129. info[0] = true;
  130. }else{
  131. info[1] = data.msg;
  132. }
  133. }});
  134. }
  135. return info;
  136. });
  137. setRelateStats(newBindPassword, '请填写密码', function(val, mess){
  138. var info=[false, mess];
  139. if(val.length <= 0){
  140. info[1] = '请填写密码';
  141. }else if(val.length < 6){
  142. info[1] = '密码不能少于6位';
  143. }else{
  144. info[0] = true;
  145. }
  146. return info;
  147. });
  148. setRelateStats(newBindAuthCode, '请填写验证码', function(val, mess){
  149. var info=[false, mess];
  150. if(val.length <= 0){
  151. info[1] = '请填写验证码';
  152. }else if(val.length > 0){
  153. $.ajax({type:"GET",url:"/admin/check-code?authCode="+val+"&account=<?= $_GET['account'] ?>",dataType:'json',async:false,success:function(data){
  154. if(data.code == 'A0001'){
  155. info[0] = true;
  156. }else{
  157. info[1] = data.msg;
  158. }
  159. }});
  160. }else{
  161. info[0] = false;
  162. }
  163. return info;
  164. });
  165. if(arguments[0] == 'click'){
  166. var submitButton = arguments[1];//获取提交按钮对象
  167. var submitButtonObj = $(submitButton);
  168. if(submitButtonObj.attr('submitStatus') == 'yes'){
  169. xhPopMsg('请稍候……',1000);
  170. return;
  171. }
  172. submitButtonObj.attr('submitStatus','yes');
  173. setTimeout(function(){
  174. submitButtonObj.attr('submitStatus','no');
  175. },2000);
  176. var newBindSubmitStatus = true;
  177. for(var om=0;om<newBindCheck.length;om++){
  178. var singleObj = newBindCheck[om]
  179. if(singleObj.attr('newBindInputStatus') == undefined){
  180. singleObj.blur();
  181. }
  182. if(singleObj.attr('newBindInputStatus') == 'no'){
  183. newBindSubmitStatus = false;
  184. }
  185. }
  186. if(newBindSubmitStatus == false){
  187. return;
  188. }
  189. var data = "_csrf=<?= Yii::$app->request->csrfToken ?>&replaceAdminAuthCode=<?= $replaceAdminAuthCode ?>";
  190. data += "&mobile="+newBindMobile.val()+"&code="+newBindAuthCode.val()+"&password="+newBindPassword.val();
  191. $.ajax({type:"POST",url:'/admin/ajax-exec-replace?account=<?= $this->context->merchant['id'] ?>',dataType:'json',data:data,async:false,success:function(data){
  192. xhPopMsg(data.msg,1600);
  193. if(data.code == 'A0001'){
  194. setTimeout(function(){
  195. window.location.href = '/admin/replace-result?account='+data.data.account;
  196. },2000);
  197. }
  198. }});
  199. }
  200. }
  201. function setRelateStats(obj,mess,check)
  202. {
  203. obj.focus(function(){
  204. $(this).removeAttr('newBindInputStatus');
  205. $(this).siblings('p').html('');
  206. });
  207. obj.blur(function(){
  208. var objVal = obj.val();
  209. var info = check(objVal,mess);
  210. if(info[0]){
  211. $(this).attr('newBindInputStatus','yes');
  212. }else{
  213. $(this).attr('newBindInputStatus','no');
  214. $(this).siblings('p').css("color","red").html(info[1]);
  215. }
  216. });
  217. }
  218. var createAuthCode = $("button[name=createAuthCode]");
  219. var getAuthCodeText = $("span[name=getAuthCodeText]");
  220. var reGetAuthCode = $("span[name=reGetAuthCode]");
  221. //获取手机验证码
  222. createAuthCode.click(function(){
  223. var mobileVal = newBindMobile.val();
  224. if(mobileVal.length <= 0){
  225. $("p[name=authHint]").css("color","red").html('请填写手机号');
  226. }
  227. if(newBindMobile.attr('newBindInputStatus') == undefined){//手机未验证
  228. return;
  229. }
  230. if(newBindMobile.attr('newBindInputStatus') == 'no'){//手机验证未通过
  231. return;
  232. }
  233. if(mobileVal.length <= 0){
  234. $("p[name=authHint]").css("color","red").html('请填写手机号');
  235. return;
  236. }
  237. $("p[name=authHint]").html('');
  238. if(createAuthCode.attr('getMobileMsgStatus') == 'yes'){
  239. $.ajax({type:"GET",url:"/admin/generate-code?mobile="+mobileVal+'&account=<?= $_GET['account'] ?>',dataType:'json',async:false,success:function(data){
  240. if(data.code == 'A0001'){
  241. createAuthCode.attr('getMobileMsgStatus','no');
  242. getAuthCodeText.css("display","none");
  243. reGetAuthCode.css("display","block").parent().css("background-color","#CCCCCC").css("border-color","#CCCCCC");
  244. var timeI = reGetAuthCode.find('i')
  245. var orTime = timeI.text();
  246. var timeNum = parseInt(timeI.text());
  247. var setInt = setInterval(function(){
  248. timeNum--;
  249. timeI.text(timeNum);
  250. if(timeNum == 0){
  251. clearInterval(setInt);
  252. getAuthCodeText.css('display','block').parent().css("background-color","#18a8df").css("border-color","#1590be");
  253. reGetAuthCode.css('display','none');
  254. timeI.text(orTime);
  255. createAuthCode.attr('getMobileMsgStatus','yes');
  256. }
  257. },1200);
  258. }else{
  259. $("p[name=authHint]").css("color","red").html(data.msg);
  260. }
  261. }});
  262. }
  263. });
  264. </script>
  265. <script src="/js/util.js?version=<?= $this->context->version ?>"></script>
  266. </body>
  267. </html>