From 13e3f6eace4ecdd742cac3f47548b3da4ce82ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Tue, 26 Aug 2025 19:59:10 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/rules.ts | 11 +++++++++++ src/views/exam/index.vue | 3 ++- src/views/student/edit.vue | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/utils/rules.ts b/src/utils/rules.ts index 745a37f..3ca2c0f 100644 --- a/src/utils/rules.ts +++ b/src/utils/rules.ts @@ -12,6 +12,17 @@ type Rule = { pattern?: RegExp; }; + +export const ruleRequiredGrade = [ + { required: true, message: "不能为空", trigger: "blur" }, + { + pattern: /^(初[一二三]|高[一二三]|初\d{4}|高\d{4})$/, + message: "请输入正确的年级 例[初一,初2025]", + trigger: "blur" + } +]; + + export const ruleRequiredI = (max: number = 20, min: number = 0): Rule[] => { let res: Rule[] = [ { required: true, message: "不能为空", trigger: "blur" }, diff --git a/src/views/exam/index.vue b/src/views/exam/index.vue index 6d180be..42b0dd7 100644 --- a/src/views/exam/index.vue +++ b/src/views/exam/index.vue @@ -8,6 +8,7 @@ import { getenum } from "@/api/enum"; import { ruleNumber, ruleRequired, + ruleRequiredGrade, ruleRequiredI, ruleRequiredNumber, } from "@/utils/rules"; @@ -108,7 +109,7 @@ const tableData: TableConfig = { }, grade: { label: "年级", - rules: ruleRequiredI(6, 2), + rules: ruleRequiredGrade, width: "100px", search: true, add: true, // 字段允许添加 diff --git a/src/views/student/edit.vue b/src/views/student/edit.vue index 4b98f7d..e01f01d 100644 --- a/src/views/student/edit.vue +++ b/src/views/student/edit.vue @@ -380,12 +380,13 @@ const handleSubmitForm = () => { userEditForm.value.validate(async (valid) => { if (valid) { loading.value = true; + let ac = form.value.account || new Date().getTime() + ""; const formData = { id: form.value.uId || 0, userType: form.value.userType || 1, level: form.value.level || 0, - account: form.value.account || "", - // PassWord: form.value.id === 0 ? md5(form.value.PassWord).toUpperCase() : "", + account: form.value.account || new Date().getTime() + "", + PassWord: form.value.id === 0 ? "无效密码" : "", realName: form.value.realName || "", studentId: form.value.studentId || "", templateId: form.value.templateId || 0, From 6befa6576db4b6863710f917be1280b6304ebd44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Tue, 26 Aug 2025 20:07:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E4=BA=BA=E6=98=BE=E7=A4=BA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/exam/classDetails.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/views/exam/classDetails.vue b/src/views/exam/classDetails.vue index 9f8ec28..699f20d 100644 --- a/src/views/exam/classDetails.vue +++ b/src/views/exam/classDetails.vue @@ -103,13 +103,13 @@ const tableData: TableConfig = { add: false, // 字段允许添加 edit: false, // 字段允许修改 }, - entryPerson: { - label: "录入人", - width: "200px", - search: true, - add: false, // 字段允许添加 - edit: false, // 字段允许修改 - }, + // entryPerson: { + // label: "录入人", + // width: "200px", + // search: false, + // add: false, // 字段允许添加 + // edit: false, // 字段允许修改 + // }, createTime: { label: "录入时间", width: "200px", From 8a29b051057883a9c902cee7d82766d19aaede2f Mon Sep 17 00:00:00 2001 From: tiananlin Date: Wed, 27 Aug 2025 09:17:55 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/=20Dockerf?= =?UTF-8?q?ile-production/Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/ Dockerfile-production/Dockerfile | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Dockerfiles/ Dockerfile-production/Dockerfile diff --git a/Dockerfiles/ Dockerfile-production/Dockerfile b/Dockerfiles/ Dockerfile-production/Dockerfile new file mode 100644 index 0000000..85c3a70 --- /dev/null +++ b/Dockerfiles/ Dockerfile-production/Dockerfile @@ -0,0 +1,41 @@ +# 构建阶段 +FROM m.daocloud.io/docker.io/library/node:22.14.0 AS builder + +# 设置工作目录 +WORKDIR /app + +# 设置 npm 镜像源 +RUN npm config set registry https://registry.npmmirror.com/ +RUN npm config set fetch-retries 3 +RUN npm config set fetch-retry-mintimeout 5000 +RUN npm config set fetch-retry-maxtimeout 60000 + +# 安装pnpm +RUN npm install -g pnpm + +# 复制源代码 +COPY . . + +# 设置 pnpm 下载源 +RUN pnpm config set registry https://registry.npmmirror.com/ + +# 安装依赖 +RUN pnpm i --fetch-timeout 300000 + +# 构建项目 +RUN pnpm build + +# 部署阶段 +FROM m.daocloud.io/docker.io/library/nginx:alpine + +# 复制构建产物到 Nginx 目录 +COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html + +# 复制 Nginx 配置 +COPY Dockerfiles/Dockerfile-staging/default.conf /etc/nginx/conf.d/default.conf + +# 暴露端口 +EXPOSE 80 + +# 启动 Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file From 7d0f738e75f5a2cb0e94557be0204378316e7b14 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Wed, 27 Aug 2025 09:18:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/=20Dockerf?= =?UTF-8?q?ile-production/default.conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ Dockerfile-production/default.conf | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Dockerfiles/ Dockerfile-production/default.conf diff --git a/Dockerfiles/ Dockerfile-production/default.conf b/Dockerfiles/ Dockerfile-production/default.conf new file mode 100644 index 0000000..3de8a37 --- /dev/null +++ b/Dockerfiles/ Dockerfile-production/default.conf @@ -0,0 +1,47 @@ +server { + listen 80; + server_name localhost; + + # 基础设置 + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + + client_max_body_size 100m; + + # 错误页面配置 + error_page 500 502 503 504 /50x.html; + location = /50x.html { + internal; # 仅用于内部错误请求 + } + + # Gzip 压缩设置 + gzip on; + gzip_min_length 1k; + gzip_comp_level 6; + gzip_types text/plain text/css text/javascript application/json + application/javascript application/x-javascript application/xml; + gzip_vary on; + gzip_disable "MSIE [1-6]\."; + + # 静态资源缓存优化 + location ~* \.(jpg|jpeg|gif|ico|css|js)$ { + expires 7d; + add_header Cache-Control "public, no-transform"; + } + + # API 代理配置 + location /api/ { + proxy_pass http://learn-archives-api-svc:8080/api/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; # 添加协议头 + + # 优化代理性能 + proxy_connect_timeout 30s; + proxy_send_timeout 60s; + proxy_read_timeout 60s; + proxy_buffering on; + } +} \ No newline at end of file