Переглянути джерело

Merge branch 'master' into luohl

* master:
  ~
  ~
luohailiang 1 рік тому
батько
коміт
420e02354b
1 змінених файлів з 37 додано та 28 видалено
  1. 37 28
      src/pages/step/[id].vue

+ 37 - 28
src/pages/step/[id].vue

@@ -17,6 +17,8 @@ const server = (await request({
   },
 })).data.one_info
 
+const isCreateUser = server.create_user_id === user.value.user_id
+
 const ykl_lc = Object.assign(JSON.parse(Object.assign(server.ykl_lc)), { ykl_id })
 console.log('ykl_lc : ', ykl_lc)
 sessionStorage.setItem('ykl_lc', JSON.stringify(ykl_lc))
@@ -32,22 +34,22 @@ const steps = reactive(
             {
               title: '出题组卷',
               children: [
-                { title: '章节知识点出题', optional: true, disabled: true, description: '选择相应的章节知识点从题库中选取题目组成试卷' },
-                { title: '智能出题', optional: true, disabled: true, description: '填写题型数量难易度等信息系统自动生成试卷' },
-                { title: '附件出题', optional: true, description: '根据上传附件试卷进行考试' },
+                { title: '章节知识点出题', optional: true, disabled: true, description: '选择相应的章节知识点从题库中选取题目组成试卷', ifCreateUser: true },
+                { title: '智能出题', optional: true, disabled: true, description: '填写题型数量难易度等信息系统自动生成试卷', ifCreateUser: true },
+                { title: '附件出题', optional: true, description: '根据上传附件试卷进行考试', ifCreateUser: true },
               ],
             },
             {
               title: '预划考号区域',
               children: [
-                { title: '预划考号区域', optional: false, description: '根据试题内容格式制作相应的答题卡样式' },
+                { title: '预划考号区域', optional: false, description: '根据试题内容格式制作相应的答题卡样式', ifCreateUser: true },
                 { title: '考场设置(可选)', optional: true, description: '根据学生考场分配情况上传' },
               ],
             },
             {
               title: '预划流程完成',
               children: [
-                { title: '预划流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行下一步' },
+                { title: '预划流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行下一步', ifCreateUser: true },
               ],
             },
           ],
@@ -70,7 +72,7 @@ const steps = reactive(
             {
               title: '制作答题卡',
               children: [
-                { title: '制作答题卡', optional: false, description: '根据试题内容格式制作相应的答题卡样式' },
+                { title: '制作答题卡', optional: false, description: '根据试题内容格式制作相应的答题卡样式', ifCreateUser: true },
               ],
             },
           ],
