IndexController.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package cn.com.qmth.examcloud.tool.controller;
  2. import cn.com.qmth.examcloud.tool.config.Constants;
  3. import cn.com.qmth.examcloud.tool.service.CommonService;
  4. import cn.com.qmth.examcloud.tool.vo.user.User;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.ui.Model;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.RequestParam;
  11. @Controller
  12. public class IndexController extends BaseController {
  13. @Autowired
  14. private CommonService commonService;
  15. @GetMapping(value = "/")
  16. public String index() {
  17. return "index";
  18. }
  19. @GetMapping(value = "/logout")
  20. public String logout() {
  21. currentSession().removeAttribute(Constants.LOGIN_USER);
  22. return "redirect:/login";
  23. }
  24. @GetMapping(value = "/login")
  25. public String login() {
  26. if (currentLoginUser() != null) {
  27. return "redirect:/admin/workspace";
  28. }
  29. return "login";
  30. }
  31. @PostMapping(value = "/login")
  32. public void doLogin(@RequestParam String domain,
  33. @RequestParam String loginName,
  34. @RequestParam String password) {
  35. User user = commonService.login(domain, loginName, password);
  36. currentSession().setAttribute(Constants.LOGIN_USER, user);
  37. }
  38. @GetMapping(value = "/admin/workspace")
  39. public String workspace() {
  40. return "admin/workspace";
  41. }
  42. /**
  43. * 任务列表
  44. */
  45. @GetMapping(value = "/admin/taskList")
  46. public String taskList(Model model) {
  47. model.addAttribute("menuIndex", 2);
  48. return "admin/taskList";
  49. }
  50. /**
  51. * 导出考生试题作答和得分明细
  52. */
  53. @GetMapping(value = "/admin/exportStudentAnswerAndScoreDetail")
  54. public String exportStudentAnswerAndScoreDetail() {
  55. return "admin/exportStudentAnswerAndScoreDetail";
  56. }
  57. /**
  58. * 更新正确答案并重新算分
  59. */
  60. @GetMapping(value = "/admin/updateCorrectAnswerAndReFixScore")
  61. public String updateCorrectAnswerAndReFixScore() {
  62. return "admin/updateCorrectAnswerAndReFixScore";
  63. }
  64. /**
  65. * 配置考试调卷规则
  66. */
  67. @GetMapping(value = "/admin/configExamPaper")
  68. public String configExamPaper() {
  69. return "admin/configExamPaper";
  70. }
  71. }