修复 staging打包无法运行问题

This commit is contained in:
小肥羊 2025-08-25 14:52:40 +08:00
parent c00574ca59
commit c81ed3a84c
8 changed files with 74 additions and 34 deletions

View File

@ -8,7 +8,7 @@ VITE_PUBLIC_PATH = /
VITE_ROUTER_HISTORY = "hash" VITE_ROUTER_HISTORY = "hash"
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false # 是否在打包时使用cdn替换本地库 替换 true 不替换 false
VITE_CDN = true VITE_CDN = false
# 是否启用gzip压缩或brotli压缩分两种情况删除原始文件和不删除原始文件 # 是否启用gzip压缩或brotli压缩分两种情况删除原始文件和不删除原始文件
# 压缩时不删除原始文件的配置gzip、brotli、both同时开启 gzip 与 brotli 压缩、none不开启压缩默认 # 压缩时不删除原始文件的配置gzip、brotli、both同时开启 gzip 与 brotli 压缩、none不开启压缩默认

View File

@ -150,7 +150,7 @@ function addPathMatch() {
/** 处理动态路由(后端返回的路由) */ /** 处理动态路由(后端返回的路由) */
function handleAsyncRoutes(routeList) { function handleAsyncRoutes(routeList) {
if (routeList.length === 0) { if (routeList == null ||routeList.length === 0) {
usePermissionStoreHook().handleWholeMenus(routeList); usePermissionStoreHook().handleWholeMenus(routeList);
} else { } else {
formatFlatteningRoutes(addAsyncRoutes(routeList)).map( formatFlatteningRoutes(addAsyncRoutes(routeList)).map(

View File

@ -15,6 +15,8 @@ import { getToken, formatToken } from "@/utils/auth";
import { useUserStoreHook } from "@/store/modules/user"; import { useUserStoreHook } from "@/store/modules/user";
// import { string } from "vue-types"; // import { string } from "vue-types";
import router from "@/router"; import router from "@/router";
import { ElMessage } from "element-plus";
import { message } from "../message";
/**请求后端的地址 未配置则访问BaseURL */ /**请求后端的地址 未配置则访问BaseURL */
const apiServiceConfig = { const apiServiceConfig = {
@ -231,10 +233,16 @@ class PureHttp {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
PureHttp.axiosInstance PureHttp.axiosInstance
.request(config) .request(config)
.then((response: undefined) => { .then((response: any) => {
resolve(response); if (response.code != null && response.code !== 200) {
message(response.message, { type: "error" });
} resolve(response);
}) })
.catch(error => { .catch(error => {
if (error.status != 200) {
if (error.status == 200) ElMessage.warning("请求失败" + error.message);
}
reject(error); reject(error);
}); });
}); });

View File

@ -1,6 +1,26 @@
export const ruleRequired = [ export const ruleRequired = [
{ required: true, message: "不能为空", trigger: "blur" } { required: true, message: "不能为空", trigger: "blur" }
]; ];
/** 验证长度不得超过多少 */
type Rule = {
required?: boolean;
message: string;
trigger: string;
max?: number;
min?: number;
pattern?: RegExp;
};
export const ruleRequiredI = (max: number = 20, min: number = 0): Rule[] => {
let res: Rule[] = [
{ required: true, message: "不能为空", trigger: "blur" },
{ max: max, message: `长度不能超过${max}`, trigger: "blur" }
];
if (min > 0)
res.push({ min: min, message: `长度不能小于${min}`, trigger: "blur" });
return res;
};
export const ruleRequiredNumber = [ export const ruleRequiredNumber = [
{ required: true, message: "不能为空", trigger: "blur" }, { required: true, message: "不能为空", trigger: "blur" },
{ {
@ -15,7 +35,7 @@ export const rulePassword = [
]; ];
export const ruleAccount = [ export const ruleAccount = [
{ required: true, message: "不能为空", trigger: "blur" }, { required: true, message: "不能为空", trigger: "blur" },
{ min: 13, message: "长度必须大于12", trigger: "blur" } { min: 9, message: "长度必须大于8", trigger: "blur" }
]; ];
export const rulePhone = [ export const rulePhone = [

View File

@ -4,7 +4,13 @@ import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
import { onMounted, ref, defineOptions } from "vue"; import { onMounted, ref, defineOptions } from "vue";
import { fa } from "element-plus/es/locales.mjs"; import { fa } from "element-plus/es/locales.mjs";
import { hTableAPI } from "@/api/hTable"; import { hTableAPI } from "@/api/hTable";
import { ruleAccount, rulePassword, rulePhone, ruleRequired } from "@/utils/rules"; import {
ruleAccount,
rulePassword,
rulePhone,
ruleRequired,
ruleRequiredI,
} from "@/utils/rules";
const ControllerName = "Admin"; const ControllerName = "Admin";
defineOptions({ defineOptions({
@ -72,7 +78,7 @@ const tableData: TableConfig = {
name: { name: {
label: "名称", label: "名称",
width: "180px", width: "180px",
rules: ruleRequired, rules: ruleRequiredI(12, 2),
search: true, search: true,
searchType: ConditionalType.Like, searchType: ConditionalType.Like,
add: true, // add: true, //
@ -88,7 +94,7 @@ const tableData: TableConfig = {
}, },
account: { account: {
label: "账号", label: "账号",
rules: ruleAccount, rules: ruleRequiredI(20, 8),
search: true, search: true,
add: true, // add: true, //
edit: false, // edit: false, //
@ -97,7 +103,7 @@ const tableData: TableConfig = {
label: "密码", label: "密码",
show: false, show: false,
/**长度必须大于6 */ /**长度必须大于6 */
rules: rulePassword, rules: ruleRequiredI(32, 6),
search: false, search: false,
add: true, // add: true, //
edit: false, // edit: false, //

View File

@ -74,6 +74,13 @@ const tableData: TableConfig = {
click: entryExam, click: entryExam,
btnStyle: "primary", // topBtn: true success danger btnStyle: "primary", // topBtn: true success danger
}, },
{
topBtn: true, //
show: true,
label: "录入成绩模板",
click: DwImportTemplate,
btnStyle: "info", // topBtn: true success danger
},
], ],
column: { column: {
// //
@ -166,6 +173,12 @@ const tableData: TableConfig = {
}, },
selectRows: [], selectRows: [],
}; };
function DwImportTemplate(obj, row, callBack) {
const baseUrl = import.meta.env.VITE_API_BASEURL;
const excelImportUsersUrl = `${baseUrl}/ExamClassInfo/DwImportTemplate`;
window.open(excelImportUsersUrl, "_blank");
}
function entryExam(obj, row, callBack) { function entryExam(obj, row, callBack) {
entryExamInfo(row[0].id); entryExamInfo(row[0].id);
} }

View File

@ -37,8 +37,8 @@ dataThemeChange(overallStyle.value);
const { title } = useNav(); const { title } = useNav();
const ruleForm = reactive({ const ruleForm = reactive({
account: "", account: "admin",
password: "", password: "123456",
}); });
const onLogin = async (formEl: FormInstance | undefined) => { const onLogin = async (formEl: FormInstance | undefined) => {
@ -52,7 +52,7 @@ const onLogin = async (formEl: FormInstance | undefined) => {
password: ruleForm.password, password: ruleForm.password,
}) })
.then((res) => { .then((res) => {
if ((res.code = 200)) { if (res.code == 200) {
// //
return initRouter().then(() => { return initRouter().then(() => {
disabled.value = true; disabled.value = true;
@ -64,7 +64,7 @@ const onLogin = async (formEl: FormInstance | undefined) => {
.finally(() => (disabled.value = false)); .finally(() => (disabled.value = false));
}); });
} else { } else {
message("登录失败", { type: "error" }); // message("", { type: "error" });
} }
}) })
.finally(() => (loading.value = false)); .finally(() => (loading.value = false));

View File

@ -4,7 +4,7 @@ import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { fa } from "element-plus/es/locales.mjs"; import { fa } from "element-plus/es/locales.mjs";
defineOptions({ defineOptions({
name: "School" name: "School",
}); });
onMounted(() => {}); onMounted(() => {});
@ -22,7 +22,7 @@ const tableData: TableConfig = {
PageSize: 20, PageSize: 20,
OrderBy: "CreateTime", // OrderBy: "CreateTime", //
defaultConditions: [], // defaultConditions: [], //
Conditions: [] Conditions: [],
}, },
operationColumn: true, // operationColumn: true, //
operationColumnData: [ operationColumnData: [
@ -30,7 +30,7 @@ const tableData: TableConfig = {
// //
topBtn: false, // topBtn: false, //
label: "修改", label: "修改",
btnType: "edit" // add edit del custom btnType: "edit", // add edit del custom
}, },
{ {
topBtn: true, // topBtn: true, //
@ -42,16 +42,9 @@ const tableData: TableConfig = {
title: "新增学校", // title title: "新增学校", // title
src: "school/SchoolEdit", // src: "school/SchoolEdit", //
width: "550px", // width: "550px", //
height: "300px" // height: "300px", //
} },
}, },
{
topBtn: false, //
show: true,
label: "删除",
btnType: "del", // add edit del
btnStyle: "danger" // topBtn: true success danger
}
], ],
column: { column: {
// //
@ -60,7 +53,7 @@ const tableData: TableConfig = {
search: true, search: true,
add: false, // add: false, //
edit: false, // edit: false, //
width: "150px" width: "150px",
}, },
name: { name: {
label: "学校名称", label: "学校名称",
@ -68,30 +61,30 @@ const tableData: TableConfig = {
search: true, search: true,
searchType: ConditionalType.Like, searchType: ConditionalType.Like,
add: true, // add: true, //
edit: true // edit: true, //
}, },
loc: { loc: {
label: "地区", label: "地区",
width: "300px", width: "300px",
search: true, search: true,
custom: row => `${row.pname}-${row.cname}-${row.rname}`, custom: (row) => `${row.pname}-${row.cname}-${row.rname}`,
add: false, // add: false, //
edit: false // edit: false, //
}, },
enable: { enable: {
label: "启用", label: "启用",
type: "switch", type: "switch",
search: true, search: true,
custom: row => (row.enable ? "启用" : "禁用"), custom: (row) => (row.enable ? "启用" : "禁用"),
add: true, // add: true, //
edit: true // edit: true, //
} },
}, },
data: [], data: [],
pageData: { pageData: {
total: 0 total: 0,
}, },
selectRows: [] selectRows: [],
}; };
</script> </script>