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

张新说的 云上贵州项目 学工的接口headers里面要加 sysCode

上级 9aa5b066
...@@ -28,6 +28,7 @@ import baseConfig from '@/config/config'; ...@@ -28,6 +28,7 @@ import baseConfig from '@/config/config';
import 'react-quill/dist/quill.snow.css'; import 'react-quill/dist/quill.snow.css';
import ButtonUpload from './ButtonUpload'; import ButtonUpload from './ButtonUpload';
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const Option = Select.Option; const Option = Select.Option;
...@@ -489,6 +490,7 @@ export default class FormArray extends Component { ...@@ -489,6 +490,7 @@ export default class FormArray extends Component {
{...defaultProps} {...defaultProps}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
data={{ data={{
token: getToken(), token: getToken(),
......
...@@ -7,6 +7,7 @@ import config from '@/config/config'; ...@@ -7,6 +7,7 @@ import config from '@/config/config';
import { connect } from 'dva'; import { connect } from 'dva';
// import { exportExcel } from 'xlsx-oc'; // import { exportExcel } from 'xlsx-oc';
import { getToken } from '@/utils/authority'; import { getToken } from '@/utils/authority';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const Step = Steps.Step; const Step = Steps.Step;
const TabPane = Tabs.TabPane; const TabPane = Tabs.TabPane;
...@@ -204,6 +205,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -204,6 +205,7 @@ export default class ImportUtil extends React.PureComponent {
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}, },
data: { data: {
token: getToken(), token: getToken(),
......
export function isJSON(str) { export function isJSON(str) {
if (typeof str == 'string') { if (typeof str == 'string') {
try { try {
JSON.parse(str); JSON.parse(str);
if (typeof JSON.parse(str) === 'number') { if (typeof JSON.parse(str) === 'number') {
return false; return false;
} }
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
} }
} }
} }
export const getSysCode = () => {
return getYunShangGuiZhouSyStemConfig().code;
};
// 查询系统配置 // 查询系统配置
export const getYunShangGuiZhouSyStemConfig = () => { export const getYunShangGuiZhouSyStemConfig = () => {
const localStorageData = localStorage.getItem('antd-pro-systemConfig'); const localStorageData = localStorage.getItem('antd-pro-systemConfig');
if (localStorageData && isJSON(localStorageData)) { if (localStorageData && isJSON(localStorageData)) {
let d = JSON.parse(localStorageData); let d = JSON.parse(localStorageData);
return { return {
sysCode: d.code, sysCode: d.code,
logo: '', logo: '',
name: d.name, name: d.name,
siteId: '5', siteId: '5',
siteUrl: '', siteUrl: '',
}; };
} } else {
return {
sysCode: undefined,
name: '',
};
}
}; };
...@@ -29,6 +29,7 @@ import { ...@@ -29,6 +29,7 @@ import {
} from 'draft-js'; } from 'draft-js';
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const FormItem = Form.Item; const FormItem = Form.Item;
function getBlockStyle(block) { function getBlockStyle(block) {
...@@ -501,6 +502,7 @@ class AttrForm extends React.Component { ...@@ -501,6 +502,7 @@ class AttrForm extends React.Component {
action={config.uploadUrl} action={config.uploadUrl}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
data={{ data={{
token: getToken(), token: getToken(),
...@@ -594,6 +596,7 @@ class VideoForm extends React.Component { ...@@ -594,6 +596,7 @@ class VideoForm extends React.Component {
action={config.uploadUrl} action={config.uploadUrl}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
data={{ data={{
token: getToken(), token: getToken(),
...@@ -686,6 +689,7 @@ class PicForm extends React.Component { ...@@ -686,6 +689,7 @@ class PicForm extends React.Component {
onChange={this.onChange} onChange={this.onChange}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
data={{ data={{
token: getToken(), token: getToken(),
......
...@@ -28,6 +28,7 @@ import { ...@@ -28,6 +28,7 @@ import {
RichUtils, RichUtils,
} from 'draft-js'; } from 'draft-js';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const FormItem = Form.Item; const FormItem = Form.Item;
function getBlockStyle(block) { function getBlockStyle(block) {
...@@ -504,6 +505,7 @@ class AttrForm extends React.Component { ...@@ -504,6 +505,7 @@ class AttrForm extends React.Component {
action={config.uploadUrl} action={config.uploadUrl}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
data={{ data={{
token: getToken(), token: getToken(),
...@@ -598,6 +600,7 @@ class VideoForm extends React.Component { ...@@ -598,6 +600,7 @@ class VideoForm extends React.Component {
onChangemultiple={false} onChangemultiple={false}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
data={{ data={{
token: getToken(), token: getToken(),
...@@ -689,6 +692,7 @@ class PicForm extends React.Component { ...@@ -689,6 +692,7 @@ class PicForm extends React.Component {
onChange={this.onChange} onChange={this.onChange}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
data={{ data={{
token: getToken(), token: getToken(),
......
...@@ -10,6 +10,7 @@ import { getMessage, getModal } from '@/webPublic/one_stop_public/utils/utils'; ...@@ -10,6 +10,7 @@ import { getMessage, getModal } from '@/webPublic/one_stop_public/utils/utils';
import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16'; import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform'; import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
import ProgressDiy from './ProgressDiy'; import ProgressDiy from './ProgressDiy';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const Modal = getModal(); const Modal = getModal();
const message = getMessage(); const message = getMessage();
...@@ -297,6 +298,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -297,6 +298,7 @@ export default class ImportUtil extends React.PureComponent {
action: config.uploadUrl, action: config.uploadUrl,
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}, },
data: { data: {
token: getToken(), token: getToken(),
......
...@@ -6,6 +6,7 @@ import { getToken } from '@/webPublic/one_stop_public/utils/token'; ...@@ -6,6 +6,7 @@ import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { deepCopy } from '@/webPublic/zyd_public/utils/utils'; import { deepCopy } from '@/webPublic/zyd_public/utils/utils';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform'; import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
import moment from 'moment'; import moment from 'moment';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const apiUrl = queryOauthActionPath(); const apiUrl = queryOauthActionPath();
const exportStyles = { const exportStyles = {
...@@ -376,9 +377,9 @@ export function getColumnsSqlKeyRealize({ ...@@ -376,9 +377,9 @@ export function getColumnsSqlKeyRealize({
* @param {sqlKey,columnsList,columnsMerges,columnsKey,styles,fileName,ext,allValues} param * @param {sqlKey,columnsList,columnsMerges,columnsKey,styles,fileName,ext,allValues} param
* 自定义表头和sql数据导出(表头合并表格,数据不合并表格) * 自定义表头和sql数据导出(表头合并表格,数据不合并表格)
* sqlKey : 数据sql编码 * sqlKey : 数据sql编码
* columnsList * columnsList
* columnsMerges * columnsMerges
* columnsKey * columnsKey
* styles : 导出excl样式 * styles : 导出excl样式
* fileName : 导出文件名 * fileName : 导出文件名
* ext : 导出后缀 目前xecl、dbf * ext : 导出后缀 目前xecl、dbf
...@@ -587,7 +588,7 @@ export function getCustomDataRealize({ ...@@ -587,7 +588,7 @@ export function getCustomDataRealize({
* ext : 导出后缀 目前xecl、dbf * ext : 导出后缀 目前xecl、dbf
* url : 接口地址 * url : 接口地址
* eliminateRow : 列需要忽略合并的数据 * eliminateRow : 列需要忽略合并的数据
* eliminateCol : 行需要忽略合并的数据 * eliminateCol : 行需要忽略合并的数据
* mergeMappingRow : *映射mergeKey 纵向合并结果,key必须在mergeKey数组里面,value不可以在mergeKey里。 * mergeMappingRow : *映射mergeKey 纵向合并结果,key必须在mergeKey数组里面,value不可以在mergeKey里。
* mergePrimary : 所有合并都会在当前mergePrimary 的范围下合并 * mergePrimary : 所有合并都会在当前mergePrimary 的范围下合并
* *
...@@ -1204,6 +1205,7 @@ export async function downloadFile(url, params, fileName = '导出文件', ext = ...@@ -1204,6 +1205,7 @@ export async function downloadFile(url, params, fileName = '导出文件', ext =
const { transformApi, headersApi } = await getTransformApi(url); const { transformApi, headersApi } = await getTransformApi(url);
let headers = { let headers = {
Authorization: `bearer ${localStorage.getItem('antd-pro-token-onestop')}`, Authorization: `bearer ${localStorage.getItem('antd-pro-token-onestop')}`,
sysCode: getSysCode(),
}; };
// if(headersApi){ // if(headersApi){
// headers.apis = headersApi; // headers.apis = headersApi;
...@@ -1247,6 +1249,7 @@ export async function downloadFileAndShowModal(url, params, fileName = '导出 ...@@ -1247,6 +1249,7 @@ export async function downloadFileAndShowModal(url, params, fileName = '导出
const { transformApi, headersApi } = await getTransformApi(url); const { transformApi, headersApi } = await getTransformApi(url);
let headers = { let headers = {
Authorization: `bearer ${localStorage.getItem('antd-pro-token-onestop')}`, Authorization: `bearer ${localStorage.getItem('antd-pro-token-onestop')}`,
sysCode: getSysCode(),
}; };
// if(headersApi){ // if(headersApi){
// headers.apis = headersApi; // headers.apis = headersApi;
......
...@@ -4,6 +4,7 @@ import config from '@/webPublic/one_stop_public/config'; ...@@ -4,6 +4,7 @@ import config from '@/webPublic/one_stop_public/config';
import { zipImage } from '@/webPublic/zyd_public/utils/handlePhoto'; import { zipImage } from '@/webPublic/zyd_public/utils/handlePhoto';
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryFileUrl } from '@/webPublic/one_stop_public/utils/queryConfig';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
export default class ImgUploadCom extends React.Component { export default class ImgUploadCom extends React.Component {
constructor(props) { constructor(props) {
...@@ -92,7 +93,8 @@ export default class ImgUploadCom extends React.Component { ...@@ -92,7 +93,8 @@ export default class ImgUploadCom extends React.Component {
url={url} url={url}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
}} sysCode: getSysCode(),
}}
data={{ data={{
token: getToken(), token: getToken(),
}} }}
......
...@@ -3,6 +3,7 @@ import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/ut ...@@ -3,6 +3,7 @@ import { queryApiActionPath, queryFileUrl } from '@/webPublic/one_stop_public/ut
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { isFromIframe } from '@/webPublic/one_stop_public/utils/utils'; import { isFromIframe } from '@/webPublic/one_stop_public/utils/utils';
import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUploadUrl'; import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUploadUrl';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const oneSetItemP = { const oneSetItemP = {
...@@ -142,6 +143,7 @@ export const uploadFile = (file) => { ...@@ -142,6 +143,7 @@ export const uploadFile = (file) => {
headers: { headers: {
Accept: '*/*', Accept: '*/*',
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}, },
body: formData, body: formData,
}) })
......
...@@ -7,6 +7,7 @@ import styles from './style.less'; ...@@ -7,6 +7,7 @@ import styles from './style.less';
import UploadComDiyForQnZy from '@/webPublic/one_stop_public/libs/UploadComDiyForQnZy'; import UploadComDiyForQnZy from '@/webPublic/one_stop_public/libs/UploadComDiyForQnZy';
import Viewer from 'react-viewer'; import Viewer from 'react-viewer';
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
message.config({ message.config({
top: 300, top: 300,
...@@ -175,6 +176,7 @@ class UploadCom extends React.Component { ...@@ -175,6 +176,7 @@ class UploadCom extends React.Component {
accept: accept, accept: accept,
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}, },
data: { data: {
token: getToken(), token: getToken(),
......
...@@ -7,6 +7,7 @@ import { checkIsImage } from "./UploadCom"; ...@@ -7,6 +7,7 @@ import { checkIsImage } from "./UploadCom";
import Viewer from "react-viewer"; import Viewer from "react-viewer";
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils'; import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
// 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样 // 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样
...@@ -109,6 +110,7 @@ export default class UploadComDiyForQnZy extends React.Component { ...@@ -109,6 +110,7 @@ export default class UploadComDiyForQnZy extends React.Component {
beforeUpload: this.beforeUpload, beforeUpload: this.beforeUpload,
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}, },
data: { data: {
token: getToken(), token: getToken(),
......
...@@ -4,6 +4,7 @@ import queryConfig from './queryConfig'; ...@@ -4,6 +4,7 @@ import queryConfig from './queryConfig';
import { Upload, message } from 'antd'; import { Upload, message } from 'antd';
import { isJSON } from '@/webPublic/one_stop_public/copy'; import { isJSON } from '@/webPublic/one_stop_public/copy';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const getToken = () => { const getToken = () => {
const x = localStorage.getItem('uploadVideoServiceToken'); const x = localStorage.getItem('uploadVideoServiceToken');
...@@ -110,6 +111,7 @@ export default class VideoUploadCom extends React.Component { ...@@ -110,6 +111,7 @@ export default class VideoUploadCom extends React.Component {
onChange={this.changeUrl} onChange={this.changeUrl}
headers={{ headers={{
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}} }}
multiple={false} multiple={false}
data={{ data={{
......
...@@ -4,6 +4,7 @@ import config from "@/config/config"; ...@@ -4,6 +4,7 @@ import config from "@/config/config";
import { formatMessage } from "umi/locale"; import { formatMessage } from "umi/locale";
import { getSysConfig } from "../utils/basiclayout"; import { getSysConfig } from "../utils/basiclayout";
import { isJSON } from "@/webPublic/zyd_public/utils/utils"; import { isJSON } from "@/webPublic/zyd_public/utils/utils";
import { getYunShangGuiZhouSyStemConfig } from '@/webPublic/one_stop_public/2023yunshangguizhou/utils';
const query = { const query = {
"screen-xs": { "screen-xs": {
...@@ -30,19 +31,7 @@ const query = { ...@@ -30,19 +31,7 @@ const query = {
} }
}; };
const getYunShangGuiZhouSyStemConfig = () => {
const localStorageData = localStorage.getItem('antd-pro-systemConfig');
if(localStorageData && isJSON(localStorageData)){
let d = JSON.parse(localStorageData);
return {
sysCode: d.code,
logo: '',
name: d.name,
siteId: '5',
siteUrl: '',
};
}
};
const getSystemConfig = () => { const getSystemConfig = () => {
const urlParams = new URL(window.location.href); const urlParams = new URL(window.location.href);
......
...@@ -15,6 +15,7 @@ import styles from './Ability.css'; ...@@ -15,6 +15,7 @@ import styles from './Ability.css';
import FormdataWrapper from '@/utils/object-to-formdata-custom'; import FormdataWrapper from '@/utils/object-to-formdata-custom';
import moment from 'moment'; import moment from 'moment';
import { controlNotification } from '@/baseComponent/utils'; import { controlNotification } from '@/baseComponent/utils';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const Option = Select.Option; const Option = Select.Option;
const nameSpan = { const nameSpan = {
...@@ -424,6 +425,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -424,6 +425,7 @@ export default class StatisticsInfo extends React.Component {
body: FormdataWrapper(params), body: FormdataWrapper(params),
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}, },
}) })
.then((res) => { .then((res) => {
......
import request from '@/utils/request'; import request from '@/utils/request';
import config, { getUploadUrl } from '@/config/config'; import config, { getUploadUrl } from '@/config/config';
import { getToken } from '@/utils/authority'; import { getToken } from '@/utils/authority';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const uploadUrl = getUploadUrl(); const uploadUrl = getUploadUrl();
...@@ -9,6 +10,7 @@ export default function uploadFile(params) { ...@@ -9,6 +10,7 @@ export default function uploadFile(params) {
method: 'POST', method: 'POST',
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
sysCode: getSysCode(),
}, },
body: params, body: params,
}); });
......
...@@ -7,6 +7,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy'; ...@@ -7,6 +7,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import { getUploadUrl } from '@/config/config'; import { getUploadUrl } from '@/config/config';
import { Row, Col } from 'antd'; import { Row, Col } from 'antd';
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getSysCode } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
const Step = Steps.Step; const Step = Steps.Step;
...@@ -378,7 +379,8 @@ export default class ImportUtil extends React.PureComponent { ...@@ -378,7 +379,8 @@ export default class ImportUtil extends React.PureComponent {
action: getUploadUrl(), action: getUploadUrl(),
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
}, sysCode: getSysCode(),
},
data: { data: {
token: getToken(), token: getToken(),
}, },
......
import { getCurrentUser, getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import gg5xxxxx from 'js-md5'; import {
getSysCode,
} from '@/webPublic/one_stop_public/2023yunshangguizhou/utils';
import { getIsBei_Dian } from '@/webPublic/zyd_public/utils/utils'; import { getIsBei_Dian } from '@/webPublic/zyd_public/utils/utils';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils'; import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
const isTest = getUrlInfo().test; export function getVisitorToken() {
let token = getToken();
export function getVisitorToken(){ const visitor_client =
let token = getToken(); sessionStorage.getItem('visitor_client') === 'true' || !!getUrlInfo().visitor;
const visitor_client = sessionStorage.getItem('visitor_client') === 'true' || !!getUrlInfo().visitor; if (visitor_client && (token === 'null' || !token)) {
if(visitor_client && (token === 'null' || !token)){ // 访客token 欢哥喊加的 // 访客token 欢哥喊加的
token = '704d693b-cc68-49a7-8888-4acc73b5ca73'; token = '704d693b-cc68-49a7-8888-4acc73b5ca73';
} }
return token; return token;
} }
export function getHeaders(url = '', headersApi = undefined) {
let token = getVisitorToken();
const res = {
headers: {
sysCode: getSysCode(),
},
};
if (process.env.NODE_ENV === 'development' && getIsBei_Dian()) {
res.headers.env = 'test';
}
if (url && typeof url === 'string' && url.indexOf('oauthPub=true') > -1) {
// 公共接口不需要token
return res;
}
if (!token || token === 'null') {
return res;
} else {
res.headers.Authorization = `bearer ${token}`; // 这个必须要带上
}
export function getHeaders(url = '', headersApi = undefined) { return res;
let token = getVisitorToken();
// const currentInfo = getCurrentUser() || {};
// const user = getUserInfo() || {};
// const userId = user.id || currentInfo.xgUserId;
// const timestamp = user.differenceBetweenServerAndClientTime ? new Date().getTime() + user.differenceBetweenServerAndClientTime : new Date().getTime();
// const secretString = token + userId + timestamp;
const res = {
headers: {},
};
if(process.env.NODE_ENV === 'development' && getIsBei_Dian()){
res.headers.env = 'test';
}
if(url && typeof url === 'string' && url.indexOf('oauthPub=true') > -1){ // 公共接口不需要token
return res;
}
if (!token || token === 'null') {
return res;
} else {
res.headers.Authorization = `bearer ${token}`; // 这个必须要带上
}
return res;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论