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

增加访客token 访问接口

上级 debed0a1
...@@ -8,7 +8,8 @@ import { countAllValues } from '@/webPublic/one_stop_public/Base16/SplitBase16In ...@@ -8,7 +8,8 @@ import { countAllValues } from '@/webPublic/one_stop_public/Base16/SplitBase16In
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils'; import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform'; import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
import { strToBinary } from './strToBinary'; // 字符串转二进制 混淆代码 import { strToBinary } from './strToBinary'; // 字符串转二进制 混淆代码
import { binaryToStr } from './binaryToStr'; // 二进制字符串转JSON字符串 混淆代码 import { binaryToStr } from './binaryToStr';
import { getVisitorToken } from '@/webPublic/zyd_public/utils/getHeaders'; // 二进制字符串转JSON字符串 混淆代码
const test = !!(getUrlInfo().test); const test = !!(getUrlInfo().test);
...@@ -93,8 +94,8 @@ export async function requestFileInfo(url, datas) { ...@@ -93,8 +94,8 @@ export async function requestFileInfo(url, datas) {
// datas = await testPromise(datas); // datas = await testPromise(datas);
// } // }
const formData = new FormData(); const formData = new FormData();
if (getToken()) { if (getVisitorToken()) {
datas.token = getToken(); datas.token = getVisitorToken();
} }
for (let key in datas) { for (let key in datas) {
formData.append(key, datas[key]); formData.append(key, datas[key]);
......
...@@ -5,8 +5,18 @@ import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils'; ...@@ -5,8 +5,18 @@ import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
const isTest = getUrlInfo().test; const isTest = getUrlInfo().test;
export function getVisitorToken(){
let token = getToken();
const visitor_client = sessionStorage.getItem('visitor_client') === 'true';
if(visitor_client && (token === 'null' || !token)){ // 访客token 欢哥喊加的
token = '704d693b-cc68-49a7-8888-4acc73b5ca73';
}
return token;
}
export function getHeaders(url = '', headersApi = undefined) { export function getHeaders(url = '', headersApi = undefined) {
const token = getToken(); let token = getVisitorToken();
const currentInfo = getCurrentUser() || {}; const currentInfo = getCurrentUser() || {};
const user = getUserInfo() || {}; const user = getUserInfo() || {};
const userId = user.id || currentInfo.xgUserId; const userId = user.id || currentInfo.xgUserId;
...@@ -19,7 +29,6 @@ export function getHeaders(url = '', headersApi = undefined) { ...@@ -19,7 +29,6 @@ export function getHeaders(url = '', headersApi = undefined) {
if(url && typeof url === 'string' && url.indexOf('oauthPub=true') > -1){ // 公共接口不需要token if(url && typeof url === 'string' && url.indexOf('oauthPub=true') > -1){ // 公共接口不需要token
return res; return res;
} }
if (!token || token === 'null') { if (!token || token === 'null') {
return res; return res;
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论