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> <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 {
......
...@@ -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 {
// 上传成功 // 上传成功
......
...@@ -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 {
......
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