1 2$(function () { 3 // ç¡®ä¿inquiry.jså çjs åªå è½½ä¸æ¬¡ 4 if (window.inquiryOnce){ 5 return 6 } 7 window.inquiryOnce = true; 8 var pageIndex = 1; 9 var pageSize = 999; 10 var isLoading = false; 11 var isFirstLoad = true; // æ°å¢åéï¼æ è¯æ¯å¦æ¯é¦æ¬¡å è½½ 12 var isFirstLoads = false; 13 $(".select-dropdown").click(function () { 14 var dropdown = $(this) 15 var ul = dropdown.children('ul'); 16 var p = dropdown.find('p') 17 // å¦æä¸ºäºçº§ä¸æ 18 if (ul.find('ul li').length) { 19 var li = ul.find('ul li') 20 } else { 21 // ä¸çº§ 22 var li = ul.find('li') 23 } 24 25 var arrows = dropdown.find('.select-arrows') 26 if (ul.css("display") == "none") { 27 ul.slideDown("fast"); 28 arrows.css('transform', 'rotate(180deg)') 29 } else { 30 ul.slideUp("fast"); 31 arrows.css('transform', 'rotate(0)') 32 } 33 34 li.click(function () { 35 var txt = $(this).text(); 36 var firstSelect = $(this).parent().prev().text(); 37 p.html(`${firstSelect} ${txt}`); 38 ul.slideUp("fast"); 39 arrows.css('transform', 'rotate(0)') 40 41 // 妿éä¸çæ¯ 'Other'ï¼åå° select-dropdown ç宽度设置为 50% 42 if ($(this).parent().parent().hasClass('selfSelect')) { 43 if (txt == 'Other') { 44 dropdown.css('width', '50%'); 45 // å±ç¤º input 46 dropdown.parent().find('.attribute_input').css('display', 'block'); 47 dropdown.parent().find('.attribute-other-wrap').css('display', 'block'); 48 } else { 49 dropdown.css('width', '100%'); 50 dropdown.parent().find('.attribute_input').css('display', 'none'); 51 dropdown.parent().find('.attribute_input').val(''); 52 dropdown.parent().find('.error-message').text(''); // ç§»é¤éè¯¯ä¿¡æ¯ 53 dropdown.parent().find('.attribute-other-wrap').css('display', 'none'); 54 } 55 } 56 }); 57 dropdown.mouseleave(function () { 58 ul.slideUp("fast"); 59 arrows.css('transform', 'rotate(0)') 60 }) 61 }); 62 $(".select-country>P").data("value","Spain"); 63 $(".select-country").click(function () { 64 //鲿¢éå¤ç¹å» 65 if (isLoading)return; 66 var dropdown = $(this); 67 var ul = dropdown.children('ul'); 68 var p = dropdown.find('p'); 69 var arrows = dropdown.find('.select-arrows'); 70 71 // ä¿®æ¹ï¼ä» å¨é¦æ¬¡å è½½æ¶æ¸ ç©ºç°æ<li> 72 if (isFirstLoad) { 73 ul.empty(); 74 isFirstLoad = false; 75 } 76 if(ul.find('li').length==0){ 77 ul.append(`<li class="disable-li"><svg class="icon-loading" aria-hidden="true"> <use xlink:href="#icon-loading"></use> </svg></li>`) 78 isLoading = true; 79 $.ajax({
80 url: Apis.getInquiryCountry, 81 // url: 'https://sam.datasortingcenter.com/getInquiryCountry', 82 type: 'get', 83 data:{ 84 // pageIndex, 85 // pageSize, 86 lang: headerVm.languageFlag 87 }, 88 success: function (res) { 89 if (res.code == '200') { 90 var data = res.msg.length == 2 ? res.msg : [res.msg, res.msg] 91 ul.empty(); 92 // éåæ°æ®æ°ç»ï¼ä¸ºæ¯ä¸ªå ç´ å建ä¸ä¸ª<li>å¹¶æ·»å å°<ul> 93 $.each(data[0], function(index, value) { 94 var li = $('<li>', { text: data[1][index], 'data-value': value }); 95 ul.append(li); 96 }); 97 // æ°æ®å è½½å®æï¼éç½®isLoadingç¶æ 98 isLoading = false; 99 isFirstLoads = true 100 } else { 101 console.log('é误'); 102 } 103 }, 104 error: function () { 105 // é误å¤ç 106 isLoading = false; 107 } 108 }); 109 } 110 111 if (ul.css("display") == "none") { 112 ul.slideDown("fast"); 113 arrows.css('transform', 'rotate(180deg)') 114 } else { 115 ul.slideUp("fast"); 116 arrows.css('transform', 'rotate(0)') 117 } 118 119 ul.on('click', 'li', function () { 120 var txt = $(this).text(); 121 console.log(txt, "@@@", $(this).data('value')); 122 p.html(`${txt}`); 123 p.data('value', $(this).data('value')) 124 ul.slideUp("fast"); 125 arrows.css('transform', 'rotate(0)') 126 dropdown.closest('.form-item').removeClass('is-error').find('.field-error').text(''); 127 128 }); 129 dropdown.mouseleave(function () { 130 ul.slideUp("fast"); 131 arrows.css('transform', 'rotate(0)'); 132 }); 133 }); 134 // æ·»å æ»å¨å°åºé¨å è½½æ´å¤æ°æ®çäºä»¶çå¬ 135 // $(".scrollable-list").on('scroll', function() { 136 // if ($(this).scrollTop() + $(this).innerHeight() >= this.scrollHeight && !isLoading) { 137 // isLoading = true; 138 // pageIndex++; // 页é¢ç´¢å¼éå¢ 139 140 // // åéæ°çAjax请æ±è·åä¸ä¸é¡µæ°æ® 141 // $.ajax({
142 // url: 'https://sam.datasortingcenter.com/getInquiryCountry?pageIndex=' + pageIndex + '&pageSize=' + pageSize, 143 // type: 'get', 144 // success: function (res) { 145 // if (res.code == '200') { 146 // var newData = res.msg; 147 // // ç´æ¥è¿½å æ°æ°æ®å°ç°æç<ul> 148 // $.each(newData, function(index, value) { 149 // var li = $('<li>', { text: value }); 150 // $('ul.scrollable-list').append(li); 151 // }); 152 // isLoading = false; 153 // } else { 154 // console.log('é误'); 155 // } 156 // }, 157 // error: function() { 158 // isLoading = false; 159 // } 160 // }); 161 // } 162 // }); 163})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.