deason 1 an în urmă
părinte
comite
dce3bfc113

+ 14 - 3
src/main/java/cn/com/qmth/examcloud/tool/controller/BaseController.java

@@ -1,6 +1,7 @@
 package cn.com.qmth.examcloud.tool.controller;
 
 import cn.com.qmth.examcloud.tool.config.Constants;
+import cn.com.qmth.examcloud.tool.vo.user.Role;
 import cn.com.qmth.examcloud.tool.vo.user.User;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,6 +32,18 @@ public class BaseController {
         return (User) currentSession().getAttribute(Constants.LOGIN_USER);
     }
 
+    protected boolean isSuperAdmin() {
+        User user = currentLoginUser();
+        if (user != null) {
+            for (Role role : user.getRoleList()) {
+                if ("SUPER_ADMIN".equals(role.getRoleCode())) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
     protected void download(HttpServletResponse response, byte[] bytes, String title) {
         try (OutputStream out = response.getOutputStream();) {
             response.reset();
@@ -49,9 +62,7 @@ public class BaseController {
             return;
         }
 
-        try (FileInputStream fis = new FileInputStream(file);
-             OutputStream out = response.getOutputStream();
-        ) {
+        try (FileInputStream fis = new FileInputStream(file); OutputStream out = response.getOutputStream();) {
             response.reset();
             response.setHeader("Accept-Length", String.valueOf(fis.available()));
             response.setContentType("application/octet-stream;charset=UTF-8");

+ 4 - 0
src/main/java/cn/com/qmth/examcloud/tool/controller/TaskController.java

@@ -28,6 +28,10 @@ public class TaskController extends BaseController {
     @ResponseBody
     @PostMapping(value = "/api/task/list")
     public Page<TaskEntity> taskList(@RequestBody TaskQuery req) {
+        if (!isSuperAdmin()) {
+            User user = currentLoginUser();
+            req.setOperatorId(user.getUserId());
+        }
         return taskManager.getTaskList(req);
     }
 

+ 15 - 4
src/main/resources/templates/admin/workspace.ftlh

@@ -15,14 +15,17 @@
                 <el-row :gutter="10">
                     <el-col :span="8">
                         <el-card shadow="hover">
-                            <el-link href="${base}/admin/exportStudentAnswerAndScoreDetail">导出考生试题作答和得分明细
+                            <el-link href="${base}/admin/exportStudentAnswerAndScoreDetail" class="f20">
+                                <i class="el-icon-connection"></i> 导出考生试题作答和得分明细
                             </el-link>
                         </el-card>
                     </el-col>
 
                     <el-col :span="8">
                         <el-card shadow="hover">
-                            <el-link href="${base}/admin/updateCorrectAnswerAndReFixScore">重新算分</el-link>
+                            <el-link href="${base}/admin/updateCorrectAnswerAndReFixScore" class="f20">
+                                <i class="el-icon-connection"></i> 重新算分
+                            </el-link>
                         </el-card>
                     </el-col>
                 </el-row>
@@ -30,12 +33,15 @@
                 <el-row :gutter="10" style="margin-top: 10px">
                     <el-col :span="8">
                         <el-card shadow="hover">
-                            <el-link href="${base}/admin/configExamPaper">批量配置考试调卷规则</el-link>
+                            <el-link href="${base}/admin/configExamPaper" class="f20">
+                                <i class="el-icon-connection"></i> 批量配置考试调卷规则
+                            </el-link>
                         </el-card>
                     </el-col>
                     <el-col :span="8">
                         <el-card shadow="hover">
-                            <el-link href="${base}/admin/createRandomPaperTemplate">批量创建随机抽卷模板
+                            <el-link href="${base}/admin/createRandomPaperTemplate" class="f20">
+                                <i class="el-icon-connection"></i> 批量创建随机抽卷模板
                             </el-link>
                         </el-card>
                     </el-col>
@@ -52,5 +58,10 @@
         methods: {}
     });
 </script>
+<style>
+    .f20 {
+        font-size: 20px;
+    }
+</style>
 </body>
 </html>