Michael Wang 3 жил өмнө
parent
commit
69483d7ef5

+ 4 - 0
config.json

@@ -27,6 +27,10 @@
         {
             "name": "线下环境",
             "host": "http://192.168.10.224:80"
+        },
+        {
+            "name": "线下环境-yt",
+            "host": "http://192.168.11.204:8090"
         }
     ]
 }

+ 26 - 21
src/api/api.ts

@@ -2,7 +2,7 @@
 // import env from "./env";
 // import _logger from "./logger";
 // const logger = _logger("api.js");
-
+// @ts-nocheck
 import { httpApp } from "@/plugins/axiosApp";
 import { store } from "@/store";
 
@@ -73,27 +73,32 @@ export function getExams(pageNumber: number, pageSize: number) {
   );
 }
 
-// export function getStudents(examId, pageNumber, pageSize, params) {
-//   const form = {
-//     examId: examId,
-//     pageNumber: pageNumber,
-//     pageSize: pageSize,
-//   };
-//   if (params != undefined) {
-//     for (const key in params) {
-//       if (params[key] && params[key] != "") {
-//         form[key] = params[key];
-//       }
-//     }
-//   }
-//   return execute("/api/exam/students", "POST", form);
-// }
+export function getStudents(
+  examId: number,
+  pageNumber: number,
+  pageSize: number,
+  params: any
+) {
+  const form = {
+    examId: examId,
+    pageNumber: pageNumber,
+    pageSize: pageSize,
+  };
+  if (params != undefined) {
+    for (const key in params) {
+      if (params[key] && params[key] != "") {
+        form[key] = params[key];
+      }
+    }
+  }
+  return httpApp.post("/api/exam/students", new URLSearchParams(form));
+}
 
-// export function countStudents(examId, params) {
-//   params = params || {};
-//   params.examId = examId;
-//   return execute("/api/exam/students/count", "POST", params);
-// }
+export function countStudents(examId: number, params) {
+  params = params || {};
+  params.examId = examId;
+  return httpApp.post("/api/exam/students/count", new URLSearchParams(params));
+}
 
 // export function getPackages(examId, upload, withUrl) {
 //   let uri = "/api/package/count/" + examId;

+ 8 - 0
src/router/index.ts

@@ -31,6 +31,14 @@ const routes: Array<RouteRecordRaw> = [
         /* webpackChunkName: "about" */ "../views/features/Image/Image.vue"
       ),
   },
