Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
ae8a8eef
Commit
ae8a8eef
authored
Jun 21, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 上传token 问题
parent
defe2f20
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
UploadFiles.less
src/components/UploadFiles/UploadFiles.less
+4
-0
UploadFiles.tsx
src/components/UploadFiles/UploadFiles.tsx
+4
-2
index.tsx
src/pages/balance/components/UploadPayVoucher/index.tsx
+3
-1
UploadFile.tsx
src/pages/handling/components/UploadFile/UploadFile.tsx
+3
-1
No files found.
src/components/UploadFiles/UploadFiles.less
View file @
ae8a8eef
...
...
@@ -39,6 +39,10 @@
margin-right: @margin-sm;
}
.error {
color: '#ff4d4f';
}
> a {
flex: 1;
.textOverflow();
...
...
src/components/UploadFiles/UploadFiles.tsx
View file @
ae8a8eef
...
...
@@ -6,6 +6,7 @@ import { Upload, Progress, Button } from 'antd';
import
{
CloudUploadOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
import
styles
from
'./UploadFiles.less'
;
import
pdf_icon
from
'@/assets/imgs/pdf_icon.png'
;
import
{
getAuth
}
from
'@/utils/auth'
;
type
PickProps
=
"headers"
|
"action"
|
"accept"
|
"beforeUpload"
|
"onChange"
|
"fileList"
...
...
@@ -35,6 +36,7 @@ const UploadFiles: React.FC<PickUploadProps> = (props: PickUploadProps) => {
fileContainerClassName
}
=
props
;
const
hasFileListProps
=
"fileList"
in
props
;
const
auth
=
getAuth
();
const
[
files
,
setFiles
]
=
useState
<
UploadFile
[]
>
(()
=>
props
.
fileList
||
[]);
// const renderFiles = hasFileListProps ? props.fileList : files;
useEffect
(()
=>
{
...
...
@@ -53,7 +55,7 @@ const UploadFiles: React.FC<PickUploadProps> = (props: PickUploadProps) => {
fileList
:
files
,
accept
:
accept
,
action
:
action
,
headers
:
headers
,
headers
:
{
...
headers
,
token
:
auth
.
token
}
,
data
:
{
fileType
:
UPLOAD_TYPE
},
...
...
@@ -102,7 +104,7 @@ const UploadFiles: React.FC<PickUploadProps> = (props: PickUploadProps) => {
<
div
className=
{
styles
.
renderFileItem
}
>
<
div
className=
{
styles
[
'fileItem-left'
]
}
>
<
img
className=
{
styles
.
img
}
src=
{
pdf_icon
}
/>
<
a
href=
{
_item
.
url
}
target=
"_blank"
>
{
_item
.
name
}
</
a
>
<
a
className=
{
cx
({[
styles
.
error
]:
_item
.
status
===
'error'
})
}
href=
{
_item
.
url
}
target=
"_blank"
>
{
_item
.
name
}
</
a
>
</
div
>
{
!
disable
&&
(
...
...
src/pages/balance/components/UploadPayVoucher/index.tsx
View file @
ae8a8eef
...
...
@@ -13,6 +13,7 @@ import { UploadFile, UploadChangeParam } from 'antd/lib/upload/interface';
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
{
VoucherFileProps
}
from
'../../common/type'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
getAuth
}
from
'@/utils/auth'
;
interface
Iprops
{
fileList
?:
VoucherFileProps
[],
...
...
@@ -31,6 +32,7 @@ const UploadPayVoucher: React.FC<Iprops> = (props) => {
const
[
fileList
,
setFileList
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
accountInfo
,
setAccountInfo
]
=
useState
<
AccountInfo
>
(
null
)
const
auth
=
getAuth
();
// 进来设置fileList
// useEffect(() => {
...
...
@@ -70,7 +72,7 @@ const UploadPayVoucher: React.FC<Iprops> = (props) => {
const
uploadProps
=
{
name
:
'file'
,
action
:
'/api/file/file/upload'
,
headers
:
{},
headers
:
{
token
:
auth
.
token
},
data
:
{
fileType
:
UPLOAD_TYPE
,
// 指定类型是本地还是线上,
},
...
...
src/pages/handling/components/UploadFile/UploadFile.tsx
View file @
ae8a8eef
...
...
@@ -4,10 +4,12 @@ import { Upload, Button, message } from 'antd';
import
{
UploadOutlined
}
from
'@ant-design/icons'
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
FileListItem
from
'./FileList'
;
import
{
getAuth
}
from
'@/utils/auth'
;
const
UploadFile
=
(
props
)
=>
{
const
{
fileList
=
[],
onChange
,
fileMaxSize
=
20
}
=
props
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
)
const
auth
=
getAuth
();
const
beforeUpload
=
(
file
)
=>
{
const
isSizeLimit
=
file
.
size
/
1024
<
fileMaxSize
;
if
(
!
isSizeLimit
)
{
...
...
@@ -19,7 +21,7 @@ const UploadFile = (props) => {
const
uploadProps
=
{
name
:
'file'
,
action
:
'/api/file/file/upload'
,
headers
:
{},
headers
:
{
token
:
auth
.
token
},
data
:
{
fileType
:
UPLOAD_TYPE
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment