Skip to content

Commit 1043b6a

Browse files
authored
Merge pull request umicro#53 from 2460392754/master
fix: upload组件修改文件上传后判断的状态码
2 parents 40604f6 + 06b436b commit 1043b6a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

uview-ui/components/u-toast/u-toast.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<view class="u-toast" :class="[isShow ? 'u-show' : '', 'u-type-' + config.type, 'u-position-' + config.position]" :style="{
3-
padding: isShow ? '0 40rpx' : 0,
43
zIndex: uZIndex
54
}">
65
<view class="u-icon-wrap">
@@ -54,7 +53,7 @@
5453
},
5554
uZIndex() {
5655
// 显示toast时候,如果用户有传递z-index值,有限使用
57-
return this.isShow ? (this.zIndex ? this.zIndex : this.$u.zIndex.toast) : '-1';
56+
return this.isShow ? (this.zIndex ? this.zIndex : this.$u.zIndex.toast) : '999999';
5857
}
5958
},
6059
methods: {
@@ -136,11 +135,12 @@
136135
justify-content: center;
137136
font-size: 28rpx;
138137
opacity: 0;
138+
pointer-events: none;
139+
padding:0 40rpx;
139140
}
140141
141142
.u-toast.u-show {
142143
opacity: 1;
143-
z-index: 9999999;
144144
}
145145
146146
.u-text {

uview-ui/components/u-upload/u-upload.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@
334334
formData: this.formData,
335335
header: this.header,
336336
success: (res) => {
337-
if (res.statusCode != 200) {
337+
if (![200,201].includes(res.statusCode)) {
338338
this.uploadError(index, res.data);
339339
} else {
340340
// 上传成功

uview-ui/libs/request/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Request {
1212
// 检查请求拦截
1313
if (this.interceptor.request && typeof this.interceptor.request === 'function') {
1414
let tmpConfig = {};
15-
let interceptorReuest = this.interceptor.request(options);
15+
let interceptorReuest = await this.interceptor.request(options);
1616
if (interceptorReuest === false) {
1717
return false;
1818
}
@@ -27,7 +27,7 @@ class Request {
2727
options.method = options.method || this.config.method;
2828

2929
return new Promise((resolve, reject) => {
30-
options.complete = (response) => {
30+
options.complete = async (response) => {
3131
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
3232
uni.hideLoading();
3333
// 清除定时器,如果请求回来了,就无需loading
@@ -36,7 +36,7 @@ class Request {
3636
if(this.config.originalData) {
3737
// 判断是否存在拦截器
3838
if (this.interceptor.response && typeof this.interceptor.response === 'function') {
39-
let resInterceptors = this.interceptor.response(response);
39+
let resInterceptors = await this.interceptor.response(response);
4040
// 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
4141
if (resInterceptors !== false) {
4242
resolve(resInterceptors);
@@ -51,7 +51,7 @@ class Request {
5151
} else {
5252
if (response.statusCode == 200) {
5353
if (this.interceptor.response && typeof this.interceptor.response === 'function') {
54-
let resInterceptors = this.interceptor.response(response.data);
54+
let resInterceptors = await this.interceptor.response(response.data);
5555
if (resInterceptors !== false) {
5656
resolve(resInterceptors);
5757
} else {

0 commit comments

Comments
 (0)