Files
sentcms/public/static/admin/js/main.js
2019-07-06 16:59:35 +08:00

174 lines
6.7 KiB
JavaScript

require.config({
urlArgs: "v=" + '4.0.0',
packages: [
{
name: 'moment',
location: '/static/libs/moment',
main: 'moment'
}
],
include: ['jquery', 'drop', 'drag', 'form'],
paths:{
'backend': '../admin/js/backend',
'form': '/static/js/require-form',
'table': '/static/js/require-table',
'upload': '/static/js/require-upload',
'validator': '/static/js/require-validator',
'drag': 'jquery.drag.min',
'drop': 'jquery.drop.min',
'echarts': 'echarts.min',
'echarts-theme': 'echarts-theme',
"vue":'/static/libs/vue/dist/vue.min',
"jquery":'/static/libs/jquery/jquery.min',
"nanoscroller":"/static/libs/nanoscroller/jquery.nanoscroller.min",
"slimscroll":"/static/js/jquery.slimscroll.min",
"bootstrap":"/static/libs/bootstrap/js/bootstrap.min",
'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
'bootstrap-table-template': 'bootstrap-table-template',
//
// 以下的包从bower的libs目录加载
'jquery': '/static/libs/jquery/dist/jquery.min',
'bootstrap': '/static/libs/bootstrap/dist/js/bootstrap.min',
'bootstrap-datetimepicker': '/static/libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
'bootstrap-daterangepicker': '/static/libs/bootstrap-daterangepicker/daterangepicker',
'bootstrap-select': '/static/libs/bootstrap-select/dist/js/bootstrap-select.min',
'bootstrap-select-lang': '/static/libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
'bootstrap-table': '/static/libs/bootstrap-table/dist/bootstrap-table.min',
'bootstrap-table-export': '/static/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
'bootstrap-table-mobile': '/static/libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
'bootstrap-table-lang': '/static/libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
'bootstrap-slider': '/static/libs/bootstrap-slider/bootstrap-slider',
'tableexport': '/static/libs/tableExport.jquery.plugin/tableExport.min',
'dragsort': '/static/libs/fastadmin-dragsort/jquery.dragsort',
'sortable': '/static/libs/Sortable/Sortable.min',
'addtabs': '/static/libs/fastadmin-addtabs/jquery.addtabs',
'slimscroll': '/static/libs/jquery-slimscroll/jquery.slimscroll',
'validator-core': '/static/libs/nice-validator/dist/jquery.validator',
'validator-lang': '/static/libs/nice-validator/dist/local/zh-CN',
'plupload': '/static/libs/plupload/js/plupload.min',
'toastr': '/static/libs/toastr/toastr',
'jstree': '/static/libs/jstree/dist/jstree.min',
'layer': '/static/libs/fastadmin-layer/dist/layer',
'cookie': '/static/libs/jquery.cookie/jquery.cookie',
'cxselect': '/static/libs/fastadmin-cxselect/js/jquery.cxselect',
'template': '/static/libs/art-template/dist/template-native',
'selectpage': '/static/libs/fastadmin-selectpage/selectpage',
'citypicker': '/static/libs/fastadmin-citypicker/dist/js/city-picker.min',
'citypicker-data': '/static/libs/fastadmin-citypicker/dist/js/city-picker.data',
},
shim:{
"nanoscroller":['jquery'],
"slimscroll":{
deps: ['jquery'],
exports: '$.fn.extend'
},
'bootstrap': ['jquery'],
'bootstrap-table': {
deps: [
'bootstrap',
// 'css!/static/libs/bootstrap-table/dist/bootstrap-table.min.css'
],
exports: '$.fn.bootstrapTable'
},
'bootstrap-table-lang': {
deps: ['bootstrap-table'],
exports: '$.fn.bootstrapTable.defaults'
},
'bootstrap-table-export': {
deps: ['bootstrap-table', 'tableexport'],
exports: '$.fn.bootstrapTable.defaults'
},
'bootstrap-table-mobile': {
deps: ['bootstrap-table'],
exports: '$.fn.bootstrapTable.defaults'
},
'bootstrap-table-advancedsearch': {
deps: ['bootstrap-table'],
exports: '$.fn.bootstrapTable.defaults'
},
'bootstrap-table-commonsearch': {
deps: ['bootstrap-table'],
exports: '$.fn.bootstrapTable.defaults'
},
'bootstrap-table-template': {
deps: ['bootstrap-table', 'template'],
exports: '$.fn.bootstrapTable.defaults'
},
'tableexport': {
deps: ['jquery'],
exports: '$.fn.extend'
},
'bootstrap-datetimepicker': [
'moment/locale/zh-cn.js',
// 'css!/static/libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
],
// 'bootstrap-select': ['css!/static/libs/bootstrap-select/dist/css/bootstrap-select.min.css',],
'bootstrap-select-lang': ['bootstrap-select'],
// 'toastr': ['css!/static/libs/toastr/toastr.min.css'],
'jstree': ['css!/static/libs/jstree/dist/themes/default/style.css',],
'plupload': {
deps: ['/static/libs/plupload/js/moxie.min.js'],
exports: "plupload"
},
// 'layer': ['css!/static/libs/fastadmin-layer/dist/theme/default/layer.css'],
// 'validator-core': ['css!/static/libs/nice-validator/dist/jquery.validator.css'],
'validator-lang': ['validator-core'],
// 'selectpage': ['css!/static/libs/fastadmin-selectpage/selectpage.css'],
'citypicker': ['citypicker-data', 'css!/static/libs/fastadmin-citypicker/dist/css/city-picker.css']
},
baseUrl:"/static/js/",
map: {
'*': {
'css': '/static/libs/require-css/css.min.js'
}
},
//baseUrl: '/static/admin/js/backend/',
waitSeconds: 30,
charset: 'utf-8' // 文件编码
});
require(['jquery', 'nanoscroller', 'bootstrap'], function($){
$(function($) {
require(['sent'], function(Sent){
require(['backend', 'backend-init', 'addons'], function (Backend, undefined, Addons) {
// 避免目录冲突
require.config({baseUrl: '/static/admin/js/module/'});
var current_url = (window.location.pathname).split('/');
if (typeof(isLoadModule) != "undefined" && isLoadModule) {
require([current_url[2]], function(Controller){
var action = current_url[3].split('.');
if (Controller.hasOwnProperty(action[0])) {
Controller[action[0]]();
} else {
if (Controller.hasOwnProperty("_empty")) {
Controller._empty();
}
}
}, function (e) {
console.error(e); // 这里可捕获模块加载的错误
})
}
})
})
$.fn.removeClassPrefix = function(prefix) {
this.each(function(i, el) {
var classes = el.className.split(" ").filter(function(c) {
return c.lastIndexOf(prefix, 0) !== 0;
});
el.className = classes.join(" ");
});
return this;
};
});
function setContentBody() {
header_height = $('header#header-navbar').height();
if ($(window).height() - header_height - 50 > $('#content-wrapper').height()) {
$('#content-wrapper').height($(window).height() - header_height - 50);
}
}
})