Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-easy-ui
Project
Project
Details
Activity
Releases
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
easyUI
hls-easy-ui
Commits
de34e915
Commit
de34e915
authored
Mar 02, 2021
by
nature
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file组件大小问题修复
parent
3830a1ea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
index.vue
packages/components/HFile/index.vue
+12
-7
fileTest.vue
src/pages/fileTest.vue
+8
-4
No files found.
packages/components/HFile/index.vue
View file @
de34e915
...
...
@@ -25,6 +25,7 @@
<
script
>
import
ShowPicturePlugin
from
'../ShowPicture/index'
import
{
toArray
,
readFile
,
isOversize
,
isImageDataUrl
}
from
'./utils'
import
{
isFunction
}
from
'../../common/utils'
import
axios
from
'axios'
export
default
{
...
...
@@ -153,7 +154,7 @@ export default {
onAfterRead
(
files
,
oversizeFiles
)
{
if
(
oversizeFiles
.
length
)
{
this
.
$emit
(
'oversize'
,
toArray
(
oversizeFiles
))
files
=
files
.
filter
(
file
=>
file
.
size
<=
this
.
maxSize
)
files
=
files
.
filter
(
item
=>
item
.
file
.
size
<=
this
.
maxSize
)
// return
}
this
.
resetInput
()
...
...
@@ -170,29 +171,33 @@ export default {
onUploadFile
()
{
let
vm
=
this
if
(
this
.
upload
)
{
if
(
vm
.
uploadConfig
)
{
if
(
vm
.
uploadConfig
&&
vm
.
uploadFiles
.
length
)
{
let
itemFile
=
vm
.
uploadFiles
.
pop
()
let
url
=
vm
.
uploadConfig
.
uploadUrl
let
uploadParams
=
vm
.
uploadConfig
.
params
let
uploadSuccess
=
vm
.
uploadConfig
.
uploadSuccess
let
uploadHeader
=
vm
.
uploadConfig
.
headers
||
{}
let
param
=
new
FormData
()
for
(
let
key
in
uploadParams
)
{
param
.
append
(
key
,
uploadParams
[
key
])
}
param
.
append
(
'fileName'
,
itemFile
.
file
.
name
)
param
.
append
(
'file'
,
itemFile
.
file
)
axios
.
post
(
url
,
param
,
{
headers
:
{
let
headers
=
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
'Authorization'
:
'Bearer '
+
window
.
localStorage
.
access_token
,
},
}
headers
=
Object
.
assign
(
headers
,
uploadHeader
)
debugger
axios
.
post
(
url
,
param
,
{
headers
:
headers
,
}).
then
(
function
(
result
)
{
/* vm.fileReadList.forEach((itemFile, index) => {
if (result.response && itemFile.file && !itemFile.attachment_id && result.response.fileName === itemFile.file.name) {
itemFile.attachment_id = result.response.attachment_id
}
}) */
if
(
uploadSuccess
)
{
if
(
isFunction
(
uploadSuccess
)
)
{
uploadSuccess
(
itemFile
,
result
)
}
if
(
vm
.
uploadFiles
.
length
>
0
)
{
...
...
src/pages/fileTest.vue
View file @
de34e915
...
...
@@ -19,17 +19,17 @@
@
upload=
"uploaded"
@
delete=
"deletePic"
@
oversize=
"oversize"
>
<div
class=
"file-chose"
>
<
!--
<
div
class=
"file-chose"
>
文件上传
<i
class=
"icon ion-ios-cloud-upload"
/>
</div>
</div>
-->
</h-file>
<list-item>
<
!--
<
list-item>
<item>
<div
slot=
"name"
>
融资额
</div>
<currency-input
slot=
"content"
v-model=
"money"
/>
<div
slot=
"right-icon"
>
¥
</div>
</item>
</list-item>
</list-item>
-->
</h-content>
</h-view>
</
template
>
...
...
@@ -56,6 +56,10 @@ export default {
source_type
:
'HLS_DOC_FILE_TEMPLET'
,
pkvalue
:
42
,
},
headers
:
{
'Content-Type'
:
'application/json'
,
'Authorization'
:
'12312'
,
},
uploadSuccess
:
this
.
fileSuccess
,
// 上传成功后的回调函数 用于给文件添加服务端唯一标示或其他
},
money
:
2100.98
,
...
...
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