You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

166 lines
6.9 KiB

  1. require.config({
  2. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  3. packages: [{
  4. name: 'moment',
  5. location: '../libs/moment',
  6. main: 'moment'
  7. }
  8. ],
  9. //在打包压缩时将会把include中的模块合并到主文件中
  10. include: ['css', 'layer', 'toastr', 'fast', 'frontend', 'frontend-init'],
  11. paths: {
  12. 'lang': "empty:",
  13. 'form': 'require-form',
  14. 'table': 'require-table',
  15. 'upload': 'require-upload',
  16. 'validator': 'require-validator',
  17. 'drag': 'jquery.drag.min',
  18. 'drop': 'jquery.drop.min',
  19. 'echarts': 'echarts.min',
  20. 'echarts-theme': 'echarts-theme',
  21. 'adminlte': 'adminlte',
  22. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  23. 'bootstrap-table-template': 'bootstrap-table-template',
  24. //
  25. // 以下的包从bower的libs目录加载
  26. 'jquery': '../libs/jquery/dist/jquery.min',
  27. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  28. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  29. 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
  30. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  31. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  32. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  33. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  34. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  35. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  36. 'bootstrap-table-jumpto': '../libs/bootstrap-table/dist/extensions/page-jumpto/bootstrap-table-jumpto',
  37. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  38. 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
  39. 'sortable': '../libs/Sortable/Sortable.min',
  40. 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
  41. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  42. 'validator-core': '../libs/nice-validator/dist/jquery.validator',
  43. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  44. 'plupload': '../libs/plupload/js/plupload.min',
  45. 'toastr': '../libs/toastr/toastr',
  46. 'jstree': '../libs/jstree/dist/jstree.min',
  47. 'layer': '../libs/fastadmin-layer/dist/layer',
  48. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  49. 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
  50. 'template': '../libs/art-template/dist/template-native',
  51. 'selectpage': '../libs/fastadmin-selectpage/selectpage',
  52. 'citypicker': '../libs/fastadmin-citypicker/dist/js/city-picker.min',
  53. 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data'
  54. },
  55. // shim依赖配置
  56. shim: {
  57. 'addons': ['frontend'],
  58. 'bootstrap': ['jquery'],
  59. 'bootstrap-table': {
  60. deps: [
  61. 'bootstrap',
  62. // 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'
  63. ],
  64. exports: '$.fn.bootstrapTable'
  65. },
  66. 'bootstrap-table-lang': {
  67. deps: ['bootstrap-table'],
  68. exports: '$.fn.bootstrapTable.defaults'
  69. },
  70. 'bootstrap-table-export': {
  71. deps: ['bootstrap-table', 'tableexport'],
  72. exports: '$.fn.bootstrapTable.defaults'
  73. },
  74. 'bootstrap-table-mobile': {
  75. deps: ['bootstrap-table'],
  76. exports: '$.fn.bootstrapTable.defaults'
  77. },
  78. 'bootstrap-table-advancedsearch': {
  79. deps: ['bootstrap-table'],
  80. exports: '$.fn.bootstrapTable.defaults'
  81. },
  82. 'bootstrap-table-commonsearch': {
  83. deps: ['bootstrap-table'],
  84. exports: '$.fn.bootstrapTable.defaults'
  85. },
  86. 'bootstrap-table-template': {
  87. deps: ['bootstrap-table', 'template'],
  88. exports: '$.fn.bootstrapTable.defaults'
  89. },
  90. 'bootstrap-table-jumpto': {
  91. deps: ['bootstrap-table'],
  92. exports: '$.fn.bootstrapTable.defaults'
  93. },
  94. 'tableexport': {
  95. deps: ['jquery'],
  96. exports: '$.fn.extend'
  97. },
  98. 'slimscroll': {
  99. deps: ['jquery'],
  100. exports: '$.fn.extend'
  101. },
  102. 'adminlte': {
  103. deps: ['bootstrap', 'slimscroll'],
  104. exports: '$.AdminLTE'
  105. },
  106. 'bootstrap-daterangepicker': [
  107. 'moment/locale/zh-cn'
  108. ],
  109. 'bootstrap-datetimepicker': [
  110. 'moment/locale/zh-cn',
  111. // 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  112. ],
  113. // 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],
  114. 'bootstrap-select-lang': ['bootstrap-select'],
  115. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  116. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],
  117. 'plupload': {
  118. deps: ['../libs/plupload/js/moxie.min'],
  119. exports: "plupload"
  120. },
  121. // 'layer': ['css!../libs/fastadmin-layer/dist/theme/default/layer.css'],
  122. // 'validator-core': ['css!../libs/nice-validator/dist/jquery.validator.css'],
  123. 'validator-lang': ['validator-core'],
  124. // 'selectpage': ['css!../libs/fastadmin-selectpage/selectpage.css'],
  125. 'citypicker': ['citypicker-data', 'css!../libs/fastadmin-citypicker/dist/css/city-picker.css']
  126. },
  127. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  128. map: {
  129. '*': {
  130. 'css': '../libs/require-css/css.min'
  131. }
  132. },
  133. waitSeconds: 30,
  134. charset: 'utf-8' // 文件编码
  135. });
  136. require(['jquery', 'bootstrap'], function ($, undefined) {
  137. //初始配置
  138. var Config = requirejs.s.contexts._.config.config;
  139. //将Config渲染到全局
  140. window.Config = Config;
  141. // 配置语言包的路径
  142. var paths = {};
  143. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  144. // 避免目录冲突
  145. paths['frontend/'] = 'frontend/';
  146. require.config({paths: paths});
  147. // 初始化
  148. $(function () {
  149. require(['fast'], function (Fast) {
  150. require(['frontend', 'frontend-init', 'addons'], function (Frontend, Addons) {
  151. //加载相应模块
  152. if (Config.jsname) {
  153. require([Config.jsname], function (Controller) {
  154. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  155. }, function (e) {
  156. console.error(e);
  157. // 这里可捕获模块加载的错误
  158. });
  159. }
  160. });
  161. });
  162. });
  163. });