农燊高科官方网站
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.

main.js 3.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. requirejs.config({
  2. urlArgs: "ver=1.0_" + (new Date).getTime(),
  3. baseUrl: '/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. //自己写的路径配置
  22. Tools: 'common/tools',
  23. addressApi: 'api/index', //所有Ajax接口存放地
  24. newApi: 'api/new', //新闻接口
  25. itemsApi: 'api/items', //挂牌项目接口
  26. biddingApi: 'api/bidding', //竞价大厅接口
  27. announApi: 'api/announcementList', //项目公告接口
  28. demandApi: 'api/demand', //个人供求接口
  29. policyApi: 'api/policy',//政策法规接口
  30. interactApi: 'api/interact',//互动交流接口
  31. user: 'api/user'//用户信息接口
  32. },
  33. shim: {
  34. bootstrap: {
  35. deps: ['jquery']
  36. },
  37. jqueryLazyload: {
  38. deps: ['jquery']
  39. },
  40. dialog: {
  41. deps: ['jquery', 'dialogConf', 'drag', 'popup'],
  42. exports: 'dialog'
  43. },
  44. swiper: {
  45. deps: ['jquery'],
  46. exports: 'swiper'
  47. },
  48. nprogress: {
  49. deps: ['jquery'],
  50. exports: 'nprogress'
  51. },
  52. paging: {
  53. deps: ['jquery'],
  54. exports: 'paging'
  55. },
  56. uploader:{
  57. deps: ['jquery','webuploader','flashonly','flashonlyMin'],
  58. exports: 'uploader'
  59. }
  60. }
  61. });
  62. //所有页面都需要的js,先行加载
  63. require(['jquery', 'addressApi']);
  64. require(["jquery", "nprogress"], function ($, nprogress) {
  65. //ajax加载页面跳转
  66. $(document).ajaxStart(function () {
  67. // $('.loading').show();
  68. nprogress.start();
  69. }).ajaxStop(function () {
  70. // $('.loading').hide();
  71. nprogress.done();
  72. });
  73. //根据条件加载不同js文件
  74. var currentPage = $("#require-page").attr("current-page");
  75. var targetModule = $("#require-page").attr("target-module");
  76. if (targetModule) {
  77. // 页面加载完毕后再执行相关业务代码比较稳妥
  78. $(function () {
  79. require([targetModule], function (targetModule) {
  80. // 不要在这里写业务代码
  81. //全部统一调用init方法
  82. //也就是每个模块都暴露一个init方法用于事件监听,页面内容加载等
  83. targetModule.init(currentPage);
  84. });
  85. });
  86. return;
  87. }
  88. })