|
@@ -90,7 +90,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script name="ImageView" lang="ts" setup>
|
|
|
-import { ref, computed, onMounted, watch } from "vue";
|
|
|
+import { ref, computed, onMounted, watch, onBeforeUnmount } from "vue";
|
|
|
import VerticalDateRange from "@/components/VerticalDateRange/index.vue";
|
|
|
import { useUserStore, useDataCheckStore } from "@/store";
|
|
|
import { IMAGE_TYPE, enum2Options } from "@/constants/enums";
|
|
@@ -178,15 +178,21 @@ function parseStudentPage(student: any) {
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
+const loading = ref(false);
|
|
|
const _getStuCardDetail = () => {
|
|
|
+ loading.value = true;
|
|
|
getStuCardDetail({
|
|
|
batchId: curBatch.value.value,
|
|
|
studentId: curStu.value.studentId,
|
|
|
- }).then((res: any) => {
|
|
|
- curStuCardData.value = res || {};
|
|
|
- parseStudentPage(curStuCardData.value);
|
|
|
- selectPage(0);
|
|
|
- });
|
|
|
+ })
|
|
|
+ .then((res: any) => {
|
|
|
+ curStuCardData.value = res || {};
|
|
|
+ parseStudentPage(curStuCardData.value);
|
|
|
+ selectPage(0);
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
};
|
|
|
function selectPage(index: number) {
|
|
|
dataCheckStore.setInfo({
|
|
@@ -197,9 +203,6 @@ function selectPage(index: number) {
|
|
|
if (!dataCheckStore.curPage) return;
|
|
|
dataCheckStore.setInfo({ curStudent: curStuCardData.value as any });
|
|
|
}
|
|
|
-onMounted(() => {
|
|
|
- _batchSubjectList();
|
|
|
-});
|
|
|
|
|
|
const arr = ref([
|
|
|
{ title: "搜索条件", name: "one", open: true },
|
|
@@ -239,6 +242,7 @@ const curStuCardData = ref({});
|
|
|
const dataList = ref<any>([]);
|
|
|
|
|
|
const chooseLeft = (item: any, index: number) => {
|
|
|
+ if (loading.value) return;
|
|
|
activeIndex.value = index;
|
|
|
if (listType.value === "level1") {
|
|
|
curSubject.value = { value: item.subjectCode, label: item.subjectName };
|
|
@@ -360,6 +364,62 @@ async function onNextPage() {
|
|
|
|
|
|
selectPage(dataCheckStore.curPageIndex + 1);
|
|
|
}
|
|
|
+
|
|
|
+function registShortcut() {
|
|
|
+ document.addEventListener("keydown", shortcutHandle);
|
|
|
+}
|
|
|
+function removeShortcut() {
|
|
|
+ document.removeEventListener("keydown", shortcutHandle);
|
|
|
+}
|
|
|
+function onPrevStudent() {
|
|
|
+ if (activeIndex.value == 0) {
|
|
|
+ window.$message.error("没有上一个学生了");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ chooseLeft(leftList.value[activeIndex.value - 1], activeIndex.value - 1);
|
|
|
+}
|
|
|
+function onNextStudent() {
|
|
|
+ if (activeIndex.value == leftList.value.length - 1) {
|
|
|
+ window.$message.error("没有下一个学生了");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ chooseLeft(leftList.value[activeIndex.value + 1], activeIndex.value + 1);
|
|
|
+}
|
|
|
+function shortcutHandle(e: KeyboardEvent) {
|
|
|
+ if (!leftList.value.length || listType.value !== "level4") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const moveAction = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
|
+ if (!moveAction.includes(e.code) || e.repeat) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ e.preventDefault();
|
|
|
+
|
|
|
+ if (e.code === "ArrowUp") {
|
|
|
+ onPrevStudent();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (e.code === "ArrowDown") {
|
|
|
+ onNextStudent();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (e.code === "ArrowLeft") {
|
|
|
+ onPrevPage();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (e.code === "ArrowRight") {
|
|
|
+ onNextPage();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ _batchSubjectList();
|
|
|
+ registShortcut();
|
|
|
+});
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ removeShortcut();
|
|
|
+});
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
.image-view {
|