From 879dde18ab43055bbc257b8778dbdb1bb8f2ff60 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期二, 29 四月 2025 17:08:10 +0800 Subject: [PATCH] 1 --- WebTM/views/indexMenu.html | 162 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 148 insertions(+), 14 deletions(-) diff --git a/WebTM/views/indexMenu.html b/WebTM/views/indexMenu.html index 2e65c7d..e2412ed 100644 --- a/WebTM/views/indexMenu.html +++ b/WebTM/views/indexMenu.html @@ -10,8 +10,15 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all"> <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all"> - <script src="../layuiadmin/Scripts/jquery-3.5.1.min.js"></script> - <script language="JavaScript">//灞忚斀鍚庨��鎸夐挳 + <!--<script src="../layuiadmin/Scripts/jquery-3.5.1.min.js"></script>--> + <script src="../layuiadmin/Scripts/jquery-1.4.1.js"></script> + <script src="../layuiadmin/layui/layui.js"></script> + <script src="../layuiadmin/Scripts/webConfig.js"></script> + <script src="../layuiadmin/zgqCustom/zgqCustom.js"></script> + <script src="../layuiadmin/PubCustom.js"></script> + <script src="../layuiadmin/Scripts/json2.js"></script> + <script language="JavaScript"> + //灞忚斀鍚庨��鎸夐挳 history.pushState(null, null, document.URL); window.addEventListener('popstate', function () { history.pushState(null, null, document.URL); @@ -20,7 +27,21 @@ <script> /^http(s*):\/\//.test(location.href) || alert('璇峰厛閮ㄧ讲鍒� localhost 涓嬪啀璁块棶'); </script> - + <style> + /* 閫夐」鍩虹鏍峰紡 */ + .aa { + padding: 0 20px; + line-height: 36px; + cursor: pointer; + transition: all 0.3s; + color: #000 !important; /* 寮哄埗榛戣壊瀛椾綋 */ + } + /* 鎮仠鐘舵�� */ + .aa:hover { + background-color: #f8f8f8 !important; + color: #000 !important; + } + </style> </head> <body class="layui-layout-body"> @@ -35,21 +56,35 @@ </a> </li> <!--<li class="layui-nav-item layui-hide-xs" lay-unselect> - <a href="http://www.layui.com/admin/" target="_blank" title="鍓嶅彴"> - <i class="layui-icon layui-icon-website"></i> - </a> - </li>--> + <a href="http://www.layui.com/admin/" target="_blank" title="鍓嶅彴"> + <i class="layui-icon layui-icon-website"></i> + </a> + </li>--> <li class="layui-nav-item" lay-unselect> <a href="javascript:;" layadmin-event="refresh" title="鍒锋柊"> <i class="layui-icon layui-icon-refresh-3"></i> </a> </li> <li class="layui-nav-item layui-hide-xs" lay-unselect> - <input type="text" placeholder="鎼滅储..." autocomplete="off" class="layui-input layui-input-search" layadmin-event="serach" lay-action="https://www.baidu.com/s?ie=UTF-8&wd="> + <!--<input type="text" placeholder="鎼滅储..." autocomplete="off" class="layui-input layui-input-search" layadmin-event="serach" lay-action="https://www.baidu.com/s?ie=UTF-8&wd=">--> + <div class="layui-form" style="margin-top: 5px; color: black;"> + <!--<select name="HModePage" id="HModePage" lay-filter="HModePage" lay-search> + </select>--> + <input type="text" class="layui-input" name="HModePage" lay-verify="HModePage" id="HModePage" placeholder="鎼滅储..." autocomplete="off"> + <!-- 涓嬫媺瀹瑰櫒 --> + <div id="dropdownMenu1" class="layui-anim layui-anim-upbit" + style="display: none;position: absolute;width: 100%;max-height: 200px;overflow-y: auto;border: 1px solid #e6e6e6;background: #f8f8f8;z-index: 999;top: 40px;left: 0;"> + <ul id="optionList1" class="layui-nav layui-nav-tree" style="width: 100%; background:white"></ul> + </div> + </div> + </li> <li class="layui-nav-item" lay-unselect style="color: black;"> <span>鐧诲綍缁勭粐锛�</span> <label id="Organization"></label> + </li> + <li class="layui-nav-item" lay-unselect style="color: black;"> + <label id="Hlanguage"></label> </li> </ul> <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right"> @@ -165,10 +200,6 @@ </div> </div> - <script src="../layuiadmin/layui/layui.js"></script> - <script src="../layuiadmin/Scripts/webConfig.js"></script> - <script src="../layuiadmin/zgqCustom/zgqCustom.js"></script> - <script src="../layuiadmin/PubCustom.js"></script> <script> // 瀵艰埅鑿滃崟鐨勯棿闅斿儚绱� var menuCell = 5; @@ -178,10 +209,12 @@ }).extend({ index: 'lib/index' //涓诲叆鍙fā鍧� }).use(['index', 'form', 'laydate', 'table', 'element'], function () { - var $ = layui.$; + var $ = layui.$ + , form = layui.form; var element = layui.element; var $ = layui.jquery; - + //鎵�鏈夋ā鍧楃殑闆嗗悎 + var PageModelList = []; var HType = "PC"; //鐧诲綍骞冲彴锛歅C绔�佹墜鏈虹 //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤� //if (sessionStorage.login != "login") { @@ -195,10 +228,103 @@ set_sideMenuDisPlay(); //#endregion + ModePage(); + //鑿滃崟鏍忓懡鍚� setMenuLabel(); + + //#region 鎹熷潖鎯呭喌 鐐瑰嚮浜嬩欢 + + // 鍒嗙鐒︾偣浜嬩欢鍜岃緭鍏ヤ簨浠� + $('#HModePage').on('focus', function () { // 鐒︾偣浜嬩欢锛氭樉绀哄叏閮ㄩ�夐」 + renderOptions1(''); + $('#dropdownMenu1').show(); + }).on('input', function () { // 杈撳叆浜嬩欢锛氳繃婊ら�夐」 + var inputVal = $(this).val().trim(); + renderOptions1(inputVal); + $('#dropdownMenu1').show(); + }); + + // 鏂囨。鐐瑰嚮鍏抽棴涓嬫媺 + $(document).on('click', function (e) { + if (!$(e.target).closest('#HModePage, #dropdownMenu1').length) { + $('#dropdownMenu1').hide(); + } + }); + + + // 娓叉煋閫夐」锛堟敮鎸佹樉绀哄叏閮級 + function renderOptions1(filterText) { + var LimitData = []; + if (filterText == "") { + for (var i = 0; i < 10; i++) { + LimitData.push(PageModelList[i]) + } + } + + var filteredData = filterText ? + PageModelList.filter(function (item) { + return item.HName.toLowerCase().includes(filterText.toLowerCase()); + }) : + LimitData; // 鏃犺繃婊ゆ枃鏈椂鏄剧ず鍏ㄩ儴 + + var DataMdel = []; + for (var i = 0; i < 10; i++) { + if (i < filteredData.length && filteredData.length != 0) { + DataMdel.push(filteredData[i]); + } + } + + var html = ''; + if (DataMdel.length > 0) { + DataMdel.forEach(function (item) { + html += `<li class="layui-nav-item aa" data-value="${item.Hurl}">${item.HName}</li>`; + }); + } else { + html = '<li class="layui-nav-item aa">鏃犲尮閰嶇粨鏋滐紙鍙嚜鐢辫緭鍏ワ級</li>'; + } + + $('#optionList1').html(html); + } + + // 閫夐」鐐瑰嚮浜嬩欢 + $('#optionList1').on('click', 'li', function (data) { + if (!$(this).text().includes('鏃犲尮閰嶇粨鏋�')) { + var selectedText = $(this).text(); + $('#HModePage').val(selectedText).trigger('input'); + var value = data.target.dataset.value + if (selectedText != "") { + layui.index.openTabsPage(value, selectedText); + } + } + $('#dropdownMenu1').hide(); + }); + //#endregion + + form.on('select(HModePage)', function (data) { + var keyword = data.elem[data.elem.selectedIndex].text; + if (data.value != "") { + layui.index.openTabsPage(data.value, keyword); + } + }); + //#region 椤甸潰鍏跺畠鏂规硶 + //鑾峰彇妯″潡椤甸潰 + function ModePage() { + $.ajax({ + type: "get", + url: GetWEBURL() + "/Web/ModePageList", + success: function (result) { + if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝 + var data = result.data.Gy_Menu; + PageModelList = data; + } + layer.closeAll("loading"); + } + }) + } + //鏄剧ず渚ц竟鑿滃崟 function set_sideMenuDisPlay() { //鍒ゆ柇鐢ㄦ埛鏄Щ鍔ㄧ杩樻槸PC绔� @@ -337,6 +463,14 @@ document.getElementById('UserName').innerHTML = sessionStorage["HUserName"]; document.getElementById('Organization').innerHTML = sessionStorage["Organization"]; + if (sessionStorage["HTranSlate"] == 1) { + document.getElementById('Hlanguage').innerHTML ="褰撳墠璇█锛氫腑鏂�"; + } else if (sessionStorage["HTranSlate"] == 2) { + document.getElementById('Hlanguage').innerHTML ="Current Language锛欵eglish"; + } else if (sessionStorage["HTranSlate"] == 3) { + document.getElementById('Hlanguage').innerHTML = "Current Language锛歋panish"; + } + function openChildPage(id) { //鑾峰彇椤甸潰 var num = document.getElementById(id); -- Gitblit v1.9.1