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

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

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