Quellcode durchsuchen

feat: 窗口最大化逻辑调整

zhangjie vor 9 Monaten
Ursprung
Commit
c5ca5cb7d4

+ 7 - 2
src/main/index.ts

@@ -7,7 +7,7 @@ import { exec } from "child_process";
 import process from "process";
 
 const isDev = process.env.NODE_ENV === "development";
-let win: any = null;
+let win: BrowserWindow | null = null;
 let loadWin: any = null;
 
 function createWin() {
@@ -91,7 +91,12 @@ function createLoadWin() {
 //     });
 
 ipcMain.on("change-win-size", (event, args: string) => {
-  const { width, height } = screen.getPrimaryDisplay().workAreaSize;
+  // const { width, height } = screen.getPrimaryDisplay().workAreaSize;
+  if (!win) return;
+  const windowBounds = win.getBounds();
+  const { width, height } =
+    screen.getDisplayMatching(windowBounds).workAreaSize;
+
   let w = args === "big" ? width : 840;
   let h = args === "big" ? height : 500;
   if (args === "small") {

+ 3 - 3
src/render/views/DataCheck/CheckAction.vue

@@ -169,7 +169,7 @@
 
 <script setup lang="ts">
 import { computed, reactive, ref, watch } from "vue";
-import { subjectList } from "@/ap/base";
+import { getSubjectList } from "@/ap/base";
 import {
   FilterFilled,
   PictureFilled,
@@ -208,10 +208,10 @@ const panelKey = ref(["1", "2", "3", "4"]);
 // course data
 const courses = ref<SubjectItem[]>([]);
 async function getCourses() {
-  const res = await subjectList({ examId: userStore.curExam.id });
+  const res = await getSubjectList({ examId: userStore.curExam.id });
   courses.value = res || [];
 }
-const fieldNames = { label: "subjectName", value: "subjectCode" };
+const fieldNames = { label: "name", value: "code" };
 
 // search
 const initSearchModel = {

+ 2 - 0
src/render/views/DataCheck/index.vue

@@ -83,6 +83,8 @@ async function getList() {
   parseStudentPageList(res.result);
 }
 
+getList();
+
 function parseStudentPageList(students: DataCheckListItem[]) {
   dataList.value = [];
 

+ 3 - 3
src/render/views/Review/ReviewAction.vue

@@ -140,7 +140,7 @@
 
 <script setup lang="ts">
 import { ref } from "vue";
-import { subjectList } from "@/ap/base";
+import { getSubjectList } from "@/ap/base";
 import {
   FilterFilled,
   WarningFilled,
@@ -170,7 +170,7 @@ const emit = defineEmits(["search", "reset", "mark"]);
 const userStore = useUserStore();
 const reviewStore = useReviewStore();
 
-const fieldNames = { label: "subjectName", value: "subjectCode" };
+const fieldNames = { label: "name", value: "code" };
 
 // tab
 const reviewKey = ref(["1", "2", "3", "4"]);
@@ -187,7 +187,7 @@ async function switchTab(key: "review" | "history") {
 // course data
 const courses = ref<SubjectItem[]>([]);
 async function getCourses() {
-  const res = await subjectList({ examId: userStore.curExam.id });
+  const res = await getSubjectList({ examId: userStore.curExam.id });
   courses.value = res || [];
 }