修复 staging打包无法运行问题
This commit is contained in:
parent
c00574ca59
commit
c81ed3a84c
|
|
@ -8,7 +8,7 @@ VITE_PUBLIC_PATH = /
|
|||
VITE_ROUTER_HISTORY = "hash"
|
||||
|
||||
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
|
||||
VITE_CDN = true
|
||||
VITE_CDN = false
|
||||
|
||||
# 是否启用gzip压缩或brotli压缩(分两种情况,删除原始文件和不删除原始文件)
|
||||
# 压缩时不删除原始文件的配置:gzip、brotli、both(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认)
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ function addPathMatch() {
|
|||
|
||||
/** 处理动态路由(后端返回的路由) */
|
||||
function handleAsyncRoutes(routeList) {
|
||||
if (routeList.length === 0) {
|
||||
if (routeList == null ||routeList.length === 0) {
|
||||
usePermissionStoreHook().handleWholeMenus(routeList);
|
||||
} else {
|
||||
formatFlatteningRoutes(addAsyncRoutes(routeList)).map(
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import { getToken, formatToken } from "@/utils/auth";
|
|||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
// import { string } from "vue-types";
|
||||
import router from "@/router";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { message } from "../message";
|
||||
|
||||
/**请求后端的地址 未配置则访问BaseURL */
|
||||
const apiServiceConfig = {
|
||||
|
|
@ -231,10 +233,16 @@ class PureHttp {
|
|||
return new Promise((resolve, reject) => {
|
||||
PureHttp.axiosInstance
|
||||
.request(config)
|
||||
.then((response: undefined) => {
|
||||
resolve(response);
|
||||
.then((response: any) => {
|
||||
if (response.code != null && response.code !== 200) {
|
||||
|
||||
message(response.message, { type: "error" });
|
||||
} resolve(response);
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.status != 200) {
|
||||
if (error.status == 200) ElMessage.warning("请求失败" + error.message);
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,26 @@
|
|||
export const ruleRequired = [
|
||||
{ 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 = [
|
||||
{ required: true, message: "不能为空", trigger: "blur" },
|
||||
{
|
||||
|
|
@ -15,7 +35,7 @@ export const rulePassword = [
|
|||
];
|
||||
export const ruleAccount = [
|
||||
{ required: true, message: "不能为空", trigger: "blur" },
|
||||
{ min: 13, message: "长度必须大于12", trigger: "blur" }
|
||||
{ min: 9, message: "长度必须大于8", trigger: "blur" }
|
||||
];
|
||||
|
||||
export const rulePhone = [
|
||||
|
|
|
|||
|
|
@ -4,7 +4,13 @@ import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
|
|||
import { onMounted, ref, defineOptions } from "vue";
|
||||
import { fa } from "element-plus/es/locales.mjs";
|
||||
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";
|
||||
|
||||
defineOptions({
|
||||
|
|
@ -72,7 +78,7 @@ const tableData: TableConfig = {
|
|||
name: {
|
||||
label: "名称",
|
||||
width: "180px",
|
||||
rules: ruleRequired,
|
||||
rules: ruleRequiredI(12, 2),
|
||||
search: true,
|
||||
searchType: ConditionalType.Like,
|
||||
add: true, // 字段允许添加
|
||||
|
|
@ -88,7 +94,7 @@ const tableData: TableConfig = {
|
|||
},
|
||||
account: {
|
||||
label: "账号",
|
||||
rules: ruleAccount,
|
||||
rules: ruleRequiredI(20, 8),
|
||||
search: true,
|
||||
add: true, // 字段允许添加
|
||||
edit: false, // 字段允许修改
|
||||
|
|
@ -97,7 +103,7 @@ const tableData: TableConfig = {
|
|||
label: "密码",
|
||||
show: false,
|
||||
/**长度必须大于6 */
|
||||
rules: rulePassword,
|
||||
rules: ruleRequiredI(32, 6),
|
||||
search: false,
|
||||
add: true, // 字段允许添加
|
||||
edit: false, // 字段允许修改
|
||||
|
|
|
|||
|
|
@ -74,6 +74,13 @@ const tableData: TableConfig = {
|
|||
click: entryExam,
|
||||
btnStyle: "primary", // topBtn: true才生效 success danger
|
||||
},
|
||||
{
|
||||
topBtn: true, // 头部按钮
|
||||
show: true,
|
||||
label: "录入成绩模板",
|
||||
click: DwImportTemplate,
|
||||
btnStyle: "info", // topBtn: true才生效 success danger
|
||||
},
|
||||
],
|
||||
column: {
|
||||
// 行数据
|
||||
|
|
@ -166,6 +173,12 @@ const tableData: TableConfig = {
|
|||
},
|
||||
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) {
|
||||
entryExamInfo(row[0].id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ dataThemeChange(overallStyle.value);
|
|||
const { title } = useNav();
|
||||
|
||||
const ruleForm = reactive({
|
||||
account: "",
|
||||
password: "",
|
||||
account: "admin",
|
||||
password: "123456",
|
||||
});
|
||||
|
||||
const onLogin = async (formEl: FormInstance | undefined) => {
|
||||
|
|
@ -52,7 +52,7 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||
password: ruleForm.password,
|
||||
})
|
||||
.then((res) => {
|
||||
if ((res.code = 200)) {
|
||||
if (res.code == 200) {
|
||||
// 获取后端路由
|
||||
return initRouter().then(() => {
|
||||
disabled.value = true;
|
||||
|
|
@ -64,7 +64,7 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||
.finally(() => (disabled.value = false));
|
||||
});
|
||||
} else {
|
||||
message("登录失败", { type: "error" });
|
||||
// message("登录失败", { type: "error" });
|
||||
}
|
||||
})
|
||||
.finally(() => (loading.value = false));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
|
|||
import { onMounted, ref } from "vue";
|
||||
import { fa } from "element-plus/es/locales.mjs";
|
||||
defineOptions({
|
||||
name: "School"
|
||||
name: "School",
|
||||
});
|
||||
|
||||
onMounted(() => {});
|
||||
|
|
@ -22,7 +22,7 @@ const tableData: TableConfig = {
|
|||
PageSize: 20,
|
||||
OrderBy: "CreateTime", // 排序
|
||||
defaultConditions: [], // 默认查询条件
|
||||
Conditions: []
|
||||
Conditions: [],
|
||||
},
|
||||
operationColumn: true, // 显示操作按钮
|
||||
operationColumnData: [
|
||||
|
|
@ -30,7 +30,7 @@ const tableData: TableConfig = {
|
|||
// 操作按钮
|
||||
topBtn: false, // 是头部按钮
|
||||
label: "修改",
|
||||
btnType: "edit" // 按钮类型 add edit del custom
|
||||
btnType: "edit", // 按钮类型 add edit del custom
|
||||
},
|
||||
{
|
||||
topBtn: true, // 头部按钮
|
||||
|
|
@ -42,16 +42,9 @@ const tableData: TableConfig = {
|
|||
title: "新增学校", // 弹出框title
|
||||
src: "school/SchoolEdit", // 组件路径
|
||||
width: "550px", // 弹框宽度
|
||||
height: "300px" // 弹框高度
|
||||
}
|
||||
height: "300px", // 弹框高度
|
||||
},
|
||||
},
|
||||
{
|
||||
topBtn: false, // 头部按钮
|
||||
show: true,
|
||||
label: "删除",
|
||||
btnType: "del", // 按钮类型 add edit del 不设置则 自定义按钮
|
||||
btnStyle: "danger" // topBtn: true才生效 success danger
|
||||
}
|
||||
],
|
||||
column: {
|
||||
// 行数据
|
||||
|
|
@ -60,7 +53,7 @@ const tableData: TableConfig = {
|
|||
search: true,
|
||||
add: false, // 字段允许添加
|
||||
edit: false, // 字段允许修改
|
||||
width: "150px"
|
||||
width: "150px",
|
||||
},
|
||||
name: {
|
||||
label: "学校名称",
|
||||
|
|
@ -68,30 +61,30 @@ const tableData: TableConfig = {
|
|||
search: true,
|
||||
searchType: ConditionalType.Like,
|
||||
add: true, // 字段允许添加
|
||||
edit: true // 字段允许修改
|
||||
edit: true, // 字段允许修改
|
||||
},
|
||||
loc: {
|
||||
label: "地区",
|
||||
width: "300px",
|
||||
search: true,
|
||||
custom: row => `${row.pname}-${row.cname}-${row.rname}`,
|
||||
custom: (row) => `${row.pname}-${row.cname}-${row.rname}`,
|
||||
add: false, // 字段允许添加
|
||||
edit: false // 字段允许修改
|
||||
edit: false, // 字段允许修改
|
||||
},
|
||||
enable: {
|
||||
label: "启用",
|
||||
type: "switch",
|
||||
search: true,
|
||||
custom: row => (row.enable ? "启用" : "禁用"),
|
||||
custom: (row) => (row.enable ? "启用" : "禁用"),
|
||||
add: true, // 字段允许添加
|
||||
edit: true // 字段允许修改
|
||||
}
|
||||
edit: true, // 字段允许修改
|
||||
},
|
||||
},
|
||||
data: [],
|
||||
pageData: {
|
||||
total: 0
|
||||
total: 0,
|
||||
},
|
||||
selectRows: []
|
||||
selectRows: [],
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue