| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>更换管理员</title>
- <link href="/css/admin/style.css?version=<?= $this->context->version ?>" rel="stylesheet" type="text/css">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="format-detection" content="telephone=no, email=no" />
- <link rel="stylesheet" href="/css/bootstrap.css?version=<?= $this->context->version ?>">
- <script src="/js/jquery-1.11.1.min.js?version=<?= $this->context->version ?>"></script>
- <style>
- label{
- font-weight:normal;
- }
- .xhMask{
- position:fixed;
- left:0;top:0;
- width:100%;
- height:100%;
- z-index:99;
- background-color:gray;
- filter:alpha(opacity=50);
- opacity:0.5;
- display:none;
- }
- .xhPop{
- position:fixed;
- width:20%;
- font-size:12px;
- height:auto;
- background:wheat;
- padding:10px;
- z-index:9999;
- display:none;
- width:160px;
- text-align:center;
- }
- .xhBeCenterBox{
- position:fixed;
- width:80%;
- height:auto;
- background:#DBE4EB;
- display:none;
- border-radius:2px;
- z-index:999;
- }
- .xhCenterModal{
- background-color: #8dc63f;
- border-color: #8dc63f;
- color: #ffffff;
- position:fixed;
- width:20%;
- font-size:12px;
- height:auto;
- padding:15px;
- z-index:999;
- display:none;
- width:180px;
- text-align:center;
- border-radius:4px;
- }
- </style>
- </head>
- <body>
- <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>
- <div name="xhCenterModal" class="xhCenterModal"></div>
- <div class="panel panel-default" style="border:none;-webkit-box-shadow:none;">
- <div class="panel-body" style="margin-top:15px;">
- <form role="form">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="field-1">*新管理员:</label>
- <div class="col-sm-10">
- <input type="text" class="form-control" name="userName" value="<?= $admin['adminName'] ?>" disabled placeholder="">
- <p></p>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">*手机号:</label>
- <div class="col-sm-10">
- <input type="tel" class="form-control" name="newBindMobile" placeholder="也是登陆后台的帐号">
- <p></p>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">*验证码:</label>
- <div class="col-sm-10">
- <input type="tel" class="form-control" name="newBindAuthCode" placeholder="" style="width:30%;display:inline">
- <button type="button" name="createAuthCode" getMobileMsgStatus="yes" class="btn btn-info btn-single">
- <span name="getAuthCodeText">获取验证码</span>
- <span style="display:none;font-size:12px;" name="reGetAuthCode"><i style="font-size:12px;font-style:normal;">120</i> 秒后重新获取</span>
- </button>
- <p name="authHint"></p>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">*密码:</label>
- <div class="col-sm-10">
- <input type="password" class="form-control" name="newBindPassword" placeholder="登陆后台的密码,不少于6位数">
- <p></p>
- </div>
- </div>
- <div class="form-group-separator"></div>
- <div class="form-group" style="text-align:center;">
- <button type="button" onclick="newBindSubmit('click',this)" class="btn btn-info btn-single">确认</button>
- </div>
- </form>
- </div>
- </div>
- <script>
- var newBindMobile = $("input[name=newBindMobile]");
- var newBindAuthCode = $("input[name=newBindAuthCode]");
- var newBindPassword = $("input[name=newBindPassword]");
- var newBindCheck = [newBindMobile,newBindPassword,newBindAuthCode];
- newBindSubmit();
- function newBindSubmit()
- {
- setRelateStats(newBindMobile,'请填写手机号',function(val,msg){
- var info = [false,msg];
- val = $.trim(val);
- if(val.length <= 0){
- info[1] = '请填写手机号';
- }else if((/^1[0-9]\d{9}$/.test(val)) == false){
- info[1] = '手机号填写不正确';
- }else{
- $.ajax({type:"GET",url:"/admin/check-mobile?mobile="+val+"&account=<?= $_GET['account'] ?>",dataType:'json',async:false,success:function(data){
- if(data.code == 'A0001'){
- info[0] = true;
- }else{
- info[1] = data.msg;
- }
- }});
- }
- return info;
- });
- setRelateStats(newBindPassword, '请填写密码', function(val, mess){
- var info=[false, mess];
- if(val.length <= 0){
- info[1] = '请填写密码';
- }else if(val.length < 6){
- info[1] = '密码不能少于6位';
- }else{
- info[0] = true;
- }
- return info;
- });
- setRelateStats(newBindAuthCode, '请填写验证码', function(val, mess){
- var info=[false, mess];
- if(val.length <= 0){
- info[1] = '请填写验证码';
- }else if(val.length > 0){
- $.ajax({type:"GET",url:"/admin/check-code?authCode="+val+"&account=<?= $_GET['account'] ?>",dataType:'json',async:false,success:function(data){
- if(data.code == 'A0001'){
- info[0] = true;
- }else{
- info[1] = data.msg;
- }
- }});
- }else{
- info[0] = false;
- }
- return info;
- });
- if(arguments[0] == 'click'){
- var submitButton = arguments[1];//获取提交按钮对象
- var submitButtonObj = $(submitButton);
- if(submitButtonObj.attr('submitStatus') == 'yes'){
- xhPopMsg('请稍候……',1000);
- return;
- }
- submitButtonObj.attr('submitStatus','yes');
- setTimeout(function(){
- submitButtonObj.attr('submitStatus','no');
- },2000);
- var newBindSubmitStatus = true;
- for(var om=0;om<newBindCheck.length;om++){
- var singleObj = newBindCheck[om]
- if(singleObj.attr('newBindInputStatus') == undefined){
- singleObj.blur();
- }
- if(singleObj.attr('newBindInputStatus') == 'no'){
- newBindSubmitStatus = false;
- }
- }
- if(newBindSubmitStatus == false){
- return;
- }
- var data = "_csrf=<?= Yii::$app->request->csrfToken ?>&replaceAdminAuthCode=<?= $replaceAdminAuthCode ?>";
- data += "&mobile="+newBindMobile.val()+"&code="+newBindAuthCode.val()+"&password="+newBindPassword.val();
- $.ajax({type:"POST",url:'/admin/ajax-exec-replace?account=<?= $this->context->merchant['id'] ?>',dataType:'json',data:data,async:false,success:function(data){
- xhPopMsg(data.msg,1600);
- if(data.code == 'A0001'){
- setTimeout(function(){
- window.location.href = '/admin/replace-result?account='+data.data.account;
- },2000);
- }
- }});
- }
- }
- function setRelateStats(obj,mess,check)
- {
- obj.focus(function(){
- $(this).removeAttr('newBindInputStatus');
- $(this).siblings('p').html('');
- });
- obj.blur(function(){
- var objVal = obj.val();
- var info = check(objVal,mess);
- if(info[0]){
- $(this).attr('newBindInputStatus','yes');
- }else{
- $(this).attr('newBindInputStatus','no');
- $(this).siblings('p').css("color","red").html(info[1]);
- }
- });
- }
- var createAuthCode = $("button[name=createAuthCode]");
- var getAuthCodeText = $("span[name=getAuthCodeText]");
- var reGetAuthCode = $("span[name=reGetAuthCode]");
- //获取手机验证码
- createAuthCode.click(function(){
- var mobileVal = newBindMobile.val();
- if(mobileVal.length <= 0){
- $("p[name=authHint]").css("color","red").html('请填写手机号');
- }
- if(newBindMobile.attr('newBindInputStatus') == undefined){//手机未验证
- return;
- }
- if(newBindMobile.attr('newBindInputStatus') == 'no'){//手机验证未通过
- return;
- }
- if(mobileVal.length <= 0){
- $("p[name=authHint]").css("color","red").html('请填写手机号');
- return;
- }
- $("p[name=authHint]").html('');
- if(createAuthCode.attr('getMobileMsgStatus') == 'yes'){
- $.ajax({type:"GET",url:"/admin/generate-code?mobile="+mobileVal+'&account=<?= $_GET['account'] ?>',dataType:'json',async:false,success:function(data){
- if(data.code == 'A0001'){
- createAuthCode.attr('getMobileMsgStatus','no');
- getAuthCodeText.css("display","none");
- reGetAuthCode.css("display","block").parent().css("background-color","#CCCCCC").css("border-color","#CCCCCC");
- var timeI = reGetAuthCode.find('i')
- var orTime = timeI.text();
- var timeNum = parseInt(timeI.text());
- var setInt = setInterval(function(){
- timeNum--;
- timeI.text(timeNum);
- if(timeNum == 0){
- clearInterval(setInt);
- getAuthCodeText.css('display','block').parent().css("background-color","#18a8df").css("border-color","#1590be");
- reGetAuthCode.css('display','none');
- timeI.text(orTime);
- createAuthCode.attr('getMobileMsgStatus','yes');
- }
- },1200);
- }else{
- $("p[name=authHint]").css("color","red").html(data.msg);
- }
- }});
- }
- });
- </script>
- <script src="/js/util.js?version=<?= $this->context->version ?>"></script>
- </body>
- </html>
|