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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
40 deletions
utils/util.js
utils/util.js
View file @
b41ec423
...
...
@@ -51,9 +51,9 @@ const getData = (url, type, param, callBack, loading, isheader) => {
wx
.
hideNavigationBarLoading
();
if
(
loading
)
{
wx
.
hideLoading
();
}
if
(
loading
)
{
wx
.
hideLoading
();
}
},
fail
:
(
err
)
=>
{
...
...
@@ -65,53 +65,56 @@ const getData = (url, type, param, callBack, loading, isheader) => {
wx
.
hideNavigationBarLoading
();
if
(
loading
)
{
wx
.
hideLoading
();
}
if
(
loading
)
{
wx
.
hideLoading
();
}
}
})
};
//上传文件
const
uploadFile
=
(
url
,
paths
,
callBack
)
=>
{
wx
.
showLoading
({
title
:
'上传中'
,
mask
:
true
})
const
uploadFile
=
(
url
,
paths
,
callBack
)
=>
{
wx
.
showLoading
({
title
:
'上传中'
,
mask
:
true
})
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
wx
.
uploadFile
({
url
:
url
,
url
:
url
,
filePath
:
paths
[
i
],
name
:
'upload'
,
formData
:
{
token
:
wx
.
getStorageSync
(
'access_token'
),
source
:
2
},
header
:
{
"Content-Type"
:
"multipart/form-data"
},
formData
:
{
token
:
wx
.
getStorageSync
(
'access_token'
),
source
:
2
},
header
:
{
"Content-Type"
:
"multipart/form-data"
},
success
:
(
res
)
=>
{
var
data
=
JSON
.
parse
(
res
.
data
);
if
(
data
.
errcode
==
103200
)
{
wx
.
showToast
({
title
:
'上传成功'
,
icon
:
'none'
,
duration
:
2000
});
callBack
(
data
.
data
[
0
])
var
data
=
JSON
.
parse
(
res
.
data
);
if
(
data
.
errcode
==
103200
)
{
wx
.
showToast
({
title
:
'上传成功'
,
icon
:
'none'
,
duration
:
2000
});
callBack
(
data
.
data
[
0
])
}
else
{
wx
.
showToast
({
title
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
});
wx
.
showToast
({
title
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
});
}
},
fail
:
(
e
)
=>
{
console
.
log
(
e
)
wx
.
showToast
({
title
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
});
console
.
log
(
e
)
wx
.
showToast
({
title
:
'上传失败'
,
icon
:
'none'
,
duration
:
2000
});
},
complete
:
()
=>
{
wx
.
hideLoading
();
...
...
@@ -120,14 +123,14 @@ const uploadFile = (url,paths,callBack) => {
}
};
const
chooseImg
=
(
url
,
num
,
callback
)
=>
{
const
chooseImg
=
(
url
,
num
,
callback
)
=>
{
wx
.
chooseImage
({
count
:
num
,
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
'album'
,
'camera'
],
success
:
(
res
)
=>
{
uploadFile
(
url
,
res
.
tempFilePaths
,
(
rtn
)
=>
{
callback
(
rtn
)
uploadFile
(
url
,
res
.
tempFilePaths
,
(
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