提交 c66f4b63 authored 作者: lihuihui's avatar lihuihui

update

上级 0dfe90d9
......@@ -14,7 +14,9 @@ export function getNewsDetails(params) {
* 发送验证码
*/
export function sendCode(data) {
return httpRequest.post('/api/usercenter/user/send-code', data)
return httpRequest.post('/api/usercenter/user/send-code', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/**
......@@ -28,5 +30,7 @@ export function checkCode(params) {
* 提交留咨信息
*/
export function postNes(data) {
return httpRequest.post('/api/enrollment/v1.0/applications', data)
return httpRequest.post('/api/enrollment/v1.0/applications', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
......@@ -156,7 +156,11 @@ export default {
}
},
checkSendcode() {
const checkCodeParam = '?account=' + this.formInfo.phone + '&code=' + this.sendCode + '&countryCode=86'
const checkCodeParam = {
account: this.formInfo.phone,
code: this.sendCode,
countryCode: 86
}
return new Promise((resolve, reject) => {
checkCode(checkCodeParam).then(res => {
if (res && res.code === 0) {
......
......@@ -13,6 +13,13 @@ const httpRequest = axios.create({
// 请求拦截
httpRequest.interceptors.request.use(
function(config) {
if (config.headers['Content-Type'] === 'multipart/form-data') {
const form = new window.FormData()
for (const key in config.data) {
form.append(key, config.data[key])
}
config.data = form
} else {
const defaultParams = {
timestamp: parseInt(Date.now() / 1000),
nonce: Math.random()
......@@ -37,15 +44,6 @@ httpRequest.interceptors.request.use(
} else {
config.params = params
}
// if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
// config.data = qs.stringify(config.data)
// }
if (config.headers['Content-Type'] === 'multipart/form-data') {
const form = new window.FormData()
for (const key in config.data) {
form.append(key, config.data[key])
}
config.data = form
}
return config
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论