let str = ''; function geturl() { x_admin_show( "在线查看", encodeURI( "../admin/look.html" ), 1300, 600, ); } $(function() { var storage = window.localStorage; let user = window.localStorage.getItem('user'); let userInfo = JSON.parse(user); let type = ''; let a = true let b = true let c = true $('.search-type span').click((e) => { // console.log(e.target.id) type = e.target.id; $('.search-type span').css({ color: 'black', // borderBottom: 'black' }); e.target.style.color = '#09c' // e.target.style.borderBottom = '1px solid #09c' }) //搜索 $('.searchBtn').click(() => { if ($('.searchInput').val() == "") { $('.search-data').css({ 'display': 'none' }); } else { var url2 = "look.html" // console.log(url2) $("#bot").css({ display: 'block' }) $('.search-box').addClass('search-box-toLeft'); $('.search-data').css({ 'display': 'block' }); const data = { type: type, keyword: $('.searchInput').val() }; $.ajax({ type: "get", url: urlBase + "api/common/find", async: true, data: data, headers: { // token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxIn0.Oik3R7IxeUi9v9d0C7kvFd2gF_xSu4WjspKKeXy3dGw" token: sessionStorage.getItem('token') }, success: res => { if (res.status == 0) { $('.search-data-list').html(); let data = res.data; // console.log(data) var name, path, major, type, system; let allData = []; for (var index in data) { // console.log(index) for (var i = 0; i < data[index].data.length; i++) { cData = data[index].data; // console.log(cData) if (index == 'repairManual') { name = cData[i].manual_name; major = cData[i].major; type = cData[i].aircraft; system = cData[i].manual_system; } else if (index == 'faultRecord') { name = cData[i].device_name; major = cData[i].major; type = cData[i].aircraft_type; system = cData[i].faultparts_system; } else if (index == 'article') { name = cData[i].title; major = cData[i].major_name; type = cData[i].aircraft; system = cData[i].aircraft_system; } var fileType; var file_path = cData[i].file_path; sessionStorage.setItem("url1",file_path) str += '
  • ' + name + '

    机型:' + type + '

    专业:' + major + '

    系统:' + system + '

  • ' // console.log(str) } } $('.search-data-list').html(str) } else { alert(res.msg); } }, error: xhr => { // console.log(xhr) } }); } }); //二次搜索 $("#bot").click(() => { if ($('.searchInput').val() == "") { $('.search-data').css({ 'display': 'none' }); } else { var one = document.getElementById("search").value; const data = { type: type, keyword1: one, keyword2: $('.searchInput').val() } $.ajax({ type: "get", url: urlBase + "api/common/refind", async: true, data: data, headers: { // token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxIn0.Oik3R7IxeUi9v9d0C7kvFd2gF_xSu4WjspKKeXy3dGw" token: sessionStorage.getItem('token') }, success: res => { if (res.status == 0) { $('.search-data-list').html(); let data = res.data; // console.log(data) let str = ''; var name, path, major, type, system; let allData = []; for (var index in data) { // console.log(data) for (var i = 0; i < data[index].data.length; i++) { cData = data[index].data; // console.log(cData) if (index == 'repairManual') { name = cData[i].manual_name; major = cData[i].major; type = cData[i].aircraft; system = cData[i].manual_system; } else if (index == 'faultRecord') { name = cData[i].device_name; major = cData[i].major; type = cData[i].aircraft_type; system = cData[i].faultparts_system; } else if (index == 'article') { name = cData[i].title; major = cData[i].major_name; type = cData[i].aircraft; system = cData[i].aircraft_system; } var file_path = cData[i].file_path; sessionStorage.setItem("url1",file_path) // str += '
  • ' str += '
  • ' + name + '

    机型:' + type + '

    专业:' + major + '

    系统:' + system + '

  • ' // console.log(str) } } $('.search-data-list').html(str) } else { alert(res.msg); } }, error: xhr => { // console.log(xhr) } }); } }); })