{imp:"uio/_laymob"}<!--模板继承-->

{block:minit}{:parent}{code:"_config/user_apply"}{/block:minit}

{block:pimp}
<script src='{=PATH_VENDUI}/layer/layer.js'></script>
<style type="text/css">

</style>
{/block:pimp}

{block:main}

{if $user->userFlag=='Login' }
    <p class="text-danger bg-warning pa10">
      [{=$user->usess['uname']}] {lang(user.lon_logined)} <br>
      {lang(user.lon_change)}【<a href="?uio-logout">{lang(user.lon_logout)}</a>】; <br>
      {lang(user.lon_touto)}：{php echo date('Y-m-d H:i:s',$user->usess['stime']+$user->utmOut); } 
    </p>
{elseif !empty($bsend) }
    <p class="text-danger bg-warning pa10">
      {=$show} <br>
      {=$msg} 
    </p>
    <p class="text-danger bg-warning pa10 mt10">
      {if $ucfg['regnow']=='mail-act'}
        {if !empty($msg_em) && strpos($msg_em,'SentOK')} 
          {lang(user.uap_loginemail)}: {=$fm['memail']} {lang(user.uap_activeuser)}<br> 
        {else} 
          {=$msg_em}
        {/if}
      {/if}
    </p>
{else}
    <div class="text-danger bg-warning pa10">
      {lang(user.uap_hasuid)}<a href="{surl(login)}">{lang(user.uap_login)}</a>！
    </div>
{/if}

{if !empty($fappok) }
    <div class="apform">
      <p> <i>{lang(uname)}: </i>
          <input value="{=$re3['uname']}" class="form-control" />
      </p>
      <p> <i>{lang(upass)}: </i>
          <input value="{=$fm['upass']}" class="form-control" />
      </p>
      <p> <i>{lang(user.uap_check)}: </i>
          <input value="{=$show}" class="form-control" />
      </p>
      <p> <i>UID: </i>
          <input value="{=$re3['uid']}" class="form-control" />
      </p>
    </div>
{/if}

