Merge branch 'manage-release' of http://gitlab.dongwu-inc.com:10080/BOE/fe-stu into release

# Conflicts:
#	src/api/request.js
This commit is contained in:
dongruihua
2022-12-14 18:35:55 +08:00

View File

@@ -109,4 +109,40 @@ export async function request(_url, params) {
console.log(e)
// router.push({path: '/login'})
})
}
// 这个方法要有 和request不一样
export async function boeRequest(_url, params) {
const s = _url.split(' ')
let url = s[0]
const method = s[1]?.toLowerCase() || 'get'
if (method === 'get') {
let paramsArray = [];
//拼接参数
if (params) {
Object.keys(params).forEach(key => paramsArray.push(key + '=' + params[key]))
if (url.search(/\?/) === -1) {
url += '?' + paramsArray.join('&')
} else {
url += '&' + paramsArray.join('&')
}
}
}
const body = method !== 'get' ? params || {} : {}
return axios({
url,
method,
headers: {
token: getCookie('token'),
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
},
baseURL: '',
...method !== 'get' ? {data: JSON.stringify(body)} : {}
}).then(resp => resp.data).then(response => {
return response
}).catch(e => {
console.log(2222)
console.log(e)
// router.push({path: '/login'})
})
}