index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. const { BlankType } = require('../../../public/common_constants');
  2. function getCardHtml(info, btn) {
  3. return `<div class="row">
  4. <div class="col-lg-8 mx-auto mt-5">
  5. <div class="card newuser-input">
  6. <div class="card-body">
  7. <h4 class="mt-2 mb-5 text-center">${info}</h4>
  8. ${btn ? `<div class="form-group text-center"><a class="btn btn-primary" href="${btn.href}">${btn.title}</a></div>` : ''}
  9. </div>
  10. </div>
  11. </div>
  12. </div>`;
  13. }
  14. module.exports = function (app) {
  15. app.get('/blank', function (req, res) {
  16. const { type } = req.query;
  17. let html = '';
  18. switch (+type) {
  19. case BlankType.SHARE_CANCEL:
  20. html = getCardHtml('分享设置已被修改,当前项目无权查看。', { href: '/pm', title: '返回项目管理' });
  21. break;
  22. case BlankType.NOT_FOUND:
  23. default:
  24. html = getCardHtml('很抱歉,您要访问的页面不存在。');
  25. break;
  26. }
  27. res.render('common/components/blank/index.html', { html });
  28. });
  29. }