let url = 'https://whszwb.com/screen-d-transportation/index.html';
let dataObj = qs.stringify({ username: '15872371619', password: 'JFat0Zdc' },{ encode: false });
axios.post('https://whszwb.com/auth/oauth/token', dataObj, {
headers: {
isToken: false,
"TENANT-ID": "1",
Authorization: 'Basic cGlnOnBpZw==',
'Content-Type': 'application/x-www-form-urlencoded'
},
params: { randomStr: 'blockPuzzle', code: '', grant_type: 'password' },
custom: { formData: true }
}).then(res => {
const data = res.data;
url += '?token=' + data.access_token;
Cookies.set("SZWB_TOKEN", data.access_token, { });
window.open(url,'_blank')
}).catch((error) => {
console.log(error);
window.open(url,'_blank')
});
Axios post from表单用法
最新推荐文章于 2024-04-01 14:04:02 发布