bzkf3 2 years ago
parent
commit
4785ab5ceb

+ 3 - 0
components.d.ts

@@ -9,6 +9,7 @@ export {}
 
 declare module '@vue/runtime-core' {
   export interface GlobalComponents {
+    Bjqk: typeof import('./src/components/step/link/bjqk.vue')['default']
     ElButton: typeof import('element-plus/es')['ElButton']
     ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
     ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
@@ -41,10 +42,12 @@ declare module '@vue/runtime-core' {
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
     SettingDialog: typeof import('./src/components/dtk/setting-dialog/index.vue')['default']
+    Szcjckqx: typeof import('./src/components/step/link/szcjckqx.vue')['default']
     TheCard: typeof import('./src/components/TheCard.vue')['default']
     TheCounter: typeof import('./src/components/TheCounter.vue')['default']
     TheFooter: typeof import('./src/components/TheFooter.vue')['default']
     TheInput: typeof import('./src/components/TheInput.vue')['default']
+    Xgstda: typeof import('./src/components/step/link/xgstda.vue')['default']
   }
   export interface ComponentCustomProperties {
     vLoading: typeof import('element-plus/es')['ElLoadingDirective']

+ 129 - 0
src/components/step/link/bjqk.vue

@@ -0,0 +1,129 @@
+<script setup lang='ts'>
+const props = defineProps<{
+  disabled: boolean
+  ze_id: number
+}>()
+let dialogVisible = $ref(false)
+
+const data = $ref([
+  {
+    student_no: '10002',
+    user_realname: '杨威',
+    user_id: '244504',
+    dtk: {
+      code: '-1',
+      hasid: '0',
+      desc: [
+        '无卷缺考',
+      ],
+    },
+  },
+  {
+    student_no: '10003',
+    user_realname: '赵秀蕊',
+    user_id: '244505',
+    dtk: {
+      code: '-1',
+      hasid: '0',
+      desc: [
+        '无卷缺考',
+      ],
+    },
+  },
+  {
+    student_no: '10004',
+    user_realname: '范成亮',
+    user_id: '244506',
+    dtk: {
+      code: '-1',
+      hasid: '0',
+      desc: [
+        '无卷缺考',
+      ],
+    },
+  },
+  {
+    student_no: '10006',
+    user_realname: '骆海亮',
+    user_id: '244508',
+    dtk: {
+      code: '-1',
+      hasid: '0',
+      desc: [
+        '无卷缺考',
+      ],
+    },
+  },
+  {
+    student_no: '10007',
+    user_realname: '郑军',
+    user_id: '244509',
+    dtk: {
+      code: '-1',
+      hasid: '0',
+      desc: [
+        '无卷缺考',
+      ],
+    },
+  },
+  {
+    student_no: '10008',
+    user_realname: '刘安',
+    user_id: '244510',
+    dtk: {
+      code: '-1',
+      hasid: '0',
+      desc: [
+        '无卷缺考',
+      ],
+    },
+  },
+])
+async function handleClickLink() {
+  if (props.disabled)
+    return
+  dialogVisible = true
+
+  // try {
+  //   const res = await request({
+  //     url: '/yzy/kcgl/get_qk_stu',
+  //     data: {
+  //       ze_id: props.ze_id,
+  //     },
+  //   })
+  //   if (res.code === '1') {
+  //     data = res?.data?.list
+  //     dialogVisible = true
+  //   }
+  //   else {
+  //     ElMessage.error(res.msg)
+  //   }
+  // }
+  // catch (error) {
+  //   console.error(error)
+  // }
+}
+</script>
+
+<template>
+  <el-link type="primary" @click="handleClickLink">
+    标记缺考
+  </el-link>
+  <el-dialog v-model="dialogVisible" title="标记缺考" width="1200px">
+    <el-table :data="data" style="width: 100%" max-height="550">
+      <el-table-column prop="date" label="学校" width="280" />
+      <el-table-column prop="name" label="班级" width="240" />
+      <el-table-column prop="student_no" label="学号" width="180" />
+      <el-table-column prop="user_realname" label="姓名" width="140" />
+      <el-table-column prop="name" label="主观题得分" width="100" />
+      <el-table-column prop="name" label="客观题得分" width="100" />
+      <el-table-column prop="name" label="操作" width="auto">
+        <template #default>
+          <el-button :type="true ? 'primary' : 'danger'" size="small">
+            {{ true ? '标记为缺考' : '取消标记缺考' }}
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-dialog>
+</template>

src/components/step/link/qxsz.vue → src/components/step/link/szcjckqx.vue


+ 33 - 0
src/components/step/link/xgstda.vue

@@ -0,0 +1,33 @@
+<script setup lang='ts'>
+const props = defineProps<{
+  disabled: boolean
+}>()
+let dialogVisible = $ref(false)
+function handleClickLink() {
+  if (props.disabled)
+    return
+  dialogVisible = true
+}
+
+const form = reactive({
+  power: '1',
+  user: ['Option A', 'Option B'],
+})
+</script>
+
+<template>
+  <el-link type="primary" @click="handleClickLink">
+    修改试题答案
+  </el-link>
+  <el-dialog v-model="dialogVisible" title="修改试题答案" width="855px">
+    <el-form :model="form" label-width="200" />
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="dialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="dialogVisible = false">
+          确定
+        </el-button>
+      </span>
+    </template>
+  </el-dialog>
+</template>

+ 29 - 5
src/composables/steps.ts

@@ -1,10 +1,9 @@
 import request from '~/utils/request'
 
 // watch(stepsMap, () => {
-//   sessionStorage.setItem('stepsMap', JSON.stringify(stepsMap))
 // }, { deep: true })
 
-function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown) {
+export function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown) {
   const _ykl_lc_ = JSON.parse(sessionStorage.getItem('ykl_lc')!)
   _ykl_lc_.processList[gid][pid][cid] = val || 1
   request({
@@ -22,7 +21,6 @@ function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown
         type: 'success',
         grouping: true,
       })
-      sessionStorage.setItem('stepsMap', JSON.stringify(_ykl_lc_.processList))
     }
   }).catch(() => {
     ElMessage({
@@ -33,7 +31,33 @@ function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown
   })
 }
 
-export function handleAutoCompleteTask() {
+export function handleAutoCompleteTask(val?: unknown) {
   const { gid, pid, cid } = JSON.parse(sessionStorage.getItem('StepId')!)
-  handleCompleteTask(gid, pid, cid)
+  // handleCompleteTask(gid, pid, cid)
+  const _ykl_lc_ = JSON.parse(sessionStorage.getItem('ykl_lc')!)
+  _ykl_lc_.processList[gid][pid][cid] = val || 1
+  return request({
+    url: '/yzy/kmksyjlc/save',
+    data: {
+      ykl_id: _ykl_lc_.ykl_id,
+      yk: {
+        ykl_lc: JSON.stringify(_ykl_lc_),
+      },
+    },
+  }).then((res) => {
+    if (res.code === '1') {
+      ElMessage({
+        message: '操作成功',
+        type: 'success',
+        grouping: true,
+      })
+      sessionStorage.setItem('ykl_lc', JSON.stringify(_ykl_lc_))
+    }
+  }).catch(() => {
+    ElMessage({
+      message: '操作失败',
+      type: 'error',
+      grouping: true,
+    })
+  })
 }

+ 2 - 2
src/pages/detail.vue

@@ -3,8 +3,8 @@ import { handleAutoCompleteTask } from '~/composables/steps'
 
 // const { gid, pid, cid } = JSON.parse(sessionStorage.getItem('StepId')!)
 const router = useRouter()
-function handleCompleteTask() {
-  handleAutoCompleteTask()
+async function handleCompleteTask() {
+  await handleAutoCompleteTask()
   router.back()
 }
 </script>

+ 42 - 45
src/pages/index.vue

@@ -12,44 +12,45 @@ const server = (await request({
 })).data.one_info
 
 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))
 
-// request({
-//   url: '/yzy/kmksyjlc/save',
-//   data: {
-//     ykl_id,
-//     yk: {
-//       ykl_lc: JSON.stringify({
-//         ...ykl_lc,
-//         processList: [
-//           [
-//             [0, 0, 1],
-//             [0, 0],
-//             [0],
-//           ],
-//           [
-//             [0],
-//             [0],
-//             [0],
-//           ],
-//           [
-//             [0],
-//             [0],
-//           ],
-//           [
-//             [0],
-//             [0],
-//           ],
-//           [
-//             [0],
-//             [0],
-//             [0],
-//           ],
-//         ],
-//       }),
-//     },
-//   },
-// })
+window.reset = () => request({
+  url: '/yzy/kmksyjlc/save',
+  data: {
+    ykl_id,
+    yk: {
+      ykl_lc: JSON.stringify({
+        ...ykl_lc,
+        processList: [
+          [
+            [0, 0, 1],
+            [0, 0],
+            [0],
+          ],
+          [
+            [0],
+            [0],
+            [0],
+          ],
+          [
+            [0],
+            [0],
+          ],
+          [
+            [0],
+            [0],
+          ],
+          [
+            [0],
+            [0],
+            [0],
+          ],
+        ],
+      }),
+    },
+  },
+})
 
 const stepsReactiveMap = reactive<unknown[][][]>(ykl_lc.processList)
 
@@ -263,8 +264,6 @@ function getPids() {
   return stepsReactiveMap.map((item, idx) => (idx < gid ? 1 : 0) + item.findLastIndex(subItem => subItem.some(subSubItem => judgeStepCompleted(subSubItem))))
 }
 watch(() => stepsReactiveMap, (val) => {
-  sessionStorage.setItem('stepsMap', JSON.stringify(val))
-
   gid = getGid()
   pids = getPids()
 }, {
@@ -416,6 +415,8 @@ function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown
         type: 'success',
         grouping: true,
       })
+      sessionStorage.setItem('ykl_lc', JSON.stringify(_ykl_lc_))
+
       stepsReactiveMap[gid][pid][cid] = val || 1
     }
   }).catch(() => {
@@ -514,13 +515,9 @@ onBeforeRouteLeave(() => {
             <template #tip>
               <template v-if="task.title === '成绩发布'">
                 <div class="mt-2 flex flex-col items-start px-1 text-xs space-y-1" style="--el-font-size-base:10px">
-                  <el-link type="primary">
-                    修改试题答案
-                  </el-link>
-                  <qxsz :disabled="judgeStepCompleted(stepsReactiveMap[currentStep][idx][idy])" />
-                  <el-link type="primary">
-                    标记缺考
-                  </el-link>
+                  <xgstda :disabled="judgeStepCompleted(stepsReactiveMap[currentStep][idx][idy])" />
+                  <szcjckqx :disabled="judgeStepCompleted(stepsReactiveMap[currentStep][idx][idy])" />
+                  <bjqk :disabled="judgeStepCompleted(stepsReactiveMap[currentStep][idx][idy])" :ze_id="ykl_lc.ze_id" />
                 </div>
               </template>
             </template>