Commit c1162586 by liimin

v2.8.0

1 parent b18deae5
{
"name": "glsx-common",
"version": "2.0.5",
"version": "2.0.8",
"description": "glsx common",
"main": "./dist/glsx-common.js",
"private": false,
......
import md5 from 'md5'
import sha1 from 'sha1'
import qs from 'qs'
import Http from './http'
export const Util = {
/**
* 校验手机号码格式
......@@ -184,6 +185,29 @@ export const Util = {
}
}
return formData
},
getConfig({ moduleName, mockUrl, env = '', httpOptions = {} }) {
if (!mockUrl) {
throw new Error('mockUrl应为必填')
}
let url = ''
if (env == 'test') {
url = 'http://config-center-backend.test.glsx.com/glsxAdmin/config?moduleUrl='
} else {
url = 'https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl='
}
const http = new Http(httpOptions)
return http
.get(`${url}${moduleName}`)
.then(res => {
if (res.code == '-1') {
throw new Error()
}
return res.data ? res.data : res
})
.catch(err => {
return http.get(mockUrl)
})
}
}
export const createSign = Util.createSign
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!