Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes-pad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ximai
mes-pad
Commits
8bbed154
Commit
8bbed154
authored
Jul 03, 2024
by
沈翠玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加状态控制loading
parent
1aacffec
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
index.vue
pages/mes/prodReport/index.vue
+0
-1
index.js
uview-ui/libs/request/index.js
+10
-8
No files found.
pages/mes/prodReport/index.vue
View file @
8bbed154
...
...
@@ -1929,7 +1929,6 @@ export default {
const
t
=
this
;
this
.
tableData
=
[];
this
.
tableSelectData
=
[]
console
.
log
(
'sadada'
,
t
.
vuex_workunit
.
workunitId
)
this
.
$u
.
api
.
getTaskList
({
workunitId
:
t
.
vuex_workunit
.
workunitId
,
...
...
uview-ui/libs/request/index.js
View file @
8bbed154
...
...
@@ -25,16 +25,15 @@ class Request {
options
.
params
=
options
.
params
||
{};
options
.
header
=
Object
.
assign
({},
this
.
config
.
header
,
options
.
header
);
options
.
method
=
options
.
method
||
this
.
config
.
method
;
this
.
config
.
loadStatus
=
true
return
new
Promise
((
resolve
,
reject
)
=>
{
options
.
complete
=
(
response
)
=>
{
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
// uni.hideLoading();
setTimeout
(()
=>
{
uni
.
hideLoading
();
},
10
)
// 清除定时器,如果请求回来了,就无需loading
clearTimeout
(
this
.
config
.
timer
);
uni
.
hideLoading
();
this
.
config
.
timer
=
null
;
this
.
config
.
loadStatus
=
false
// 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
if
(
this
.
config
.
originalData
)
{
// 判断是否存在拦截器
...
...
@@ -84,10 +83,12 @@ class Request {
// 而没有清除前者的定时器,导致前者超时,一直显示loading
if
(
this
.
config
.
showLoading
&&
!
this
.
config
.
timer
)
{
this
.
config
.
timer
=
setTimeout
(()
=>
{
if
(
this
.
config
.
loadStatus
)
{
uni
.
showLoading
({
title
:
this
.
config
.
loadingText
,
mask
:
this
.
config
.
loadingMask
})
}
this
.
config
.
timer
=
null
;
},
this
.
config
.
loadingTime
);
}
...
...
@@ -111,6 +112,7 @@ class Request {
// 此参数无需处理,因为5+和支付宝小程序不支持,默认为text即可
responseType
:
'text'
,
showLoading
:
true
,
// 是否显示请求中的loading
loadStatus
:
false
,
// loading状态
loadingText
:
'请求中...'
,
loadingTime
:
800
,
// 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
timer
:
null
,
// 定时器
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment