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

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

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