2026-06-11 09:43:42 +08:00
|
|
|
import {getUrlParam} from './request'
|
2026-06-18 15:10:50 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解析扫码结果,返回跳转页面路径
|
|
|
|
|
* @param {string} str 扫码结果字符串
|
|
|
|
|
* @returns {{ path: string, query: string } | null} 返回 { path, query } 或 null(材料编码场景)
|
|
|
|
|
*/
|
|
|
|
|
export const parseScanResult = (str) => {
|
|
|
|
|
if (!str) return null
|
|
|
|
|
|
|
|
|
|
// 焊接接头二维码:https://sggl.sedin.com.cn/StaticPage/HJGL/index.html?id=xxx&weldjoint=1
|
|
|
|
|
// if (str.includes('weldjoint')) {
|
|
|
|
|
// const id = getUrlParam(str, 'id')
|
|
|
|
|
// if (id) {
|
|
|
|
|
// return { path: '/scanpages/hj/material_sampling', query: `id=${id}` }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 后续可在此扩展其他扫码类型...
|
|
|
|
|
|
|
|
|
|
// 非 URL 格式,视为材料编码
|
|
|
|
|
return null
|
2026-06-11 09:43:42 +08:00
|
|
|
}
|