Unverified Commit 1043b6a9 authored by YanxinNet's avatar YanxinNet Committed by GitHub

Merge pull request #53 from 2460392754/master

fix: upload组件修改文件上传后判断的状态码
parents 40604f61 06b436b5
<template>
<view class="u-toast" :class="[isShow ? 'u-show' : '', 'u-type-' + config.type, 'u-position-' + config.position]" :style="{
padding: isShow ? '0 40rpx' : 0,
zIndex: uZIndex
}">
<view class="u-icon-wrap">
......@@ -54,7 +53,7 @@
},
uZIndex() {
// 显示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: {
......@@ -136,11 +135,12 @@
justify-content: center;
font-size: 28rpx;
opacity: 0;
pointer-events: none;
padding:0 40rpx;
}
.u-toast.u-show {
opacity: 1;
z-index: 9999999;
}
.u-text {
......
......@@ -334,7 +334,7 @@
formData: this.formData,
header: this.header,
success: (res) => {
if (res.statusCode != 200) {
if (![200,201].includes(res.statusCode)) {
this.uploadError(index, res.data);
} else {
// 上传成功
......
......@@ -12,7 +12,7 @@ class Request {
// 检查请求拦截
if (this.interceptor.request && typeof this.interceptor.request === 'function') {
let tmpConfig = {};
let interceptorReuest = this.interceptor.request(options);
let interceptorReuest = await this.interceptor.request(options);
if (interceptorReuest === false) {
return false;
}
......@@ -27,7 +27,7 @@ class Request {
options.method = options.method || this.config.method;
return new Promise((resolve, reject) => {
options.complete = (response) => {
options.complete = async (response) => {
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
uni.hideLoading();
// 清除定时器,如果请求回来了,就无需loading
......@@ -36,7 +36,7 @@ class Request {
if(this.config.originalData) {
// 判断是否存在拦截器
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回调
if (resInterceptors !== false) {
resolve(resInterceptors);
......@@ -51,7 +51,7 @@ class Request {
} else {
if (response.statusCode == 200) {
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) {
resolve(resInterceptors);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment