123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- 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 +=
- '<li class="search-data-item"><a href=javascript:geturl()>' +
- name + '</a><p>机型:<span>' + type +
- '</span></p><p>专业:<span>' + major +
- '</span></p><p>系统:<span>' + system + '</span></p></li>'
- // 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 += '<li class="search-data-item"><a href=""></a></li>'
- str += '<li class="search-data-item"><a href=javascript:geturl()>' + name + '</a><p>机型:<span>' + type +
- '</span></p><p>专业:<span>' + major +
- '</span></p><p>系统:<span>' + system + '</span></p></li>'
- // console.log(str)
- }
- }
- $('.search-data-list').html(str)
- } else {
- alert(res.msg);
- }
- },
- error: xhr => {
- // console.log(xhr)
- }
- });
- }
- });
- })
|