router.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. module.exports = app => {
  3. // session验证中间件
  4. const sessionAuth = app.middlewares.sessionAuth();
  5. // 创建时间自动填充中间件
  6. const datetimeFill = app.middlewares.datetimeFill();
  7. // 项目管理员判断中间件
  8. const projectManagerCheck = app.middlewares.projectManagerCheck();
  9. // 登入登出相关
  10. app.get('/login', 'loginController.index');
  11. app.get('/', 'loginController.index');
  12. app.get('/logout', 'loginController.logout');
  13. app.post('/login', 'loginController.login');
  14. // 用户信息初始化相关
  15. app.get('/boot', sessionAuth, 'bootController.index');
  16. app.post('/boot', sessionAuth, 'bootController.boot');
  17. // 控制面板相关
  18. app.get('/dashboard', sessionAuth, 'dashboardController.index');
  19. // 项目相关
  20. app.get('/project/info', sessionAuth, 'projectController.info');
  21. app.get('/project/account', sessionAuth, projectManagerCheck, 'accountController.index');
  22. app.post('/project/account/permission/:accountId', sessionAuth, projectManagerCheck, 'accountController.savePermission');
  23. app.get('/project/account/enable/:accountId', sessionAuth, projectManagerCheck, 'accountController.enable');
  24. app.get('/project/account/disable/:accountId', sessionAuth, projectManagerCheck, 'accountController.enable');
  25. app.get('/project/switch/:projectId', sessionAuth, projectManagerCheck, 'projectController.switchProject');
  26. app.post('/project/info', sessionAuth, 'projectController.saveInfo');
  27. // 台账管理相关
  28. app.get('/ledger/explode', sessionAuth, 'ledgerController.explode');
  29. app.post('/ledger/get-children', sessionAuth, 'ledgerController.getChildren');
  30. app.post('/ledger/base-operation', sessionAuth, 'ledgerController.baseOperation');
  31. app.post('/ledger/update', sessionAuth, 'ledgerController.update');
  32. app.post('/ledger/update-info', sessionAuth, 'ledgerController.updateInfo');
  33. app.post('/ledger/paste-block', sessionAuth, 'ledgerController.pasteBlock');
  34. app.get('/ledger/change', sessionAuth, 'ledgerController.change');
  35. app.get('/ledger/index', sessionAuth, 'ledgerController.index');
  36. // 个人账号相关
  37. app.get('/profile/info', sessionAuth, 'profileController.info');
  38. app.post('/profile/save', sessionAuth, 'profileController.saveBase');
  39. app.post('/profile/password', sessionAuth, 'profileController.modifyPassword');
  40. app.post('/profile/code', sessionAuth, 'profileController.getCode');
  41. app.post('/profile/bind', sessionAuth, 'profileController.bindMobile');
  42. // 标段管理相关
  43. app.get('/tender', sessionAuth, 'tenderController.index');
  44. app.post('/tender/add', sessionAuth, datetimeFill, 'tenderController.add');
  45. // 计量管理相关
  46. app.get('/measure/middle', sessionAuth, 'measureController.middle');
  47. };