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

一站式上次文件接口修改

上级 3af159c8
......@@ -27,6 +27,7 @@ import ReactQuill from 'react-quill';
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';
const RadioGroup = Radio.Group;
const Option = Select.Option;
......@@ -486,6 +487,12 @@ export default class FormArray extends Component {
accept={info.accept}
multiple={info.multiple}
{...defaultProps}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
defaultFileList={value[info.key]}
name="file"
onChange={({ fileList }) => {
......
......@@ -6,6 +6,7 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import config from '@/config/config';
import { connect } from 'dva';
import { exportExcel } from 'xlsx-oc';
import { getToken } from '@/utils/authority';
const Step = Steps.Step;
const TabPane = Tabs.TabPane;
......@@ -195,9 +196,12 @@ export default class ImportUtil extends React.PureComponent {
name: 'file',
action: config.sqlFormsServer + '/upload',
headers: {
authorization: 'authorization-text',
},
headers: {
Authorization: `bearer ${getToken()}`,
},
data: {
token: getToken(),
},
accept: '.xlsx',
showUploadList: false,
onChange: (info) => {
......
......@@ -27,6 +27,7 @@ import {
CompositeDecorator,
RichUtils,
} from 'draft-js';
import { getToken } from '@/webPublic/one_stop_public/utils/token';
const FormItem = Form.Item;
function getBlockStyle(block) {
......@@ -497,6 +498,12 @@ class AttrForm extends React.Component {
showUploadList={false}
name="file"
action={config.uploadUrl}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
onChangemultiple={false}
style={{ padding: 0 }}>
{url ? (
......@@ -584,6 +591,12 @@ class VideoForm extends React.Component {
showUploadList={false}
name="file"
action={config.uploadUrl}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
onChangemultiple={false}
style={{ padding: 0 }}>
{url ? (
......@@ -670,6 +683,12 @@ class PicForm extends React.Component {
name="file"
action={config.uploadUrl}
onChange={this.onChange}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
multiple={false}
style={{ padding: 0 }}>
{url ? (
......
......@@ -501,6 +501,12 @@ class AttrForm extends React.Component {
showUploadList={false}
name="file"
action={config.uploadUrl}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
onChangemultiple={false}
style={{ padding: 0 }}>
{url ? (
......@@ -589,6 +595,12 @@ class VideoForm extends React.Component {
name="file"
action={config.uploadUrl}
onChangemultiple={false}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
style={{ padding: 0 }}>
{url ? (
<video src={config.httpServer + url} controls="controls">
......@@ -674,6 +686,12 @@ class PicForm extends React.Component {
name="file"
action={config.uploadUrl}
onChange={this.onChange}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
multiple={false}
style={{ padding: 0 }}>
{url ? (
......
......@@ -266,9 +266,11 @@ export default class ImportUtil extends React.PureComponent {
const props = {
name: 'file',
action: config.uploadUrl,
headers: {
authorization: 'authorization-text',
Authorization: `bearer ${getToken()}`,
},
data: {
token: getToken(),
},
accept: '.xlsx',
showUploadList: false,
......
......@@ -124,6 +124,7 @@ export function requestFileInfo(url, datas) {
if (isJSON(res)) {
res = JSON.parse(res);
}
// console.log(res);
}
return res;
});
......
......@@ -2,6 +2,7 @@ import React from 'react';
import {Upload, message} from 'antd';
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';
export default class ImgUploadCom extends React.Component {
constructor(props) {
......@@ -55,6 +56,12 @@ export default class ImgUploadCom extends React.Component {
disabled={disabled}
accept={'image/*'}
url={url}
headers={{
Authorization: `bearer ${getToken()}`,
}}
data={{
token: getToken(),
}}
beforeUpload={(file) => {
return zipImage(file, 4);
// 图片压缩函数. 超过fileSizeLimitMb兆的图片 直接压缩成原来的 30% 如果后续有其他需求考虑 做成全局配置项 配置可以压缩的图片的范围
......
......@@ -6,6 +6,7 @@ import config from '@/webPublic/one_stop_public/config';
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';
message.config({
top: 300,
......@@ -174,6 +175,12 @@ class UploadCom extends React.Component {
name: 'file',
multiple: isMultiple,
accept: accept,
headers: {
Authorization: `bearer ${getToken()}`,
},
data: {
token: getToken(),
},
action: config.uploadUrl,
showUploadList: false,
onChange: this.changeUrl,
......
......@@ -5,6 +5,7 @@ import config from "@/webPublic/one_stop_public/config";
import styles from "./style.less";
import { checkIsImage } from "./UploadCom";
import Viewer from "react-viewer";
import { getToken } from '@/webPublic/one_stop_public/utils/token';
// 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样
......@@ -104,6 +105,12 @@ export default class UploadComDiyForQnZy extends React.Component {
showUploadList: false,
onChange: this.changeUrl,
beforeUpload: this.beforeUpload,
headers: {
Authorization: `bearer ${getToken()}`,
},
data: {
token: getToken(),
},
};
return (
......
......@@ -99,7 +99,6 @@ export default class VideoUploadCom extends React.Component {
render() {
const { json, disabled } = this.props;
const { url } = this.state;
console.log(url);
return (
<Upload.Dragger
disabled={disabled}
......@@ -109,6 +108,9 @@ export default class VideoUploadCom extends React.Component {
name="file"
action={configService + '/uploadFileApi/upload'}
onChange={this.changeUrl}
headers={{
Authorization: `bearer ${getToken()}`,
}}
multiple={false}
data={{
isConvert: true,
......
......@@ -362,9 +362,12 @@ export default class ImportUtil extends React.PureComponent {
const props = {
name: 'file',
action: getUploadUrl(),
headers: {
authorization: 'authorization-text',
},
headers: {
Authorization: `bearer ${getToken()}`,
},
data: {
token: getToken(),
},
accept: '.xlsx',
showUploadList: false,
onChange: (info) => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论