app.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // +----------------------------------------------------------------------
  2. // | ThinkAdmin
  3. // +----------------------------------------------------------------------
  4. // | 版权所有 2014~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  5. // +----------------------------------------------------------------------
  6. // | 官方网站: http://think.ctolog.com
  7. // +----------------------------------------------------------------------
  8. // | 开源协议 ( https://mit-license.org )
  9. // +----------------------------------------------------------------------
  10. // | github开源项目:https://github.com/zoujingli/ThinkAdmin
  11. // +----------------------------------------------------------------------
  12. // 当前资源URL目录
  13. var baseRoot = (function () {
  14. var scripts = document.scripts, src = scripts[scripts.length - 1].src;
  15. return src.substring(0, src.lastIndexOf("/") + 1);
  16. })();
  17. // 配置参数
  18. require.config({
  19. waitSeconds: 60,
  20. baseUrl: baseRoot,
  21. map: {'*': {css: baseRoot + 'plugs/require/require.css.js'}},
  22. paths: {
  23. 'template': ['plugs/template/template'],
  24. 'pcasunzips': ['plugs/jquery/pcasunzips'],
  25. // openSource
  26. 'json': ['plugs/jquery/json2.min'],
  27. 'layui': ['plugs/layui/layui'],
  28. 'base64': ['plugs/jquery/base64.min'],
  29. 'angular': ['plugs/angular/angular.min'],
  30. 'ckeditor': ['plugs/ckeditor/ckeditor'],
  31. 'websocket': ['plugs/socket/websocket'],
  32. // jQuery
  33. 'jquery.ztree': ['plugs/ztree/jquery.ztree.all.min'],
  34. 'jquery.masonry': ['plugs/jquery/masonry.min'],
  35. 'jquery.cookies': ['plugs/jquery/jquery.cookie'],
  36. // bootstrap
  37. 'bootstrap': ['plugs/bootstrap/js/bootstrap.min'],
  38. 'bootstrap.typeahead': ['plugs/bootstrap/js/bootstrap3-typeahead.min'],
  39. 'bootstrap.multiselect': ['plugs/bootstrap-multiselect/bootstrap-multiselect'],
  40. // distpicker
  41. 'distpicker': ['plugs/distpicker/distpicker'],
  42. },
  43. shim: {
  44. // open-source
  45. 'websocket': {deps: [baseRoot + 'plugs/socket/swfobject.min.js']},
  46. // jquery
  47. 'jquery.ztree': {deps: ['css!' + baseRoot + 'plugs/ztree/zTreeStyle/zTreeStyle.css']},
  48. // bootstrap
  49. 'bootstrap.typeahead': {deps: ['bootstrap']},
  50. 'bootstrap.multiselect': {deps: ['bootstrap', 'css!' + baseRoot + 'plugs/bootstrap-multiselect/bootstrap-multiselect.css']},
  51. 'distpicker': {deps: [baseRoot + 'plugs/distpicker/distpicker.data.js']},
  52. },
  53. deps: ['json', 'bootstrap'],
  54. // 开启debug模式,不缓存资源
  55. // urlArgs: "ver=" + (new Date()).getTime()
  56. });
  57. // 注册jquery到require模块
  58. define('jquery', function () {
  59. return layui.$;
  60. });
  61. // UI框架初始化
  62. PageLayout.call(this);
  63. // UI框架布局函数
  64. function PageLayout(callback, custom) {
  65. window.WEB_SOCKET_SWF_LOCATION = baseRoot + "plugs/socket/WebSocketMain.swf";
  66. require(custom || [], callback || false);
  67. }