PageSourceSearch

https://www.xztech.ai/Public/Cn/js/base-v4.3.0.min.js

js xztech.ai collected 2026-10-05 13:20:13 UTC 138,029 bytes, 2,905 lines download raw bytes

1(function(window) {
2    var ys = {};
3    var ys = window.ys || {}; 
4    var lenis_use = false;
5    // 滚动条隐藏与显示
6    var scrollbar = {
7        $html: $("html"),
8        $body: $("body"),
9        originalBodyPad: null,
10        scrollbarWidth: 0,
11        hide: function() {
12            this.$body = $("body");
13            this.checkScrollbar();
14            this.setScrollbar();
15            this.$html.css("overflow", "hidden");
16            // if (this.isMobileSafari()) {
17            //     this.$html.css({
18            //         width: "100%",
19            //         position: "fixed"
20            //     });
21            // }
22        },
23        show: function() {
24            this.$body = $("body");
25            this.$html.removeAttr("style");
26            this.resetScrollbar();
27        },
28        checkScrollbar: function() {
29            var fullWindowWidth = window.innerWidth
30            if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
31                var documentElementRect = document.documentElement.getBoundingClientRect();
32                fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
33            }
34            this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth;
35            this.scrollbarWidth = this.measureScrollbar();
36        },
37        setScrollbar: function() {
38            var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
39            this.originalBodyPad = document.body.style.paddingRight || ''
40            if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this
41                .scrollbarWidth)
42        },
43        measureScrollbar: function() {
44            var scrollDiv = document.createElement('div');
45            scrollDiv.style.position = "absolute";
46            scrollDiv.style.top = "-9999px";
47            scrollDiv.style.width = "50px";
48            scrollDiv.style.height = "50px";
49            scrollDiv.style.overflow = "scroll";
50
51            this.$body.append(scrollDiv);
52            var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
53            this.$body[0].removeChild(scrollDiv);
54            return scrollbarWidth;
55        },
56        resetScrollbar: function() {
57            this.$body.css('padding-right', 0);
58        },
59        isMobileSafari: function() {
60            var ua = navigator.userAgent.toLowerCase();
61            var isChrome = ua.indexOf("chrome") != -1;
62            var isSafari = ua.indexOf("safari") != -1;
63            var isMobile = ua.indexOf("safari") != -1;
64
65            if (!isChrome && isSafari && isMobile) {
66                return 1;
67            } else {
68                return 0;
69            }
70        }
71    };
72    ys.scrollbar = scrollbar;
73    $.extend(ys, {
74        // 页面平滑滚动
75        yxlenis: function(val, isUse) {
76            lenis_use = isUse || false;
77            if (lenis_use && window.Lenis) {
78                if (window.lenis) return; 
79                window.lenis = new Lenis({
80                    duration: val || 1.2
81                });
82                function raf(time) {
83                    if (window.lenis) { // 增加检查,防止销毁后报错
84                        window.lenis.raf(time);
85                        requestAnimationFrame(raf);
86                    }
87                }
88                requestAnimationFrame(raf);
89            }
90        },
91        /**
92         * @description 回到顶部
93         * @param {Number} duration - 时间(ms)
94         * @param {Number} pos - 时间(px)
95         */
96        goTop: function(duration,pos,callback) {
97            duration = duration || 500;
98            pos = pos || 0;
99            if (lenis_use && window.lenis && typeof window.lenis.scrollTo === 'function') {
100                window.lenis.scrollTo(pos, {
101                    duration: duration / 1000, 
102                    onComplete: callback 
103                });
104            } else {
105                $("html,body").stop().animate({ 
106                    scrollTop: pos 
107                }, duration, function() {
108                    callback && callback();
109                });
110            }
111        },
112        /**
113         * @description 同goTop类似,固定使用lenis滚动
114         * @param {Number} duration - 时间(ms)
115         * @param {Number} pos - 时间(px)
116         */
117        lenisTo: function(duration,pos,callback) {
118            if (!lenis_use || !window.lenis) {
119                console.warn('lenisTo: Lenis 未初始化,请确保已调用 yxlenis(val, true)');
120                return;
121            }
122            duration = (duration || 500) / 1000;
123            pos = pos || 0;
124            window.lenis.scrollTo(pos, {
125                offset: 0,
126                immediate: false,
127                duration: duration,
128                easing: t => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2,
129                onComplete: callback 
130            });
131        },
132        lenisStop:function(){
133            if (lenis_use && window.lenis){
134                window.lenis.stop();
135            }
136        },
137        lenisStart:function(){
138            if (lenis_use && window.lenis){
139                window.lenis.start();
140            }
141        },
142        /**
143         * @description 滚动条初始化
144         * @param {String} selector - css选择器
145         * @param {Boolean} inside - 滚动条占用内容区
146         * @param {String} inside - 滚动条方向
147         */
148        mCustomScrollbarInit:function(selector, inside, axis) {
149            var $obj = $(selector);
150            if ($obj.length === 0) {
151                console.warn('mCustomScrollbarInit: 未找到元素', selector);
152                return this;
153            }
154            var scrollbarAxis = axis ? axis : "y";
155            var scrollbarPosition = inside ? "inside" : "outside";
156            $obj.mCustomScrollbar({
157                axis: scrollbarAxis,
158                scrollInertia: 500,
159                theme: 'dark',
160                scrollbarPosition: scrollbarPosition,
161            });
162            $obj.on('click.mCSB', '.mCSB_scrollTools', function(e) {
163                e.stopPropagation();
164            });
165            return this;
166        },
167        /**
168         * @description 当滚动条离开最顶部给选择元素加一个类名isfixed
169         * 距离顶部超过pos时加类名isfixed,否则移除类名
170         * pc端鼠标移入时加类名ishover,否则移除类名
171         * @param {String} selector - css选择器
172         * @param {Number} pos - 滚动体离开位置(px)
173         */
174        isFixed:function(selector, pos) {
175            var $obj = $(selector);
176            if ($obj.length === 0) {
177                console.warn('isFixed: 未找到元素', selector);
178                return;
179            }
180            pos = pos || 0;
181            var resizeTimer;
182            function judgeTop() {
183                var scrollTop = window.pageYOffset || $(window).scrollTop();
184                $obj.toggleClass("isfixed", scrollTop > pos);
185            }
186            function bindHover() {
187                var isTouch = 'ontouchstart' in window;
188                if (window.innerWidth > 1199 && !isTouch) {
189                    $obj.off('mouseenter.isFixed mouseleave.isFixed')
190                        .on('mouseenter.isFixed', function() {
191                            $(this).addClass('ishover');
192                        })
193                        .on('mouseleave.isFixed', function() {
194                            $(this).removeClass('ishover');
195                        });
196                } else {
197                    $obj.off('mouseenter.isFixed mouseleave.isFixed').removeClass('ishover');
198                }
199            }
200            $(function() {
201                judgeTop();
202                bindHover();
203                $(window).on("scroll.isFixed", judgeTop).on("resize.isFixed", function() {
204                    clearTimeout(resizeTimer);
205                    resizeTimer = setTimeout(function() {
206                        judgeTop();
207                        bindHover();
208                    }, 100);
209                });
210            });
211        },
212        /**
213         * @description 数字滚动
214         * @param {String} selector - css选择器
215         * @param {Boolean} addZero - 是否补0
216         * @param {Number} speed - 滚动速度(ms)
217         */
218        numRoll: function(selector, addZero, speed) {
219            var $ele = $(selector);
220            if ($ele.length === 0) return;
221            speed = speed || 1000;   
222            function toThousands(num) {
223                var parts = num.toString().split('.');
224                parts[0] = parts[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
225                return parts.join('.');
226            }  
227            if (!$.fn.appear || !$.fn.countTo) return;
228            $ele.each(function() {
229                var $this = $(this);
230                if (!$this.data('numRoll-init')) {
231                    var content = $this.data("to");
232                    if (content) $this.attr('data-save', content);
233                    $this.data('numRoll-init', true);
234                }
235            });
236            $ele.appear(function() {
237                var $this = $(this);
238                var realContent = $this.text().trim();
239                // 停止前一次动画
240                $this.stop(true, true).removeAttr('style');
241                $this.width($this.width());
242                
243                var fromNum = parseFloat($this.data("from")) || 0;
244                var content = $this.data("to") || realContent;
245                var savedData = $this.data("save");
246                
247                var targetNum = parseFloat(content.toString().replace(/,/g, "").replace(/[^\d.]/g, ''));
248                var decimalPlaces = (targetNum.toString().split('.')[1] || '').length;
249                var targetIntLength = parseInt(targetNum).toString().length;
250                var hasComma = content.toString().indexOf(',') !== -1;
251                
252                var formatter = function(value, options) {
253                    var myValue = value.toFixed(decimalPlaces);
254                    var parts = myValue.split('.');
255                    if (addZero) {
256                        var intPart = parts[0];
257                        while (intPart.length < targetIntLength) {
258                            intPart = "0" + intPart;
259                        }
260                        parts[0] = intPart;
261                        myValue = parts.join('.');
262                    }                   
263                    if (hasComma || parseInt(parts[0]) >= 1000) {
264                        myValue = toThousands(myValue);
265                    }
266                    return myValue;
267                };
268                if (!isNaN(targetNum)) {
269                    $this.countTo({
270                        from: fromNum,
271                        to: targetNum,
272                        speed: speed,
273                        refreshInterval: 60,
274                        decimals: decimalPlaces,
275                        formatter: formatter,
276                        onComplete: function() {
277                            $this.removeAttr("style").text(savedData || realContent);
278                        }
279                    });
280                }
281            }, { one: false }); 
282        },
283        /**
284         * @description banner轮播视频初始化
285         * @param {String} selector - css选择器
286         */
287        banVideo: function(selector) {
288            var $obj = $(selector);
289            var autoplay = true;
290            var timers = []; // 存储定时器用于清理
291            var isInitialized = false;
292            // 清理函数
293            function clearTimers() {
294                timers.forEach(clearTimeout);
295                timers = [];
296            }
297            function stopAllVideos() {
298                $obj.find("video").each(function() {
299                    var video = $(this).get(0);
300                    video.pause();
301                    video.currentTime = 0;
302                    video.onended = null;
303                });
304            }
305            function bindVideoEnd($video) {
306                if ($video.length === 0) return;
307                var video = $video.get(0);
308                video.onended = function() {
309                    if (autoplay && $obj.get(0).slick) {  // 检查 slick 是否存在
310                        $obj.slick('slickNext');
311                        $obj.slick('slickPlay');
312                    }
313                };
314            }
315            function handleSlideChange(slick, index) {
316                clearTimers();
317                stopAllVideos();
318                var $nowSlide = $(slick.$slides[index]);
319                var $video = $nowSlide.find("video");
320                if ($video.length > 0) {
321                    $obj.slick('slickPause');         
322                    // 延迟播放确保 DOM 就绪
323                    var timer = setTimeout(function() {
324                        if ($video.length > 0 && $video.is(':visible')) {
325                            $video.get(0).play().catch(function(e) {
326                                console.warn('Video play failed:', e);
327                                // 播放失败时恢复轮播
328                                if (autoplay) $obj.slick('slickPlay');
329                            });
330                        }
331                    }, 50);
332                    timers.push(timer);
333                    bindVideoEnd($video);
334                } else if (autoplay) {
335                    $obj.slick('slickPlay');
336                }
337            }
338            if (window.innerWidth > 1199 && $obj.find("video").length > 0) {
339                if (isInitialized) return;  // 防止重复初始化
340                isInitialized = true;
341                // 解绑旧事件(保险起见)
342                $obj.off('.banVideo');
343                clearTimers();
344                // 初始化第一张
345                var $firstSlide = $obj.find(".slick-slide[data-slick-index=0]");
346                var $firstVideo = $firstSlide.find("video");
347                if ($firstVideo.length > 0) {
348                    $obj.slick('slickPause');
349                    if ($obj.get(0).slick.slideCount < 2) {
350                        $firstVideo.attr("loop", "loop");
351                    }
352                    if ($firstVideo.get(0).paused) {
353                        var timer = setTimeout(function() {
354                            $firstVideo.get(0).play().catch(function(e) {
355                                console.warn('First video autoplay failed:', e);
356                            });
357                        }, 100);
358                        timers.push(timer);
359                    }
360                    bindVideoEnd($firstVideo);
361                }
362                // 绑定切换事件
363                $obj.on('afterChange.banVideo', function(event, slick, index) {
364                    handleSlideChange(slick, index);
365                });
366            } else {
367                // 移动端
368                $obj.slick('slickPlay');
369                // 彻底停止视频(不移除 DOM,以便窗口变大时恢复)
370                $obj.find("video").each(function() {
371                    var $v = $(this);
372                    var video = $v.get(0);
373                    video.pause();
374                    video.src = '';      // 停止缓冲
375                    video.load();        // 重置
376                    $v.hide();
377                });
378            }
379            var banvideo = {
380                play: function() {
381                    autoplay = true;
382                    $obj.slick('slickPlay');
383                },
384                pause: function() {
385                    autoplay = false;
386                    $obj.slick('slickPause');
387                },
388                destroy: function() {
389                    $obj.off('.banVideo');  // 移除所有 .banVideo 命名空间事件
390                    clearTimers();
391                    stopAllVideos();
392                    isInitialized = false;
393                },
394                refresh: function() {
395                    this.destroy();
396                }
397            }
398            return banvideo;
399        },
400        // 暂停所有slick轮播
401        stopSlick: function() {
402            $(".slick-slider").each(function() {
403                var $slider = $(this);
404                // 检查是否已初始化
405                if ($slider.hasClass('slick-initialized')) {
406                    $slider.slick('slickPause');
407                }
408            });
409        },
410        /**
411         * @description 弹窗蒙层
412         * @param {String} btn  弹窗触发按钮(选择器) 
413         * @param {String} modal     对应弹窗(选择器)
414         * @param {String} scrollEle     滚动条元素(选择器)
415         * @param {Function} data     数据对应
416         */
417        modal: function(btn, modal, scrollEle, data) {
418            var $modal = $(modal);
419            var eventNs = '.modal_' + modal.replace(/[#.\s\[\]]/g, '_');  // 唯一命名空间
420            // 清理旧事件(防止重复绑定)
421            $("body").off(eventNs);
422            $(document).off(eventNs);
423            // 数据填充函数(移出闭包)
424            function fillData($btn, data) {
425                $.each(data, function(index, item) {
426                    var selector = item[0], target = item[1], type = item[2], attr = item[3];
427                    var $from = $btn.find(selector).length ? $btn.find(selector) : $btn;
428                    var $to = $modal.find(target);
429                    switch(type) {
430                        case 'img':
431                            $to.attr('src', $from.attr('src'));
432                            break;
433                        case 'attr':
434                            $to.text($from.attr(attr));
435                            break;
436                        case 'html':
437                            $to.html($from.html());
438                            break;
439                        case 'text':
440                        default:
441                            $to.text($from.text().trim());
442                    }
443                });
444            }
445            // 显示
446            $("body").on("click" + eventNs, btn, function(e) {
447                e.preventDefault();
448                var $btn = $(this);
449                // 填充数据
450                if (data) fillData($btn, data);
451                // 显示弹窗
452                $modal.stop().fadeIn(function() {
453                    // 焦点管理:移到弹窗内第一个可聚焦元素
454                    $modal.attr('tabindex', '-1').focus();
455                    // 或聚焦关闭按钮:$modal.find('.ys-modal-close').focus();
456                });
457                // 禁用背景滚动
458                if (typeof scrollbar !== 'undefined') scrollbar.hide();
459                if (window.lenis && lenis_use) window.lenis.stop();
460                // 阻止背景滚动(iOS)
461                $('body').addClass('modal-open');
462            });
463            // 关闭函数(复用)
464            function closeModal() {
465                $modal.stop().fadeOut(function() {
466                    // 恢复滚动
467                    if (typeof scrollbar !== 'undefined') scrollbar.show();
468                    if (window.lenis && lenis_use) window.lenis.start();
469                    $('body').removeClass('modal-open');
470                    // 清空数据
471                    if (data) {
472                        $.each(data, function(i, item) {
473                            $modal.find(item[1]).empty();
474                        });
475                    }
476                    // 重置滚动位置
477                    if ($modal.hasClass('ys-modal-update')) {
478                        var scrollEl = $modal.find('.ys-modal-content')[0] || $modal[0];
479                        scrollEl.scrollTop = 0;  // 简单重置
480                    }
481                });
482                // 返回焦点到触发按钮(需要存储)
483                if ($modal.data('triggerBtn')) {
484                    $modal.data('triggerBtn').focus();
485                }
486            }
487            // 关闭按钮
488            $("body").on("click" + eventNs, ".ys-modal-close", closeModal);
489            // 遮罩关闭
490            $("body").on("click" + eventNs, ".ys-modal-mask", function(e) {
491                if (e.target === this) closeModal();  // 确保是点击遮罩本身
492            });
493            // ESC 键关闭
494            $(document).on("keydown" + eventNs, function(e) {
495                if (e.key === 'Escape' && $modal.is(':visible')) {
496                    closeModal();
497                }
498            });
499            // 初始化滚动条(仅一次)
500            var actualScrollEle = scrollEle || ".ys-modal-content";
501            if (!$modal.hasClass('ys-modal-update') && actualScrollEle !== "noscroll") {
502                var $scroller = $modal.find(actualScrollEle);
503                if ($scroller.length && !$scroller.hasClass('mCustomScrollbar')) {
504                    $scroller.mCustomScrollbar({
505                        axis: "y",
506                        scrollInertia: 500,
507                        theme: 'dark',
508                        mouseWheel: { preventDefault: true }  // 防止冒泡
509                    });
510                }
511            } else if (actualScrollEle === "noscroll") {
512                $modal.find(".ys-modal-content").addClass("noscroll");
513            }
514            // 返回控制对象(可选)
515            return {
516                open: function($triggerBtn) {
517                    $modal.data('triggerBtn', $triggerBtn);
518                    $modal.stop().fadeIn();
519                },
520                close: closeModal,
521                destroy: function() {
522                    $("body").off(eventNs);
523                    $(document).off(eventNs);
524                    if ($modal.find('.mCustomScrollbar').length) {
525                        $modal.find('.mCustomScrollbar').mCustomScrollbar('destroy');
526                    }
527                }
528            };
529        },
530        /**
531         * @description 视频弹窗
532         * @param {selector} selector - css选择器
533         * @param {Boolean} autoplay - 是否弹窗自动播放video
534         * @param {selector} btn - 其他点击类名
535         */
536        videomodal: function(selector, autoplay) {
537            // 默认 autoplay 为 true,但允许显式传入 false
538            autoplay = (autoplay !== false);
539            var $videomodal;
540            var eventNs = '.videomodal_' + selector.replace(/[#.\s\[\]]/g, '_');
541            // 清理旧事件(防止重复调用)
542            $("body").off("click" + eventNs);
543            $(document).off("keydown" + eventNs);
544            // 插入或获取视频模版(单例模式)
545            if ($(".ys-videom").length > 0) {
546                $videomodal = $(".ys-videom");
547            } else {
548                var videomodalHtml =
549                    '<div class="ys-videom" role="dialog" aria-modal="true" tabindex="-1">' +
550                        '<div class="ys-modal-mask"></div>' +
551                        '<div class="ys-videom-container">' +
552                            '<button class="ys-videom-close" aria-label="关闭视频">' +
553                                '<i class="iconfont icon-close"></i>' +
554                            '</button>' +
555                            '<div class="ys-videom-content">' +
556                                '<div class="ys-videom-iframebox"></div>' +
557                            '</div>' +
558                        '</div>' +
559                    '</div>';
560                $videomodal = $(videomodalHtml);
561                $("body").append($videomodal);
562            }
563            // 内部事件只绑定一次
564            if (!$videomodal.data('events-bound')) {
565                $videomodal.on("click.videomodal", ".ys-videom-close, .ys-modal-mask", function(e) {
566                    if ($(e.target).is('.ys-videom-close, .ys-modal-mask, .icon-close')) {
567                        Vmodal.close();
568                    }
569                });
570                $videomodal.data('events-bound', true);
571            }
572            var Vmodal = {
573                $self: $videomodal,
574                $triggerBtn: null,  // 存储触发按钮
575                close: function() {
576                    // 恢复滚动
577                    if (typeof scrollbar !== 'undefined') scrollbar.show();
578                    if (window.lenis && typeof lenis_use !== 'undefined' && lenis_use) {
579                        window.lenis.start();
580                    }
581                    // 清理视频(先暂停再移除)
582                    var $video = $videomodal.find(".ys-videom-video");
583                    if ($video.length) {
584                        var video = $video.get(0);
585                        video.pause();
586                        video.src = '';
587                        video.load();
588                        $video.remove();
589                    }
590                    // 清理 iframe
591                    $videomodal.find(".ys-videom-iframebox").hide().empty();
592                    // 隐藏弹窗
593                    $videomodal.hide().removeAttr('aria-hidden');
594                    // 返回焦点
595                    if (this.$triggerBtn) {
596                        this.$triggerBtn.focus();
597                    }
598                    // 解绑 ESC
599                    $(document).off("keydown" + eventNs);
600                },
601                show: function($trigger) {
602                    this.$triggerBtn = $trigger;  // 保存触发按钮
603                    scrollbar.hide();
604                    if (window.lenis && typeof lenis_use !== 'undefined' && lenis_use) {
605                        window.lenis.stop();
606                    }
607                    $videomodal.show().attr('aria-hidden', 'false');
608                    // 焦点转移到关闭按钮或弹窗
609                    setTimeout(function() {
610                        $videomodal.find('.ys-videom-close').focus();
611                    }, 100);
612                    // 绑定 ESC 关闭
613                    var self = this;
614                    $(document).on("keydown" + eventNs, function(e) {
615                        if (e.key === 'Escape') {
616                            self.close();
617                        }
618                    });
619                }
620            };
621            // 触发按钮点击
622            $("body").on("click" + eventNs, selector, function(e) {
623                e.preventDefault();
624                var $btn = $(this);
625                var videoType = $btn.attr("data-type");
626                var videoSrc = $btn.attr("data-src");
627                if (!videoSrc) return;
628                if (videoType === "video") {
629                    // 清理旧视频
630                    $videomodal.find(".ys-videom-video").remove();
631                    var videoPoster = $btn.data("poster") || '';
632                    var isMobile = window.innerWidth < 767;
633                    var isExternal = /^https?:\/\//.test(videoSrc);
634                    // 创建视频元素(安全方式)
635                    var $video = $('<video>')
636                        .addClass('ys-videom-video')
637                        .css('display', 'block')
638                        .attr({
639                            playsinline: true,
640                            controls: true,
641                            poster: videoPoster
642                        });
643                    // 移动端外部视频特殊处理(自动播放策略)
644                    if (isMobile && isExternal && autoplay) {
645                        $video.attr('muted', true);
646                    }
647                    // 安全设置 src
648                    $('<source>').attr('src', videoSrc).appendTo($video);
649                    $videomodal.find(".ys-videom-content").append($video);
650                    Vmodal.show($btn);
651                    // 自动播放
652                    if (autoplay) {
653                        var playPromise = $video.get(0).play();
654                        if (playPromise !== undefined) {
655                            playPromise.catch(function(err) {
656                                console.warn('Autoplay prevented:', err);
657                                // 显示播放按钮提示用户手动播放
658                            });
659                        }
660                    }
661                } else if (videoType === "iframe") {
662                    // 验证 URL 安全
663                    // if (!/^https?:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com|bilibili\.com|player\.bilibili\.com)/.test(videoSrc)) {
664                    //     console.error('Unsafe iframe URL:', videoSrc);
665                    //     return;
666                    // }
667                    // 处理自动播放参数
668                    var finalSrc = "";
669                    var rawInput = videoSrc.trim();
670                    if (rawInput.toLowerCase().indexOf('<iframe') > -1) {
671                        var match = rawInput.match(/src=["']?([^"'\s>]+)["']?/i);
672                        if (match && match[1]) {
673                            finalSrc = match[1];
674                        } else {
675                            finalSrc = rawInput; 
676                        }
677                    } else {
678                        finalSrc = rawInput;
679                    }
680                    var separator = finalSrc.indexOf('?') > -1 ? '&' : '?';
681                    var autoplayParam = autoplay ? separator + 'autoplay=1' : '';
682                    
683                    var absoluteUrl = finalSrc + autoplayParam;
684
685                    var $iframe = $('<iframe>').attr({
686                        src: absoluteUrl,
687                        frameborder: 0,
688                        allowfullscreen: true,
689                        allow: 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'
690                    });
691
692                    // 填充到容器并显示
693                    $videomodal.find(".ys-videom-iframebox").show().empty().append($iframe);
694                    Vmodal.show($btn);
695                } else {
696                    return;
697                }
698            });
699            return Vmodal;  // 返回控制对象供外部使用
700        },
701        /**
702         * @description 解决bshare乱码
703         * @param {String} title - 分享的标题文字
704         * @param {String} summary - 分享的内容文字
705         */
706        shareInit: function(title, summary) {
707            var _this = this;
708            var pageTitle = title || $("h1").text().trim();
709            var pageSummary = summary || $("p").eq(0).text().replace(/\s+/g, " "); 
710            
711            var encodedTitle = encodeURIComponent(pageTitle);
712            var encodedSummary = encodeURIComponent(pageSummary);
713            var currentUrl = encodeURIComponent(window.location.href);
714            var rawUrl = window.location.href;      
715            
716            var eventNs = '.shareinit';
717
718            // ========== 微信分享保持不变(弹窗二维码)==========
719            if (!$(".ys-share-wechat").data('share-bound')) {
720                $(".ys-share-wechat").data('share-bound', true).on("click" + eventNs, function(e) {
721                    e.preventDefault();
722                    var $wechatpop;
723                    // 插入或获取弹窗
724                    if ($(".ys-wechat").length > 0) {
725                        $wechatpop = $(".ys-wechat");
726                    } else {
727                        var wechatHtml =
728                            '<div class="ys-wechat" role="dialog" aria-modal="true">' +
729                                '<div class="ys-modal-mask"></div>' +
730                                '<div class="ys-wechat-cont">' +
731                                    '<div id="qrcode">' +
732                                        '<div class="ys-wechat-cont-parga"><p></p></div>' +
733                                        '<div class="ys-wechat-cont-btn" aria-label="关闭">' +
734                                            '<i class="iconfont icon-close"></i>' +
735                                        '</div>' +
736                                    '</div>' +
737                                '</div>' +
738                            '</div>';
739                        $wechatpop = $(wechatHtml);
740                        $("body").append($wechatpop);
741                        // 事件只绑定一次
742                        $wechatpop.on("click" + eventNs, ".ys-wechat-cont-btn, .ys-modal-mask", function() {
743                            $wechatpop.stop().fadeOut(function() {
744                                if (typeof scrollbar !== 'undefined') scrollbar.show();
745                                if (window.lenis && typeof lenis_use !== 'undefined' && lenis_use) {
746                                    window.lenis.start();
747                                }
748                            });
749                        });
750                        // ESC 关闭
751                        $(document).on("keydown" + eventNs, function(e) {
752                            if (e.key === 'Escape' && $wechatpop.is(':visible')) {
753                                $wechatpop.find('.ys-wechat-cont-btn').trigger('click');
754                            }
755                        });
756                    }
757                    // 清空旧二维码(支持 canvas 和 img)
758                    $wechatpop.find("#qrcode canvas").remove();
759                    $wechatpop.find("#qrcode img").remove();
760                    // 生成新二维码
761                    if ($.fn.qrcode) {
762                        $('#qrcode').qrcode({
763                            text: rawUrl,
764                            width: 200,
765                            height: 200
766                        });
767                    } else {
768                        console.error('qrcode plugin not loaded');
769                        // 回退:显示 URL 文本
770                        $('#qrcode').html('<p style="word-break:break-all;">' + rawUrl + '</p>');
771                    }
772                    // 显示弹窗
773                    $wechatpop.stop().fadeIn(function() {
774                        $(this).find('.ys-wechat-cont-btn').focus(); // 焦点管理
775                    });
776                    if (typeof scrollbar !== 'undefined') scrollbar.hide();
777                    if (window.lenis && typeof lenis_use !== 'undefined' && lenis_use) {
778                        window.lenis.stop();
779                    }
780                });
781            }
782
783            // ========== 社交平台分享(新标签页打开)==========
784            var sharePlatforms = [
785                { selector: '.ys-share-sinaminiblog', url: 'https://service.weibo.com/share/share.php?url={url}&title={title}%20-{summary}' },
786                { selector: '.ys-share-twitter', url: 'https://twitter.com/intent/tweet?text={title}%20{url}' },
787                { selector: '.ys-share-facebook', url: 'https://www.facebook.com/sharer/sharer.php?u={url}' },
788                { selector: '.ys-share-linkedin', url: 'https://www.linkedin.com/sharing/share-offsite/?url={url}' },
789                { selector: '.ys-share-qq', url: 'https://connect.qq.com/widget/shareqq/index.html?url={url}&title={title}&summary={summary}' }
790            ];
791
792            sharePlatforms.forEach(function(platform) {
793                var $btn = $(platform.selector);
794                if ($btn.length && !$btn.data('share-bound')) {
795                    $btn.data('share-bound', true)
796                        .css("cursor", "pointer")
797                        .on("click" + eventNs, function(e) {
798                            e.preventDefault();
799                            e.stopPropagation(); // 关键:阻止冒泡到父级 a 标签
800
801                            var shareUrl = platform.url
802                                .replace('{url}', currentUrl)
803                                .replace('{title}', encodedTitle)
804                                .replace('{summary}', encodedSummary);
805
806                            // 核心修改:不传任何尺寸参数,浏览器会直接开新标签页
807                            // 使用 "_blank" 配合 "noopener,noreferrer" 确保性能和安全
808                            window.open(shareUrl, "_blank", "noopener,noreferrer");
809                        });
810                }
811            });
812        },
813        /**
814         * @description 通过js调用animate.css的动画
815         * @param {String} ele - 动画的元素
816         * @param {String} animate - 动画的名字
817         * @param {Function} callback - 动画执行完的回调函数
818         */
819        animateCss: function(ele, animate, callback) {
820            var $ele = $(ele);
821            var duration = $ele.css('animation-duration');
822            duration = (duration === '0s' || !duration) ? 1000 : parseFloat(duration) * 1000;
823            // 先移除再添加,确保动画能重复触发
824            $ele.removeClass('animated ' + animate);
825            void $ele[0].offsetWidth; // 强制重绘
826            $ele.addClass('animated ' + animate);
827            if (callback === 'show') $ele.stop().show();
828            setTimeout(function() {
829                $ele.removeClass('animated ' + animate);
830                if (callback === 'hide') {
831                    $ele.stop().hide();
832                } else if (typeof callback === 'function') {
833                    callback();
834                }
835            }, duration);
836        },
837        //检查页面是否缩放
838        checkViewport: function() {
839            var zoom = 1;
840            var isZoomed = false;
841            // 更准确的检测:比较视觉视口与布局视口
842            if (window.visualViewport && window.visualViewport.scale) {
843                zoom = window.visualViewport.scale;
844                isZoomed = (zoom !== 1);
845            }
846            // 备用方案
847            if (window.outerWidth && window.innerWidth) {
848                zoom = Math.round((window.outerWidth / window.innerWidth) * 100) / 100;
849                // 容差:允许 0.95-1.05
850                isZoomed = (zoom < 0.95 || zoom > 1.05);
851            }
852            // IE
853            if (window.screen && window.screen.deviceXDPI) {
854                zoom = window.screen.deviceXDPI / window.screen.logicalXDPI;
855                isZoomed = (zoom !== 1);
856            }
857            if (isZoomed) {
858                alert('当前页面缩放比例为 ' + Math.round(zoom * 100) + '%,请设置成 100%');
859            }
860        },
861        // 重新加载main.css和midea.css
862        reloadCss: function(options) {
863            const defaults = {
864                targetFiles: ['main.css', 'media.css'],  // 目标文件
865                attribute: 'href',                       // 链接属性
866                excludeExternal: true,                   // 排除外部链接
867                forceReload: false                       // 所有link都加时间戳
868            };
869            const settings = $.extend({}, defaults, options);
870            $("link[rel='stylesheet']").each(function() {
871                const $link = $(this);
872                let href = $link.attr(settings.attribute);
873                // 跳过无效链接
874                if (!href || href === 'undefined') return;
875                // 排除外部链接
876                if (settings.excludeExternal && (href.indexOf('//') === 0 || href.indexOf('http') === 0)) {
877                    // 检查是否同源
878                    if (href.indexOf(location.host) === -1) return;
879                }
880                // 检查是否匹配目标文件
881                const shouldReload = settings.targetFiles.some(function(file) {
882                    return href.indexOf(file) !== -1;
883                });
884                if (shouldReload || settings.forceReload) {
885                    // 移除旧的时间戳,避免重复追加
886                    href = href.replace(/\?.*$/, '').replace(/&.*$/, '');
887                    // 添加新时间戳
888                    const timestamp = new Date().getTime();
889                    const separator = href.indexOf('?') !== -1 ? '&' : '?';
890                    $link.attr(settings.attribute, href + separator + 't=' + timestamp);
891                }
892            });
893        },
894        /**
895         * @description 锚点定位
896         * @param {String} tp - 路由拼接
897         * @param {Number} navHeight - pc导航高度
898         * @param {Number} time - 滑动的时间
899         */
900        yxtop:function(param) {
901            var head1 = parseFloat($('html').css('--headh')) || 0;
902            var dataDef = {
903                navHeight: head1,
904                time: 500,
905                tp: "",
906                delay: 0,
907                mobileBreakpoint: 1200,    // 断点可配置
908                mobileNavHeight: 56,       // 移动端导航高度
909                offset: 0,                 // 额外偏移量
910                force: false               // 是否强制滚动(即使无 tp 参数)
911            };
912            var data = $.extend({}, dataDef, param);
913            function doScroll(targetTp, pushState) {
914                var navHeight = data.navHeight;
915                if (window.innerWidth < data.mobileBreakpoint) {
916                    navHeight = data.mobileNavHeight;
917                }
918                var target = $('[data-section="' + targetTp + '"]');
919                if (target.length === 0) {
920                    console.warn('yxtop: 未找到目标元素 [data-section="' + targetTp + '"]');
921                    return false;
922                }
923                var scrollTop = target.offset().top - navHeight - data.offset;
924                scrollTop = Math.max(0, scrollTop);
925                $("html, body").stop().animate({
926                    scrollTop: scrollTop
927                }, data.time);
928                // 更新 URL,可选
929                if (pushState !== false) {
930                    history.pushState(null, null, '#section=' + targetTp);
931                }
932                return true;
933            }
934            function init(config) {
935                var tp = config.tp;
936                var hash = window.location.hash;
937                if (hash) {
938                    // 支持 #section=xxx 或 #xxx 或 #sectionxxx 三种格式
939                    if (hash.indexOf('tp=') !== -1) {
940                        tp = hash.replace(/^#tp=/, '').replace(/^#/, '');
941                    }else if(hash.indexOf('tp') !== -1){
942                        tp = hash.replace(/^#tp/, '').replace(/^#/, '');
943                    }else if (hash.indexOf('section=') !== -1) {
944                        tp = hash.replace(/^#section=/, '').replace(/^#/, '');
945                    }else if(hash.indexOf('section') !== -1){
946                        tp = hash.replace(/^#section/, '').replace(/^#/, '');
947                    } else {
948                        tp = hash.replace(/^#/, '');
949                    }
950                }
951                if (!tp && !config.force) return; // 无目标且不强制,直接退出
952                doScroll(tp, false);
953            }
954            function bindClick() {
955                $(document).off('click.yxtop').on('click.yxtop', 'a[href^="#"]', function(e) {
956                    var href = $(this).attr('href');
957                    if (!href || href === '#') return;
958                    var targetTp;
959                    // 支持 #section=xxx 或 #xxx 或 #sectionxxx 三种格式
960                    if (href.indexOf('tp=') !== -1) {
961                        targetTp = href.replace(/^#tp=/, '').replace(/^#/, '');
962                    }else if(href.indexOf('tp') !== -1){
963                        targetTp = href.replace(/^#tp/, '').replace(/^#/, '');
964                    }else if (href.indexOf('section=') !== -1) {
965                        targetTp = href.replace(/^#section=/, '').replace(/^#/, '');
966                    }else if(href.indexOf('section') !== -1){
967                        targetTp = href.replace(/^#section/, '').replace(/^#/, '');
968                    } else {
969                        targetTp = href.replace(/^#/, '');
970                    }
971                    // 阻止默认锚点行为,强制滚动
972                    e.preventDefault();
973                    doScroll(targetTp, true);
974                });
975            }
976            bindClick();
977            $(window).on("load.yxtop hashchange.yxtop", function() {
978                init(data);
979            });
980            if(data.delay>0){
981                setTimeout(function(){
982                    init(data);
983                }, data.delay);
984            }
985            return {
986                scrollTo: function(tp, customOffset) {
987                    // 支持编程式调用
988                    var originalOffset = data.offset;
989                    if (customOffset !== undefined) {
990                        data.offset = customOffset;
991                    }
992                    doScroll(tp, true);
993                    data.offset = originalOffset; // 恢复
994                },
995                refresh: function() {
996                    init(data);
997                },
998                clear: function() {
999                    history.pushState("", document.title, window.location.pathname + window.location.search);
1000                }
1001            };
1002        },
1003        /**
1004         * @description 侧边固定
1005         * @param {String} nav - 侧边导航最外面的盒子
1006         * @param {String} area - 侧边导航显示的区域
1007         */
1008        asideNav: function(nav, area, options) {
1009            var $nav = $(nav);
1010            var $area = $(area);
1011            var settings = $.extend({
1012                fixedClass: 'ys-fixed',      // 在区域内固定
1013                bottomClass: 'ys-notfixed',  // 滚出区域底部
1014                topOffset: 0,                // 顶部触发偏移
1015                bottomOffset: 0,             // 底部触发偏移,也是距离顶部距离
1016                throttle: null,        // null = 使用 RAF, 数字 = 时间节流(ms)
1017                useRAF: true           // 优先使用 requestAnimationFrame
1018            }, options);
1019            var timerId  = null;
1020            var resizeTimer = null;
1021            function updateState() {
1022                var scrollTop = $(window).scrollTop();
1023                var areaOffsetTop = $area.offset().top;
1024                var areaTop = areaOffsetTop - settings.topOffset;
1025                var areaBottom = areaOffsetTop + $area.height() - settings.bottomOffset;
1026                var navHeight = $nav.outerHeight();
1027                // 三种状态
1028                var isAbove = scrollTop < areaTop;  // 未进入区域
1029                var isInside = scrollTop >= areaTop && 
1030                            (scrollTop + navHeight) <= areaBottom;  // 在区域内
1031                var isBelow = (scrollTop + navHeight) > areaBottom;   // 超出区域底部
1032                // 应用状态
1033                $nav.toggleClass(settings.fixedClass, isInside);
1034                $nav.toggleClass(settings.bottomClass, isBelow);
1035                // 调试日志
1036                // console.log('scroll:', scrollTop, 'area:', areaTop, '-', areaBottom, 
1037                // '状态:', isAbove ? '上' : isInside ? '中' : '下');
1038            }
1039            function init() {
1040                // 重置状态
1041                $nav.removeClass(settings.fixedClass + ' ' + settings.bottomClass);
1042                updateState();
1043            }
1044            // 节流滚动
1045            function onScroll() {
1046                if (timerId) return;
1047                
1048                if (settings.useRAF && window.requestAnimationFrame) {
1049                    timerId = requestAnimationFrame(function() {
1050                        updateState();
1051                        timerId = null;
1052                    });
1053                } else {
1054                    timerId = setTimeout(function() {
1055                        updateState();
1056                        timerId = null;
1057                    }, settings.throttle || 16);
1058                }
1059            }
1060            // 防抖 resize
1061            function onResize() {
1062                clearTimeout(resizeTimer);
1063                resizeTimer = setTimeout(init, 100);
1064            }
1065            // 绑定事件(命名空间)
1066            $(window)
1067                .on('scroll.asideNav', onScroll)
1068                .on('resize.asideNav', onResize)
1069                .on('load.asideNav', init);
1070            // 初始化
1071            init();
1072            // 返回控制
1073            return {
1074                refresh: init,
1075                destroy: function() {
1076                    $(window).off('.asideNav');
1077                    $nav.removeClass(settings.fixedClass + ' ' + settings.bottomClass);
1078                }
1079            };
1080        },
1081        /**
1082         * @description 判断是否为IE浏览器
1083         */
1084        isIE:function() {
1085            if (!!window.ActiveXObject || "ActiveXObject" in window || !!document.documentMode) {
1086                console.warn('该浏览器为IE浏览器');
1087                return true;
1088            } else {
1089                return false;               
1090            }
1091        },
1092        // a链接拼接字符串
1093        concatHref:function(str, selector) {
1094            var $ele = selector ? $(selector) : $("a");
1095            $ele.each(function() {
1096                var $this = $(this);
1097                var oldHref = $this.attr("href");
1098                if (!oldHref || oldHref === '#') return;
1099                if (oldHref.indexOf('javascript') === 0) return;
1100                if (oldHref.indexOf('http') === 0 && oldHref.indexOf(location.host) === -1) return;
1101                var hasQuery = oldHref.indexOf("?") !== -1;
1102                var hasHash = oldHref.indexOf("#") !== -1;
1103                // 防止重复添加相同参数
1104                var paramKey = str.split('=')[0];
1105                if (oldHref.indexOf(paramKey + '=') !== -1) return;
1106                var newHref;
1107                if (hasHash && !hasQuery) {
1108                    newHref = oldHref.replace('#', '?' + str + '#');
1109                } else if (hasQuery) {
1110                    var separator = oldHref.indexOf("?") === oldHref.length - 1 ? '' : '&';
1111                    newHref = oldHref + separator + str;
1112                } else {
1113                    newHref = oldHref + "?" + str;
1114                }
1115                $this.attr("href", newHref);
1116            });
1117        },
1118        // 移动端屏幕高度
1119        screenh:function(){
1120            function setFullHeight() {
1121                var screenHeight = window.innerHeight;
1122                $('.ys-page-wrap').css('--height-ph',screenHeight+'px');
1123            }
1124            setFullHeight();
1125            window.addEventListener('resize', setFullHeight);
1126        },
1127        /**
1128         * @description 下拉选择
1129         * @param {String} selector - css选择器
1130         * @param {String} value - 获取id/value
1131         */
1132        select: function(selector, valueKey, callback) {
1133            var $obj = $(selector);
1134            var eventNs = ".ysSelect";
1135            $obj.find(".ys-select-li").each(function(index) {
1136                var $li = $(this);
1137                if ($li.attr("data-id") === undefined) {
1138                    $li.attr("data-id", index);
1139                }
1140                if (!$li.attr("data-value")) {
1141                    $li.attr("data-value", $li.text().trim());
1142                }
1143            });
1144            $obj.find(".ys-select-hd").off(eventNs).on("click" + eventNs, function(e) {
1145                e.stopPropagation();
1146                var $thisHd = $(this);
1147                var $parent = $thisHd.closest(".ys-select");
1148                var $thisBd = $thisHd.siblings(".ys-select-bd");
1149                var isOpening = !$thisHd.hasClass("on");
1150                // 关闭其他所有的下拉框
1151                $(".ys-select-hd").not($thisHd).removeClass("on");
1152                $(".ys-select-bd").not($thisBd).stop().slideUp(200, function() {
1153                    $(this).closest(".ys-select").removeClass("zindex");
1154                });
1155                if (isOpening) {
1156                    // 展开逻辑
1157                    $thisHd.addClass("on");
1158                    $parent.addClass("zindex"); // 展开前立即增加层级
1159                    $thisBd.stop().slideDown(300, function() {
1160                        $(this).addClass("showscroll");
1161                        // 仅在显示后更新滚动条,提高性能
1162                        var $scrollContent = $(this).find(".ys-select-inof");
1163                        if ($scrollContent.data("mCS")) {
1164                            $scrollContent.mCustomScrollbar("update");
1165                        }
1166                    });
1167                } else {
1168                    // 收起逻辑
1169                    $thisHd.removeClass("on");
1170                    $thisBd.stop().slideUp(200, function() {
1171                        $(this).removeClass("showscroll");
1172                        $parent.removeClass("zindex");
1173                    });
1174                }
1175            });
1176            $obj.off(eventNs, ".ys-select-li").on("click" + eventNs, ".ys-select-li", function(e) {
1177                e.stopPropagation();
1178                var $li = $(this);
1179                var $parentBd = $li.closest(".ys-select-bd");
1180                var $parentHd = $parentBd.siblings(".ys-select-hd");
1181                var selectShow = $li.text().trim();
1182                var data = $li.data();
1183                // 动态获取值,优先使用传入的 valueKey
1184                var realVal = valueKey ? $li.data(valueKey) : $li.data("value");
1185                // 填充值并触发原生 change 事件
1186                $parentHd.find(".ys-select-show").val(selectShow);
1187                $parentHd.find(".ys-select-real")
1188                    .attr("data-id", data.id)
1189                    .val(realVal)
1190                    .trigger("change");
1191                $li.addClass("on").siblings().removeClass("on");
1192                // 自动收起
1193                $parentHd.click();
1194                if (typeof callback === 'function') {
1195                    callback(data);
1196                }
1197            });
1198            // 点空白收起下拉
1199            $(document).off(eventNs).on("click" + eventNs, function(e) {
1200                var $target = $(e.target);
1201                var isSelectComponent = $target.closest(".ys-select-hd, .ys-select-bd, .mCSB_scrollTools").length > 0;
1202                if (!isSelectComponent) {
1203                    $(".ys-select-hd.on").each(function() {
1204                        var $thisHd = $(this);
1205                        var $thisBd = $thisHd.siblings(".ys-select-bd");
1206                        $thisHd.removeClass("on");
1207                        $thisBd.stop().slideUp(200, function() {
1208                            $(this).removeClass("showscroll");
1209                            $(this).closest(".ys-select").removeClass("zindex");
1210                        });
1211                    });
1212                }
1213            });
1214            $obj.on("mousedown" + eventNs, ".mCSB_scrollTools", function(e) {
1215                e.stopPropagation();
1216            });
1217            var $scrollArea = $obj.find(".ys-select-inof");
1218            if ($scrollArea.length && $.fn.mCustomScrollbar) {
1219                $scrollArea.mCustomScrollbar({
1220                    axis: "y",
1221                    scrollInertia: 300, // 缩短惯性时间,操作更跟手
1222                    theme: 'dark',
1223                    scrollbarPosition: "outside",
1224                    // autoHideScrollbar: true,
1225                    mouseWheel: { preventDefault: true } // 防止滚动穿透
1226                });
1227            }
1228        },
1229        // pc默认导航下拉
1230        navSlide: function() {
1231            var $navItems = $('.head-nav-item-title');
1232            var $pageWrap = $('.ys-page-wrap');
1233            var eventNs = '.navSlide';
1234            var slideSpeed = 300; // 统一控制速度
1235            $navItems.off(eventNs).hover(function() {
1236                var $this = $(this);
1237                var $dropdown = $this.siblings('.head-nav-item-down');
1238                var $parentItem = $this.closest('.head-nav-item');
1239                $dropdown.stop(true, true).slideDown(slideSpeed);
1240                $parentItem.addClass("yxnav-active1").siblings().removeClass("yxnav-active1");
1241                $this.closest('.head-nav-item-nub').addClass('on');
1242                $pageWrap.addClass('open-nav');
1243            });
1244            $navItems.closest('.head-nav-item-nub').off(eventNs).hover(function() {}, function() {
1245                var $this = $(this);
1246                var $dropdown = $this.find('.head-nav-item-down');
1247                var $parentItem = $this.closest('.head-nav-item');
1248                $dropdown.stop(true, true).slideUp(slideSpeed);
1249                $this.removeClass('on');
1250                $parentItem.removeClass("yxnav-active1");
1251                $pageWrap.removeClass('open-nav');
1252                $('.head-nav-item.act').addClass("yxnav-active1");
1253            });
1254        },
1255        /**
1256        * @description pc除一级外
1257        * @ele1 hover类名
1258        * @ele2 加选中类名的类名
1259        * @class1 选中类名 
1260        */
1261        navSlide2: function(trigger, targetWrap, activeClass) {
1262            var $triggers = $(trigger);
1263            var eventNs = '.navSlide2';
1264            $triggers.off(eventNs).hover(function() {
1265                var $this = $(this);
1266                var $target;
1267                if (trigger === targetWrap) {
1268                    $target = $this;
1269                } else {
1270                    $target = $this.closest(targetWrap);
1271                }
1272                $target.addClass(activeClass).siblings().removeClass(activeClass);
1273
1274            }, function() {
1275                var $this = $(this);
1276                var $target;
1277                if (trigger === targetWrap) {
1278                    $target = $this;
1279                } else {
1280                    $target = $this.closest(targetWrap);
1281                }
1282                $target.removeClass(activeClass);
1283                $(targetWrap).filter(".act").addClass(activeClass);
1284            });
1285        },
1286        /**
1287         * @description 移动端导航初始化
1288         * @param {Number} style - 
1289         */
1290        phNavInit: function(style) {
1291            var _this = this;
1292            var eventNs = '.phNav';
1293            var setPageState = function(isOpen) {
1294                if (isOpen) {
1295                    if (_this.scrollbar) _this.scrollbar.hide();
1296                    if (_this.lenisStop) _this.lenisStop();
1297                    $('.ys-page-wrap').addClass('open-nav');
1298                } else {
1299                    if (_this.scrollbar) _this.scrollbar.show();
1300                    if (_this.lenisStart) _this.lenisStart();
1301                    $('.ys-page-wrap').removeClass('open-nav');
1302                }
1303            };
1304            // 导航是否反白
1305            var toggleWhiteNav = function(isOpen) {
1306                if (isOpen) {
1307                    $('.ys-hd-ph').addClass('has-btn');
1308                } else {
1309                    $('.ys-hd-ph').removeClass('has-btn');
1310                }
1311            };
1312            var initActiveExpand = function() {
1313                $('body').find('.ys-phnav-haschild .yxnav-active2, .ys-phnav-haschild .yxnav-active3').each(function() {
1314                    var $ul = $(this).parent('ul');
1315                    $ul.css('display', 'block');
1316                    $ul.siblings('.ys-phnav-lisbox').find('.ys-phnav-icon').addClass('on');
1317                });
1318            };
1319            // 展开折叠
1320            var bindAccordion = function() {
1321                $(".ys-phnav-lisbox").off(eventNs).on("click" + eventNs, function() {
1322                    var $subNav = $(this).siblings("ul");
1323                    if ($subNav.length > 0) {
1324                        $(this).find(".ys-phnav-icon").toggleClass("on");
1325                        $subNav.stop().slideToggle();
1326                        $(this).parent().siblings().find("ul").stop().slideUp();
1327                        $(this).parent().siblings().find(".ys-phnav-icon").removeClass("on");
1328                    }
1329                });
1330                $(".ys-phnav-lisbox a").on("click", function(e) { e.stopPropagation(); });
1331            };
1332            switch (style) {
1333                case 1:
1334                    phNavInit1();
1335                    break;
1336                case 2:
1337                    phNavInit2();
1338                    break;
1339                case 3:
1340                    phNavInit3();
1341                    break;
1342                case 4:
1343                    phNavInit4();
1344                    break;
1345                default:
1346                    phNavInit1();
1347            }
1348            function phNavInit1() {
1349                initActiveExpand();
1350                $(".ys-phnav-menubtn").off(eventNs).on("click" + eventNs, function() {
1351                    var isOpening = !$(this).hasClass("on");
1352                    $(this).toggleClass("on");
1353                    toggleWhiteNav(isOpening);
1354                    setPageState(isOpening);
1355                    $(".ys-phnav-menu").stop().slideToggle(300);
1356                });
1357                bindAccordion();
1358                initCustomScroll('.ys-phmenu-scroll');
1359            }
1360            function phNavInit2() {
1361                initActiveExpand();
1362                $(".ys-phnavss-btn").off(eventNs).on("click" + eventNs, function(e) {
1363                    e.stopPropagation();
1364                    var isOpening = !$(".ys-phnavss-xl").is(':visible');
1365                    $(".ys-phnav-menubtn, .ys-phnav-menu, .ys-phnav2-lang-modal").removeClass("on");
1366                    toggleWhiteNav(isOpening);
1367                    setPageState(isOpening);
1368                    $(this).toggleClass("on");
1369                    $(".ys-phnavss-xl").stop().slideToggle(300);
1370                });
1371                $(".ys-main, .ys-footer").on("click" + eventNs, function() {
1372                    if($(".ys-phnavss-xl").is(':visible')) {
1373                        $(".ys-phnavss-xl").stop().slideUp(200);
1374                        $(".ys-phnavss-btn").removeClass('on');
1375                        toggleWhiteNav(false);
1376                        setPageState(false);
1377                    }
1378                });
1379                $(".ys-phnav-menubtn").off(eventNs).on("click" + eventNs, function(e) {
1380                    e.stopPropagation();
1381                    $(".ys-phnavss-xl").hide(); // 立即隐藏搜索
1382                    $(".ys-phnavss-btn").removeClass('on');  
1383                    var isOpening = !$(this).hasClass("on");
1384                    if (!isOpening) $(".ys-phnav2-lang-modal").removeClass("on");
1385                    $(this).toggleClass("on");
1386                    $(".ys-phnav-menu").toggleClass("on");
1387                    toggleWhiteNav(isOpening);
1388                    setPageState(isOpening);
1389                });
1390                bindAccordion();
1391                $(".ys-phnav2-lang-btn").on("click", function() { $(".ys-phnav2-lang-modal").addClass("on"); });
1392                $(".ys-phnav2-lang-back").on("click", function() { $(".ys-phnav2-lang-modal").removeClass("on"); });
1393                initCustomScroll('.ys-phmenu-scroll');
1394            }
1395            function phNavInit3() {
1396                if (_this.modal) {
1397                    _this.modal(".ys-phnavss-btn", ".ys-phnavss-modal");
1398                }
1399                $(".ys-phnav-menubtn").off(eventNs).on("click" + eventNs, function() {
1400                    setPageState(true);
1401                    $(this).addClass("on");
1402                    $(".ys-phnav-menu").addClass("on");
1403                });
1404                $(".ys-phmenu-close").off(eventNs).on("click" + eventNs, function() {
1405                    setPageState(false);
1406                    $(".ys-phnav-menubtn, .ys-phnav-menu, .ys-phsubnav-modal").removeClass("on");
1407                    $(".ys-phnav3-lang-hd").removeClass("on");
1408                    $(".ys-phnav3-lang-bd").stop().slideUp(0);
1409                });
1410                $(".ys-phnav-lisbox").off(eventNs).on("click" + eventNs, function() {
1411                    var $subNav = $(this).siblings(".ys-phsubnav-modal");
1412                    if ($subNav.length > 0) { $subNav.addClass("on"); }
1413                });
1414                $(".ys-phsubnav-close").off(eventNs).on("click" + eventNs, function() {
1415                    $(this).closest(".ys-phsubnav-modal").removeClass("on");
1416                });
1417                $(".ys-phnav3-lang-hd").off(eventNs).on("click" + eventNs, function() {
1418                    $(this).toggleClass("on");
1419                    $(".ys-phnav3-lang-bd").stop().slideToggle();
1420                });
1421                $(".ys-phnav-lisbox a, .ys-phnav3-lang-hd a").on("click", function(e) { 
1422                    e.stopPropagation(); 
1423                });
1424                initCustomScroll('.ys-phmenu-scroll');
1425                initCustomScroll('.ys-phsubnav-scroll');
1426            }
1427            function phNavInit4() {
1428                initActiveExpand();
1429                if (_this.modal) {
1430                    _this.modal(".ys-phnavss-btn", ".ys-phnavss-modal");
1431                }
1432                $(".ys-phnav-menubtn").off(eventNs).on("click" + eventNs, function() {
1433                    var isOpening = !$(this).hasClass("on");
1434                    $(this).toggleClass("on");
1435                    toggleWhiteNav(isOpening);
1436                    setPageState(isOpening);
1437                    $(".ys-phnav-menu").stop().slideToggle(300, function() {
1438                        if ($.fn.mCustomScrollbar) $('.ys-phmenu-scroll').mCustomScrollbar("update");
1439                    });
1440                });
1441                bindAccordion();
1442                initCustomScroll('.ys-phmenu-scroll');
1443            }
1444            function initCustomScroll(selector) {
1445                var $el = $(selector);
1446                if ($el.length && $.fn.mCustomScrollbar) {
1447                    $el.mCustomScrollbar({
1448                        axis: "y",
1449                        scrollInertia: 500,
1450                        theme: 'dark',
1451                        scrollbarPosition: "outside"
1452                    });
1453                }
1454            }
1455        },
1456        /**
1457         * @description 内页锚点定位
1458         * @param {String} btn  锚点点击按钮(选择器,默认.anchor-btn) 
1459         * @param {String} selector  对应板块(选择器,默认.mod-point)
1460         * @param {number} pos  距离顶部距离(px,默认导航高度)
1461         * @param {number} pos2  滑动距离顶部距离pos2(px,默认屏幕高度的一半)
1462         */
1463        insideAnchor: function(btn, selector, pos, pos2) {
1464            var _this = this;
1465            var btn = btn ? btn : ".anchor-btn";
1466            var selector = selector ? selector : ".mod-point";
1467            var getHeaderHeight = function() {
1468                if (window.innerWidth < 1200) return 56;
1469                return $('.ys-hd-pc').height() || 0;
1470            };
1471            var pos = pos ? pos : getHeaderHeight();
1472            var pos2 = pos2 ? pos2 : $(window).height() / 2;
1473            achange();
1474            asideNav();
1475            $(window).on("scroll", asideNav);
1476            $(window).on("load", asideNav);
1477            $(window).on("resize", asideNav);
1478            function achange() {
1479                $(btn).on("click", function() {
1480                    var pag = $(this).attr('data-num');             
1481                    $(selector).removeClass('act-nr');
1482                    var $target = $(selector + '[data-num="' + pag + '"]').addClass('act-nr');       
1483                    setTimeout(function() {
1484                        if ($target.length > 0) {
1485                            var targetTop = $target.offset().top - pos;
1486                            _this.goTop(500, targetTop);
1487                        }
1488                    }, 100); 
1489                });
1490            }
1491            function asideNav() {
1492                var maxNum = $(btn + ':last-child').attr('data-num');
1493                var scrollTop = $(window).scrollTop();
1494                for (var i = 0; i <= maxNum; i++) {
1495                    var $item = $(selector + '[data-num="' + i + '"]');
1496                    if ($item.length > 0) {
1497                        var pos1 = $item.offset().top - pos2;
1498                        if (scrollTop > pos1) {
1499                            // 滑动时精准联动
1500                            $(selector).removeClass('act-nr');
1501                            $item.addClass('act-nr');
1502                            $(btn + '[data-num="' + i + '"]').addClass('act').siblings().removeClass('act');
1503                        }
1504                    }
1505                }
1506            }
1507        },
1508        /**
1509         * @description 侧边锚点隐藏
1510         * @param {String} selector  侧边锚点盒子(选择器,默认.mod-anchor)
1511         * @param {String} selector1  滑到此板块侧边隐藏(选择器,默认.anchor-hide) 
1512         * @param {Number} topx  锚点开始出现位置(默认banner下)
1513         * @param {Number} botx  锚点结束出现位置(默认footer)
1514         */
1515        anchorHide: function(selector, selector1, topx_custom, botx_custom) {
1516            var _this = this;
1517            var $selector = $(selector || ".mod-anchor");
1518            var $selector1 = $(selector1 || ".anchor-hide");
1519            // 将变量存入局部对象,避免 resize 时丢失
1520            var vals = {
1521                sideh: 0,
1522                placeh: 0,
1523                topx: 0,
1524                botx: 0
1525            };
1526            function initValue() {
1527                vals.sideh = $selector.outerHeight() / 2;
1528                vals.placeh = $(window).height() / 2 - vals.sideh;
1529                var banh = $('.ys-nybanner').length > 0 ? $('.ys-nybanner').outerHeight() : 0;
1530                var mainTop = $('.ys-main').length > 0 ? $('.ys-main').offset().top : 0;
1531                var footerTop = $('.ys-footer').length > 0 ? $('.ys-footer').offset().top : $(document).height();
1532                // 优先使用传入的参数,否则动态计算
1533                vals.topx = topx_custom ? topx_custom : (mainTop + banh - vals.placeh);
1534                vals.botx = botx_custom ? botx_custom : (footerTop - $(window).height() + vals.placeh);
1535            }
1536            // 头部底部显隐逻辑
1537            function tfHide() {
1538                var sTop = $(window).scrollTop();
1539                if (sTop > vals.topx && sTop < vals.botx) {
1540                    $selector.addClass('on1');
1541                } else {
1542                    $selector.removeClass('on1');
1543                }
1544            }
1545            // 侧边锚点遇到特定区域(selector1)时的避让逻辑
1546            function scrollAn() {
1547                var sTop = $(window).scrollTop();
1548                var shouldHide = false; // 增加标志位,解决循环覆盖问题
1549                $selector1.each(function() {
1550                    var $item = $(this);
1551                    var itemH = $item.outerHeight();
1552                    // 计算当前区块触发隐藏的临界点
1553                    var t1 = $item.offset().top - $(window).height() / 2 - vals.sideh;
1554                    var b1 = $item.offset().top + itemH - ($(window).height() / 2 - vals.sideh);
1555                    if (sTop > t1 && sTop < b1) {
1556                        shouldHide = true;
1557                        return false; // 找到一个匹配的就跳出循环,提高性能
1558                    }
1559                });
1560                if (shouldHide) {
1561                    $selector.addClass('act');
1562                } else {
1563                    $selector.removeClass('act');
1564                }
1565            }
1566            $(window).on("load.anchorHide resize.anchorHide", function() {
1567                initValue();
1568                tfHide();
1569                scrollAn();
1570            });
1571            $(window).on("scroll.anchorHide", function() {
1572                tfHide();
1573                scrollAn();
1574            });
1575            setTimeout(function() {
1576                initValue();
1577                tfHide();
1578                scrollAn();
1579            }, 500);
1580        },
1581        // 图片放大
1582        viewer:function(selector,Boolean){
1583            var _this = this;
1584            var selector = selector ? selector : ".viewerimg";
1585            var viewerBool = Boolean ? Boolean : true;
1586            $(selector).viewer({ 
1587                navbar: Boolean, 
1588                title: Boolean, 
1589                toolbar: Boolean, 
1590                tooltip: Boolean, 
1591                url: 'data-original',
1592                show: function() {
1593                    // 锁定页面滚动
1594                    if (ys.scrollbar) ys.scrollbar.hide();
1595                    if (ys.lenisStop) ys.lenisStop();
1596                    $("body").addClass("mod-viewer");
1597                },
1598                // 当查看器隐藏(动画开始前)
1599                hide: function() {
1600                    // 恢复页面滚动
1601                    if (ys.scrollbar) ys.scrollbar.show();
1602                    if (ys.lenisStart) ys.lenisStart();
1603                    $("body").removeClass("mod-viewer");
1604                }
1605            });
1606        },
1607        /**
1608         * @description 走马灯个数
1609         * @param {Number} selector - 获取selector1里selector的总个数
1610         * @param {Number} selector1 - selector1的--total显示获取的个数
1611         * @param {Number} speed - 走马灯速度
1612         * nohover - 不悬停暂停
1613         */
1614        goon: function(selector, selector1, speed) {
1615            $(selector1).each(function() {
1616                var $parent = $(this);
1617                if ($parent.data('gsap_horse')) {
1618                    $parent.data('gsap_horse').kill();
1619                }
1620                var $original = $parent.find('.ys-horse-inof1');
1621                var html1 = $original.prop('outerHTML');
1622                if ($parent.find('.ys-horse-inof2').length < 1) {
1623                    $parent.append(html1);
1624                    $parent.find('.ys-horse-inof').eq(1).addClass('ys-horse-inof2').removeClass('ys-horse-inof1');
1625                }
1626                if ($parent.find('.ys-horse-inof3').length < 1) {
1627                    $parent.append(html1);
1628                    $parent.find('.ys-horse-inof').eq(2).addClass('ys-horse-inof3').removeClass('ys-horse-inof1');
1629                }
1630                var shu1 = $parent.find(selector).length;
1631                $parent.css('--total', shu1);
1632                var effectiveSpeed = speed || 3;
1633                var duration1 = effectiveSpeed * shu1;
1634                var $e1 = $parent.find('.ys-horse-inof1');
1635                var $e2 = $parent.find('.ys-horse-inof2');
1636                var $e3 = $parent.find('.ys-horse-inof3');
1637                var horse = gsap.timeline({ repeat: -1 });
1638                $parent.data('gsap_horse', horse); // 存储动画对象以便后续清理
1639                if ($parent.hasClass('act')) {
1640                    horse.set($e1, { x: "0%" }).set($e2, { x: "100%" }).set($e3, { x: "-100%" });
1641                    horse.to([$e1, $e2, $e3], { x: "+=100%", duration: duration1, ease: "none" });
1642                } else if ($parent.hasClass('up')) {
1643                    horse.to($e1, { y: "-100%", duration: duration1, ease: "none" }, 0)
1644                        .to($e2, { y: "0%", duration: duration1, ease: "none" }, 0)
1645                        .to($e3, { y: "100%", duration: duration1, ease: "none" }, 0);
1646                } else if ($parent.hasClass('down')) {
1647                    horse.to($e1, { y: "100%", duration: duration1, ease: "none" }, 0)
1648                        .to($e2, { y: "200%", duration: duration1, ease: "none" }, 0)
1649                        .to($e3, { y: "0%", duration: duration1, ease: "none" }, 0);
1650                } else {
1651                    horse.to($e1, { x: "-100%", duration: duration1, ease: "none" }, 0)
1652                        .to($e2, { x: "0%", duration: duration1, ease: "none" }, 0)
1653                        .to($e3, { x: "100%", duration: duration1, ease: "none" }, 0);
1654                }
1655                $parent.off('mouseenter mouseleave click'); 
1656                if (!$parent.hasClass('nohover')) {
1657                    if (window.innerWidth > 1199) {
1658                        $parent.hover(function() { horse.pause(); }, function() { horse.resume(); });
1659                    } else {
1660                        $parent.on('click', function() {
1661                            if ($parent.hasClass('act-on')) {
1662                                horse.resume();
1663                                $parent.removeClass('act-on');
1664                            } else {
1665                                horse.pause();
1666                                $parent.addClass('act-on');
1667                            }
1668                        });
1669                    }
1670                }
1671            });
1672        },
1673        // slick轮播进度条
1674        dots1: function() {
1675            var _this = this;
1676            $('.ys-dots1').appear(function() {
1677                $(this).addClass('dots-go');
1678            });
1679            $('.ys-dots1 .slick-slide video').each(function() {
1680                var $video = $(this);
1681                var $container = $video.parents('.ys-dots1');
1682                var index = $video.parents('.slick-slide').attr('data-slick-index');   
1683                var setDuration = function(duration) {
1684                    if (duration) {
1685                        $container.find('.slick-dots li').eq(index).css('--pro', duration + 's');
1686                    }
1687                };
1688                if (this.readyState >= 1) {
1689                    setDuration(this.duration);
1690                } else {
1691                    $video.one('loadedmetadata', function() {
1692                        setDuration(this.duration);
1693                    });
1694                }
1695            });
1696        },
1697        // 禁止右键
1698        rightclick:function() {
1699            document.addEventListener('contextmenu', function(e) {
1700                e.preventDefault();
1701            });
1702        },
1703        // 保护页面图片或内容
1704        websafe:function(){
1705            // 禁用右键菜单
1706            document.addEventListener('contextmenu', function(e) {
1707                e.preventDefault();
1708            });
1709            // 禁用 F12 和 常用的开发者工具快捷键 (可选,增加破解成本)
1710            document.addEventListener('keydown', function(e) {
1711                if (
1712                    e.key === 'F12' || 
1713                    (e.ctrlKey && e.shiftKey && (e.key === 'I' || e.key === 'J' || e.key === 'C')) ||
1714                    (e.ctrlKey && e.key === 'U')
1715                ) {
1716                    e.preventDefault();
1717                }
1718            });
1719            // 防止拖拽下载
1720            $('img').on('dragstart', function(e) {
1721                e.preventDefault();
1722            });
1723        },
1724        // 底部分享二维码
1725        footershare: function(li, btn1, code1) {
1726            var $li = $(li || ".footer-share li");
1727            var $btn1 = $(btn1 || ".footer-share-btn");
1728            var $code1 = $(code1 || ".footer-share-code");
1729            //先解绑,防止 resize 或多次初始化导致事件堆叠
1730            $li.off('mouseenter mouseleave');
1731            $btn1.off('click');
1732            $(document).off('click.share'); // 使用命名空间解绑
1733            $code1.off('click');
1734            if (window.innerWidth > 1199) {
1735                $li.hover(function() {
1736                    $(this).find($code1).stop().slideDown(300);
1737                }, function() {
1738                    $(this).find($code1).stop().slideUp(200);
1739                });
1740            } else {
1741                $btn1.on('click', function(e) {
1742                    e.stopPropagation();
1743                    var $currentCode = $(this).parents('li').find($code1);
1744                    $currentCode.stop().slideToggle(300);
1745                    $(this).parents('li').siblings().find($code1).stop().slideUp(200);
1746                });
1747                // 使用命名空间绑定,方便管理,点击页面任意位置关闭
1748                $(document).on('click.share', function() {
1749                    $code1.stop().slideUp(200);
1750                });
1751                // 阻止二维码区域自身的点击冒泡(防止点二维码时也触发关闭)
1752                $code1.on('click', function(e) {
1753                    e.stopPropagation();
1754                });
1755            }
1756        },
1757        // 底部副导航移动端
1758        // Boolean为true,点击一级导航不跳转,默认false,点击一级导航跳转
1759        footernav: function(Boolean) {
1760            Boolean = Boolean || false;
1761            var $navItem = $('.footer-nav>li');
1762            $navItem.each(function() {
1763                if ($(this).find('ul').length < 1) {
1764                    $(this).addClass('no-nav');
1765                }
1766            });
1767            $navItem.off('click').on('click', function(e) {
1768                if ($(this).find('ul').length > 0 && Boolean) {
1769                    e.preventDefault(); // 根据需求决定是否阻止 a 标签跳转
1770                }
1771                $(this).toggleClass('act').siblings().removeClass('act');
1772                $(this).find('ul').stop().slideToggle(300);
1773                $(this).siblings().find('ul').stop().slideUp(250);
1774            });
1775        },
1776        // 语言下拉
1777        lang: function(hover1, down1) {
1778            var $hover = $(hover1 || ".head-lang");
1779            var $down = $(down1 || ".head-lang-down");
1780            // 先解绑,防止重复初始化
1781            $hover.off('mouseenter mouseleave click');
1782            if (window.innerWidth > 1199) {
1783                $hover.hover(function() {
1784                    $(this).addClass('act');
1785                    $(this).find($down).stop().slideDown(200);
1786                }, function() {
1787                    var $this = $(this);
1788                    $this.find($down).stop().slideUp(200, function() {
1789                        $this.removeClass('act'); 
1790                    });
1791                });
1792            } else {
1793                $hover.on('click', function(e) {
1794                    e.stopPropagation();
1795                    $(this).toggleClass('act');
1796                    $(this).find($down).stop().slideToggle(300);
1797                });
1798                $(document).on('click.lang', function() {
1799                    $down.slideUp(200);
1800                    $hover.removeClass('act');
1801                });
1802            }
1803        },
1804        // 搜索
1805        pcSearch: function(style) {
1806            var _this = this;
1807            var $header = $('.ys-hd-pc');
1808            // 清理函数:防止样式切换时旧事件干扰
1809            function clearEvents() {
1810                $(".head-search-btn").off("click");
1811                $header.off("mouseenter mouseleave");
1812                $(document).off("click.pcSearch");
1813            }
1814            // 通用的下拉搜索逻辑 (适配 style 2, 3 等)
1815            function commonSlideSearch(btnSelector, winSelector) {
1816                clearEvents();
1817                var $btn = $(btnSelector);
1818                var $win = $(winSelector);
1819                $btn.on("click", function(e) {
1820                    e.stopPropagation();
1821                    $win.stop().slideToggle();
1822                    $(this).toggleClass('act');
1823                    $header.toggleClass('has-search');
1824                });
1825                // 阻止窗口内部点击冒泡
1826                $win.on("click", function(e) {
1827                    e.stopPropagation();
1828                });
1829                // 点击空白处关闭
1830                $(document).on("click.pcSearch", function() {
1831                    $win.stop().slideUp();
1832                    $btn.removeClass('act');
1833                    $header.removeClass('has-search');
1834                });
1835            }
1836            switch (style) {
1837                case 1:
1838                    this.modal(".ys-search1 .head-search-btn", ".ys-search1 .ys-phnavss-modal");
1839                    break;
1840                case 2:
1841                    commonSlideSearch(".ys-search2 .head-search-btn", ".ys-search2-win");
1842                    break;
1843                case 3:
1844                    commonSlideSearch(".ys-search3 .head-search-btn", ".yx-search3xlbox");
1845                    // hover移出导航收起
1846                    $header.hover(function() {}, function() {
1847                        $(".yx-search3xlbox").stop().slideUp();
1848                        $(".ys-search3 .head-search-btn").removeClass('act');
1849                        $header.removeClass('has-search');
1850                    });
1851                    break;
1852                case 4:
1853                    // 预留位置
1854                    break;
1855                case 5:
1856                    this.modal(".ys-search5 .head-search-btn", ".ys-search5 .ys-phnavss-modal");
1857                    break;
1858                default:
1859                    commonSlideSearch(".ys-search3 .head-search-btn", ".yx-search3xlbox");
1860                    // hover移出导航收起
1861                    $header.hover(function() {}, function() {
1862                        $(".yx-search3xlbox").stop().slideUp();
1863                        $(".ys-search3 .head-search-btn").removeClass('act');
1864                        $header.removeClass('has-search');
1865                    });
1866            }
1867        },
1868        // 选项卡
1869        // 如果项目中用了轮播图或懒加载,可以在此处触发 resize
1870        tab: function(ele1, ele2, ele3,callback) {
1871            var _ele1 = ele1 || '.ys-tab';
1872            var _ele2 = ele2 || '.ys-tab-btn-item';
1873            var _ele3 = ele3 || '.ys-tab-core-item';
1874            $(_ele1).each(function() {
1875                var $parent = $(this);
1876                // 只查找当前 Tab 容器下的直接按钮,防止干扰嵌套的 Tab
1877                var $btns = $parent.find(_ele2);
1878                var $contents = $parent.find(_ele3);
1879                $btns.off('click').on('click', function() {
1880                    // 使用 index($btns) 确保序号只在按钮组内计算,不受其他兄弟元素干扰
1881                    var index = $btns.index(this); 
1882                    // 按钮状态切换
1883                    $(this).addClass("on").siblings(_ele2).removeClass("on");
1884                    // 内容块切换:
1885                    // 1. 只操作当前容器下的内容
1886                    // 2. 使用 fadeTo 配合 hide 可以让动画在某些卡顿环境下更平滑
1887                    $contents.eq(index).stop().fadeIn(300)
1888                            .siblings(_ele3).stop().hide();
1889                    if (typeof callback === 'function') {
1890                        callback(index);
1891                    }
1892                });
1893            });
1894        },
1895        // 载入
1896        fadeup1: function(ele1, class1, pos) {
1897            var _ele = ele1 || '.ys-upfade1';
1898            var _class = class1 || 'ys-fade-true';
1899            var _pos = pos || 0; // 如果没传,默认偏移0
1900            $( _ele ).each(function () {
1901                let ele = $(this);
1902                ScrollTrigger.create({
1903                    trigger: ele,
1904                    endTrigger: $('.ys-main').length ? '.ys-main' : ele,
1905                    start: "top bottom-=" + _pos, 
1906                    end: "bottom top",
1907                    toggleActions: "play none none none",     
1908                    onEnter: function(){
1909                        ele.addClass(_class);
1910                    } ,
1911                    onLeaveBack: function(){
1912                        ele.removeClass(_class);
1913                    } ,
1914                });
1915            });
1916        },
1917        // 增加pc默认循环播放视频,移动端隐藏
1918        playVideopc: function(ele1) {
1919            var $targets = $(ele1);
1920            if (window.innerWidth > 1199) {
1921                $targets.each(function() {
1922                    var $el = $(this);
1923                    var _v = $el.is('video') ? this : $el.find('video').get(0);               
1924                    if (!_v) return;
1925                    _v.muted = true;
1926                    _v.loop = true;
1927                    _v.setAttribute('playsinline', '');
1928                    var initTrigger = function() {
1929                        ScrollTrigger.create({
1930                            trigger: _v,
1931                            invalidateOnRefresh: true, 
1932                            start: "top bottom", 
1933                            end: "bottom top",    
1934                            onEnter: () => _v.play(),
1935                            onLeaveBack: () => _v.pause()
1936                        });
1937                        ScrollTrigger.refresh();
1938                    };
1939                    if (_v.readyState >= 1) {
1940                        initTrigger();
1941                    } else {
1942                        _v.addEventListener('loadedmetadata', initTrigger);
1943                    }
1944                });
1945            }else{
1946                $targets.each(function() {
1947                    var $el = $(this);
1948                    var $video = $el.is('video') ? $el : $el.find('video');
1949                    if ($video.length > 0) {
1950                        // 彻底销毁视频防止后台运行
1951                        $video.each(function() {
1952                            this.pause();
1953                            this.src = ""; 
1954                            this.load(); 
1955                            $(this).remove(); 
1956                        });
1957                    }
1958                });
1959            }
1960        },
1961        // open 点击 ele1 加类名act,
1962        // close 点击 ele1 去类名 act
1963        filter:function(open,close,ele1,act){
1964            var _this = this;
1965            var $body = $('body');
1966            $body.on('click', open, function() {
1967                var $target = $(this).parents(ele1);
1968                $target.addClass(act);
1969                if (ys.scrollbar) ys.scrollbar.hide();
1970                if (typeof ys.lenisStop === 'function') ys.lenisStop();
1971            });
1972            $body.on('click', close, function() {
1973                var $target = $(this).parents(ele1);
1974                $target.removeClass(act);
1975                if (ys.scrollbar) ys.scrollbar.show();
1976                if (typeof ys.lenisStart === 'function') ys.lenisStart();
1977            });
1978        },
1979        // 表单类
1980        // 提示语
1981        form_init: function() {
1982            $('.ys-fii-tips').each(function() {
1983                var $this = $(this);
1984                var $item = $this.closest('.ys-form-inof-item');
1985                var $group = $this.closest('.ys-form-inof');
1986                var groupTips = $group.data('tips') || "";
1987                var itemTip = $item.data('tips') || "";
1988                var itemTips1 = $item.data('tips1') || "";
1989                if (itemTip) {
1990                    $this.find('i').text(itemTip);
1991                    $this.find('span').text(groupTips);
1992                } else {
1993                    $this.find('span').text(itemTips1 || groupTips);
1994                }
1995            });
1996        },
1997        // area为cn为国内,gl为海外,hmt为含港澳台的国内;默认国内
1998        tips: function(area, callback) {
1999            area = area || 'cn';
2000            var telReg = /^(\+86\s?)?1[3-9]\d{9}$/;
2001            var emailReg = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
2002            // 手机归属地切换
2003            $('.ys-fpc-top').off('click').click(function() {
2004                $(this).siblings('.ys-fpc-down').stop().slideToggle();
2005                $(this).closest('.ys-form-phone').toggleClass('phone-select');
2006            });
2007            $('.ys-form-phone-city').on('click', '.ys-select-item', function() {
2008                var $parent = $(this).closest('.ys-form-phone');
2009                var selectShow = $(this).text().trim();
2010                $parent.find(".ys-fpc-top span").text(selectShow);
2011                $parent.removeClass('phone-select ys-form-empty').find('input').val('');
2012                $parent.find('.ys-fpc-down').stop().slideUp();
2013                if (selectShow == '港澳台') {
2014                    $parent.addClass('hk-ma-tai');
2015                } else {
2016                    $parent.removeClass('hk-ma-tai');
2017                }
2018            });
2019            // 核心校验逻辑
2020            var checkRequired = function($item) {
2021                var $input = $item.find('input, textarea');
2022                var val = $input.val() ? $input.val().trim() : "";
2023                if($item.hasClass('ys-form-phone') && $item.find('.iti').length > 0){
2024                   var $input1 = $item.find('input.iti__tel-input');
2025                   var val1 = $input1.val() ? $input1.val().trim() : "";
2026                }
2027                // 下拉/搜索/勾选框逻辑
2028                if ($item.find('.ys-fii-select-search, .ys-fii-select, [class^="ys-fii-checkbox"]').length > 0) {
2029                    if ($item.find('.ys-select-show').val().trim()) $item.removeClass('ys-form-empty');
2030                    else $item.addClass('ys-form-empty');
2031                } 
2032                // 平铺按钮逻辑
2033                else if ($item.hasClass('ys-form-tiled')) {
2034                    if ($item.find('.ys-form-oi-nub.on').length > 0) $item.removeClass('ys-form-empty');
2035                    else $item.addClass('ys-form-empty');
2036                }
2037                // 隐私协议逻辑
2038                else if ($item.hasClass('ys-form-inof-agree')) {
2039                    if ($item.hasClass('on')) $item.removeClass('ys-form-empty');
2040                    else $item.addClass('ys-form-empty');
2041                }
2042                // 手机号/邮箱正则逻辑
2043                else {
2044                    if ($item.hasClass('ys-form-phone')) {
2045                        if($item.find('.iti').length > 0){
2046                            var isIntl1 = $('.iti__cn').length ;
2047                            if(val1 === ''){
2048                                $item.addClass('ys-form-empty').removeClass('ys-form-empty1');
2049                            } else {
2050                                if (isIntl1<2 ? val1.length < 6 : !telReg.test(val1)) {
2051                                    $item.addClass('ys-form-empty ys-form-empty1');
2052                                } else {
2053                                    $item.removeClass('ys-form-empty ys-form-empty1');
2054                                }
2055                            }
2056                        }else{
2057                            var isIntl = (area == 'gl' || (area == 'hmt' && $item.hasClass('hk-ma-tai')));
2058                            if (isIntl ? val.length < 6 : !telReg.test(val)) {
2059                                $item.addClass('ys-form-empty ys-form-empty1');
2060                            } else {
2061                                $item.removeClass('ys-form-empty ys-form-empty1');
2062                            }
2063                        }
2064                    } else if (val === '') {
2065                        $item.addClass('ys-form-empty').removeClass('ys-form-empty1');
2066                    } else if ($item.hasClass('ys-form-email') && !emailReg.test(val)) {
2067                        $item.addClass('ys-form-empty ys-form-empty1');
2068                    } else {
2069                        $item.removeClass('ys-form-empty ys-form-empty1');
2070                    }
2071                }
2072            };
2073            // 事件绑定
2074            $('.ys-form-inof').each(function() {
2075                var $form = $(this);
2076                var debounceTimer; // 防抖
2077                // 隐私勾选点击
2078                $form.find('.ys-fia-text-btn').click(function() {
2079                    var $agree = $(this).closest('.ys-form-inof-agree');
2080                    $agree.toggleClass('on');
2081                    checkRequired($agree);
2082                });
2083                // 平铺按钮点击
2084                $form.find(".ys-form-oi-nub").click(function() {
2085                    var $tiled = $(this).closest('.ys-form-tiled');
2086                    if ($tiled.hasClass('ys-form-tiled2')) $(this).toggleClass('on');
2087                    else $(this).addClass("on").siblings().removeClass("on");
2088                    checkRequired($tiled.closest('.ys-form-required'));
2089                });
2090                // 输入框实时监听
2091                $form.find('.ys-form-required input, .ys-form-required textarea').on('input propertychange', function() {
2092                    var $el = $(this);
2093                    clearTimeout(debounceTimer);
2094                    debounceTimer = setTimeout(function() {
2095                        checkRequired($el.closest('.ys-form-required'));
2096                    }, 300);
2097                });
2098                // 失去焦点
2099                $form.find('.ys-form-required input, .ys-form-required textarea').on('blur', function() {
2100                    checkRequired($(this).closest('.ys-form-required'));
2101                });
2102                // 下拉菜单选择监听
2103                $form.on('click', '.ys-form-required .ys-select-bd .ys-select-li', function() {
2104                    $(this).closest('.ys-form-required').removeClass('ys-form-empty');
2105                });
2106                // 提交按钮逻辑
2107                $form.find('.ys-fii-submit').off('click').click(function() {
2108                    var $currentForm = $(this).closest('.ys-form-inof');
2109                    // 提交时对所有非隐藏的必填项执行一次全量检查
2110                    $currentForm.find('.ys-form-required:not(.ys-form-hide)').each(function() {
2111                        checkRequired($(this));
2112                    });
2113                    // 最终判断 ok 状态并执行回调
2114                    var ok = true;
2115                    if ($currentForm.find('.ys-form-empty').length > 0) {
2116                        ok = false;
2117                        var $firstError = $currentForm.find('.ys-form-empty').first();
2118                        if (typeof ys.focus === 'function') ys.focus($firstError);
2119                    }
2120                    if (ok) callback && callback($currentForm.data());
2121                });
2122            });
2123        },
2124        // 聚焦
2125        focus: function(ele) {
2126            var $ele = $(ele); 
2127            if (!$ele.hasClass('ys-form-empty')) return false;
2128            var top_pos = $ele.offset().top - $(window).height() / 3;
2129            if ($ele.closest('.ys-modal').length === 0) {
2130                $("html, body").stop().animate({
2131                    scrollTop: top_pos
2132                }, 300);
2133            }
2134            var isSpecial = $ele.find('.ys-fii-select-search, .ys-fii-select').length > 0 || 
2135                            $ele.hasClass('ys-form-inof-agree');
2136            if (!isSpecial) {
2137                $ele.find('.ys-fii-input input').focus();
2138            }
2139            return true;
2140        },
2141        /**
2142         * @description 带搜索单选下拉选择
2143         * @param {String} selector - css选择器
2144         * @param {String} value - 传值
2145         */
2146        select_search: function(selector, value, callback) {
2147            var $obj = $(selector);
2148            // 初始化数据
2149            $obj.find(".ys-select-li").each(function(index) {
2150                var $this = $(this);
2151                if ($this.attr("data-id") === undefined) $this.attr("data-id", index);
2152                $this.attr("data-value", $this.text().trim());
2153            });
2154            // 内部校验
2155            var checkSelectEmpty = function($targetSelect) {
2156                var $required = $targetSelect.closest('.ys-form-required');
2157                if ($required.length > 0) {
2158                    var val = $targetSelect.find(".ys-select-show").val();
2159                    $required.toggleClass('ys-form-empty', (!val || val.trim() === ""));
2160                }
2161            };
2162            var jumpToSelectedSync = function($container, $bd) {
2163                var $select = $bd.closest(".ys-select");
2164                var currentText = $select.find(".ys-select-show").val() ? $select.find(".ys-select-show").val().trim() : "";
2165                // 立即同步类名状态
2166                $bd.find(".ys-select-li").removeClass("on");
2167                var $targetLi = null;
2168                if (currentText !== "") {
2169                    $bd.find(".ys-select-li").each(function() {
2170                        if ($(this).text().trim() === currentText) {
2171                            $targetLi = $(this).addClass("on");
2172                            return false;
2173                        }
2174                    });
2175                }
2176                // 强制插件在隐藏状态下完成计算
2177                $container.mCustomScrollbar("update");
2178                // 执行定位,scrollInertia 设为 0
2179                if ($targetLi) {
2180                    $container.mCustomScrollbar("scrollTo", $targetLi, {
2181                        scrollInertia: 0,
2182                        timeout: 0,
2183                        callbacks: false // 禁用回调以提升性能
2184                    });
2185                } else {
2186                    $container.mCustomScrollbar("scrollTo", "top", { scrollInertia: 0, timeout: 0 });
2187                }
2188            };
2189            // 头部点击逻辑
2190            $obj.find(".ys-select-hd").off('click').click(function(e) {
2191                e.stopPropagation();
2192                var $thisHd = $(this);
2193                var $thisSelect = $thisHd.closest(".ys-select");
2194                var $thisBd = $thisHd.siblings(".ys-select-bd");
2195                var $scrollContainer = $thisBd.find(".ys-fiiss-core").length > 0 ? 
2196                                    $thisBd.find(".ys-fiiss-core") : 
2197                                    $thisBd.find(".ys-select-inof");
2198                // 互斥关闭逻辑...
2199                $(".ys-select-hd").not(this).each(function() {
2200                    var $other = $(this).closest(".ys-select");
2201                    if ($other.hasClass("zindex")) {
2202                        $(this).removeClass("on");
2203                        $other.find('.ys-fiiss-input-close').trigger('click');
2204                        $other.find(".ys-select-bd").stop().hide(); 
2205                        $other.find(".ys-checkbox-bd").stop().hide(); 
2206                        $other.removeClass("zindex");
2207                        checkSelectEmpty($other);
2208                    }
2209                });
2210                if ($thisSelect.hasClass("zindex")) {
2211                    // 收起
2212                    $thisHd.removeClass("on");
2213                    $thisSelect.find('.ys-fiiss-input-close').trigger('click');
2214                    $thisBd.stop().slideUp(function() {
2215                        $thisSelect.removeClass("zindex");
2216                        checkSelectEmpty($thisSelect);
2217                    });
2218                } else {
2219                    // 在展开前,先让容器处于不可见但占据空间的状态,或者直接强制 update 定位
2220                    $thisBd.show().css("visibility", "hidden"); 
2221                    jumpToSelectedSync($scrollContainer, $thisBd);
2222                    $thisBd.hide().css("visibility", "visible"); // 瞬间还原状态
2223                    // 执行展开
2224                    $thisHd.addClass("on");
2225                    $thisSelect.addClass("zindex");
2226                    // 使用 show() 或快速 slideDown,确保位置已经定死
2227                    $thisBd.stop().slideDown(200, function() {
2228                        $(this).addClass("showscroll");
2229                    });
2230                }
2231            });
2232            // 列表项点击逻辑 (保持不变)
2233            $obj.find(".ys-select-bd").off('click', '.ys-select-li').on("click", ".ys-select-li", function(e) {
2234                var $li = $(this);
2235                var $select = $li.closest(".ys-select");
2236                var $hd = $select.find(".ys-select-hd");
2237                $hd.find(".ys-select-show").val($li.text().trim());
2238                $hd.find(".ys-select-real").val(value ? $li.data(value) : $li.data("value")).trigger("change");
2239                $li.addClass("on").siblings().removeClass("on");
2240                $hd.trigger('click'); // 触发收起
2241                if (callback) callback($li.data());
2242            });
2243            // 初始化 mCustomScrollbar
2244            var scrollConfig = {
2245                axis: "y",
2246                scrollInertia: 500, 
2247                theme: 'dark',
2248                scrollbarPosition: "outside",
2249                advanced: { autoScrollOnFocus: false }
2250            };
2251            if ($obj.find(".ys-fiiss-core").length > 0) {
2252                $obj.find(".ys-fiiss-core").mCustomScrollbar(scrollConfig);
2253            } else {
2254                $obj.find(".ys-select-bd .ys-select-inof").mCustomScrollbar(scrollConfig);
2255            }
2256            // 点击空白收起逻辑
2257            $(document).off('click.select_close').on('click.select_close', function(e) {
2258                if (!$(e.target).closest('.ys-select').length) {
2259                    $(".ys-select.zindex").each(function() {
2260                        var $active = $(this);
2261                        $active.find('.ys-fiiss-input-close').trigger('click');
2262                        $active.find(".ys-select-hd").removeClass("on");
2263                        $active.find(".ys-select-bd").stop().slideUp(200, function() {
2264                            $active.removeClass("zindex");
2265                            checkSelectEmpty($active);
2266                        });
2267                    });
2268                }
2269            });
2270        },
2271        /**
2272         * @description 带搜索多选下拉选择1
2273         * @param {String} selector - css选择器
2274         * @param {String} text1: 您选中了
2275         * @param {String} text2: 个选项
2276         */
2277        checkbox1: function(selector, text1, text2, callback) {
2278            var texta = text1 ? text1 : '您选中了';
2279            var textb = text2 ? text2 : '个选项';
2280            var $obj = $(selector);
2281            // 初始化数据:分配 ID 和 Value
2282            $obj.find(".ys-select-li").each(function(index) {
2283                var $this = $(this);
2284                if ($this.attr("data-id") == undefined) {
2285                    $this.attr("data-id", index);
2286                }
2287                $this.attr("data-value", $this.find('.ys-checkbox1-font').text().trim());
2288            });
2289            // 内部校验
2290            var checkSelectEmpty = function($targetSelect) {
2291                var $required = $targetSelect.closest('.ys-form-required');
2292                if ($required.length > 0) {
2293                    var val = $targetSelect.find(".ys-select-show").val();
2294                    $required.toggleClass('ys-form-empty', (!val || val.trim() === ""));
2295                }
2296            };
2297            // 内部私有:瞬间定位到第一个选中项 ---
2298            var jumpToSelectedSync = function($container, $bd) {
2299                // 查找第一个选中的项
2300                var $firstSelected = $bd.find(".ys-select-li.on").first();
2301                // 强制插件更新
2302                $container.mCustomScrollbar("update");
2303                if ($firstSelected.length > 0) {
2304                    $container.mCustomScrollbar("scrollTo", $firstSelected, {
2305                        scrollInertia: 0,
2306                        timeout: 0,
2307                        callbacks: false
2308                    });
2309                } else {
2310                    $container.mCustomScrollbar("scrollTo", "top", {
2311                        scrollInertia: 0,
2312                        timeout: 0,
2313                        callbacks: false
2314                    });
2315                }
2316            };
2317            // 头部点击(展开/收起)
2318            $obj.find(".ys-select-hd").off('click').click(function(e) {
2319                e.stopPropagation();
2320                var $thisHd = $(this);
2321                var $thisSelect = $thisHd.closest(".ys-select");
2322                var $thisBd = $thisHd.siblings(".ys-checkbox-bd");
2323                var $scrollInof = $thisBd.find(".ys-select-inof");
2324                // 互斥逻辑:关闭其他下拉框
2325                $(".ys-select-hd").not(this).each(function() {
2326                    var $otherHd = $(this);
2327                    var $otherSelect = $otherHd.closest(".ys-select");
2328                    if ($otherSelect.hasClass("zindex")) {
2329                        $otherHd.removeClass("on");
2330                        // 直接 hide,避免多重动画冲突
2331                        $otherSelect.find(".ys-checkbox-bd, .ys-select-bd").stop().hide();
2332                        $otherSelect.removeClass("zindex");
2333                        checkSelectEmpty($otherSelect);
2334                    }
2335                });
2336                if ($thisSelect.hasClass("zindex")) {
2337                    // 收回逻辑
2338                    $thisHd.removeClass("on");
2339                    $thisBd.removeClass("showscroll").stop().slideUp(function() {
2340                        $thisSelect.removeClass("zindex");
2341                        $scrollInof.mCustomScrollbar("disable");
2342                        checkSelectEmpty($thisSelect);
2343                    });
2344                } else {
2345                    // A. 预渲染定位
2346                    $thisBd.show().css("visibility", "hidden");
2347                    jumpToSelectedSync($scrollInof, $thisBd);
2348                    $thisBd.hide().css("visibility", "visible");
2349                    // B. 动画展开
2350                    $thisHd.addClass("on");
2351                    setTimeout(function() {
2352                        $thisSelect.addClass("zindex");
2353                    }, 200);
2354                    $thisBd.stop().slideDown(200, function() {
2355                        $(this).addClass("showscroll");
2356                        $scrollInof.mCustomScrollbar("update");
2357                    });
2358                }
2359            });
2360            // 选项点击(多选逻辑)
2361            $obj.find(".ys-checkbox-bd").off('click', '.ys-select-li').on("click", ".ys-select-li", function(e) {
2362                e.stopPropagation();
2363                var $li = $(this);
2364                var $bd = $li.closest('.ys-checkbox-bd');
2365                var $hd = $bd.siblings(".ys-select-hd");
2366                $li.toggleClass("on"); // 切换选中状态
2367                var $onLis = $bd.find('.ys-select-li.on');
2368                var length1 = $onLis.length;
2369                // 必填校验显示隐藏
2370                var $required = $li.parents('.ys-form-required');
2371                if (length1 > 0) {
2372                    $required.removeClass('ys-form-empty');
2373                } else {
2374                    $required.addClass('ys-form-empty');
2375                }
2376                // 处理显示文字和 ID 集合
2377                var displayValue = '';
2378                var idArr = [];
2379                var dataResult = [];
2380                if (length1 === 1) {
2381                    var $singleOn = $onLis.eq(0);
2382                    displayValue = $singleOn.find('.ys-checkbox1-font').text().trim();
2383                    idArr.push($singleOn.data('id'));
2384                    dataResult = $singleOn.data();
2385                } else if (length1 > 1) {
2386                    displayValue = texta + length1 + textb;
2387                    $onLis.each(function() {
2388                        idArr.push($(this).data('id'));
2389                        dataResult.push($(this).data());
2390                    });
2391                }
2392                // 更新头部显示和隐藏域
2393                $hd.find(".ys-select-show").val(displayValue);
2394                $hd.find(".ys-select-real").attr("data-id", idArr.join(',')).val(idArr.join(',')).trigger("change");
2395                if (callback) {
2396                    callback(dataResult);
2397                }
2398            });
2399            // 点击页面空白关闭
2400            $(document).off('click.checkbox_close').on('click.checkbox_close', function(e) {
2401                if (!$(e.target).closest('.ys-select').length) {
2402                    $(".ys-select.zindex").each(function() {
2403                        var $active = $(this);
2404                        $active.find(".ys-select-hd").removeClass("on");
2405                        $active.find(".ys-checkbox-bd").removeClass("showscroll").stop().slideUp(function() {
2406                            $active.removeClass("zindex");
2407                            checkSelectEmpty($active);
2408                        });
2409                    });
2410                }
2411            });
2412            // 初始化滚动条
2413            var scrollConfig = {
2414                axis: "y",
2415                scrollInertia: 500, // 全局设为 0,彻底消除停顿感
2416                theme: 'dark',
2417                scrollbarPosition: "outside",
2418                advanced: { autoScrollOnFocus: false }
2419            };
2420            $obj.find(".ys-checkbox-bd .ys-select-inof").mCustomScrollbar(scrollConfig);
2421            // 默认禁用,等展开时再 update
2422            $obj.find(".ys-checkbox-bd .ys-select-inof").mCustomScrollbar("disable");
2423            // 阻止滚动条点击冒泡
2424            $('body').on('click', '.mCSB_scrollTools', function (e) {
2425                e.stopPropagation();
2426            });
2427        },
2428        /**
2429         * @description 带搜索多选下拉选择2
2430         * @param {String} selector - css选择器
2431         * @param {String} value - 传值
2432         */
2433        checkbox2: function(selector, callback) {
2434            var $obj = $(selector);
2435            // 初始化数据
2436            $obj.find(".ys-select-li").each(function(index) {
2437                var $this = $(this);
2438                if ($this.attr("data-id") == undefined) {
2439                    $this.attr("data-id", index);
2440                }
2441                $this.attr("data-value", $this.find('.ys-checkbox1-font').text().trim());
2442            });
2443            // 内部校验
2444            var checkSelectEmpty = function($targetSelect) {
2445                var $required = $targetSelect.closest('.ys-form-required');
2446                if ($required.length > 0) {
2447                    var val = $targetSelect.find(".ys-select-show").val();
2448                    $required.toggleClass('ys-form-empty', (!val || val.trim() === ""));
2449                }
2450            };
2451            // 内部私有:瞬间定位到第一个选中项 ---
2452            var jumpToSelectedSync = function($container, $bd) {
2453                var $firstSelected = $bd.find(".ys-select-li.on").first();
2454                $container.mCustomScrollbar("update");
2455                if ($firstSelected.length > 0) {
2456                    $container.mCustomScrollbar("scrollTo", $firstSelected, {
2457                        scrollInertia: 0,
2458                        timeout: 0,
2459                        callbacks: false
2460                    });
2461                } else {
2462                    $container.mCustomScrollbar("scrollTo", "top", {
2463                        scrollInertia: 0,
2464                        timeout: 0,
2465                        callbacks: false
2466                    });
2467                }
2468            };
2469            // 头部点击逻辑
2470            $obj.find(".ys-select-hd").off('click').click(function(e) {
2471                e.stopPropagation();
2472                var $thisHd = $(this);
2473                var $thisSelect = $thisHd.closest(".ys-select");
2474                var $thisBd = $thisHd.siblings(".ys-checkbox-bd");
2475                var $scrollInof = $thisBd.find(".ys-select-inof");
2476                // 互斥关闭其他
2477                $(".ys-select-hd").not(this).each(function() {
2478                    var $otherHd = $(this);
2479                    var $otherSelect = $otherHd.closest(".ys-select");
2480                    if ($otherSelect.hasClass("zindex")) {
2481                        $otherHd.removeClass("on");
2482                        $otherSelect.find(".ys-checkbox-bd, .ys-select-bd").stop().hide();
2483                        $otherSelect.removeClass("zindex");
2484                        checkSelectEmpty($otherSelect);
2485                    }
2486                });
2487                if ($thisSelect.hasClass("zindex")) {
2488                    // 收回
2489                    $thisHd.removeClass("on");
2490                    $thisBd.removeClass("showscroll").stop().slideUp(function() {
2491                        $thisSelect.removeClass("zindex");
2492                        $scrollInof.mCustomScrollbar("disable");
2493                        checkSelectEmpty($thisSelect);
2494                    });
2495                } else {
2496                    // 展开前预渲染定位
2497                    $thisBd.show().css("visibility", "hidden");
2498                    jumpToSelectedSync($scrollInof, $thisBd);
2499                    $thisBd.hide().css("visibility", "visible");
2500                    // 执行展开
2501                    $thisHd.addClass("on");
2502                    setTimeout(function() { $thisSelect.addClass("zindex"); }, 200);
2503                    $thisBd.stop().slideDown(200, function() {
2504                        $(this).addClass("showscroll");
2505                        $scrollInof.mCustomScrollbar("update");
2506                        checkSelectEmpty($thisSelect);
2507                    });
2508                }
2509            });
2510            // 列表项点击逻辑
2511            $obj.find(".ys-checkbox-bd").off('click', '.ys-select-li').on("click", ".ys-select-li", function(e) {
2512                e.stopPropagation();
2513                var $li = $(this);
2514                var $bd = $li.closest('.ys-checkbox-bd');
2515                var $hd = $bd.siblings(".ys-select-hd");
2516                $li.toggleClass("on");
2517                var $onLis = $bd.find('.ys-select-li.on');
2518                var length1 = $onLis.length;
2519                // 必填校验
2520                var $required = $li.parents('.ys-form-required');
2521                $required.toggleClass('ys-form-empty', length1 === 0);
2522                var displayValues = [];
2523                var idArr = [];
2524                var dataResult = [];
2525                // 遍历所有选中的 li,提取文字和 ID
2526                $onLis.each(function(i) {
2527                    var $current = $(this);
2528                    displayValues.push($current.find('.ys-checkbox1-font').text().trim());
2529                    idArr.push($current.data('id'));
2530                    dataResult.push($current.data());
2531                });
2532                // 将结果用逗号拼接展示
2533                $hd.find(".ys-select-show").val(displayValues.join(','));
2534                // 注意:data.id 在多选时应传合集或首项,这里遵循你原代码逻辑传 id 字符串
2535                $hd.find(".ys-select-real").attr("data-id", idArr.join(',')).val(idArr.join(',')).trigger("change");
2536                if (callback) callback(dataResult);
2537            });
2538            // 点击页面关闭
2539            $(document).off('click.checkbox2_close').on('click.checkbox2_close', function(e) {
2540                if (!$(e.target).closest('.ys-select').length) {
2541                    $(".ys-select.zindex").each(function() {
2542                        var $active = $(this);
2543                        $active.find(".ys-select-hd").removeClass("on");
2544                        $active.find(".ys-checkbox-bd").removeClass("showscroll").stop().slideUp(function() {
2545                            $active.removeClass("zindex");
2546                            checkSelectEmpty($active);
2547                        });
2548                    });
2549                }
2550            });
2551            // 滚动条配置
2552            var scrollConfig = {
2553                axis: "y",
2554                scrollInertia: 500,
2555                theme: 'dark',
2556                scrollbarPosition: "outside",
2557                advanced: { autoScrollOnFocus: false }
2558            };
2559            $obj.find(".ys-checkbox-bd .ys-select-inof").mCustomScrollbar(scrollConfig);
2560            $obj.find(".ys-checkbox-bd .ys-select-inof").mCustomScrollbar("disable");
2561            // 阻止滚动条点击冒泡
2562            $obj.find('.mCSB_scrollTools').off('click').on('click', function (e) {
2563                e.stopPropagation();
2564            });
2565        },
2566        /**
2567         * @description 表单下拉搜索嵌入
2568         * @param {String} nodata - 没有数据时替换文字
2569         */
2570        select_input: function(nodata) {
2571            $(document).off('input.ys_input', '.ys-fiiss-input input').on('input.ys_input', '.ys-fiiss-input input', function() {
2572                var $inputWrap = $(this).parents('.ys-fiiss-input');
2573                if ($(this).val() === '') {
2574                    $inputWrap.removeClass('act');
2575                } else {
2576                    $inputWrap.addClass('act');
2577                }
2578            });
2579            $(document).off('click.ys_clear', '.ys-fiiss-input-close').on('click.ys_clear', '.ys-fiiss-input-close', function(e) {
2580                e.stopPropagation();
2581                var $inputWrap = $(this).parents('.ys-fiiss-input');
2582                var $input = $inputWrap.find('input');
2583                $input.val('').trigger('input'); // 触发 input 事件以恢复列表
2584                $inputWrap.removeClass('act');
2585            });
2586            $('.ys-fiiss-input').each(function() {
2587                var $inputWrap = $(this);
2588                if ($inputWrap.parents('.ys-form-inof-item').hasClass('ys-form-next')) return;
2589                var $core = $inputWrap.siblings('.ys-fiiss-core');
2590                var $contentArea = $core.find(".mCSB_container").length > 0 ? $core.find(".mCSB_container") : $core;
2591                // 核心:在初始化时保存原始 HTML。注意:只在第一次初始化时保存,防止重复保存搜索后的结果
2592                if (!$inputWrap.data('original-html')) {
2593                    $inputWrap.data('original-html', $contentArea.html());
2594                }
2595                var originalHtml = $inputWrap.data('original-html');
2596                var timer = null;
2597                $inputWrap.find("input").off("input.filter").on("input.filter", function () {
2598                    var _this = this;
2599                    var val = $(_this).val().toLowerCase();
2600                    var $selectBd = $inputWrap.closest('.ys-select-bd');
2601                    var valueon = $selectBd.find('.ys-select-li.on').data('value');
2602                    if (timer) clearTimeout(timer);
2603                    timer = setTimeout(function () {
2604                        if (val === '') {
2605                            $contentArea.html(originalHtml);
2606                        } else {
2607                            var $tempDiv = $('<div>').append(originalHtml);
2608                            var resultArr = [];
2609                            $tempDiv.find('.ys-select-li').each(function() {
2610                                var itemText = $(this).data('value') ? String($(this).data('value')) : $(this).text().trim();
2611                                if (itemText.toLowerCase().indexOf(val) !== -1) {
2612                                    var newText = itemText.replace(new RegExp('(' + val + ')', 'gi'), '<span style="color:red;">$1</span>');
2613                                    $(this).html(newText);
2614                                    resultArr.push($(this)[0].outerHTML);
2615                                }
2616                            });
2617                            if (resultArr.length === 0) {
2618                                $contentArea.html('<li class="ys-select-li ys-select-emptyli">' + nodata + '</li>');
2619                            } else {
2620                                $contentArea.html(resultArr.join(''));
2621                            }
2622                        }
2623                        // 重新标记选中项
2624                        if (valueon) {
2625                            $contentArea.find('.ys-select-li[data-value="' + valueon + '"]').addClass('on');
2626                        }
2627                        $core.mCustomScrollbar("update");
2628                        $core.mCustomScrollbar("scrollTo", "top", { scrollInertia: 0 });
2629                    }, 200);
2630                });
2631            });
2632        },
2633        // 表单下拉搜索
2634        select_input_dan: function(ele, nodata) {
2635            var $ele = $(ele);
2636            var $selectBd = $ele.closest('.ys-select-bd');
2637            var $core = $ele.siblings('.ys-fiiss-core');
2638            var $container = $core.find(".mCSB_container").length > 0 ? $core.find(".mCSB_container") : $core;
2639            // 缓存原始 HTML(只在第一次调用时缓存)
2640            if (!$ele.data('original-html')) {
2641                $ele.data('original-html', $container.html());
2642            }
2643            var originalHtml = $ele.data('original-html');
2644            // 输入框逻辑:控制清空按钮 + 过滤
2645            var timer = null;
2646            $ele.find("input").off("input").on("input", function() {
2647                var _this = this;
2648                var val = $(_this).val().trim().toLowerCase();
2649                // 控制清空按钮显示
2650                $ele.toggleClass('act', val !== '');
2651                if (timer) clearTimeout(timer);
2652                timer = setTimeout(function() {
2653                    if (val === '') {
2654                        $container.html(originalHtml);
2655                    } else {
2656                        var $tempDiv = $('<div>').append(originalHtml);
2657                        var resultHtml = '';
2658                        $tempDiv.find('.ys-select-li').each(function() {
2659                            var $li = $(this);
2660                            var text = $li.data('value') ? String($li.data('value')) : $li.text().trim();
2661                            if (text.toLowerCase().indexOf(val) !== -1) {
2662                                // 高亮匹配文字
2663                                var highlighted = text.replace(new RegExp('(' + val + ')', 'gi'), '<span style="color:red;">$1</span>');
2664                                $li.html(highlighted);
2665                                resultHtml += $li[0].outerHTML;
2666                            }
2667                        });
2668                        $container.html(resultHtml || '<li class="ys-select-li ys-select-emptyli">' + nodata + '</li>');
2669                    }
2670                    // 保持之前选中的高亮
2671                    var currentVal = $selectBd.siblings('.ys-select-hd').find('.ys-select-show').val();
2672                    $container.find('.ys-select-li').each(function() {
2673                        if ($(this).data('value') == currentVal) $(this).addClass('on');
2674                    });
2675                    // 刷新滚动条
2676                    $core.mCustomScrollbar("update");
2677                    $core.mCustomScrollbar("scrollTo", "top", { scrollInertia: 0 });
2678                }, 200);
2679            });
2680            // 清空按钮点击
2681            $ele.find('.ys-fiiss-input-close').off('click').on('click', function(e) {
2682                e.stopPropagation();
2683                $ele.find('input').val('').trigger('input');
2684            });
2685        },
2686    });
2687    // slick滚动到自动轮播
2688    function slickAuto(accy) {
2689        var offset = accy || 0;
2690        return this.each(function() { // 保持链式调用
2691            var $this = $(this);
2692            $this.appear(function() {
2693                if ($this.hasClass('slick-initialized')) {
2694                    $this.slick("slickPlay"); // 注意:较新版本 slick 建议用 slickPlay
2695                }
2696            }, { accY: offset });
2697        });
2698    }
2699    $.fn.slickAuto = slickAuto;
2700    // load加载动画
2701    var loading = {
2702        show:function(fonts){
2703            var fonts = fonts ? fonts : '加载中';
2704            var loadingELe = '';
2705            loadingELe+='<div id="modal-loading">';
2706            loadingELe+='    <div class="modal-loading-container">';
2707            loadingELe+='        <svg class="loading-svg" viewBox="0 0 40 40" version="1.1" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">';
2708            loadingELe+='            <circle class="loading-svg-circle loading-svg-circle1" cx="50%" cy="50%" r="12" stroke-width="3" stroke="#1833BA" />';
2709            loadingELe+='            <circle class="loading-svg-circle loading-svg-circle2" cx="50%" cy="50%" r="16" stroke-width="3" stroke="#1833BA" />';
2710            loadingELe+='        </svg>';
2711            loadingELe+='        <div class="loading-svg-text">'+fonts+'</div>';
2712            loadingELe+='    </div>';
2713            loadingELe+='</div>';
2714            if($("#modal-loading").length<1){
2715                $("body").append(loadingELe);
2716            }
2717            $("#modal-loading").removeAttr("style").css("display", "flex");
2718        },
2719        hide:function(){
2720            $("#modal-loading").stop().fadeOut();
2721        }
2722    };
2723    ys.loading = loading;
2724    // iPad导航兼容
2725    document.addEventListener('DOMContentLoaded', (event) => {
2726        // 检测是否是iPad
2727        const isIPad = navigator.userAgent.match(/iPad/i) != null;
2728        if (isIPad) {
2729            // 为所有链接添加点击事件监听器
2730            document.querySelectorAll('.head-nav-item-title').forEach((link) => {
2731                link.addEventListener('click', (event) => {
2732                // 阻止链接跳转
2733                event.preventDefault();
2734                // 可以在这里添加其他逻辑,比如显示警告信息等
2735                //   alert('链接跳转被禁止!');
2736                });
2737            });
2738        }
2739    });
2740    if(window.innerWidth<1200){
2741        // QQ浏览器图集触发兼容性问题,viewer-show加给图片放大插件中要放大的图片
2742        $('img:not([data-original]),video').click(function (e) {
2743            e.preventDefault();
2744        });
2745        $('img,video').each(function () {
2746            if ($(this).parents('a').length > 0) {
2747                if ($(this).parents('a').attr('target') == '_blank') {
2748                    $(this).parents('a').click(function(){
2749                        window.open(this.href,'_blank');
2750                    });
2751                }else if($(this).parents('a').attr('href') != "javascript:void(0);" && $(this).parents('a').attr('href')!='javascript:void(0)' && $(this).parents('a').attr('href')!='' && $(this).parents('a').attr('href')!='javascript:;' && $(this).parents('a').attr('href')!=undefined){
2752                    $(this).parents('a').click(function(){
2753                        window.location = this.href;
2754                    });
2755                }
2756            }
2757        })
2758    }
2759    // img尺寸提示代码
2760    $(function(){
2761        if (typeof(closeWeb)=='undefined') {
2762            showImgSize();
2763            window.onload = showImgSize;
2764            function showImgSize() {
2765                $("img").each(function () {
2766                    var w = this.naturalWidth;
2767                    var h = this.naturalHeight;
2768                    if(w<400 || h<400){
2769                        w = w*2;
2770                        h = h*2;
2771                    }
2772                    $(this).attr('data-size', w + "*" + h);
2773                });
2774            }
2775        }
2776    })
2777    window.ys = ys;
2778}(window));
2779
2780
2781var anmtArr = [];
2782
2783function banVideow(selector) {
2784    var $obj = $(selector);
2785    var autoplay = true;
2786    if ($(window).width() > 1200 && $obj.find("video").length > 0) {
2787        init();
2788
2789        function init() {
2790            firstVideo();
2791            videoEnd();
2792            afterChange();
2793            videoCircleInit();
2794        };
2795        // 濡偓妤犲瞼顑囨稉鈧仦蹇旀Ц閸氾附婀佺憴鍡涱暥
2796        function firstVideo() {
2797            var $firSlide = $obj.find(".slick-slide[data-slick-index=0]");
2798            var $video = $firSlide.find("video");
2799            // autoplay閼奉亜濮╅幘顓熸杹
2800            if ($video.length > 0) {
2801                $obj.slick('slickPause');
2802                // 婵″倹鐏夋潪顔芥尡閸欘亝婀佹稉鈧稉顏勬儕閻滎垱鎸遍弨锟�
2803                if ($obj.get(0).slick.slideCount < 2) {
2804                    $video.attr("loop", "loop");
2805                };
2806                if ($video.get(0).paused) {
2807                    setTimeout(function () {
2808                        $video.get(0).play();
2809                    }, 100);
2810                }
2811            } else {
2812                $obj.slick('slickPlay');
2813                anmtArr[0].play();
2814            }
2815        };
2816        // 閸掑洦宕查崚棰佺瑓娑撯偓瀵姵妲搁崥锔芥箒鐟欏棝顣�
2817        function afterChange() {
2818            $obj.on('afterChange', function (event, slick, index) {
2819                // 鐟欏棝顣堕弳鍌氫粻楠炶泛娲栭崚鎵儑娑撯偓鐢拷
2820                $obj.find("video").each(function () {
2821                    var video = $(this).get(0);
2822                    video.pause();
2823                    video.currentTime = 0;
2824                });
2825                // 閺堝顫嬫0鎴濆灟閺嗗倸浠犳潪顔芥尡
2826                var $nowSlide = $(slick.$slides[index]);
2827                var $video = $nowSlide.find("video");
2828                if ($video.length > 0) {
2829                    $obj.slick('slickPause');
2830                    $video.get(0).play();
2831                } else {
2832                    if (autoplay) {
2833                        $obj.slick('slickPlay');
2834                    }
2835                    anmtArr[index].play();
2836                };
2837            });
2838        };
2839        // 鐟欏棝顣堕崷鍡楁箑鏉╂稑瀹抽崠褰掑帳
2840        function videoCircleInit() {
2841            $obj.find("video").each(function () {
2842                var video = $(this).get(0);
2843                video.ontimeupdate = function (e) {
2844                    var index = parseInt($(this).parents(".slick-slide").attr(
2845                        "data-slick-index"));
2846                    var duration = this.duration;
2847                    var currentTime = this.currentTime;
2848                    var progress = parseInt((currentTime / duration) * 100) / 100;
2849                    if (progress < 1) {
2850                        if (anmtArr[index]) {
2851                            anmtArr[index].seek(anmtArr[index].duration * progress);
2852                        }
2853                    } else {
2854                        if (anmtArr[index]) {
2855                            anmtArr[index].seek(anmtArr[index].duration * 0.999999);
2856                        }
2857                        $obj.slick("next");
2858                    }
2859                };
2860            });
2861        };
2862        // 鐟欏棝顣堕幘顓炵暚閸掑洦宕查崚棰佺瑓娑撯偓瀵拷
2863        function videoEnd() {
2864            $obj.find("video").each(function () {
2865                var video = $(this).get(0);
2866                video.onended = function () {
2867                    if (autoplay) {
2868                        $obj.slick("next");
2869                        $obj.slick('slickPlay');
2870                    }
2871                };
2872            });
2873        };
2874
2875    } else {
2876        $obj.slick('play');
2877        anmtArr[0].play();
2878        $obj.on('afterChange', function (event, slick, index) {
2879            anmtArr[index].play();
2880        });
2881    };
2882    $obj.on('beforeChange', function (event, slick, index) {
2883        // 鐟欏棝顣堕弳鍌氫粻楠炶泛娲栭崚鎵儑娑撯偓鐢拷
2884        $obj.find("video").each(function () {
2885            var video = $(this).get(0);
2886            video.pause();
2887            video.currentTime = 0;
2888        });
2889        // 閸斻劎鏁鹃弳鍌氫粻楠炶泛娲栭崚鎵儑娑撯偓鐢拷
2890        anmtArr[index].pause();
2891        anmtArr[index].seek(0);
2892    });
2893    var banvideo = {
2894        play: function () {
2895            $obj.slick('slickPlay');
2896            autoplay = true;
2897        },
2898        pause: function () {
2899            autoplay = false;
2900            $obj.slick('slickPause');
2901        }
2902    };
2903    return banvideo;
2904};
2905ys.banVideow = banVideow;

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.