网站
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

105 wiersze
3.7 KiB

  1. requirejs.config({
  2. urlArgs: "ver=1.0_" + (new Date).getTime(),
  3. baseUrl: '/newBusinessEntities/static/js/',
  4. paths: {
  5. //第三方库的路径配置
  6. jquery: 'lib/jquery/jquery-1.9.1.min', //jquery
  7. bootstrap: 'lib/bootstrap/js/bootstrap.min', //bootstrap
  8. jqueryCookie: 'lib/jquery-cookie/jquery.cookie', //cookie插件
  9. template: 'lib/template/template', //模板引擎
  10. templaten: 'lib/template/template-native', //模板引擎-后端写法
  11. jqueryLazyload: 'lib/jQuery-plugins/jquery.lazyload.min', //图片延迟加载
  12. dialog: 'lib/dialog/dialog', //artDialog弹窗插件
  13. dialogConf: 'lib/dialog/dialog-config',
  14. drag: 'lib/dialog/drag',
  15. popup: 'lib/dialog/popup',
  16. swiper: 'lib/swiper/swiper.min', //焦点图插件
  17. nprogress: 'lib/nprogress/nprogress', //页面加载loading组件
  18. echarts: 'lib/echarts/echarts.min', //echarts组件
  19. laydata:'lib/laydata/laydata',
  20. paging:'lib/paging/page_common',//分页插件
  21. cupload:'lib/cupload/cupload',//上传图片插件
  22. dateTime:'lib/dateTime/dateTime.min',//时间选择器
  23. LeftNav:'lib/LeftNav/LeftNav',//树状标签插件
  24. InfinitePullDown:'lib/InfinitePullDown/InfinitePullDown',//无限下拉菜单插件
  25. //自己写的路径配置
  26. Tools: '/newBusinessEntities/static/js/common/tools',
  27. addressApi: '/newBusinessEntities/static/js/api/index', //所有Ajax接口存放地
  28. user: 'api/user',//用户信息接口
  29. register:'api/register',//用户注册接口
  30. ajaxUploadImage:'lib/ajaxUpload/ajaxupload',//上传图片
  31. kindeditor:'lib/kindeditor/kindeditor-all',
  32. zhCN:'lib/kindeditor/lang/zh-CN',
  33. },
  34. shim: {
  35. bootstrap: {
  36. deps: ['jquery']
  37. },
  38. jqueryLazyload: {
  39. deps: ['jquery']
  40. },
  41. dialog: {
  42. deps: ['jquery', 'dialogConf', 'drag', 'popup'],
  43. exports: 'dialog'
  44. },
  45. swiper: {
  46. deps: ['jquery'],
  47. exports: 'swiper'
  48. },
  49. nprogress: {
  50. deps: ['jquery'],
  51. exports: 'nprogress'
  52. },
  53. paging: {
  54. deps: ['jquery'],
  55. exports: 'paging'
  56. },
  57. dateTime: {
  58. deps: ['jquery'],
  59. exports: 'dateTime'
  60. },
  61. ajaxUploadImage: {
  62. deps: ['jquery'],
  63. exports: 'ajaxUploadImage'
  64. },
  65. LeftNav: {
  66. deps: ['jquery'],
  67. exports: 'LeftNav'
  68. },
  69. InfinitePullDown: {
  70. deps: ['jquery'],
  71. exports: 'InfinitePullDown'
  72. },
  73. }
  74. });
  75. //所有页面都需要的js,先行加载
  76. require(['jquery', 'addressApi']);
  77. require(["jquery", "nprogress"], function ($, nprogress) {
  78. //ajax加载页面跳转
  79. $(document).ajaxStart(function () {
  80. // $('.loading').show();
  81. nprogress.start();
  82. }).ajaxStop(function () {
  83. // $('.loading').hide();
  84. nprogress.done();
  85. });
  86. //根据条件加载不同js文件
  87. var currentPage = $("#require-page").attr("current-page");
  88. var targetModule = $("#require-page").attr("target-module");
  89. if (targetModule) {
  90. // 页面加载完毕后再执行相关业务代码比较稳妥
  91. $(function () {
  92. require([targetModule], function (targetModule) {
  93. //不要在这里写业务代码
  94. //全部统一调用init方法
  95. //也就是每个模块都暴露一个init方法用于事件监听,页面内容加载等
  96. targetModule.init(currentPage);
  97. });
  98. });
  99. return;
  100. }
  101. })