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

一站式上次文件接口修改

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