焊接日报

This commit is contained in:
2026-06-11 09:43:42 +08:00
parent 2c8af0f2e0
commit 06781c69e1
14 changed files with 713 additions and 24 deletions
+22 -2
View File
@@ -137,11 +137,31 @@ export function request(options) {
}
// GET 快捷方法
export function get(url, params = {}) {
export const get = (url, params = {}) => {
return request({ url, method: 'GET', data: params })
}
// POST 快捷方法
export function post(url, data = {}) {
export const post = (url, data = {}) => {
return request({ url, method: 'POST', data })
}
export const getUrlParam = (url, name) => {
if (!url || !name) return null;
// 构造正则:匹配 ?name= 或 &name= 后面的值
// [?&] : 匹配起始分隔符
// ${name}: 匹配具体的参数名
// = : 匹配等号
// ([^&]*) : 捕获组,匹配直到下一个 & 或字符串结束的内容
const regex = new RegExp(`[?&]${name}=([^&]*)`, 'i'); // 'i' 表示忽略大小写
const match = url.match(regex);
if (match && match[1]) {
return decodeURIComponent(match[1]);
}
return null;
};