From 4e6e74c462362fbedf3158987f7bae154c880a79 Mon Sep 17 00:00:00 2001 From: xcw <727612669@qq.com> Date: Tue, 28 Mar 2023 14:09:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsFile/requst.js | 6 ++- pagesA/my-watch/my-watch.vue | 70 ++++++++++++++++++++++---- pagesB/course-detail/course-detail.vue | 4 +- 3 files changed, 69 insertions(+), 11 deletions(-) diff --git a/jsFile/requst.js b/jsFile/requst.js index 1273eb6..46a51af 100644 --- a/jsFile/requst.js +++ b/jsFile/requst.js @@ -106,13 +106,15 @@ const request = (method, url, options) => { break; } return new Promise((resolve, reject) => { - console.log(`${url}的参数===>`,options); + uni.showLoading({title: '加载中',mask:true}); uni.request({ url: `${getApp().globalData.hostapi}${url}`, method: methods, data: options, header: headers, success: res => { + uni.hideLoading(); + console.log(`${url}的参数===>`,options); if (res.statusCode == 200) { if (res.data.code == 0) { // 接口调用成功 @@ -123,11 +125,13 @@ const request = (method, url, options) => { checkError(res); } } else { + uni.hideLoading(); // 接口返回错误信息 checkError(res); } }, fail: e => { + uni.hideLoading(); // 接口请求错误 checkError(e, reject); }, diff --git a/pagesA/my-watch/my-watch.vue b/pagesA/my-watch/my-watch.vue index 84d8123..0e9dae3 100644 --- a/pagesA/my-watch/my-watch.vue +++ b/pagesA/my-watch/my-watch.vue @@ -1,14 +1,14 @@