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
74c1d691
Commit
74c1d691
authored
Oct 24, 2023
by
tangfh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update base-tab.vue
parent
2fa40a8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
23 deletions
+76
-23
base-tab.vue
pages/template/base-tab.vue
+76
-23
No files found.
pages/template/base-tab.vue
View file @
74c1d691
...
...
@@ -3,10 +3,10 @@
<!-- [uni-nav-bar 自定义导航栏](https://uniapp.dcloud.net.cn/component/uniui/uni-nav-bar.html) -->
<uni-nav-bar
ref=
"navBar"
class=
"uni-navi-bar"
status-bar=
"true"
:border=
"false"
color=
"#333333"
fixed=
"true"
left-icon=
"left"
left-text=
"返回"
:title=
"title"
@
clickLeft=
"onNavBarLeftClick"
:titleRightIcon=
"tabBars[tabIndex].isNeedFilter ? titleRightIcon : ''"
:titleRightIcon2=
"titleRightIcon2"
@
onClickTitleRightIcon=
"onClickTitleRightIcon"
@
onClickTitleRightIcon2=
"onClickTitleRightIcon2"
>
:titleRightIcon=
"tabBars[tabIndex].isNeedFilter ? titleRightIcon : ''"
:titleRightIcon2=
"titleRightIcon2"
@
onClickTitleRightIcon=
"onClickTitleRightIcon"
@
onClickTitleRightIcon2=
"onClickTitleRightIcon2"
>
</uni-nav-bar>
<c-tab-bar
:tabBars=
"tabBars"
:tabIndex=
"tabIndex"
:tabWidth=
"tabWidth"
:scrollInto=
"scrollInto"
:marginL=
"tabItemMargin"
:marginR=
"tabItemMargin"
@
onTabItemClick=
"onTabItemClick"
></c-tab-bar>
<swiper
:current=
"tabIndex"
class=
"swiper-box"
:duration=
"300"
@
change=
"onTabChange"
...
...
@@ -15,18 +15,22 @@
<scroll-view
class=
"scroll-v"
scroll-y
:refresher-enabled=
"tab.content.refresherEnable"
@
refresherrefresh=
"onRefresh()"
:enable-back-to-top=
"true"
:lower-threshold=
"75"
:refresher-triggered=
"tab.content.refreshing"
@
scrolltolower=
"onLoadMore(index)"
:style=
"
{height: (swiperHeight) + 'px'}">
:style=
"
{height: (swiperHeight) + 'px'}"
:scroll-top="tab.content.scrollTopReal"
:show-scrollbar="true"
@scroll="onScroll"
>
<view
class=
"flex-column"
v-if=
"tab.content.list.length > 0"
:style=
"
{'min-height': (swiperHeight + 'px')}">
<
view
class=
"view-tmp1 active"
v-for=
"(item2, index2) in tab.content.list"
:index=
"index
2"
:key=
"index2"
:item=
"item2"
@
onItemClick=
"onItemClick(item2, index2)"
>
<text>
hello
</text>
</
view
>
<
iooItem
v-for=
"(item2, index2) in tab.content.list"
:index=
"index2"
:key=
"item2.id"
:item=
"item
2"
@
onItemClick=
"onItemClick(item2, index2)"
>
</
iooItem
>
</view>
<c-status-view
v-if=
"tab.content.list.length == 0 && !tab.content.firstRequest"
:status=
"tab.content.contentStatus"
@
onStatusClick=
"onStatusClick"
></c-status-view>
<uni-load-more
:status=
"tab.content.loadStatus"
:icon-size=
"16"
v-if=
"tab.content.isLoading || tab.content.list.length > 0"
v-if=
"tab.content.isLoading || tab.content.list.length > 0
|| tab.content.hide
"
:content-text=
"loadMoreViewContentText"
/>
</scroll-view>
</swiper-item>
...
...
@@ -42,30 +46,62 @@
import
constant
from
'./../../utils/constant.js'
import
util
from
'./../../utils/util.js'
import
MSC
from
'./../../utils/mishang_constant.js'
import
IOOC
from
'./../../pages-ioo/utils/ioo-constants.js'
// 缓存每页最多
const
MAX_CACHE_DATA
=
100
;
// 缓存页签数量
const
MAX_CACHE_PAGE
=
3
;
const
MAX_CACHE_PAGE
=
6
;
const
TABBARS
=
{
apply
:
{
tab1
:
{
type
:
1
,
name
:
'
店员申请
'
,
name
:
'
待审核
'
,
isNeedFilter
:
false
,
content
:
JSON
.
parse
(
JSON
.
stringify
(
constant
.
LIST_CONTENT
))
},
passed
:
{
tab2
:
{
type
:
2
,
name
:
'我的店员'
,
name
:
'批准进场'
,
isNeedFilter
:
true
,
content
:
JSON
.
parse
(
JSON
.
stringify
(
constant
.
LIST_CONTENT
))
},
tab3
:
{
type
:
3
,
name
:
'不通过'
,
isNeedFilter
:
true
,
content
:
JSON
.
parse
(
JSON
.
stringify
(
constant
.
LIST_CONTENT
))
},
tab4
:
{
type
:
4
,
name
:
'已完成'
,
isNeedFilter
:
true
,
content
:
JSON
.
parse
(
JSON
.
stringify
(
constant
.
LIST_CONTENT
))
},
tab5
:
{
type
:
5
,
name
:
'已取消'
,
isNeedFilter
:
true
,
content
:
JSON
.
parse
(
JSON
.
stringify
(
constant
.
LIST_CONTENT
))
},
tab6
:
{
type
:
6
,
name
:
'已失效'
,
isNeedFilter
:
true
,
content
:
JSON
.
parse
(
JSON
.
stringify
(
constant
.
LIST_CONTENT
))
}
};
// 1. 导入组件
import
iooItem
from
'@/pages-ioo/components/ioo-item/ioo-item.vue'
export
default
{
components
:
{
iooItem
},
// 2. 注册组件
data
()
{
return
{
title
:
'
通行证管理
'
,
title
:
'
装修物料进场单
'
,
navBarHeight
:
0
,
refresherTriggered
:
false
,
loadMoreViewShow
:
false
,
...
...
@@ -75,7 +111,7 @@
loadMoreViewStatus
:
'noMore'
,
cacheTab
:
[],
tabIndex
:
0
,
tabBars
:
[
TABBARS
.
apply
,
TABBARS
.
passed
],
tabBars
:
[
TABBARS
.
tab1
,
TABBARS
.
tab2
,
TABBARS
.
tab3
,
TABBARS
.
tab4
,
TABBARS
.
tab5
,
TABBARS
.
tab6
],
screen
:
""
,
tabItemMargin
:
30
,
//tabItem第一个margin-left和最后一个margin-right的margin
tabWidth
:
0
,
...
...
@@ -87,6 +123,7 @@
},
titleRightIcon
:
"/static/btn_bar_screen.png"
,
titleRightIcon2
:
"/static/btn_problem.png"
,
scrollTop
:
-
1
,
}
},
onLoad
(
option
)
{
...
...
@@ -110,6 +147,9 @@
},
methods
:
{
init
(
option
)
{
//TODO remove
IOOC
.
setMock
();
this
.
refresh
();
},
refresh
()
{
...
...
@@ -122,10 +162,10 @@
uni
.
navigateBack
();
},
onClickTitleRightIcon
()
{
IOOC
.
setMock
()
},
onClickTitleRightIcon2
()
{
IOOC
.
setMock
()
},
onFilterEnsureBtnClick
(
items
)
{
this
.
$refs
.
filter
.
dismiss
();
...
...
@@ -143,9 +183,13 @@
onStatusClick
()
{
this
.
refresh
();
},
onScroll
(
event
)
{
var
tab
=
this
.
tabBars
[
this
.
tabIndex
];
tab
.
content
.
scrollTop
=
event
.
detail
.
scrollTop
;
},
onRefresh
(
e
)
{
var
tab
=
this
.
tabBars
[
this
.
tabIndex
];
if
(
!
tab
.
content
.
refreshing
&&
!
tab
.
content
.
refreshFlag
)
{
if
(
tab
.
content
.
refreshing
&&
!
tab
.
content
.
refreshFlag
)
{
//
return
;
}
tab
.
content
.
page
=
1
;
...
...
@@ -164,14 +208,14 @@
this
.
getList
(
this
.
tabIndex
);
},
getList
(
index
)
{
let
url
=
MSC
.
URLS
.
audit_clerk_list
;
const
url
=
IOOC
.
list
()
;
if
(
!
url
)
{
return
;
}
var
tab
=
this
.
tabBars
[
this
.
tabIndex
];
let
param
=
{
status
:
tab
.
type
,
screen
:
tab
.
isNeedFilter
?
this
.
screen
:
''
,
page
:
tab
.
content
.
page
,
};
let
option
=
{
isNeedShowLoading
:
false
...
...
@@ -192,6 +236,7 @@
tab
.
content
.
firstRequest
=
false
;
let
data
=
res
.
data
.
data
;
let
list
=
data
.
list
;
if
(
tab
.
content
.
refreshing
||
tab
.
content
.
refreshFlag
||
tab
.
content
.
list
.
length
==
0
)
{
tab
.
content
.
total_pages
=
util
.
calTotalPage
(
data
.
total_list
);
this
.
clearTabData
(
this
.
tabIndex
);
...
...
@@ -199,11 +244,19 @@
tab
.
content
.
loadStatus
=
tab
.
content
.
total_pages
==
1
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
}
else
if
(
tab
.
content
.
loadStatus
==
constant
.
LOAD_STATUS
.
loading
)
{
tab
.
content
.
hide
=
true
;
if
(
list
.
length
>
0
)
{
tab
.
content
.
list
=
tab
.
content
.
list
.
concat
(
list
);
}
tab
.
content
.
loadStatus
=
tab
.
content
.
page
>=
tab
.
content
.
total_pages
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
tab
.
content
.
loadStatus
=
tab
.
content
.
page
>
tab
.
content
.
total_pages
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
const
_this
=
this
;
//解决分页数据很少时,加载更多显示问题
tab
.
content
.
scrollTopReal
=
-
1
setTimeout
(()
=>
{
//_this.scrollTop = 0
tab
.
content
.
scrollTopReal
=
tab
.
content
.
scrollTop
-
40
},
300
)
}
tab
.
content
.
contentStatus
=
tab
.
content
.
list
.
length
==
0
?
constant
.
CONTENT_STATUS
.
EMPTY
:
{};
},
...
...
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