puzhibing
2023-10-08 22199bbdda579861736420fe26c2873ab0f5d21c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
var $parentNode = window.parent.document;
 
function $childNode(name) {
    return window.frames[name]
}
 
// tooltips
$('.tooltip-demo').tooltip({
    selector: "[data-toggle=tooltip]",
    container: "body"
});
 
// 使用animation.css修改Bootstrap Modal
$('.modal').appendTo("body");
 
$("[data-toggle=popover]").popover();
 
//折叠ibox
$('.collapse-link').click(function () {
    var ibox = $(this).closest('div.ibox');
    var button = $(this).find('i');
    var content = ibox.find('div.ibox-content');
    content.slideToggle(200);
    button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
    ibox.toggleClass('').toggleClass('border-bottom');
    setTimeout(function () {
        ibox.resize();
        ibox.find('[id^=map-]').resize();
    }, 50);
});
 
//关闭ibox
$('.close-link').click(function () {
    var content = $(this).closest('div.ibox');
    content.remove();
});
 
//判断当前页面是否在iframe中
if (top == this) {
    var gohome = '<div class="gohome"><a class="animated bounceInUp" href="' + Feng.ctxPath + '/" title="返回首页"><i class="fa fa-home"></i></a></div>';
    $('body').append(gohome);
}
 
//animation.css
function animationHover(element, animation) {
    element = $(element);
    element.hover(
        function () {
            element.addClass('animated ' + animation);
        },
        function () {
            //动画完成之前移除class
            window.setTimeout(function () {
                element.removeClass('animated ' + animation);
            }, 2000);
        });
}
 
//拖动面板
function WinMove() {
    var element = "[class*=col]";
    var handle = ".ibox-title";
    var connect = "[class*=col]";
    $(element).sortable({
            handle: handle,
            connectWith: connect,
            tolerance: 'pointer',
            forcePlaceholderSize: true,
            opacity: 0.8,
        })
        .disableSelection();
};
 
$(function () {
//初始化下拉框
    var config = {
        '.chosen-select': {},
        '.chosen-select-deselect': {
            allow_single_deselect: true
        },
        '.chosen-select-no-single': {
            disable_search_threshold: 10
        },
        '.chosen-select-no-results': {
            no_results_text: '没有要显示的数据!'
        },
        '.chosen-select-width': {
            width: "95%"
        }
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }
    $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
    });
 
 
 
    /* 顶部 展示提醒数量 */
    function TopMessage ( time) {
        this.time = time||30000;
        this.$elems = [];
        this.data = [
            //{ icon: "fa-bell", title: "商品审核", field: "auditeGoodsNum", to_url: Feng.ctxPath + "/mallGoods"},
        ]
        this.$container = $( $parentNode).find("#message_alter");
    }
    TopMessage.prototype = {
        baseSimpleAjax: function( url, callback) {
            (new $ax(Feng.ctxPath + url, callback, function (data) {})).start();
        },
        init: function( url) {
            this.url = url;
            if ( this.$container.hasClass( "_is_add_top_message")) { return; }
            this.$container.addClass( "_is_add_top_message");
            this.prepend_$el();
        },
        prepend_$el: function( ) {
            var that = this;
            (this.data||[]).reverse().forEach( function( item) {
                var $elem = $('' +
                    '<li class="dropdown open">' +
                    '    <a class="count-info order-count" aria-expanded="false" style="background-color:transparent;">' +
                    '        <i class="fa '+ item.icon +'"></i>' + item.title +
                    '        <span class="label label-danger"></span>' +
                    '    </a>' +
                    '</li>');
                that.$container.prepend( $elem);
                $elem.on( "click", function() {
                    sessionStorage.setItem( "aaaaaaaaaaaaaaaaaaaaa_top_to_message", "1");
                    Feng.newCrontab( Feng.url_params(item.to_url, { pending: true}), item.title);
                });
                that._interval( $elem, item.field);
            });
            this._ajax();
        },
        _ajax: function() {
            var that = this;
            that.baseSimpleAjax( that.url, function (data) {
                that.$elems.forEach(function (val) {
                    val.el.find( "span").text( data[ val.field] <= 0 ? '' : data[ val.field]);
                });
            });
        },
        /* 定时器 定时执行 请求 */
        _interval: function( $elem, field) {
            var that = this;
            that.$elems.push( { el: $elem, field: field});
 
            this.interval_id || (this.interval_id = setInterval( function() {
                that._ajax();
            }, this.time||30000));
        }
    }
    //new TopMessage().init( "/indexReport/getIndexForMessage");
});