Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
U
uni-app-base
Project
Project
Details
Activity
Releases
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
tangfh
uni-app-base
Commits
cf6d3f04
Commit
cf6d3f04
authored
May 25, 2023
by
tangfh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+
parent
40ca9b14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
28 deletions
+35
-28
base-page.vue
pages/template/base-page.vue
+14
-11
base-tab.vue
pages/template/base-tab.vue
+21
-17
No files found.
pages/template/base-page.vue
View file @
cf6d3f04
...
...
@@ -58,15 +58,18 @@
},
methods
:
{
init
(
option
)
{
this
.
onRefresh
()
let
_this
=
this
;
setTimeout
(()
=>
{
_this
.
refresherTriggered
=
true
;
},
35
)
},
onNavBarLeftClick
()
{
uni
.
navigateBack
();
},
refreshInit
()
{
this
.
page
=
1
;
this
.
total_page
total_page
=
1
;
this
.
status
=
'noMore'
;
this
.
total_page
=
1
;
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
noMore
;
},
onEmptyClick
()
{
this
.
onRefresh
();
...
...
@@ -77,10 +80,10 @@
this
.
request
();
},
onLoadMore
(
e
)
{
if
(
'noMore'
==
this
.
s
tatus
)
{
if
(
constant
.
LOAD_STATUS
.
noMore
==
this
.
loadMoreS
tatus
)
{
return
;
}
this
.
status
=
'loading'
;
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
loading
;
this
.
request
();
},
onBottomBtnClick
()
{
...
...
@@ -125,8 +128,8 @@
}
if
(
this
.
refresherTriggered
||
this
.
isOnFilter
||
this
.
items
.
length
==
0
)
{
this
.
items
=
list
;
this
.
s
tatus
=
this
.
total_page
==
1
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
}
else
if
(
this
.
s
tatus
==
'loading'
)
{
this
.
loadMoreS
tatus
=
this
.
total_page
==
1
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
}
else
if
(
this
.
loadMoreS
tatus
==
'loading'
)
{
if
(
list
.
length
>
0
)
{
this
.
items
=
this
.
items
.
concat
(
list
);
}
...
...
@@ -140,14 +143,14 @@
if
(
this
.
refresherTriggered
)
{
this
.
refresherTriggered
=
false
;
if
(
this
.
total_page
>
1
)
{
this
.
s
tatus
=
constant
.
LOAD_STATUS
.
more
;
this
.
loadMoreS
tatus
=
constant
.
LOAD_STATUS
.
more
;
}
}
else
if
(
this
.
s
tatus
==
constant
.
LOAD_STATUS
.
loading
)
{
}
else
if
(
this
.
loadMoreS
tatus
==
constant
.
LOAD_STATUS
.
loading
)
{
if
(
this
.
page
>
this
.
total_page
)
{
this
.
s
tatus
=
constant
.
LOAD_STATUS
.
noMore
;
this
.
loadMoreS
tatus
=
constant
.
LOAD_STATUS
.
noMore
;
this
.
page
=
this
.
total_page
}
else
{
this
.
s
tatus
=
constant
.
LOAD_STATUS
.
more
;
this
.
loadMoreS
tatus
=
constant
.
LOAD_STATUS
.
more
;
}
}
this
.
firstRequest
=
false
...
...
pages/template/base-tab.vue
View file @
cf6d3f04
...
...
@@ -16,7 +16,8 @@
<view
class=
"view-tmp1 active"
v-for=
"(item2, index2) in tab.data"
:index=
"index2"
:key=
"index2"
:item=
"item2"
@
onItemClick=
"onItemClick"
></view>
</view>
<c-empty
v-if=
"tab.data.length == 0"
@
onEmptyClick=
"onEmptyClick"
></c-empty>
<c-status-view
v-if=
"tab.data.length == 0 && !tab.firstRequest"
:status=
"tab.contentStatus"
@
onStatusClick=
"onStatusClick"
></c-status-view>
<uni-load-more
:status=
"tab.loadStatus"
:icon-size=
"16"
v-if=
"tab.isLoading || tab.data.length > 0"
:content-text=
"loadMoreViewContentText"
/>
</scroll-view>
...
...
@@ -86,7 +87,6 @@
date
:
"2023-05-06-08 13:16"
,
item
:
"公共照明"
,
},
firstRequest
:
true
,
}
},
onLoad
(
option
)
{
...
...
@@ -146,24 +146,24 @@
}
_this
.
tabList
.
push
(
tab
);
});
_this
.
onRefresh
();
var
tab
=
_this
.
tabList
[
_this
.
tabIndex
];
setTimeout
(()
=>
{
tab
.
refreshing
=
true
;
},
35
)
},
350
)
},
onNavBarLeftClick
()
{
uni
.
navigateBack
();
},
onEmptyClick
()
{
onStatusClick
()
{
var
tab
=
this
.
tabList
[
this
.
tabIndex
];
tab
.
refreshing
=
true
;
this
.
onRefresh
();
},
onRefresh
(
e
)
{
var
tab
=
this
.
tabList
[
this
.
tabIndex
];
if
(
!
tab
.
refreshFlag
)
{
return
;
}
tab
.
page
=
1
;
setTimeout
(
function
()
{
tab
.
refreshing
=
true
;
},
30
);
tab
.
refreshing
=
true
;
tab
.
loadStatus
=
tab
.
page
==
tab
.
total_pages
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
this
.
getList
(
this
.
tabIndex
)
},
...
...
@@ -210,13 +210,15 @@
this
.
tabList
[
this
.
tabIndex
].
data
=
this
.
tabList
[
this
.
tabIndex
].
data
.
concat
(
data
.
list
);
},
requestFail
(
res
,
status
)
{
this
.
contentStatus
=
status
;
if
(
this
.
tabList
[
this
.
tabIndex
].
data
.
length
==
0
)
{
this
.
tabList
[
this
.
tabIndex
].
contentStatus
=
status
;
}
},
requestComplete
()
{
if
(
this
.
refresherTriggered
)
{
this
.
refresherTriggered
=
false
;
}
t
his
.
firstRequest
=
fals
e
;
this
.
tabList
[
this
.
tabIndex
].
firstRequest
=
false
;
var
tab
=
this
.
tabList
[
this
.
tabIndex
]
;
tab
.
refreshing
=
false
;
t
ab
.
isRequestComplete
=
tru
e
;
uni
.
hideLoading
()
},
onLoadMore
(
e
)
{
...
...
@@ -235,7 +237,10 @@
if
(
this
.
tabList
[
index
].
data
.
length
>
0
)
{
return
;
}
this
.
getList
(
index
);
var
tab
=
this
.
tabList
[
this
.
tabIndex
];
setTimeout
(()
=>
{
tab
.
refreshing
=
true
;
},
35
)
},
switchTab
(
index
)
{
if
(
this
.
tabIndex
===
index
)
{
...
...
@@ -285,7 +290,6 @@
})
},
ensure
()
{
uni
.
$emit
(
"onRepairItemSelected"
,
this
.
seletedItem
)
uni
.
navigateBack
();
}
}
...
...
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