<!--{include file="<!--{$tplpath}-->block_header.tpl"}-->
<!-------------------------------------- 头部结束 -------------------------------------->
    <link rel="stylesheet" href="<!--{$skinpath}-->assets/css/main.css">

<!-------------------------------------- 主体开始 -------------------------------------->
<style>
    .main_l {
        float: left;
        width: 300px;
    }
    .main_r {
        float: left;
        width: 550px;
    }
    .naInfoImgBox {
         padding: 80px 20px 0;
     }
    .na-img-area {
        width: 80px;
        height: 80px;
        border: 2px solid #e3e3e3;
        border-radius: 50%;
        padding: 4px;
        background: #fff;
        position: relative;
        z-index: 4;
        cursor: pointer;
    }
    .na-img-bg-area {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        overflow: hidden;
    }
    .na-img-area img {
        display: block;
        width: 100%;
        height: 100%;
        border-radius: 50%;
    }
    .na-edit {
        position: absolute;
        top: 23px;
        left: 23px;
        display: none;
        width: 43px;
        height: 43px;
        background: url(https://account.xiaomi.com/static/res/7c3e9b0/passport/acc-2014/img/n-ava-edit.png) 0 0 no-repeat;
        _background: url(https://account.xiaomi.com/static/res/7c3e9b0/passport/acc-2014/img/n-ava-edit-ie.png) 0 0 no-repeat;
    }
    .framedatabox {
        padding-top: 15px;
    }
    .fdata {
        padding-left: 20px;
        line-height: 40px;
        overflow: hidden;
    }
    .bind-form label {
        display: inline-block;
        *zoom: 1;
        *display: inline;
        width: 60px;
        font-size: 14px;
        margin-left: 20px;
    }
</style>
<div class="page-main user-main">
  <div class="container">
      <!--{if !empty($check)}-->
    <div class="row">
      <div class="span4">
          <div class="uc-box uc-sub-box">
              <div class="uc-nav-box">
                  <div class="box-hd">
                      <h3 class="title">个人中心</h3>
                  </div>
                  <div class="box-bd">
                      <ul class="uc-nav-list J_navList">
                          <li><a class="J_noRandom" href="index.php?c=user">我的个人中心</a></li>
                          <li class="active"><a class="J_noRandom" href="./index.php?c=user&a=user_info">个人信息</a></li>
                          <li><a class="J_noRandom" href="./index.php?c=user&a=profit">我的收益</a></li>
                          <li><a class="J_noRandom" href="index.php?c=user&a=share">我的推广</a></li>
                          <li><a class="J_noRandom" href="./index.php?c=user&a=user_address">收货地址</a></li>
                          <li><a class="J_noRandom" href="./index.php?c=user&a=user_edit">修改密码</a></li>
                      </ul>
                  </div>
              </div>
              <div class="uc-nav-box">
                  <div class="box-hd">
                      <h3 class="title">订单中心</h3>
                  </div>
                  <div class="box-bd">
                      <ul class="uc-nav-list J_navList">
                          <li><a class="J_noRandom" href="./index.php?c=user&a=order_list">我的订单</a></li>
                      </ul>
                  </div>
              </div>
          </div>
      </div>
      <div class="span16">
        <div class="uc-box uc-main-box">
          <div class="uc-content-box order-list-box">
            <div class="box-hd">
              <h1 class="title">个人信息</h1>
            </div>
            <div class="box-bd">
              <div class="xm-goods-list-wrap">
                  <div class="uinfo c_b">
                      <div>
                          <div class="main_l">
                              <div class="naInfoImgBox t_c">
                                  <div class="na-img-area marauto">
                                      <!--na-img-bg-area不能插入任何子元素-->
                                      <div class="na-img-bg-area">
                                          <!--{if empty(<!--{$data.pic}-->)}-->
                                          <img name="img" id="testList" src="<!--{$mpath}-->images/timg.png"/>
                                          <!--{else}-->
                                          <img name="img" id="testList" src="<!--{$data.pic}-->"/>
                                          <!--{/if}-->
                                          <input type="hidden" class="fr shuru" name="headerimg" id="headerimg" value="<!--{$data.pic}-->"/>
                                      </div>

                                  </div>
                              </div>
                          </div>
                          <div class="main_r">
                              <div class="framedatabox">
                                  <div class="fdata">
                                      <h3>基础资料</h3>
                                  </div>
                                  <div class="bind-form">
                                      <label for="user_name">昵称</label>
                                      <input class="input-text J_addressInput" type="text" id="nickname" name="nickname" placeholder="昵称" value="<!--{$data.nickname}-->">
                                  </div>
<br/>
                                   <div class="bind-form">
                                      <label  for="user_name">邮箱</label>
                                      <input class="input-text J_addressInput" type="text" id="email" name="email" placeholder="邮箱" value="<!--{$data.email}-->" >
                                  </div>

                              </div>

                          </div>
                      </div>
                  </div>
                  <div class="action" style="margin-left: 300px; margin-top: 33%;">
                      <a class="btn btn-primary" href="javascript:void(0)" id="edit_btn">修改</a>
                  </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
      <!--{else}-->
      <a class="btn btn-primary" href="./index.php?c=user&a=login">去登录</a>
      <!--{/if}-->
  </div>
</div>



<script>
              $(function(){
                    $("#edit_btn").bind("click", function(){ //提交

                        $nickname=$("[name=nickname]").val();
                        $email=$("[name=email]").val();
                        $pic=$("[name=headerimg]").val();

                            $.ajax({
                                    type: "POST",
                                    url: "index.php?c=user&a=ajaxeditinfo",
                                    cache: false,
                                data: {nickname:$nickname,email:$email,pic:$pic},
                                    dataType: "json",
                                    success: function(data) {
                                            var json = eval(data);
                                            var response = json.response;
                                            var result = json.result;                                          
                                            if (response == "1") {
                                                  layer.msg(result, {icon: 1});

                                                setTimeout( function(){
                                                    window.location.reload();
                                                }, 1 * 1000 );//延迟5000毫米

                                            }
                                            else {
                                                  layer.msg(result, {icon: 5});
                                            }
                                    },
                                   
                                   
                            });

                    });

            });
         </script>
         
 <script>
  layui.use('upload', function(){
  var $ = layui.jquery,
  upload = layui.upload;
  
  //普通图片上传
  var uploadInst = upload.render({
    elem: '#testList',
    url: 'index.php?c=user&a=upload'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code > 0){
        return layer.msg('上传失败');
      }else{
          $("[name=img]").attr("src",res.name);
          $("[name=headerimg]").val(res.name1);
      }
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  

  
  //绑定原始文件域
  upload.render({
    elem: '#test20'
    ,url: '/upload/'
    ,done: function(res){
      console.log(res)
    }
  });
  
});
</script>        

        <!-------------------------------------- 主体结束 -------------------------------------->
        <!-------------------------------------- 尾部开始 -------------------------------------->

<!--{include file="<!--{$tplpath}-->botton.tpl"}-->
<!-------------------------------------- 尾部结束 -------------------------------------->

