From 0d52e11e3dd739eb5a67ea645f0ca4c4be77ad91 Mon Sep 17 00:00:00 2001
From: 平凡 <hmxmylove@163.com>
Date: 星期六, 18 七月 2020 00:03:27 +0800
Subject: [PATCH] 禁止加密密文返回前端
---
ruoyi-ui/src/utils/index.js | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/ruoyi-ui/src/utils/index.js b/ruoyi-ui/src/utils/index.js
index 6c3017c..49897c9 100644
--- a/ruoyi-ui/src/utils/index.js
+++ b/ruoyi-ui/src/utils/index.js
@@ -124,19 +124,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
}
/**
--
Gitblit v1.9.2