1234567891011121314151617181920212223242526272829303132333435 |
- function request(config = {}) {
- let s4 = new SM4Util();
- let postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + localStorage.getItem("GlWorkPlatform-AccessToken")
- }
- };
- let {
- url,
- data,
- header = {}
- } = config
- url = apiurljs.login + url
- let headers = {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + localStorage.getItem("GlWorkPlatform-AccessToken")
- }
- return new Promise((resolve, reject) => {
- axios.post(url, {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, {headers})
- .then(response => {
- resolve(strToJson(s4.decryptData_CBC(response.data.data)))
- })
- .catch(error => {
- reject(error)
- });
- })
- }
|