|
|
@ -124,19 +124,21 @@ export function param(json) {
|
|
|
|
* @returns {Object}
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export function param2Obj(url) {
|
|
|
|
export function param2Obj(url) {
|
|
|
|
const search = url.split('?')[1]
|
|
|
|
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
|
|
|
|
if (!search) {
|
|
|
|
if (!search) {
|
|
|
|
return {}
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return JSON.parse(
|
|
|
|
const obj = {}
|
|
|
|
'{"' +
|
|
|
|
const searchArr = search.split('&')
|
|
|
|
decodeURIComponent(search)
|
|
|
|
searchArr.forEach(v => {
|
|
|
|
.replace(/"/g, '\\"')
|
|
|
|
const index = v.indexOf('=')
|
|
|
|
.replace(/&/g, '","')
|
|
|
|
if (index !== -1) {
|
|
|
|
.replace(/=/g, '":"')
|
|
|
|
const name = v.substring(0, index)
|
|
|
|
.replace(/\+/g, ' ') +
|
|
|
|
const val = v.substring(index + 1, v.length)
|
|
|
|
'"}'
|
|
|
|
obj[name] = val
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return obj
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|