保存进度!
This commit is contained in:
		
							
								
								
									
										1189
									
								
								code/ts/后端辅助工具/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1189
									
								
								code/ts/后端辅助工具/package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -9,6 +9,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "axios": "^1.3.2",
 | 
					    "axios": "^1.3.2",
 | 
				
			||||||
    "pako": "^2.1.0"
 | 
					    "pako": "^2.1.0",
 | 
				
			||||||
 | 
					    "ts-node": "^10.9.1"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										77
									
								
								code/ts/后端辅助工具/src/utils/url.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								code/ts/后端辅助工具/src/utils/url.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * @Author: Kane
 | 
				
			||||||
 | 
					 * @Date: 2023-02-28 19:30:40
 | 
				
			||||||
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 | 
					 * @FilePath: /后端辅助工具/src/utils/url.ts
 | 
				
			||||||
 | 
					 * @Description: 
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 将url的参数拆分成对象
 | 
				
			||||||
 | 
					 * @param url 访问的url
 | 
				
			||||||
 | 
					 * @returns 
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function getURLParams(url: string)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    const arr = url.split("?");
 | 
				
			||||||
 | 
					    const params = arr[1].split("&");
 | 
				
			||||||
 | 
					    const obj = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (let i = 0; i < params.length; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        const param = params[i].split("=");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        obj[param[0]] = param[1];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return obj;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getParamsFromURL(url: string)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    const indexOfQuestionMark: number = url.indexOf("?");
 | 
				
			||||||
 | 
					    const indexOfSharp: number = url.indexOf("#");
 | 
				
			||||||
 | 
					    const paramObj = {};
 | 
				
			||||||
 | 
					    let paramString;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //url中没有问号,说明没有参数
 | 
				
			||||||
 | 
					    if (indexOfQuestionMark < 0)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return paramObj;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //检查是否有#号
 | 
				
			||||||
 | 
					    if (indexOfSharp < 0)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //没有#号,可以直接截取参数字符串
 | 
				
			||||||
 | 
					        paramString = url.substring(indexOfQuestionMark);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //有#号,需要排除掉#的内容
 | 
				
			||||||
 | 
					        const end: number = indexOfQuestionMark < indexOfSharp ? indexOfSharp : url.length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        paramString = url.substring(indexOfQuestionMark + 1, end);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //拆分属性
 | 
				
			||||||
 | 
					    const paramArray: string[] = paramString.split("&");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    paramArray.forEach((item) =>
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (item.length == 0)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const param = item.split("=");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        paramObj[param[0]] = param[1] || "";
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return paramObj;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export { getURLParams, getParamsFromURL };
 | 
				
			||||||
@@ -2,10 +2,11 @@
 | 
				
			|||||||
 * @Author: Kane
 | 
					 * @Author: Kane
 | 
				
			||||||
 * @Date: 2023-02-23 16:15:45
 | 
					 * @Date: 2023-02-23 16:15:45
 | 
				
			||||||
 * @LastEditors: Kane
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 * @LastEditTime: 2023-02-23 16:16:04
 | 
					 * @LastEditTime: 2023-02-28 09:22:08
 | 
				
			||||||
 * @FilePath: /后端辅助工具/webpack.config.js
 | 
					 * @FilePath: /后端辅助工具/webpack.config.js
 | 
				
			||||||
 * @Description: 
 | 
					 * @Description: 
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
					 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const path = require("path");
 | 
					// const path = require("path");
 | 
				
			||||||
 | 
					import { path } from "path";
 | 
				
			||||||
		Reference in New Issue
	
	Block a user