router.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. // 个人账号相关
  30. app.get('/profile/info', sessionAuth, 'profileController.info');
  31. app.post('/profile/save', sessionAuth, 'profileController.saveBase');
  32. app.post('/profile/password', sessionAuth, 'profileController.modifyPassword');
  33. app.post('/profile/code', sessionAuth, 'profileController.getCode');
  34. app.post('/profile/bind', sessionAuth, 'profileController.bindMobile');
  35. // 标段管理相关
  36. app.get('/tender', sessionAuth, 'tenderController.index');
  37. app.post('/tender/add', sessionAuth, datetimeFill, 'tenderController.add');
  38. };