提交 b66d0ad0 authored 作者: 钟是志's avatar 钟是志

28295 【就业门户】需要实现访问档案查询的路由地址带上token参数,可以直接进入登录状态下的档案查询页面

上级 af2f85bb
......@@ -2,7 +2,7 @@ import encryptApiList, { resBinaryApiList } from '@/webPublic/one_stop_public/Ba
import { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import { qqCw } from '@/webPublic/one_stop_public/utils/request';
import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import { getHeaders, isJSON } from '@/webPublic/zyd_public/utils/utils';
import { deepCopy } from '@/webPublic/one_stop_public/utils/myutils';
import { countAllValues } from '@/webPublic/one_stop_public/Base16/SplitBase16Index';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
......@@ -141,7 +141,7 @@ export async function requestFileInfo(url, datas) {
return fetch(url && url.indexOf('http') > -1 ? url : queryApiActionPath() + url, {
headers: {
Accept: 'application/json',
Authorization: `bearer ${getToken()}`,
...getHeaders(url).headers,
},
method: 'POST',
credentials: 'omit',
......
......@@ -16,11 +16,10 @@ import { queryIsSafe } from '@/webPublic/one_stop_public/utils/queryConfig';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
import {
getToken,
setToken,
setFetchUrl,
getFetchUrl,
getType,
setType, getCurrentUser, delToken
delToken
} from '@/webPublic/one_stop_public/utils/token';
import urlTransform from '@/webPublic/zyd_public/request/urlTransform';
import { proxyChangeUrl } from '@/webPublic/zyd_public/request/proxyChangeUrl';
......@@ -51,14 +50,13 @@ const checkStatus = response => {
const errortext = codeMessage[response.status] || response.statusText;
const token = getToken();
if (token && token !== 'null') {
controlNotification({
message: `${response.status === 401 ? '登录过期' : '请求错误'}`,
description: errortext,
});
}
if (response.status === 401) {
setToken(null);
delToken();
if (window.top != window.self) {
window.top.postMessage('returnLogin', '*'); // Iframe 返回登录页
return true;
......
......@@ -70,7 +70,11 @@ export function getHeaders(url = '') {
const userId = user.id || currentInfo.xgUserId;
const timestamp = new Date().getTime() + window.differenceBetweenServerAndClientTime;
const secretString = token + userId + timestamp;
if(!token || token === 'null'){
return {
headers: {},
}
}
const res = {
headers: {
Authorization: `bearer ${token}`,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论