跨域在请求头中直接携带Cookie是会报错的,直接使用document.cookie将Cookie保存在浏览器,在之后的请求中会默认携带到请求头中,注意请求中要配置withCredentials: true
document.cookie = 'X_GU_SID= ' + sessionStorage.getItem('sessionId') + ';path=/';
document.cookie = 'USER_ID=' + sessionStorage.getItem('userId') + ';path=/';
document.cookie = 'Account=' + sessionStorage.getItem('account') + ';path=/';
document.cookie = 'USER_NAME=' + sessionStorage.getItem('userName') + ';path=/';