| | |
| | | var DEFAULT_NAMESPACE = "default"; |
| | | vc.http = { |
| | | post: function (componentCode, componentMethod, param, options, successCallback, errorCallback) { |
| | | // 获取访问令牌 |
| | | let _accessToken = vc.getData('hc_accessToken'); |
| | | if(_accessToken){ |
| | | Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken.token; |
| | | } |
| | | // 添加USER-ID请求头 |
| | | Vue.http.headers.common['USER-ID'] = '-1'; |
| | | // 添加VERSION请求头 |
| | | Vue.http.headers.common['VERSION'] = 'v1.8'; |
| | | vc.loading('open'); |
| | | Vue.http.post('/callComponent/' + componentCode + "/" + componentMethod, param, options) |
| | | .then(function (res) { |
| | |
| | | }); |
| | | }, |
| | | get: function (componentCode, componentMethod, param, successCallback, errorCallback) { |
| | | // 获取访问令牌 |
| | | let _accessToken = vc.getData('hc_accessToken'); |
| | | if(_accessToken){ |
| | | Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken.token; |
| | | } |
| | | // 添加USER-ID请求头 |
| | | Vue.http.headers.common['USER-ID'] = '-1'; |
| | | // 添加VERSION请求头 |
| | | Vue.http.headers.common['VERSION'] = 'v1.8'; |
| | | //加入缓存机制 |
| | | var _getPath = '/' + componentCode + '/' + componentMethod; |
| | | if (vc.constant.GET_CACHE_URL.includes(_getPath)) { |
| | |
| | | }); |
| | | }, |
| | | upload: function (componentCode, componentMethod, param, options, successCallback, errorCallback) { |
| | | // 获取访问令牌 |
| | | let _accessToken = vc.getData('hc_accessToken'); |
| | | if(_accessToken){ |
| | | Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken.token; |
| | | } |
| | | // 添加USER-ID请求头 |
| | | Vue.http.headers.common['USER-ID'] = '-1'; |
| | | // 添加VERSION请求头 |
| | | Vue.http.headers.common['VERSION'] = 'v1.8'; |
| | | vc.loading('open'); |
| | | Vue.http.post('/callComponent/upload/' + componentCode + "/" + componentMethod, param, options) |
| | | .then(function (res) { |