<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
     <link rel="stylesheet" type="text/css" href="../../css/toast.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" href="../../css/projeck.css">
    <style>
        html,body{
          background: #fff;
        }
        .api_layout{
          width: 100%;
          position: relative;
        }
      .bannerOr{
        height: 135px;
        width: 100%;
        background:url('') no-repeat;
        background-size: 100% 100%;
      }
      .h3{
        font-size: 21px;
        padding: 19px 15px;
        position: relative;
        font-weight: normal;
      }
      .icon{
        display: block;
        width: 35px;
        height: 35px;
        background: url(../../image/t.png) no-repeat;
        background-size: cover;
        margin-right: 20px;
      }
      .list{
          padding: 0 10px;
      }
      .list li{
          padding: 12px 0;
          padding-left: 15px;
      }
      .del_name{
        font-size: 16px;
        color: #000;
        /*font-weight: bold;*/
      }
      .icon_left{
          width: 16px;
          height: 16px;
          display: block;
          background: url("../../image/more.png") no-repeat;
          background-size: contain;
          position: absolute;
          right: 10px;
      }
    </style>
</head>
<body>
    <div class="api_layout">
        <div class="bannerOr" id="bannerOr"></div>
        <div class="organization_content" id="organization_content">
            <!-- <div class="organization_item">
              <h3 class="h3 after-border">机关部室</h3>
              <ul class="list relative after-border">
                 <li class="flex-start relative after-border">
                    <i class="icon"></i>
                    <p class="del_name">领导班子 （8人）</p>
                    <i class="icon_left"></i>
                 </li>
                  <li class="flex-start relative after-border">
                      <i class="icon"></i>
                      <p class="del_name">领导班子 （8人）</p>
                      <i class="icon_left"></i>
                  </li>
                  <li class="flex-start relative after-border">
                      <i class="icon"></i>
                      <p class="del_name">领导班子 （8人）</p>
                      <i class="icon_left"></i>
                  </li>
              </ul>
            </div>
            <div class="organization_item">
                <h3 class="h3 after-border">机关部室</h3>
                <ul class="list relative after-border">
                    <li class="flex-start relative after-border">
                        <i class="icon"></i>
                        <p class="del_name">领导班子 （8人）</p>
                        <i class="icon_left"></i>
                    </li>
                    <li class="flex-start relative after-border">
                        <i class="icon"></i>
                        <p class="del_name">领导班子 （8人）</p>
                        <i class="icon_left"></i>
                    </li>
                    <li class="flex-start relative after-border">
                        <i class="icon"></i>
                        <p class="del_name">领导班子 （8人）</p>
                        <i class="icon_left"></i>
                    </li>
                </ul>
            </div> -->
        </div>
    </div>
</body>
</html>
<script type="text/template" id="template_organzation">
  {{ for(var prop in it) { }}
    {{? prop != 'leader'}}
      <div class="organization_item">
        <h3 class="h3 after-border">{{=it[prop].name}}</h3>
        <ul class="list relative after-border">
          {{ for (var i=0;i<it[prop].data.length;i++) { }}
           <li class="flex-start relative after-border" onclick="openPersonalList('{{=it[prop].data[i].id}}','{{=it[prop].data[i].title}}')">
              <i class="icon"></i>
              <p class="del_name">{{=it[prop].data[i].title}} （{{=it[prop].data[i].user_num}}人）</p>
              <i class="icon_left"></i>
           </li>
            {{ } }}
        </ul>
      </div>
    {{?}}
  {{ } }}
</script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script src="../../script/config.js" charset="utf-8"></script>

<script type="text/javascript">
var toast = new auiToast();
  apiready = function () {
      $api.fixStatusBar($api.dom('header'));
      var info = $api.getStorage('data'),
      user = JSON.parse(info).data.user;
      token = JSON.parse(info).data.access_token;
      getGroupList(token)
  }
  function getGroupList(token) {
    var headers = {
        "Authorization": "Bearer " + token
    };
    $http.fnReuestData(UrlRouter.getGroupList,headers,'get','',function (ret,err) {
      if (ret && ret.code === 0) {
        if (ret.data.banner == '#') {
          $api.css($api.dom('#bannerOr'), 'display:none');
        }else {
          $api.css($api.dom('#bannerOr'), 'display:block');
          document.getElementById('bannerOr').style.background = 'url('+ret.data.banner+')';
          document.getElementById('bannerOr').style.backgroundSize = '100% 100%';
        }
        $apis.append(organization_content,'#template_organzation',ret.data.group);
        toast.hide()
      }else {
        toast.hide()
        api.toast({
            msg: '网络错误',
            duration: 2000,
            location: 'bottom'
        });
      }
    })
  }
  function openPersonalList(ids,title) {
    var pageParam ={
      id:ids
    }
    $event.openTabLayout('mailList_frm','mailList_frm',title,pageParam)
  }
  // 点击人员列表看详情
  function openDetails(name,phone,img,del) {
    api.openFrame({
        name: 'modul',
        bounces: false,
        url: 'modul.html',
        bgColor:'rgba(0,0,0,.6)',
        rect: {
            x: 0,
            y: 0,
            w: api.winWidth,
            h: 'auto',
        },
        pageParam: {
            username: name,
            mobile:phone,
            avatar:img,
            delp:del
        }
    });
    // $event.openFrame('modul','','','','');
  }
</script>
