1function loginPopup() { 2 let options = { 3 skin: "custom-popup login-popup", 4 area: ["400px", "460px"], 5 title: "", 6 type: 2, 7 closeBtn: 0, 8 resize: false, 9 content: "/login/loginPopup.html", 10 }; 11 if (isMobile == 1) { 12 options = { 13 skin: "custom-mobile-popup", 14 title: "", 15 type: 2, 16 closeBtn: 0, 17 offset: "b", 18 area: ["100%", "80%"], 19 resize: false, 20 content: "/login/loginPopup.html", 21 }; 22 } 23 layer.open(options); 24} 25/*é ä»¶ä¸åºç»å½*/ 26function loginPopup2() { 27 let url = '/login/loginPopup2.html?lang='+awsConfig.lang 28 let options = { 29 skin: 'custom-popup login-popup', 30 area: ['400px', '460px'], 31 title:'', 32 type:2, 33 closeBtn:0, 34 resize:false, 35 content: url 36 } 37 if (isMobile == 1) { 38 options = { 39 skin: 'round-20', 40 area: ['90%', '450px'], 41 title:'', 42 type:2, 43 closeBtn:0, 44 resize:false, 45 content: url 46 } 47 } 48 layer.open(options) 49} 50/*é ä»¶ä¸åºæ³¨å*/ 51function regPopup2() { 52 let url = '/login/regPopup2.html?lang='+awsConfig.lang 53 let options = { 54 skin: 'custom-popup login-popup', 55 area: ['400px', '520px'], 56 title:'', 57 type:2, 58 closeBtn:0, 59 resize:false, 60 content: url 61 } 62 if (isMobile == 1) { 63 options = { 64 skin: 'round-20', 65 area: ['90%', '450px'], 66 title:'', 67 type:2, 68 closeBtn:0, 69 resize:false, 70 content: url 71 } 72 } 73 layer.open(options) 74} 75function noLoginTips(msg) { 76 if (isMobile == 1) { 77 layer.confirm( 78 msg, 79 { 80 skin: "custom-layer-confirm", 81 title: "<span class='global-iconfont global-icon-xinxi'></span>", 82 btn: [sign_in_text, cancel_text], 83 }, 84 function (index) { 85 window.location.href = "/member-login.html"; 86 layer.close(index); 87 } 88 ); 89 } else { 90 layer.msg(msg, { icon: 2, time: 2000 }, function () { 91 loginPopup(); 92 }); 93 } 94} 95//ç»å½éªè¯ 96function checkLogin() { 97 console.log("checkLogin"); 98 return new Promise((resolve, reject) => { 99 utils.getAjax({ 100 url: "/public/checkLogin.html", 101 success: (res) => { 102 if (res.code == 200) { 103 if (res.data.member_id > 0) { 104 resolve(res.data); 105 memberCustomerInfo(); 106 } else { 107 reject(false); 108 } 109 } else { 110 reject(false); 111 } 112 }, 113 }); 114 }); 115} 116function logOut() { 117 utils.getAjax({ 118 url: "/member-logout.html", 119 success: (res) => { 120 if (res.code == 200) { 121 /*collect.jsä» é¨åå¸å±å¼å ¥ï¼æªå¼å ¥ç页é¢(å¦ä¾åºååå°)æ $collectAction*/ 122 window.$collectAction && $collectAction.logout(); 123 utils.refresh(); 124 /*å ¼å®¹é ä»¶ååï¼éåºç»å½ä» å·æ°å½å页*/ 125 // window.location.href = "/member-login.html"; 126 } else { 127 utils.tips(res.message, 2); 128 } 129 }, 130 }); 131} 132function getInquiryCart() { 133 utils.getAjax({ 134 url: "/member.inquiry_cart/list", 135 success: (res) => { 136 if (res.code == 200) { 137 } 138 }, 139 }); 140} 141var domainHost = window.location.pathname; 142let searchSource = ""; 143if (domainHost.includes("goods.html")) { 144 searchSource = "ååå表"; 145} else if (domainHost.includes("/goods-search.html")) { 146 searchSource = "产åæç´¢é¡µ"; 147} else if (domainHost.includes("/")) { 148 searchSource = "é¦é¡µ"; 149} 150 151function pageSearch(event) { 152 console.log(searchSource, "searchSource"); 153 localStorage.setItem("mySearch", searchSource); 154 let type = $('input[name="head_search_type"]').val(); 155 let keywords = $("#keywords").val(); 156 if (valid.isEmpty(keywords)) { 157 layer.msg("Please enter keywords"); 158 return false; 159 } 160 let url = 161 (type == "Products" ? "/goods-search.html" : "/shop/search.html") + 162 "?keywords=" + 163 keywords + 164 "&head_search_type=" + 165 type; 166 if (searchSource == "产åæç´¢é¡µ") { 167 let isAllow = $("input[name='is_allow']:checked").val() == "on" ? 1 : 0; 168 let isSample = $("input[name='is_sample']:checked").val() == "on" ? 1 : 0; 169 let buyNum = 170 $('input[name="limit_by_num"]').val() !== undefined && 171 $('input[name="limit_by_num"]').val() !== null 172 ? $('input[name="limit_by_num"]').val() 173 : ""; 174 let min = 175 $('input[name="min_price"]').val() !== undefined && 176 $('input[name="min_price"]').val() !== null 177 ? $('input[name="min_price"]').val() 178 : ""; 179 let max = 180 $('input[name="max_price"]').val() !== undefined && 181 $('input[name="max_price"]').val() !== null 182 ? $('input[name="max_price"]').val() 183 : ""; 184 url = 185 type == "Products" 186 ? "/goods-search.html?keywords=" + 187 keywords + 188 "&head_search_type=" + 189 type + 190 "&is_allow=" + 191 isAllow + 192 "&is_sample=" + 193 isSample + 194 "&limit_by_num=" + 195 buyNum + 196 "&min_price=" + 197 min + 198 "&max_price=" + 199 max
200 : "/shop/search.html?keywords=" + 201 keywords + 202 "&head_search_type=" + 203 type; 204 } 205 if (window.IbiSite) url = window.IbiSite.searchUrl(url, true); 206 console.log(url, "url"); 207 setTimeout(function () { 208 window.location.href = url; 209 }, 150); //å使¯æ¯«ç§ 210} 211function articleSearchVal(httpStr) { 212 let keywords = $("#articleKeywords").val(); 213 let code = $(".search_select .tit").attr("data-values"); 214 /* if(valid.isEmpty(keywords)){ 215 layer.msg('Please enter keywords') 216 return false 217 }*/ 218 if (!valid.isEmpty(keywords)) { 219 //æ¿æ¢æç´¢è¯ç©ºæ ¼ä¸ºæ¨ªå² 220 keywords = keywords.replace(/\s+/g, "-") + ".html"; 221 } 222 //console.log(httpStr+window.location.hostname+'/ecs-article-'+code+keywords+'.html'); 223 //æ¼è·¯ç±è·³è½¬ 224 let searchUrl = 225 httpStr + 226 window.location.hostname + 227 "/ecs-article-" + 228 code + 229 "/" + 230 keywords; 231 window.location.href = window.IbiSite ? window.IbiSite.searchUrl(searchUrl, true) : searchUrl; 232} 233function setKeywords() { 234 let keywords = 235 utils.GetUrlParam()["keywords"] !== undefined && 236 utils.GetUrlParam()["keywords"] !== null 237 ? utils.GetUrlParam()["keywords"] 238 : ""; 239 if (keywords) { 240 try { 241 keywords = decodeURI(keywords); 242 } catch (error) { 243 keywords = keywords.replace(/\+/g, " "); 244 } 245 $("#keywords").val(keywords); 246 } 247 let type = 248 utils.GetUrlParam()["type"] !== undefined && 249 utils.GetUrlParam()["type"] !== null 250 ? utils.GetUrlParam()["type"] 251 : ""; 252 let buyNum = 253 utils.GetUrlParam()["limit_by_num"] !== undefined && 254 utils.GetUrlParam()["limit_by_num"] !== null 255 ? utils.GetUrlParam()["limit_by_num"] 256 : ""; 257 let min = 258 utils.GetUrlParam()["min_price"] !== undefined && 259 utils.GetUrlParam()["min_price"] !== null 260 ? utils.GetUrlParam()["min_price"] 261 : ""; 262 let max = 263 utils.GetUrlParam()["max_price"] !== undefined && 264 utils.GetUrlParam()["max_price"] !== null 265 ? utils.GetUrlParam()["max_price"] 266 : ""; 267 let isAllow = utils.GetUrlParam()["is_allow"]; 268 let isSample = utils.GetUrlParam()["is_sample"]; 269 if (type) $("#search-type").val(decodeURI(type)); 270 if (buyNum) $('input[name="limit_by_num"]').val(decodeURI(buyNum)); 271 if (min) $('input[name="min_price"]').val(decodeURI(min)); 272 if (max) $('input[name="max_price"]').val(decodeURI(max)); 273 if (isAllow == 1) $("#is-allow").attr("checked", "checked"); 274 if (isSample == 1) $("#is-sample").attr("checked", "checked"); 275} 276function openCart() { 277 checkLogin() 278 .then(() => { 279 window.location.href = "/member.cart/index"; 280 }) 281 .catch(() => { 282 noLoginTips(); 283 }); 284} 285function feedback() { 286 layer.open({ 287 title: ["Feedback", "font-size:28px;text-align:center;"], 288 type: 2, 289 area: ["800px", "550px"], 290 skin: "feedback-layer", 291 content: "/page-feedback.html", 292 }); 293} 294function goTop() { 295 if ($(window).scrollTop() > 0) { 296 $("html,body").animate({ scrollTop: 0 }, 500); 297 } 298} 299function getWhat(url) { 300 // fbq("trackCustom", "WhatsAppContact"); 301 setTimeout(function () { 302 window.open(url); 303 }, 300); //å使¯æ¯«ç§ 304} 305 306function delCart(id) { 307 console.log(id); 308 utils.getAjax({ 309 url: "/member.cart/del", 310 data: { cart_ids: [id] }, 311 success: (res) => { 312 if (res.code == 200) { 313 getCartList(); 314 } 315 }, 316 }); 317} 318function getChatUrl() { 319 utils.getAjax({ 320 url: " /goods/chatUrl", 321 success: function (res) { 322 if (res.code == 200 && !valid.isEmpty(res.data)) { 323 let url = res.data.service_platform_url; 324 let html = ""; 325 } 326 }, 327 }); 328} 329function resetAndSubmitForm() { 330 console.log(1); 331 var form = document.getElementById("myForm"); 332 var inputs = form.getElementsByTagName("input"); 333 var selects = form.getElementsByTagName("select"); 334 // æ¸ ç©ºææè¾å ¥å段 335 for (var i = 0; i < inputs.length; i++) { 336 inputs[i].value = ""; 337 } 338 console.log(2); 339 for (var i = 0; i < selects.length; i++) { 340 selects[i].value = ""; 341 } 342 console.log(3); 343 // 触å表åæäº¤ 344 form.submit(); 345 console.log(4); 346} 347 348function vrClick(obj) { 349 var url = $(obj).data("url"); 350 if (url != "") { 351 let prefix = url.substring(0, 6); 352 let pageW = $(window).width(); 353 let area = ["75%", "80%"]; 354 if (pageW < 800) { 355 area = ["90%", "90%"]; 356 } 357 if (prefix == "video#") { 358 this.vr_url_type = "video"; 359 url = url.substring(6, url.length); 360 layer.open({ 361 type: 1, 362 title: "", 363 area: area, 364 content: '<div id="vrVideo"></div>', 365 success: () => { 366 Do("aliplayer", function () { 367 player = new Aliplayer( 368 { 369 id: "vrVideo", 370 source: url, 371 width: "100%", 372 height: "100%", 373 autoplay: false, 374 skinLayout: [ 375 { name: "bigPlayButton", align: "cc" }, 376 { 377 name: "controlBar", 378 align: "blabs", 379 x: 0, 380 y: 0, 381 children: [ 382 { name: "progress", align: "blabs", x: 0, y: 44 }, 383 { name: "playButton", align: "tl", x: 15, y: 12 }, 384 { name: "timeDisplay", align: "tl", x: 10, y: 7 }, 385 { name: "fullScreenButton", align: "tr", x: 10, y: 12 }, 386 { name: "volume", align: "tr", x: 5, y: 10 }, 387 ], 388 }, 389 ], 390 }, 391 function (player) { 392 console.log("The player is created."); 393 } 394 ); 395 }); 396 }, 397 }); 398 } else { 399 layer.open({ 400 type: 2, 401 shadeClose: true, 402 area: area, 403 title: false, 404 content: url + "?is_back=-1", 405 }); 406 } 407 } 408} 409function goodsThumbInit() { 410 $(".goods-item-panel").each(function () { 411 let goodsThumb = $(this).find(".thumb"); 412 let src = goodsThumb.data("src"); 413 if (src != "") { 414 utils.getImageAspectRatio(src).then((res) => { 415 if (res.radio > 1) { 416 goodsThumb 417 .addClass("background-width") 418 .css("backgroundImage", `url('${src}')`); 419 } else { 420 goodsThumb 421 .addClass("background-height") 422 .css("backgroundImage", `url('${src}')`); 423 } 424 }); 425 } 426 }); 427} 428/** 429 * å¼¹çªææ¾è§é¢ 430 * @param url 431 */ 432function videoShow(url) { 433 if (url == "") return; 434 let pageW = $(window).width(); 435 let area = ["800px", "500px"]; 436 if (pageW < 800) { 437 area = ["90%", "90%"]; 438 } 439 layer.open({ 440 type: 1, 441 title: "", 442 area: area, 443 content: '<div id="vrVideo"></div>', 444 success: () => { 445 Do("aliplayer", function () { 446 player = new Aliplayer( 447 { 448 id: "vrVideo", 449 source: url, 450 width: "100%", 451 height: "100%", 452 autoplay: false, 453 skinLayout: [ 454 { name: "bigPlayButton", align: "cc" }, 455 { 456 name: "controlBar", 457 align: "blabs", 458 x: 0, 459 y: 0, 460 children: [ 461 { name: "progress", align: "blabs", x: 0, y: 44 }, 462 { name: "playButton", align: "tl", x: 15, y: 12 }, 463 { name: "timeDisplay", align: "tl", x: 10, y: 7 }, 464 { name: "fullScreenButton", align: "tr", x: 10, y: 12 }, 465 { name: "volume", align: "tr", x: 5, y: 10 }, 466 ], 467 }, 468 ], 469 }, 470 function (player) { 471 console.log("The player is created."); 472 } 473 ); 474 }); 475 }, 476 }); 477} 478 479/** 480 * å¾çé¢è§ 481 * @param url 482 * @param urls 483 */ 484function imageShow(obj) { 485 let url = $(obj).data("url"); 486 if (url == "") return; 487 let urls = $(obj).data("urls"); 488 if (typeof urls !== "object") urls = [url]; 489 console.log(urls, "urls"); 490 //if(urls.length==0) urls.push(url) 491 Do("previewImage", function () { 492 previewImage.start({ 493 current: url, // å½åæ¾ç¤ºå¾ççhttp龿¥ 494 urls: urls, // éè¦é¢è§çå¾çhttp龿¥å表 495 }); 496 }); 497} 498//ä¼ä¸è®¤è¯éªè¯ 499function checkMemberAuth(callFn, noLogin = null) { 500 utils.loading("show"); 501 checkLogin() 502 .then((res) => { 503 utils.loading("hide"); 504 if (res.is_company_need_auth == 1 && res.member_auth_status != 2) { 505 layer.confirm( 506 member_auth_tips, 507 { 508 skin: "custom-layer-confirm", 509 title: "", 510 btn: [sure_text, close_text], 511 }, 512 function (index) { 513 window.location.href = "/member.member/certification"; 514 layer.close(index); 515 } 516 ); 517 return false;
518 } else { 519 callFn && callFn(); 520 return true; 521 } 522 }) 523 .catch(() => { 524 utils.loading("hide"); 525 if (typeof noLogin === "function") { 526 noLogin && noLogin(); 527 return false; 528 } else { 529 noLoginTips(no_login_tips); 530 return false; 531 } 532 }); 533} 534function loginState() { 535 var html = ""; 536 checkLogin() 537 .then((res) => { 538 html = `<div class="dropdown my-account"> 539 <span class="item-icon global-iconfont"></span> 540 <a href="${member_url}" class="tit">${my_account_text}</a> 541 <ul class="dropdown-menu dropdown-menu-end has-arrow">`; 542 if (res["is_only_supplier"] == 0) { 543 html += ` 544 <li> 545 <a class="dropdown-item m-flex-box flex-align-center" href="/member-index.html"> 546 <span class="text">${user_center_text}</span> 547 </a> 548 </li> 549 <li> 550 <a class="dropdown-item m-flex-box flex-align-center" href="/member.inquiry/index"> 551 <span class="text">${my_RFQ_text}</span> 552 </a> 553 </li> 554 <li> 555 <a class="dropdown-item m-flex-box flex-align-center" href="/member.order/index"> 556 <span class="text">${my_order_text}</span> 557 </a> 558 </li>`; 559 } 560 561 if (res["is_supply"] == 1) { 562 html += ` <li> 563 <a class="dropdown-item m-flex-box flex-align-center" 564 href="/supply"> 565 <span class="text">${supplier_center_text}</span> 566 </a> 567 </li>`; 568 } 569 html += `<li><hr class="dropdown-divider"></li> 570 <li> 571 <a class="dropdown-item m-flex-box flex-align-center" 572 href="javascript:;" onclick="logOut()"> 573 <span class="text">${sign_out_text}</span> 574 </a> 575 </li> 576 </ul> 577 </div>`; 578 $("#header-member-state").html(html); 579 html = `<a href="/member.cart/index" class="handle"> 580 <span class="badge cart-badge" id="cart-badge"></span> 581 <span class="item-icon global-iconfont"></span> 582 <div class="tit">${shopping_cart_text}</div> 583 </a> 584 <div class="cart-list-dropdown" id="cart-list-dropdown"> 585 <div class="cart-list-box" id="cart-popup-detail"></div> 586 <div class="cart-list-footer"> 587 <a href="/member.cart/index.html" class="btn btn-main">${go_to_cart_text}</a> 588 </div> 589 </div>`; 590 $("#header-cart-box").html(html); 591 getCartList(); 592 }) 593 .catch((err) => { 594 html = `<span class="item-icon global-iconfont"></span> 595 <div class="tit"> 596 <a href="javascript:;" onclick="loginLink()" rel="nofollow">${sign_in_text}</a> 597 <span>/</span> 598 <a href="javascript:;" onclick="regLink()" rel="nofollow">${join_text}</a> 599 </div>`; 600 $("#header-member-state").html(html); 601 html = ` <a href="javascript:;" onclick="loginLink()" rel="nofollow" class="handle"> 602 <span class="item-icon global-iconfont"></span> 603 <div class="tit">${shopping_cart_text}</div> 604 </a>`; 605 $("#header-cart-box").html(html); 606 }); 607} 608function loginLink() { 609 if (isInPart == 1) { 610 loginPopup2() 611 } else { 612 window.location.href = login_url 613 } 614} 615function regLink() { 616 if (isInPart == 1) { 617 regPopup2() 618 } else { 619 window.location.href = register_url 620 } 621} 622function getCartList() { 623 utils.getAjax({ 624 url: "/member.cart/index", 625 success: (res) => { 626 if (res.code == 200) { 627 let list = []; 628 for (let i = 0; i < res.data.length; i++) { 629 list = [...res.data[i].list, ...list]; 630 } 631 let num = list.length; 632 //console.log(list,'list') 633 if (num > 0) {
634 $("#cart-badge") 635 .text(num > 99 ? "99+" : num) 636 .show(); 637 $("#cart-list-dropdown").addClass("has-item"); 638 } else { 639 $("#cart-badge").hide(); 640 $("#cart-list-dropdown").removeClass("has-item"); 641 } 642 var html = ""; 643 for (var i = 0; i < list.length; i++) { 644 var item = list[i]; 645 var goods_price = utils.formatNum(item.goods_price, 6, false); 646 html += `<div class="cart-item"> 647 <div class="goods-thumb" style="background-image:url(${item.goods_thumb})"></div> 648 <div class="goods-name">${item.goods_name}</div> 649 <div class="action"> 650 <div class="buy-info text-right"> 651 <span class="price"> 652 <!--å¸ç§--> 653 ${item.currency_symbol_show} ${goods_price} 654 </span> 655 </div> 656 <div class="text-right"> 657 <a href="javascript:;" onclick="delCart('${item.id}')" class="del-cart">${delete_text}</a> 658 </div> 659 </div> 660 </div>`; 661 } 662 $("#cart-popup-detail").html(html); 663 } 664 }, 665 }); 666} 667//ä¾§è¾¹æ åå§å 668function pageSidebarInit() { 669 if (!valid.isEmpty(whatsapp_url)) { 670 let logo = `${site_abbreviation}`; 671 if (!valid.isEmpty(invert_logo)) logo = `<img src="${invert_logo}" alt="">`; 672 var wathsappHtml = `<div id="whatsapp" class="whatsapp-sidebar"> 673 <a href="javascript:;" onclick="whatsappShow(2)" class="handle" title="Whatsapp"> 674 <i class="icon global-iconfont global-icon-liuyan1"></i> 675 </a> 676 <div class="whatsapp-popup"> 677 <div class="whatsapp-popup-header"> 678 <div class="head"> 679 <div class="logo"> ${logo}</div> 680 <a href="javascript:;" onclick="whatsappShow()" class="close global-iconfont global-icon-guanbi1"></a> 681 </div> 682 <div class="title">${whatsapp_popup_text.title}</div> 683 <div class="sub-title">${whatsapp_popup_text.sub_title}</div> 684 </div> 685 <div class="whatsapp-popup-content"> 686 <div class="message-item"> 687 <div class="avatar"></div> 688 <div class="message-content"> 689 <span class="horn"></span> 690 <span>${whatsapp_popup_text.message}</span> 691 </div> 692 </div> 693 </div> 694 <div class="whatsapp-popup-footer"> 695 <a href="javascript:;" onclick="getWhat('${whatsapp_url}')" class="whatsapp-btn"> 696 ${whatsapp_popup_text.btn_text} 697 </a> 698 </div> 699 </div> 700 </div>`; 701 if ($("#whatsapp").length == 0) { 702 $("body").append(wathsappHtml); 703 } 704 } 705 var sidebarHtml = ` 706 <div class="page-sidebar" id="page-sidebar"> 707 <ul class="tool-list"> 708 <li class="item" data-network="quote"> 709 <a href="/page-quote.html" class="item-a"> 710 <i class="item-icon global-iconfont global-icon-mubiao"></i> 711 <div class="item-title">${RFQ_text}</div> 712 </a> 713 </li> 714 <li class="item feedback" data-network="feedback"> 715 <a href="javascript:;" class="item-a" onclick="feedback()"> 716 <i class="item-icon global-iconfont global-icon-liuyan"></i> 717 <div class="item-title">${feedback_text}</div> 718 </a> 719 </li> 720 `; 721 if (!valid.isEmpty(app_download_json) && app_download_json.length > 0) { 722 let appItem = ``; 723 for (let i = 0; i < app_download_json.length; i++) { 724 let item = app_download_json[i]; 725 let link = `<a href="javascript:;'"><img src="${item.btn_img}" class="store-btn"></a>`; 726 if (item.link != "") 727 link = `<a href="${item.link}" target="_blank"><img src="${item.btn_img}" class="store-btn"></a>`; 728 appItem += `<div class="qrcode-item text-center"> 729 <div> 730 <img src="${item.qr_code}" class="qrcode-img"> 731 </div> 732 <div class="m-t-5">${link}</div> 733 </div>`; 734 } 735 sidebarHtml += ` <li class="item popup-box" data-network="app"> 736 <a href="javascript:;" class="item-a""> 737 <i class="item-icon global-iconfont global-icon-shouji"></i> 738 <div class="item-title">${APP_text}</div> 739 </a> 740 <div class="qrcode-box"> 741 <div class="title-img font-size-16 font-weight600"> 742 ${app_download_json[0]["sub_title"]} 743 </div> 744 <div class="text-center p-tb-5">${app_download_json[0]["desc"]}</div> 745 <div class="m-flex-box"> 746 ${appItem} 747 </div> 748 </div> 749 </li>`; 750 } 751 sidebarHtml += ` <li id="goTop" class="item go-top" style="display:none;"> 752 <a href="javascript:;" onclick="goTop()" class="item-a"> 753 <i class="item-icon global-iconfont global-icon-shangchuan"></i> 754 <div class="item-title">${TOP_text}</div> 755 </a> 756 </li> 757 </ul> 758 </div>`; 759 if ($("#page-sidebar").length == 0) { 760 $("body").append(sidebarHtml); 761 } 762} 763function whatsappShow(type = 1) { 764 if (type == 1) { 765 $("#whatsapp").removeClass("show"); 766 } else { 767 $("#whatsapp").addClass("show"); 768 } 769} 770//å¤´é¨æç´¢ 771function changeSearchType(obj) { 772 let name = $(obj).data("name"); 773 let value = $(obj).data("value"); 774 $("#head-select-type").find(".txt").text(name); 775 $('input[name="head_search_type"]').val(value); 776 if (name == "Products") { 777 page_search_url = "/goods/suggest"; 778 page_search_showName = "goods_name"; 779 } else { 780 page_search_url = "/shop/suggest"; 781 page_search_showName = "company_name"; 782 } 783} 784function searchInit(query, keyCode) { 785 if (keyCode == 13) { 786 pageSearch(); 787 } else { 788 if (valid.isEmpty(query)) return false;
789 var script = document.createElement("script"); 790 var link = 791 page_search_url + 792 "?keyword=" + 793 encodeURIComponent(query) + 794 "&callback=handleSearchResult"; 795 script.src = link; 796 document.body.appendChild(script); 797 } 798} 799function handleSearchResult(data) { 800 let keyword = $('input[name="keywords"]').val(); 801 if (data.keyword == keyword) { 802 if (!valid.isEmpty(data.list)) { 803 var html = "<ul>"; 804 for (var i = 0; i < data.list.length; i++) { 805 item = data.list[i]; 806 if (page_search_showName == "goods_name") { 807 html += ` <li><a href="${item.url}" target="_blank">${item.name}</a></li>`; 808 } else { 809 html += ` <li><a href="${item.url}" target="_blank">${item.company_name}</a></li>`; 810 } 811 } 812 html += "</ul>"; 813 $("#search-result-box").html(html); 814 $(".search-popup").show(); 815 } else { 816 $(".search-popup").hide(); 817 } 818 } 819} 820/** 821 * æå è½½åå§å 822 */ 823function lozadInit() { 824 Do("lozad", function () { 825 const observer = lozad(".lazy-img", { 826 load: function (el) { 827 let img = $(el).attr("data-src"); 828 let tagName = el.nodeName.toLowerCase(); 829 if (tagName === "img") { 830 $(el).attr("src", img); 831 } else { 832 $(el).css("background-image", "url(" + img + ")"); 833 } 834 }, 835 }); 836 const goodsThumbObserver = lozad(".goods-lazy-img", { 837 load: function (el) { 838 let img = $(el).attr("data-src"); 839 let style = { width: "100%" }; 840 let parent = $(el).parent("div"); 841 parent.addClass("loading"); 842 utils 843 .getImageAspectRatio(img) 844 .then((res) => { 845 if (res.radio < 1) style = { height: "100%" }; 846 $(el).attr("src", img).css(style); 847 parent.removeClass("loading"); 848 }) 849 .catch(() => { 850 $(el).attr("src", img).css(style); 851 parent.removeClass("loading"); 852 }); 853 }, 854 }); 855 observer.observe(); 856 goodsThumbObserver.observe(); 857 }); 858} 859var cookieSetAction = { 860 init: () => { 861 var html = `<div class="cookie-wrap" id="cookie-wrap"> 862 <div class="cookie-cont p-20"> 863 <div class="cont-lf"> 864 <div class="title font-size-18 font-weight600 m-b-15">${cookie_set_text["About Cookies On This Site"]} 865 </div> 866 <div class="cookie-desc font-size-14 text-gray text-justify"> 867 ${cookie_set_text["Cookies_desc"]} 868 </div> 869 </div> 870 <div class="cont-rt m-t-20"> 871 <div class="btn-wrap m-flex-box flex-center flex-align-center"> 872 <button type="button" class="btn btn-primary m-r-20 font-size-14" onclick="cookieSetAction.setAutoCookie()"> 873 ${cookie_set_text["I understand"]} 874 </button> 875 <button type="button" class="btn btn-outline-secondary font-size-14" onclick="cookieSetAction.cookiePopShow()"> 876 ${cookie_set_text["Cookie Settings"]} 877 </button> 878 </div> 879 </div> 880 </div> 881 <a href="javascript:;" onclick="cookieSetAction.closeCookiePop()" class="close"> 882 <i class="global-iconfont global-icon-guanbi1"></i> 883 </a> 884 </div>`; 885 if ($("#cookie-wrap").length == 0) { 886 $("body").append(html); 887 } 888 }, 889 checkCookie: function () { 890 var token = utils.cookie.get("set_cookie_token"); 891 if (!token) { 892 $("#cookie-wrap").show(); 893 } 894 }, 895 closeCookiePop: function () { 896 $("#cookie-wrap").hide(); 897 },
898 cookiePopShow: function () { 899 var html = ` 900 <div class="cookie-set-wrap"> 901 <a href="javascript:;" onclick="layer.closeAll()" class="close"> 902 <i class="global-iconfont global-icon-guanbi1"></i> 903 </a> 904 <div class="content"> 905 <div class="font-size-24 font-weight600 m-b-10">${cookie_set_text["Privacy Preference Center"]}</div> 906 <div class="font-size-16 line-height-28"> 907 ${cookie_set_text["cookies_desc_info"]} 908 </div> 909 <div class="font-size-18 font-weight600 m-t-30 m-b-20">${cookie_set_text["Manage Consent Preferences"]}</div> 910 <div class="switch-wrap m-flex-box flex-align-center flex-s"> 911 <div class="title font-size-16"> 912 ${cookie_set_text["Analytics Cookies"]} 913 </div> 914 <div class="form-switch"> 915 <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault"> 916 </div> 917 </div> 918 </div> 919 <div class="btn-wrap m-flex-box flex-end text-right m-t-20"> 920 <button type="button" class="btn btn-main m-r-20" onclick="cookieSetAction.setAutoCookie()">${cookie_set_text["I understand"]}</button> 921 <button type="button" class="btn btn-outline-secondary" onclick="cookieSetAction.setAutoCookie()">${cookie_set_text["Reject All"]}</button> 922 </div> 923 </div>`; 924 layer.open({ 925 type: 1, 926 skin: "custom-popup", 927 title: false, 928 area: ["860px", "480px"], //å®½é« 929 closeBtn: 0, 930 content: html, 931 }); 932 }, 933 setAutoCookie: function () { 934 var timer = new Date().getTime(); 935 let getTopLevelDomain = function () { 936 const url = new URL(window.location.href); 937 const hostname = url.hostname; 938 const parts = hostname.split(".").reverse(); 939 940 // é常顶级ååç±æå两é¨åç»æï¼ä¾å¦ .com, .co.uk 941 if (parts.length > 2) { 942 return `${parts[1]}.${parts[0]}`; 943 } else { 944 return hostname; 945 } 946 }; 947 let domain = getTopLevelDomain(); 948 utils.cookie.set("set_cookie_token", timer, { 949 domain: domain, 950 path: "/", 951 expires: 10 * 365 * 24 * 60 * 60, 952 }); 953 $("#cookie-wrap").hide(); 954 layer.closeAll(); 955 }, 956}; 957function redirectToLogin() { 958 checkLogin() 959 .then(() => {}) 960 .catch(() => { 961 noLoginTips("Not logged in, Please log in first"); 962 return false; 963 }); 964} 965 966// ç»å½è·åéªè¯æ è¯ 967function memberCustomerInfo() { 968 const deviceIdKey = localStorage.getItem( 969 "__ibi_device_id" 970 ); 971 utils.getAjax({ 972 url: "/member.Customer/info", 973 data: { originalId: deviceIdKey }, 974 success: function (res) {}, 975 }); 976} 977// ç¹å»åç±» 978function categoryMenu(obj){ 979 let url = $(obj).data('url') 980 window.open(url) 981 setTimeout(()=>{ 982 let categoryId = $(obj).data('pid') 983 let categoryName = $(obj).data('name') 984 window.$collectAction && $collectAction.goodsCateClick(categoryId,categoryName,'é¦é¡µ','') 985 },500) 986}
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.