/** EasyWeb iframe v3.1.7 date:2020-03-11 License By http://easyweb.vip */

layui.config({
    version: '317',
    base: getProjectUrl() + 'module/',
    defaultTheme: 'theme-colorful', // 默认主题
    tabAutoRefresh: false,           // 是否切换Tab自动刷新页面
    ajaxSuccessBefore: function (res, url, obj) {
        var layer = layui.layer;
        var notice = layui.notice;
        if (res.ajsx_common && res.code == 1001) {
            layer.closeAll();
            parent.layui.admin.confirm(res.msg,function (index) {
                parent.layer.close(index);
            })
            // notice.msg(res.msg, {icon: 2});
            // layui.notice.error({
            //     theme:'dark',
            //     timeout: 2500,
            //     animateInside:true,
            //     position:"topCenter",
            //     transitionIn:"bounceInDown",
            //     transitionOut:'fadeOutDown',
            //     title: res.msg,
            //     message: res.msg
            // });
            // return false
        }
    }
}).extend({
    steps: 'steps/steps',
    notice: 'notice/notice',
    cascader: 'cascader/cascader',
    // dropdown: 'dropdown/dropdown',
    fileChoose: 'fileChoose/fileChoose',
    // treeTable: 'treeTable/treeTable',
    Split: 'Split/Split',
    Cropper: 'Cropper/Cropper',
    tagsInput: 'tagsInput/tagsInput',
    citypicker: 'city-picker/city-picker',
    introJs: 'introJs/introJs',
    zTree: 'zTree/zTree',
    eleTree: 'eleTree/eleTree'
}).use(['layer', 'admin'], function () {
    var $ = layui.jquery;
    var layer = layui.layer;
    var admin = layui.admin;


    setTimeout(function () {
        admin.removeLoading();
    }, window === top ? 300 : 0);

});

function getProjectUrl() {
    var layuiDir = layui.cache.dir;
    if (!layuiDir) {
        var js = document.scripts, last = js.length - 1, src;
        for (var i = last; i > 0; i--) {
            if (js[i].readyState === 'interactive') {
                src = js[i].src;
                break;
            }
        }
        var jsPath = src || js[last].src;
        layuiDir = jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
    }
    return layuiDir.substring(0, layuiDir.indexOf('assets'));
}

function msg(title, message, inc) {
    if (inc == 1) {
        layui.notice.success({
            theme: 'dark',
            timeout: 2500,
            animateInside: true,
            position: "topCenter",
            transitionIn: "bounceInDown",
            transitionOut: 'fadeOutDown',
            title: title,
            message: message
        });
    }
    if (inc == 2) {
        layui.notice.error({
            theme: 'dark',
            timeout: 2500,
            animateInside: true,
            position: "topCenter",
            transitionIn: "bounceInDown",
            transitionOut: 'fadeOutDown',
            title: title,
            message: message
        });
    }

}
