systemmanage_user.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!--<link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">-->
  8. <link href="../css/mui.min.css" rel="stylesheet" />
  9. <link href="../css/common.css" rel="stylesheet" />
  10. <style type="text/css">
  11. .mui-content {
  12. background: #fff;
  13. }
  14. #popover {
  15. display: block;
  16. top: 57px;
  17. left: 165px;
  18. }
  19. /*tab*/
  20. .mui-segmented-control {
  21. border: none;
  22. }
  23. .mui-segmented-control .mui-control-item {
  24. border-left: none;
  25. color: #333;
  26. }
  27. .mui-segmented-control .mui-control-item.mui-active {
  28. color: #333;
  29. background: transparent;
  30. border-bottom: 2px solid #007AFF;
  31. }
  32. .mui-segmented-control .mui-control-item{
  33. border-bottom: 2px solid #c8c7cc;
  34. }
  35. .usercontrol{
  36. display: none;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <header class="mui-bar mui-bar-nav">
  42. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  43. <h1 class="mui-title">用户管理</h1>
  44. <!--<a class="mui-icon mui-icon-plus mui-pull-right" id="addUser">添加</a>-->
  45. <a href="#popover" id="openPopover" class="mui-icon mui-icon-more mui-pull-right"></a>
  46. </header>
  47. <div class="mui-content">
  48. <!-- <div id="segmentedControl" class="mui-segmented-control usercontrol"> -->
  49. <!-- <a class="mui-control-item mui-active" data-id='systemmanage_user_list'>用户管理</a> -->
  50. <!-- <a class="mui-control-item" data-id="systemmanage_usergroup_list">用户组管理</a> -->
  51. <!-- </div> -->
  52. </div>
  53. <script src="../js/mui.min.js"></script>
  54. <script type="text/javascript">
  55. mui.init({
  56. //处理窗口关闭前的业务
  57. beforeback: function() {
  58. //... //窗口关闭前处理其他业务详情点击 ↑ "关闭页面"链接查看
  59. var currentWebview=plus.webview.currentWebview();
  60. plus.webview.close(currentWebview);
  61. },
  62. })
  63. var floatw = null;
  64. mui.plusReady(function() {
  65. //预加载页面
  66. var subInfos = [{
  67. url: 'systemmanage_user_list.html',
  68. id: 'systemmanage_user_list'
  69. }];
  70. var pageStyle = {
  71. top: "55px",
  72. bottom: "0px"
  73. }
  74. //用户判断
  75. var isuser = plus.storage.getItem('isuser');
  76. console.log(isuser)
  77. // if(isuser == 'agency'){
  78. // document.getElementById('segmentedControl').style.display = 'none';
  79. // pageStyle = {
  80. // top: "5px",
  81. // bottom: "0px"
  82. // }
  83. // }else{
  84. // document.getElementById('segmentedControl').style.display = 'block';
  85. // }
  86. //添加列表
  87. var self = plus.webview.currentWebview();
  88. var activeTab = '';
  89. var firstPage = plus.webview.create(subInfos[0].url, subInfos[0].id, pageStyle);
  90. self.append(firstPage)
  91. activeTab = subInfos[0].id;
  92. // 根据id查询子页面的信息
  93. var getSubInfoById = function(infoList, id) {
  94. var result = null;
  95. for(var i = 0, len = infoList.length; i < len; i++) {
  96. var _info = infoList[i];
  97. if(_info.id === id) {
  98. result = _info;
  99. break;
  100. }
  101. }
  102. return result;
  103. };
  104. mui('#segmentedControl').on('tap', 'a', function() {
  105. var _self = this;
  106. var targetTab = _self.getAttribute('data-id');
  107. if(targetTab === activeTab) {
  108. return;
  109. }
  110. var _subWv = plus.webview.getWebviewById(targetTab);
  111. // 若webview不存在,则创建;
  112. if(!_subWv) {
  113. var _subInfo = getSubInfoById(subInfos, targetTab);
  114. _subWv = plus.webview.create(_subInfo.url, _subInfo.id, pageStyle);
  115. self.append(_subWv);
  116. }
  117. _subWv.show();
  118. // 隐藏之前的webview
  119. plus.webview.getWebviewById(activeTab).hide('none');
  120. activeTab = targetTab;
  121. })
  122. //顶部右上角按钮menu触发弹出菜单
  123. document.getElementById('openPopover').addEventListener('tap', function() {
  124. floatWebview()
  125. })
  126. // 创建悬浮窗口
  127. function floatWebview() {
  128. if(floatw) { // 避免快速多次点击创建多个窗口
  129. floatw.show("fade-in");
  130. } else {
  131. floatw = plus.webview.create("systemmanage_user_nav.html", "systemmanage_user_nav", {
  132. background: 'transparent',
  133. zindex: 10,
  134. });
  135. floatw.show("fade-in");
  136. }
  137. }
  138. })
  139. </script>
  140. </body>
  141. </html>