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

鉴权新街口修改

上级 69bdfed6
......@@ -17,6 +17,7 @@ import { offline } from '../location/Toast';
import { giveBase16EnCode, requestFileInfo } from '@/webPublic/one_stop_public/Base16';
import objectToFormData from '@/webPublic/zyd_public/utils/object-to-formdata-custom';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
const codeMessage = {
200: '服务器成功返回请求的数据。',
......@@ -170,7 +171,9 @@ export const requestOrigin = (url, data, options = {}) => {
// method: "POST",
requestType: 'form',
...getHeaders(),
...options,
})
.then(response => {
// console.log(response);
......@@ -256,9 +259,7 @@ export const requestOrigin = (url, data, options = {}) => {
options.prefix = '';
}
if (getToken()) {
options.headers = {
Authorization: `bearer ${getToken()}`,
};
options.headers = getHeaders().headers;
}
return fetchRequest(url, {
......
import { getCurrentUser, getToken } from '@/webPublic/one_stop_public/utils/token';
import { getCurrentUser, getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import Md5 from 'js-md5';
import { getIsBei_Dian } from '@/webPublic/zyd_public/utils/utils';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
......@@ -8,16 +8,18 @@ const isTest = getUrlInfo().test;
export function getHeaders(url = '') {
const token = getToken();
const currentInfo = getCurrentUser();
const currentInfo = getCurrentUser() || {};
const user = getUserInfo() || {};
const userId = user.id || currentInfo.xgUserId;
const timestamp = new Date().getTime() + window.differenceBetweenServerAndClientTime;
const secretString = token + currentInfo.xgUserId + timestamp;
const secretString = token + userId + timestamp;
const res = {
headers: {
Authorization: `bearer ${token}`,
},
};
if(getIsBei_Dian() && currentInfo?.userid){
if(getIsBei_Dian() && userId){
res.headers.auth = Md5(secretString);
res.headers.timestamp = timestamp;
if (isTest) {
......@@ -26,8 +28,7 @@ export function getHeaders(url = '') {
secretString,
md5S: Md5(secretString),
timestamp,
xgUserId: currentInfo.xgUserId,
typeString: currentInfo.typeString,
userId: userId,
differenceBetweenServerAndClientTime: window.differenceBetweenServerAndClientTime,
},
);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论