| | |
| | | config.method = 'post' |
| | | if (config.url.includes('LoginAndRedirect') || config.url.includes('getjsonresult')) { |
| | | config.data = qs.stringify(config.data) |
| | | } else if (config.url.includes('Upload')) { |
| | | } else if (config.url.includes('Upload') || config.url.includes('doupload') || config.url.includes('dopreload')) { |
| | | config.headers = { 'Content-Type': 'multipart/form-data' } |
| | | } else { |
| | | // config.headers.token = sessionStorage.getItem('TOKEN') || '' |
| | |
| | | |
| | | class Api { |
| | | constructor() { |
| | | let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' |
| | | if (process.env.NODE_ENV === 'production') { |
| | | axios.defaults.baseURL = document.location.origin + '/' + service |
| | | axios.defaults.baseURL = document.location.origin + '/' + window.GLOB.service |
| | | } else { |
| | | // axios.defaults.baseURL = 'http://127.0.0.1:8888' |
| | | } |
| | |
| | | // func: 'webapi_login', |
| | | UserName: username, |
| | | Password: password, |
| | | systemType: options.systemType, |
| | | systemType: options.sysType, |
| | | Type: 'X' |
| | | } |
| | | |
| | |
| | | |
| | | if (isCloud) { |
| | | param.debug = 'Y' |
| | | if (options.cloudLoginApi) { |
| | | param.rduri = options.cloudLoginApi |
| | | if (options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi.replace(/\/webapi(.*)/, '/webapi/dologon') |
| | | } |
| | | } else if (!isCloud && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon') |
| | |
| | | param.t = new Date().getTime() |
| | | |
| | | return axios({ |
| | | url: '/webapi/dostars', |
| | | url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | param.t = new Date().getTime() |
| | | |
| | | return axios({ |
| | | url: '/webapi/dostars', |
| | | url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | param.t = new Date().getTime() |
| | | |
| | | return axios({ |
| | | url: '/webapi/dostars', |
| | | url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | |
| | | return new Promise(resolve => { |
| | | axios({ |
| | | url: '/webapi/dostars', |
| | | url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, |
| | | data: param |
| | | }).then(res => { |
| | | if (res.status) { |
| | |
| | | param.t = new Date().getTime() |
| | | |
| | | return axios({ |
| | | url: '/webapi/dostars', |
| | | url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 大文件上传 |
| | | */ |
| | | getLargeFileUpload (param) { |
| | | return axios({ |
| | | url: '/webapi/doupload', |
| | | data: param |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 查询文件是否已上传 |
| | | */ |
| | | getFilePreUpload (param) { |
| | | return axios({ |
| | | url: '/webapi/dopreload', |
| | | data: param |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取微信支付二维码 |
| | | */ |
| | | getWxNativePay (param) { |
| | | return axios({ |
| | | url: '/wxpay/wxNativePay', |
| | | data: param |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 文件上传 |
| | | */ |
| | | getFileUpload (param) { |