@@ -98,7 +100,7 @@ const steps = reactive(
             {
               title: '批阅任务分配',
               children: [
-                { title: '批阅任务分配', optional: false, description: '对阅卷老师分配批阅任务' },
+                { title: '批阅任务分配', optional: false, description: '对阅卷老师分配批阅任务', ifCreateUser: true },
               ],
             },
             {
@@ -115,19 +117,19 @@ const steps = reactive(
             {
               title: '成绩发布',
               children: [
-                { title: '成绩发布', optional: false, description: '成绩汇总发布到分析平台' },
+                { title: '成绩发布', optional: false, description: '成绩汇总发布到分析平台', ifCreateUser: true },
               ],
             },
             {
               title: '修改成绩',
               children: [
-                { title: '修改成绩', optional: false, description: '考试成绩发布后三天内可修改' },
+                { title: '修改成绩', optional: false, description: '考试成绩发布后三天内可修改', ifCreateUser: true },
               ],
             },
             {
               title: '考试关闭',
               children: [
-                { title: '考试关闭', optional: false, description: '最后考试结束关闭考试' },
+                { title: '考试关闭', optional: false, description: '最后考试结束关闭考试', ifCreateUser: true },
               ],
             },
           ],
@@ -140,22 +142,22 @@ const steps = reactive(
             {
               title: '出题组卷',
               children: [
-                { title: '章节知识点出题', optional: true, disabled: true, description: '选择相应的章节知识点从题库中选取题目组成试卷' },
-                { title: '智能出题', optional: true, disabled: true, description: '填写题型数量难易度等信息系统自动生成试卷' },
-                { title: '附件出题', optional: true, description: '根据上传附件试卷进行考试' },
+                { title: '章节知识点出题', optional: true, disabled: true, description: '选择相应的章节知识点从题库中选取题目组成试卷', ifCreateUser: true },
+                { title: '智能出题', optional: true, disabled: true, description: '填写题型数量难易度等信息系统自动生成试卷', ifCreateUser: true },
+                { title: '附件出题', optional: true, description: '根据上传附件试卷进行考试', ifCreateUser: true },
               ],
             },
             {
               title: '制作答题卡',
               children: [
-                { title: '制作答题卡', optional: false, description: '根据试题内容格式制作相应的答题卡样式' },
+                { title: '制作答题卡', optional: false, description: '根据试题内容格式制作相应的答题卡样式', ifCreateUser: true },
                 { title: '考场设置(可选)', optional: true, description: '根据学生考场分配情况上传' },
               ],
             },
             {
               title: '组卷流程完成',
               children: [
-                { title: '组卷流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行下一步' },
+                { title: '组卷流程完成', optional: false, description: '试卷内容和答题卡已确认,可进行下一步', ifCreateUser: true },
               ],
             },
           ],
@@ -184,7 +186,7 @@ const steps = reactive(
             {
               title: '批阅任务分配',
               children: [
-                { title: '批阅任务分配', optional: false, description: '对阅卷老师分配批阅任务' },
+                { title: '批阅任务分配', optional: false, description: '对阅卷老师分配批阅任务', ifCreateUser: true },
               ],
             },
             {
@@ -201,19 +203,19 @@ const steps = reactive(
             {
               title: '成绩发布',
               children: [
-                { title: '成绩发布', optional: false, description: '成绩汇总发布到分析平台' },
+                { title: '成绩发布', optional: false, description: '成绩汇总发布到分析平台', ifCreateUser: true },
               ],
             },
             {
               title: '修改成绩',
               children: [
-                { title: '修改成绩', optional: false, description: '考试成绩发布后三天内可修改' },
+                { title: '修改成绩', optional: false, description: '考试成绩发布后三天内可修改', ifCreateUser: true },
               ],
             },
             {
               title: '考试关闭',
               children: [
-                { title: '考试关闭', optional: false, description: '最后考试结束关闭考试' },
+                { title: '考试关闭', optional: false, description: '最后考试结束关闭考试', ifCreateUser: true },
               ],
             },
           ],
@@ -356,23 +358,29 @@ function handleValidTask(currentStep: number, idx: number, idy: number) {
   }
 }
 
-function beforeClickTask(gid: number, pid: number, idy: number) {
-  const continueDoTask = true
+function judgeIfContinueDoTask(gid: number, pid: number, idy: number) {
+  const currentTask = steps[gid].children[pid].children[idy]
+  const continueDoTask = !currentTask.ifCreateUser || isCreateUser
   if (!continueDoTask) {
     ElMessage({
-      message: '无权操作',
+      message: '只有考试创建人才能操作',
       type: 'warning',
       grouping: true,
     })
   }
-  else {
-    return handleValidTask(gid, pid, idy)
-  }
   return continueDoTask
 }
 
+function beforeClickTask(gid: number, pid: number, idy: number) {
+  const continueDoTask = judgeIfContinueDoTask(gid, pid, idy)
+  if (!continueDoTask)
+    return false
+  else
+    return handleValidTask(gid, pid, idy)
+}
+
 function judgeTaskCanClick(gid: number, pid: number, idy: number) {
-  const continueDoTask = true
+  const continueDoTask = judgeIfContinueDoTask(gid, pid, idy)
   if (!continueDoTask) {
     return false
   }
@@ -500,7 +508,7 @@ const TaskEventMap: { [key: string]: () => void } = {
     handleCompleteTaskAuto()
   },
   // 先划块后上传 老流程
-  '启动客户端': () => {
+  '连接扫描仪': () => {
     window.open(`BozeduYuejuan://${user.value.token},${ykl_lc.ze_id},${window.GLOBAL_CONFIG.yzy}`, '_blank')
     handleCompleteTaskAuto()
   },
@@ -674,7 +682,8 @@ const TaskEventMap: { [key: string]: () => void } = {
                       :class="task.disabled ? 'cursor-not-allowed' : 'cursor-pointer'"
                       @click="beforeClickTask(currentStep, idx, idy) && (TaskEventMap[task.title] ? TaskEventMap[task.title]() : handleCompleteTaskAuto())"
                     >
-                      {{ judgeStepCompleted(stepsReactiveMap[currentStep][idx][idy]) ? '已经完成' : task.disabled ? '暂未开放' : '立即开始'
+                      {{ judgeStepCompleted(stepsReactiveMap[currentStep][idx][idy]) ? '已经完成' : task.disabled ? '暂未开放'
+                        : '立即开始'
                       }}
                     </div>
                   </template>