1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| import axios from 'axios'
const instance = axios.create({ baseURL: 'http//quest-sit.paic.com.cn', headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-cache' }, responseType: 'json', validateStatus( status ){ return status >= 200 && status <= 500 } })
instance.interceptors,response.use((response:any) => { let data = response.data if(response && response.status == '401'){ if(window.location.origin){ window.location.href = `${window.location.origin}/#/login` }else{ window.location.href = window.location.protocal + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/#/login' } } if(data && (data.code == '602' || data.code == '401')){ if(window.location.origin){ window.location.href = `${window.location.origin}/#/login` }else { window.location.href = window.location.protocal + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '') + '/#/login' } } if(data && (data.code == '500' || data.code = '50x')){ Message({ message:data.msg, type:'warning' }) return data } })
export const recieveOpinion = async function( url, projectCode, processInstanceId ){ let data = { projectCode, processInstanceId, feedback } try { let res = Promise.resolve(instance.post( urlConfig.workUrl + url ,data ? data : {})) console.log('----接受审核----', url, data, res) return res }catch(error){ console.error(error, url + '接口获取数据失败') } }
|