修复 staging打包无法运行问题
This commit is contained in:
parent
c00574ca59
commit
c81ed3a84c
|
|
@ -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(不开启压缩,默认)
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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 = [
|
||||||
|
|
|
||||||
|
|
@ -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, // 字段允许修改
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue