保存进度!
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-12-14 15:12:46
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2023-03-05 00:14:41
 | 
			
		||||
 * @LastEditTime: 2023-03-05 21:35:01
 | 
			
		||||
 * @FilePath: /task_schedule/.eslintrc.cjs
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
@@ -81,6 +81,11 @@ module.exports = {
 | 
			
		||||
          "exports": "never",
 | 
			
		||||
          "functions": "never",
 | 
			
		||||
        },], //数组和对象键值对最后一个逗号
 | 
			
		||||
        "@typescript-eslint/quotes": ["error", "double",],
 | 
			
		||||
        "@typescript-eslint/space-before-function-paren": "off",
 | 
			
		||||
        "@typescript-eslint/strict-boolean-expressions": ["error", {
 | 
			
		||||
          "allowString": true,
 | 
			
		||||
        },],
 | 
			
		||||
        "comma-style": ["error", "last",], //逗号在行位
 | 
			
		||||
        "array-bracket-spacing": ["error", "never",],
 | 
			
		||||
        "no-undef-init": "error",
 | 
			
		||||
@@ -88,6 +93,8 @@ module.exports = {
 | 
			
		||||
        "no-use-before-define": "error",
 | 
			
		||||
        "no-shadow-restricted-names": "error", //禁止对一些关键字或者保留字进行赋值操作,比如NaN、Infinity、undefined、eval、arguments等
 | 
			
		||||
        "prefer-const": "warn",
 | 
			
		||||
        "spaced-comment": "error",
 | 
			
		||||
        "space-before-function-paren": "off",
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  ],
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /task_schedule/src/utils/api/url.ts
 | 
			
		||||
 * @Description: 对URL的操作
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
type stringkey = Record<string, string>;
 | 
			
		||||
@@ -15,7 +15,7 @@ type stringkey = Record<string, string>;
 | 
			
		||||
 * @param url 访问的url
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
function getURLParams(url: string)
 | 
			
		||||
function getURLParams(url: string): Record<string, string>
 | 
			
		||||
{
 | 
			
		||||
    const arr = url.split("?");
 | 
			
		||||
    const params = arr[1].split("&");
 | 
			
		||||
@@ -38,38 +38,37 @@ function getURLParams(url: string)
 | 
			
		||||
 */
 | 
			
		||||
function getParamsFromURL(url: string): stringkey
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    const indexOfQuestionMark: number = url.indexOf("?");
 | 
			
		||||
    const indexOfSharp: number = url.indexOf("#");
 | 
			
		||||
    const paramObj: stringkey = {};
 | 
			
		||||
    let paramString;
 | 
			
		||||
 | 
			
		||||
    //url中没有问号,说明没有参数
 | 
			
		||||
    // 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)
 | 
			
		||||
        if (item.length === 0)
 | 
			
		||||
        {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@@ -82,4 +81,4 @@ function getParamsFromURL(url: string): stringkey
 | 
			
		||||
    return paramObj;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export { getURLParams, getParamsFromURL };
 | 
			
		||||
export { getURLParams, getParamsFromURL };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user