1234567891011121314151617181920212223242526272829303132 |
- const BASE_URL = 'http://192.168.3.152:8088/glwork'
- export function ApiRequest(config = {}){
- let {
- url,
- data,
- method="GET",
- header={}
- } = config
- url = BASE_URL + url
- if(uni.getStorageSync('GlWorkPlatform-AccessToken')){
- header['Authorization'] = 'Bearer ' + uni.getStorageSync('GlWorkPlatform-AccessToken')
- }
- return new Promise((resolve, reject)=>{
- uni.request({
- url: url,
- data: data,
- method: method,
- header: header,
- timeout: 60000,
- success: (res)=>{
- resolve(res.data)
- },
- fail: (err) => {
- reject(err)
- },
- complete: (event)=>{
-
- }
- })
- })
- }
|