|  |  |  | 
|---|
|  |  |  | uni.showToast({ title: response.data.message, icon: 'none', duration: 2000 }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return data || {} | 
|---|
|  |  |  | }, (response) => { | 
|---|
|  |  |  | uni.hideLoading(); | 
|---|
|  |  |  | let code; | 
|---|
|  |  |  | }, (error) => { | 
|---|
|  |  |  | uni.hideLoading(); | 
|---|
|  |  |  | let code  = error.code | 
|---|
|  |  |  | if (error.code === "ECONNABORTED") { | 
|---|
|  |  |  | code = 999 | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | code = error.response.status | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | switch (code) { | 
|---|
|  |  |  | case 404: | 
|---|
|  |  |  | uni.showToast({ title: '请求资源不存在', icon: 'none', duration: 2000 }); | 
|---|
|  |  |  | 
|---|
|  |  |  | uni.showToast({ title: '请求超时', icon: 'none', duration: 2000 }); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return Promise.reject(response) | 
|---|
|  |  |  | return Promise.reject(error) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|