Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uview-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李晖
uview-ui
Commits
1043b6a9
Unverified
Commit
1043b6a9
authored
Jun 09, 2020
by
YanxinNet
Committed by
GitHub
Jun 09, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #53 from 2460392754/master
fix: upload组件修改文件上传后判断的状态码
parents
40604f61
06b436b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
u-toast.vue
uview-ui/components/u-toast/u-toast.vue
+3
-3
u-upload.vue
uview-ui/components/u-upload/u-upload.vue
+1
-1
index.js
uview-ui/libs/request/index.js
+4
-4
No files found.
uview-ui/components/u-toast/u-toast.vue
View file @
1043b6a9
<
template
>
<
template
>
<view
class=
"u-toast"
:class=
"[isShow ? 'u-show' : '', 'u-type-' + config.type, 'u-position-' + config.position]"
:style=
"
{
<view
class=
"u-toast"
:class=
"[isShow ? 'u-show' : '', 'u-type-' + config.type, 'u-position-' + config.position]"
:style=
"
{
padding: isShow ? '0 40rpx' : 0,
zIndex: uZIndex
zIndex: uZIndex
}">
}">
<view
class=
"u-icon-wrap"
>
<view
class=
"u-icon-wrap"
>
...
@@ -54,7 +53,7 @@
...
@@ -54,7 +53,7 @@
},
},
uZIndex
()
{
uZIndex
()
{
// 显示toast时候,如果用户有传递z-index值,有限使用
// 显示toast时候,如果用户有传递z-index值,有限使用
return
this
.
isShow
?
(
this
.
zIndex
?
this
.
zIndex
:
this
.
$u
.
zIndex
.
toast
)
:
'
-1
'
;
return
this
.
isShow
?
(
this
.
zIndex
?
this
.
zIndex
:
this
.
$u
.
zIndex
.
toast
)
:
'
999999
'
;
}
}
},
},
methods
:
{
methods
:
{
...
@@ -136,11 +135,12 @@
...
@@ -136,11 +135,12 @@
justify-content
:
center
;
justify-content
:
center
;
font-size
:
28rpx
;
font-size
:
28rpx
;
opacity
:
0
;
opacity
:
0
;
pointer-events
:
none
;
padding
:
0
40rpx
;
}
}
.u-toast.u-show
{
.u-toast.u-show
{
opacity
:
1
;
opacity
:
1
;
z-index
:
9999999
;
}
}
.u-text
{
.u-text
{
...
...
uview-ui/components/u-upload/u-upload.vue
View file @
1043b6a9
...
@@ -334,7 +334,7 @@
...
@@ -334,7 +334,7 @@
formData
:
this
.
formData
,
formData
:
this
.
formData
,
header
:
this
.
header
,
header
:
this
.
header
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
if
(
res
.
statusCode
!=
200
)
{
if
(
!
[
200
,
201
].
includes
(
res
.
statusCode
)
)
{
this
.
uploadError
(
index
,
res
.
data
);
this
.
uploadError
(
index
,
res
.
data
);
}
else
{
}
else
{
// 上传成功
// 上传成功
...
...
uview-ui/libs/request/index.js
View file @
1043b6a9
...
@@ -12,7 +12,7 @@ class Request {
...
@@ -12,7 +12,7 @@ class Request {
// 检查请求拦截
// 检查请求拦截
if
(
this
.
interceptor
.
request
&&
typeof
this
.
interceptor
.
request
===
'
function
'
)
{
if
(
this
.
interceptor
.
request
&&
typeof
this
.
interceptor
.
request
===
'
function
'
)
{
let
tmpConfig
=
{};
let
tmpConfig
=
{};
let
interceptorReuest
=
this
.
interceptor
.
request
(
options
);
let
interceptorReuest
=
await
this
.
interceptor
.
request
(
options
);
if
(
interceptorReuest
===
false
)
{
if
(
interceptorReuest
===
false
)
{
return
false
;
return
false
;
}
}
...
@@ -27,7 +27,7 @@ class Request {
...
@@ -27,7 +27,7 @@ class Request {
options
.
method
=
options
.
method
||
this
.
config
.
method
;
options
.
method
=
options
.
method
||
this
.
config
.
method
;
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
options
.
complete
=
(
response
)
=>
{
options
.
complete
=
async
(
response
)
=>
{
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
uni
.
hideLoading
();
uni
.
hideLoading
();
// 清除定时器,如果请求回来了,就无需loading
// 清除定时器,如果请求回来了,就无需loading
...
@@ -36,7 +36,7 @@ class Request {
...
@@ -36,7 +36,7 @@ class Request {
if
(
this
.
config
.
originalData
)
{
if
(
this
.
config
.
originalData
)
{
// 判断是否存在拦截器
// 判断是否存在拦截器
if
(
this
.
interceptor
.
response
&&
typeof
this
.
interceptor
.
response
===
'
function
'
)
{
if
(
this
.
interceptor
.
response
&&
typeof
this
.
interceptor
.
response
===
'
function
'
)
{
let
resInterceptors
=
this
.
interceptor
.
response
(
response
);
let
resInterceptors
=
await
this
.
interceptor
.
response
(
response
);
// 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
// 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
if
(
resInterceptors
!==
false
)
{
if
(
resInterceptors
!==
false
)
{
resolve
(
resInterceptors
);
resolve
(
resInterceptors
);
...
@@ -51,7 +51,7 @@ class Request {
...
@@ -51,7 +51,7 @@ class Request {
}
else
{
}
else
{
if
(
response
.
statusCode
==
200
)
{
if
(
response
.
statusCode
==
200
)
{
if
(
this
.
interceptor
.
response
&&
typeof
this
.
interceptor
.
response
===
'
function
'
)
{
if
(
this
.
interceptor
.
response
&&
typeof
this
.
interceptor
.
response
===
'
function
'
)
{
let
resInterceptors
=
this
.
interceptor
.
response
(
response
.
data
);
let
resInterceptors
=
await
this
.
interceptor
.
response
(
response
.
data
);
if
(
resInterceptors
!==
false
)
{
if
(
resInterceptors
!==
false
)
{
resolve
(
resInterceptors
);
resolve
(
resInterceptors
);
}
else
{
}
else
{
...
...
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