{if empty($bsend) }

  <p class="bg-info tc pa10">{lang(user.lon_reg)}</p>

  <div class="user-login">
    <form action="?reg" usercheck='uapply' method="post" name="fmapply" id="fmapply">
    <ul class="row">
      <li class="col-xs-4 col-md-4"><label for="ex1">{lang(user.uap_type)}</label></li>
      <li class="col-xs-8 col-md-8">
        <select name="mod" class="form-control">
          {loop $_groups $k $v}{if $v['pid']=='users'}
          {php $cfgm = read($k); $cfgs = basElm::text2arr(@$cfgm['cfgs']); }
          {if !empty($cfgs['defgrade']) }
          <option value="{=$k}" {if $k=='company'}selected{/if}>{=$v[title]}</option>
          {/if}{/if}{/loop}
        </select>
      </li>
    </ul>
    <ul class="row">
      <li class="col-xs-4 col-md-4"><label for="ex1">{lang(uname)}</label></li>
      <li class="col-xs-8 col-md-8"><input type="text" class="form-control" id="fm[uname]" name="fm[uname]" reg="key:2-15" url='{=PATH_BASE}?ajax-cajax&act=userExists'></li>
    </ul>
    <ul class="row">
      <li class="col-xs-4 col-md-4"><label for="ex2">{lang(upass)}</label></li>
      <li class="col-xs-8 col-md-8"><input type="password" class="form-control" id="fm[upass]" name="fm[upass]" reg="str:6-24" autocomplete="off"></li>
    </ul>
    <ul class="row">
      <li class="col-xs-4 col-md-4"><label for="ex2">{lang(user.uap_pw2)}</label></li>
      <li class="col-xs-8 col-md-8"><input type="password" class="form-control" id="fm[upass2]" name="fm[upass2]" reg="str:6-24" autocomplete="off"></li>
    </ul>
    {if in_array($ucfg['regnow'],array('idpwd','mail-act')) }
    {if $ucfg['regnow']=='mail-act' }
    <style type="text/css">
    input::input-placeholder{text-align: right;}
    input::-ms-input-placeholder{text-align: right;}
    input::-webkit-input-placeholder{text-align: right;}
    </style>
    <?php 
    $emajax="url='".PATH_BASE."?ajax-cajax&act=userExists&key=memail'"; 
    $phem = "placeholder='".lang('user.uap_forgamail')."'";
    ?>
    {/if}
    <ul class="row">
      <li class="col-xs-4 col-md-4"><label for="ex2">{lang(user.uap_mail)}</label></li>
      <li class="col-xs-8 col-md-8"><input type="text" class="form-control" id="fm[memail]" name="fm[memail]" {=$emajax} reg='nul:fix:email'></li>
    </ul>
    <ul class="row">
      <li class="col-xs-4 col-md-4"><label for="ex3">{lang(vcode)}</label></li>
      <li class="col-xs-8 col-md-8"><script>fsInit('fmapply');</script></li>
    </ul>
    <ul class="row">
      <li class="col-xs-12 col-md-12">
        <button type="submit" class="btn btn-primary wp100">{lang(submit)}</button>
        <input name="act" type="hidden" value="doapply" />
        <input name="recbk" type="hidden" value="{=$recbk}" />
      </li>
    </ul>
    {elseif $ucfg['regnow']=='sms-vcode' }
    <ul class="row">
      <li class="col-xs-4 col-md-4"><label for="ex2">{lang(user.uap_mobnum)}</label></li>
      <li class="col-xs-8 col-md-8">
        <input type="text" class="form-control" id='fm_mtel' name="fm[mtel]" reg='fix:tel' onblur="chkMtel()" url='{=PATH_BASE}?ajax-cajax&act=userExists&key=mtel'>
        <i id='send2nd' class="vcm1" onclick="reSend()">{lang(user.uap_forgsmscode)}</i>
      </li>
    </ul>
    <ul class="row" id='rowvc1' style="display:none;">
      <li class="col-xs-4 col-md-4"><label for="ex2">{lang(vcode)}</label></li>
      <li class="col-xs-8 col-md-8"> <!--{lang(user.uap_getvcode)}--> 
        <i id='sendsms' class="btn btn-info w80 vcm1" onclick="sendSms()">{lang(user.uap_sendsms)}</i>
        <script>fsInit('vsms4','1,-95','form-control w70');</script>
        <i class="vcm2">{lang(user.uap_cshowvcode)}</i>
      </li>
    </ul>
    <ul class="row" id='rowvc2' style="display:none;">
      <li class="col-xs-4 col-md-4"><label for="ex2" class="vct1">{lang(user.uap_smsvcode)}</label></li>
      <li class="col-xs-8 col-md-8">
        <input id='fm_smscode' name='fm[smscode]' type='text' value='' class='form-control' maxlength='6'  reg='str:6-6' placeholder="{lang(user.uap_smsvcode)}"  />
      </li>
    </ul>
    <ul class="row">
      <li class="col-xs-4 col-md-4"></li>
      <li class="col-xs-8 col-md-8">
        <input name="bsend" value="{lang(submit)}" tabindex="19830" type="submit" class="form-control btn btn-primary" />
        <input name="act" type="hidden" value="doapply" />
        <input name="recbk" type="hidden" value="{=$recbk}" />
      </li>
    </ul>
    {/if}
    <input name="ismobflag" type="hidden" value="1" />
    </form>
  </div>

{/if} 

<script>
var evf_isExtends = true;
function evf_uapply(msgarr,isSubmit){ 
    if(msgarr.length>0){
        evf_errAlert(msgarr,isSubmit);
        return false;
    }
    var pw1 = $(jsElm.jeID('fm[upass]'));
    var pw2 = $(jsElm.jeID('fm[upass2]'));
    if( pw1.val() && $(pw1).val() == $(pw2).val() ){ //匹配成功
        $(pw2).evf_callback(null,"sucess");
    }else{//匹配失败
        $(pw2).evf_callback("{lang(user.uap_pwxeq)}","failed");
        return false;
    }
}
</script>

{/block:main}