+  {
+    path: "/image-download",
+    name: "ImageDownload",
+    component: () =>
+      import(
+        /* webpackChunkName: "about" */ "../views/features/ImageDownload/ImageDownload.vue"
+      ),
+  },
 ];
 
 const router = createRouter({

+ 1 - 0
src/store.ts

@@ -11,6 +11,7 @@ const _store = {
     user: {},
   },
   config: JSON.parse(JSON.stringify(window.electron.config)) || {},
+  pageInputs: {},
 } as Store;
 
 const handler = function () {

+ 14 - 0
src/types/index.ts

@@ -28,6 +28,20 @@ export interface Store {
     openDevTools: boolean;
     servers: Server[];
   };
+
+  pageInputs: {
+    "/image-download": {
+      type: string;
+      template: string;
+      dir: string;
+      append: boolean;
+      failover: boolean;
+      watermark: boolean;
+      trackMode: string;
+      examNumber?: string;
+      subjectCode?: string;
+    };
+  };
 }
 
 export interface DB {

+ 9 - 9
src/views/features/Image/Image.vue

@@ -182,15 +182,15 @@ onMounted(async () => {});
 
 const start = () => {
   store.pageInputs["/image-download"] = {
-    type,
-    template,
-    dir,
-    append,
-    failover,
-    watermark,
-    trackMode,
-    examNumber,
-    subjectCode,
+    type: type.value,
+    template: template.value,
+    dir: dir.value,
+    append: append.value,
+    failover: failover.value,
+    watermark: watermark.value,
+    trackMode: trackMode.value,
+    examNumber: examNumber.value,
+    subjectCode: subjectCode.value,
   };
   router.push("/image-download");
 };

+ 87 - 0
src/views/features/ImageDownload/ImageDownload.vue

@@ -0,0 +1,87 @@
+<template>
+  <div class="wp">
+    <div class="hd">
+      <div class="logo"><img src="img/logo.png" /></div>
+      <span class="y">
+        欢迎您,<span id="user-name"></span> <span class="pipe">|</span
+        ><a href="##">退出</a>
+      </span>
+    </div>
+    <div class="cont">
+      <div class="title title_grey cl">
+        <h2>图片下载中 …</h2>
+      </div>
+      <div class="progress-box">
+        <h3>正在下载图片,请耐心等候 ~</h3>
+        <div class="progress">
+          <div class="progress-outer">
+            <div id="progress" class="progress-inner" style="width: 0%">
+              <span class="progress-text"></span>
+            </div>
+          </div>
+        </div>
+        <p>
+          已下载图片:<b id="finish-count"></b> / 全部图片:<b
+            id="total-count"
+            >{{ totalCount }}</b
+          >
+        </p>
+      </div>
+    </div>
+    <div class="xcConfirm" id="popup" style="display: none">
+      <div class="xc_layer"></div>
+      <div class="popbox">
+        <a href="##" id="popup-close"><span class="close"></span></a>
+        <div class="txtbox">
+          <div id="popup-error" class="icon error" style="display: none"></div>
+          <div
+            id="popup-success"
+            class="icon success"
+            style="display: none"
+          ></div>
+          <div id="popup-text" class="text"></div>
+        </div>
+      </div>
+    </div>
+    <div class="ft">
+      Copyright © 2011-2020 www.qmth.com.cn, All Rights Reserved
+    </div>
+    <div style="display: none">
+      <canvas id="canvas"></canvas>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { store } from "@/store";
+import { computed, onMounted, ref } from "vue";
+import router from "@/router";
+import { getStudents, countStudents } from "@/api/api";
+
+const totalCount = ref(0);
+
+const config = store.pageInputs["/image-download"];
+onMounted(async () => {
+  if (config.type === "1") {
+    // imageUtil.downloadSheet(config.dir, config.template, config.append, config.failover, config
+    //                 .watermark, config.trackMode, {
+    //                 examNumberIn: config.examNumber,
+    //                 subjectCode: config.subjectCode
+    //             })
+    // const res = await getStudents(store.env.examId, 1, 10, {
+    //   upload: true,
+    //   withSheetUrl: true,
+    //   withScoreDetail: config.watermark,
+    //   withGroupScoreTrack: config.watermark && config.trackMode,
+    // });
+    // totalCount.value = res.data.length;
+    const res = await countStudents(store.env.examId, {
+      upload: true,
+      withSheetUrl: true,
+      withScoreDetail: config.watermark,
+      withGroupScoreTrack: config.watermark && config.trackMode,
+    });
+    totalCount.value = res.data;
+  }
+});
+</script>

BIN
src/views/features/ImageDownload/img/logo.png


BIN
src/views/features/ImageDownload/img/logo_blue.png


+ 3 - 2
src/views/features/Login/Login.vue

@@ -2,7 +2,7 @@
   <div class="login-flex">
     <div class="login">
       <div class="logo"><img src="img/logo_blue.png" /></div>
-      <form @submit="loginAction">
+      <a-form @submit="loginAction">
         <div>
           <a-select
             style="width: 100%"
@@ -26,10 +26,11 @@
             id="password-input"
             type="password"
             placeholder="请输入密码"
+            @press-enter="loginAction"
           />
         </div>
         <div><a href="##" id="login-button" @click="loginAction">登录</a></div>
-      </form>
+      </a-form>
     </div>
     <div class="ft">
       Copyright © 2011-2021 www.qmth.com.cn, All Rights Reserved