MrShi
2025-07-04 82d483406921aa92b6ce3a1af5d17d80ccb78256
web/js/operation.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
$(document).ready(function() {
    // è®¾ç½®å…¬å…±å¯¼èˆªæ 
    // $("#header").load("./components/nav.html");
    // è®¾ç½®å…¬å…±åº•部
    $("#footer").load("./components/footer.html");
    // å½“页面滚动到一定距离时显示返回顶部按钮
    $('#back-to-top').fadeOut();
    $(window).scroll(function() {
        if ($(this).scrollTop() > 100) { // è¿™é‡Œå¯ä»¥æ ¹æ®éœ€è¦è°ƒæ•´æ•°å€¼
            $('#back-to-top').fadeIn(); // æ˜¾ç¤ºæŒ‰é’®
        } else {
            $('#back-to-top').fadeOut(); // éšè—æŒ‰é’®
        }
    });
    // ç‚¹å‡»æŒ‰é’®æ—¶ï¼Œé¡µé¢å¹³æ»‘滚动到顶部
    $('#back-to-top').click(function(event) {
        event.preventDefault(); // é˜»æ­¢é“¾æŽ¥çš„默认行为
        $('html, body').animate({scrollTop: 0}, 800); // é¡µé¢å¹³æ»‘滚动到顶部,800毫秒完成滚动
    });
    $(".index-a-c-item").click(function () {
        // console.log($(this).siblings())
        $(this).siblings().each(function () {
            let name = $(this).attr('name')
            if (name === '资产管理') {
                $(this).children().first().attr('src', './assets/icon/yunwei_ic_zichan@2x.png')
            } else if (name === '巡检运维') {
                $(this).children().first().attr('src', './assets/icon/yunwei_ic_xunjian@2x.png')
            } else if (name === '仓储管理') {
                $(this).children().first().attr('src', './assets/icon/yunwei_ic_cangchu@2x.png')
            } else if (name === '商户管理') {
                $(this).children().first().attr('src', './assets/icon/yunwei_ic_shanghu@2x.png')
            }
            $(this).css('background', '#ffffff')
            $(this)
                .children()
                .last()
                .children()
                .css('color', '#191B1F')
        })
        if ($(this).attr('name') === '资产管理') {
            $(this)
                .css('background', '#FF7900')
                .children()
                .first()
                .attr('src', './assets/icon/yunwei_ic_zichan_sel@2x.png')
        } else if ($(this).attr('name') === '巡检运维') {
            $(this)
                .css('background', '#FF7900')
                .children()
                .first()
                .attr('src', './assets/icon/yunwei_ic_xunjian_sel@2x.png')
        } else if ($(this).attr('name') === '仓储管理') {
            $(this)
                .css('background', '#FF7900')
                .children()
                .first()
                .attr('src', './assets/icon/yunwei_ic_cangchu_sel@2x.png')
        } else if ($(this).attr('name') === '商户管理') {
            $(this)
                .css('background', '#FF7900')
                .children()
                .first()
                .attr('src', './assets/icon/yunwei_ic_shanghu_sel@2x.png')
        }
        $(this)
            .children()
            .last()
            .children()
            .css('color', '#FFFFFF')
    })
});