From 6751b97db9a892cdc91288e1a90dabfa3870b52f Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期五, 25 二月 2022 18:34:37 +0800
Subject: [PATCH] fix 修复一些小问题
---
ruoyi-ui/src/utils/index.js | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/ruoyi-ui/src/utils/index.js b/ruoyi-ui/src/utils/index.js
index 4bcc029..df5db12 100644
--- a/ruoyi-ui/src/utils/index.js
+++ b/ruoyi-ui/src/utils/index.js
@@ -1,3 +1,5 @@
+import { parseTime } from './ruoyi'
+
/**
* 琛ㄦ牸鏃堕棿鏍煎紡鍖�
*/
@@ -124,19 +126,21 @@
* @returns {Object}
*/
export function param2Obj(url) {
- const search = url.split('?')[1]
+ const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
if (!search) {
return {}
}
- return JSON.parse(
- '{"' +
- decodeURIComponent(search)
- .replace(/"/g, '\\"')
- .replace(/&/g, '","')
- .replace(/=/g, '":"')
- .replace(/\+/g, ' ') +
- '"}'
- )
+ const obj = {}
+ const searchArr = search.split('&')
+ searchArr.forEach(v => {
+ const index = v.indexOf('=')
+ if (index !== -1) {
+ const name = v.substring(0, index)
+ const val = v.substring(index + 1, v.length)
+ obj[name] = val
+ }
+ })
+ return obj
}
/**
@@ -377,9 +381,10 @@
// 涓嬪垝杞┘宄�
export function camelCase(str) {
- return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase())
+ return str.replace(/_[a-z]/g, str1 => str1.substr(-1).toUpperCase())
}
export function isNumberStr(str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
}
+
--
Gitblit v1.9.3