Commit 7531d76b authored by 何虹's avatar 何虹 💬

.

parent e2bd7860
import axios from 'axios' import axios from 'axios'
import hsUtil from 'hs-util-js' import hsUtil from 'hs-util-js'
const urlParam = hsUtil.SystemModule.getUrlParams()
const parseGlobalParams = hsUtil.SystemModule.parseGlobalParams()
class Root { class Root {
constructor(_axios) { constructor (_axios) {
this.moduleName = 'rootModule' this.moduleName = 'rootModule'
this.axios = _axios || axios this.axios = _axios || axios
} }
getParseGlobalParams () {
return hsUtil.SystemModule.parseGlobalParams()
}
getuUrlParam () {
hsUtil.SystemModule.getUrlParams()
}
filterEmptyValue (obj) { filterEmptyValue (obj) {
if (!obj) return if (!obj) return
const emptyValues = [null, undefined, 'null', 'undefined', NaN] const emptyValues = [null, undefined, 'null', 'undefined', NaN]
...@@ -40,15 +44,15 @@ class Root { ...@@ -40,15 +44,15 @@ class Root {
delete params._user_info delete params._user_info
delete params.user_info delete params.user_info
const replaceStr = { const replaceStr = {
'%': "%25", '%': '%25',
'#': "%23", '#': '%23',
'&': "%26", '&': '%26',
'>': "%3E", '>': '%3E',
'<': "%3C", '<': '%3C',
'+': "%2B", '+': '%2B',
'/': "%2F", '/': '%2F',
'=': "3D", '=': '3D',
':': "3A" ':': '3A'
} }
const replaceStrKeys = Object.keys(replaceStr) const replaceStrKeys = Object.keys(replaceStr)
for (let k in params) { for (let k in params) {
...@@ -59,10 +63,11 @@ class Root { ...@@ -59,10 +63,11 @@ class Root {
}) })
params[k] = value params[k] = value
} }
} }
} }
getDbName () { getDbName () {
const parseGlobalParams = this.getParseGlobalParams()
const urlParam = this.getuUrlParam()
if (urlParam.dbName) return urlParam.dbName if (urlParam.dbName) return urlParam.dbName
if (parseGlobalParams.db_name) return parseGlobalParams.db_name if (parseGlobalParams.db_name) return parseGlobalParams.db_name
return '' return ''
...@@ -77,9 +82,11 @@ class Root { ...@@ -77,9 +82,11 @@ class Root {
//this.handleParams(params) //this.handleParams(params)
params && (aixosCtx.params = params) params && (aixosCtx.params = params)
if (aixosCtx.params && aixosCtx.params.token) delete aixosCtx.params.token if (aixosCtx.params && aixosCtx.params.token) delete aixosCtx.params.token
if (aixosCtx.params && aixosCtx.params._user_info) delete aixosCtx.params._user_info if (aixosCtx.params && aixosCtx.params._user_info)
delete aixosCtx.params._user_info
// 给问号参数加上db_name,逻辑是 session中没有 就去取url上的 // 给问号参数加上db_name,逻辑是 session中没有 就去取url上的
if (!aixosCtx.params) {// 问号参数不存在时加一个参数 if (!aixosCtx.params) {
// 问号参数不存在时加一个参数
aixosCtx.params = { aixosCtx.params = {
db_name: this.getDbName() db_name: this.getDbName()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment