home.html 4.17 KB
<!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>home</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
      <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
      <link rel="stylesheet" type="text/css" href="../../css/home/home.css"/>
      <style>
        html,
        body{
          background: #f4f6f9;
          height: 100%;
          width: 100%;
        }
      </style>
  </head>
  <body>
    <div id="status"></div>
    <header class="aui-header-bar  title-home" style="width:'auto';height:44px;">
      <div class="aui-header-left">
        <span class="header-title" style="margin-left:15px;">智能灭弧器</span>
        <div id="header_title_hide1" class="aui-hide" style="width:1px;height:10px;background:rgba(255,255,255,0.5);margin-left:8px;"></div>
        <div id="header_title_hide2" class="header-title-more aui-hide" style="margin-left:8.5px;"></div>
      </div>
      <div class="aui-header-right" tapmode onclick="openDeviceListWin();">
        <img src="../../image/change-device.png" style="width:24px;height:24px;margin-top:0rem;"/>
        <span class="change-device">切换设备</span>
      </div>
    </header>
    <div style="background:linear-gradient(90deg,rgba(91,127,248,1) 0%,rgba(75,175,239,1) 100%);height:10rem;width:auto;"></div>
    <footer></footer>
  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/vue.min.js"></script>
  <script type="text/javascript">
      var vueData = {}
      var vm;
      apiready = function(){
        var footer = $api.dom('footer'); // 获取 footer 标签元素
        var footerH = $api.fixTabBar(footer);
        api.parseTapmode();
        var statusH = $api.getStorage('SAFEAREATOP');
        api.addEventListener({
            name: 'changeHeader'
        }, function(ret, err){
          // id="header_title_hide1"
          var obj1 = $api.byId("header_title_hide1");
          var obj2 = $api.byId("header_title_hide2");
          var hasCls1 = $api.hasCls(obj1, 'aui-hide');
          var hasCls2 = $api.hasCls(obj2, 'aui-hide');
          if( ret.value.hide == false ){
             if (hasCls1) {
               $api.removeCls(obj1, 'aui-hide');
             }
             if (hasCls2) {
               $api.removeCls(obj2, 'aui-hide');
             }
            //  console.log(ret.value.deviceName);
            if (ret.value.deviceName) {
              $api.html(obj2, ret.value.deviceName);
            }
           }else {
             if (!hasCls1) {
               $api.addCls(obj1, 'aui-hide');
             }
             if (!hasCls2) {
               $api.addCls(obj2, 'aui-hide');
             }
           }
        });

        //------设置状态栏
        document.getElementById("status").style.cssText = "height:"+ statusH +"px;width:'auto';background:linear-gradient(90deg,rgba(91,127,248,1) 0%,rgba(75,175,239,1) 100%);"
        api.setStatusBarStyle({
            style: 'light'
        });
        //------
        //---------初始化vue
        vm = new Vue({
          el: '#app',
          data: vueData,
          methods: {
            // changeText: function(text) {
            // }
          }
        })
        //---------
        //打开home_frm
        api.openFrame({
            name: 'homeFrm',
            url: './home_frm.html',
            rect: {
                x: 0,
                y: 44+Number(statusH),
                w: api.winWidth,
                h: api.winHeight-49-footerH-44-statusH
            },
            pageParam: {
                // name: 'test'
            },
            reload: true,
            bounces: true,
        });

      };
      function openDeviceListWin() {
        api.openWin({
            name: 'deviceList_win',
            url: '../utils/deviceList_win.html',
            slidBackEnabled: false,
            // pageParam: {
            //     name: 'test'
            // }
        });
      }
  </script>
  </html>