Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsalesProgram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b41ec423
authored
Jul 30, 2019
by
梁建民
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
格式化
parent
c3026ab2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
utils/util.js
utils/util.js
View file @
b41ec423
...
@@ -74,17 +74,20 @@ const getData = (url, type, param, callBack, loading, isheader) => {
...
@@ -74,17 +74,20 @@ const getData = (url, type, param, callBack, loading, isheader) => {
};
};
//上传文件
//上传文件
const
uploadFile
=
(
url
,
paths
,
callBack
)
=>
{
const
uploadFile
=
(
url
,
paths
,
callBack
)
=>
{
wx
.
showLoading
({
wx
.
showLoading
({
title
:
'上传中'
,
title
:
'上传中'
,
mask
:
true
mask
:
true
})
})
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
wx
.
uploadFile
({
wx
.
uploadFile
({
url
:
url
,
url
:
url
,
filePath
:
paths
[
i
],
filePath
:
paths
[
i
],
name
:
'upload'
,
name
:
'upload'
,
formData
:
{
token
:
wx
.
getStorageSync
(
'access_token'
),
source
:
2
},
formData
:
{
token
:
wx
.
getStorageSync
(
'access_token'
),
source
:
2
},
header
:
{
header
:
{
"Content-Type"
:
"multipart/form-data"
"Content-Type"
:
"multipart/form-data"
},
},
...
@@ -120,13 +123,13 @@ const uploadFile = (url,paths,callBack) => {
...
@@ -120,13 +123,13 @@ const uploadFile = (url,paths,callBack) => {
}
}
};
};
const
chooseImg
=
(
url
,
num
,
callback
)
=>
{
const
chooseImg
=
(
url
,
num
,
callback
)
=>
{
wx
.
chooseImage
({
wx
.
chooseImage
({
count
:
num
,
count
:
num
,
sizeType
:
[
'original'
,
'compressed'
],
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
uploadFile
(
url
,
res
.
tempFilePaths
,
(
rtn
)
=>
{
uploadFile
(
url
,
res
.
tempFilePaths
,
(
rtn
)
=>
{
callback
(
rtn
)
callback
(
rtn
)
})
})
}
}
...
...
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