shimai
9 days ago 88a31d5a960bd10f3799bc00f8aa24461567d06e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * URL参数解析工具
 * 用于获取和合并URL查询参数与默认值
 */
 
/**
 * 获取默认参数(开发环境使用)
 * @returns {Object} 默认参数对象
 */
export const getDefaultParams = () => {
  return {
    caseId: '202602261114241000',
    caseTypeFirst: '24_01-2',
    caseType: '24_02-9',
    platform_code: 'AI_0001',
    authorization: ''
  };
};
 
/**
 * 解析URL查询参数
 * @returns {Object} URL参数对象
 */
export const parseUrlParams = () => {
  const params = {};
  const searchParams = new URLSearchParams(window.location.search);
  
  // 获取所有参数
  for (const [key, value] of searchParams.entries()) {
    params[key] = value;
  }
  
  return params;
};
 
/**
 * 合并URL参数和默认值
 * URL参数优先级高于默认值
 * @returns {Object} 合并后的参数对象
 */
export const getMergedParams = () => {
  const defaultParams = getDefaultParams();
  const urlParams = parseUrlParams();
  
  return {
    ...defaultParams,
    ...urlParams
  };
};