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
bc2298c8
Commit
bc2298c8
authored
Jul 17, 2023
by
tangfh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+
parent
94d9442d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
25 deletions
+62
-25
base-page.vue
pages/template/base-page.vue
+62
-25
No files found.
pages/template/base-page.vue
View file @
bc2298c8
...
...
@@ -2,20 +2,27 @@
<view
class=
"content"
>
<!-- [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"
>
left-icon=
"left"
left-text=
"返回"
:title=
"option.navBar.title"
:titleRightIcon=
"option.navBar.center.right.icon"
:titleRightIcon2=
"option.navBar.center.right2.icon"
@
clickLeft=
"onNavBarLeftClick"
@
onClickTitleRightIcon=
"onClickTitleRightIcon"
@
onClickTitleRightIcon2=
"onClickTitleRightIcon2"
>
</uni-nav-bar>
<scroll-view
class=
"scroll-view"
scroll-y=
"true"
enable-back-to-top=
"true"
:refresher-enabled=
"refresherEnabled"
@
refresherrefresh=
"onRefresh"
@
scrolltolower=
"onLoadMore"
:refresher-triggered=
"refresherTriggered"
:style=
"
{'height':(scrollViewHeight+'px')}">
<view
class=
"flex-column"
v-if=
"items.length > 0"
:style=
"
{'min-height': (scrollViewHeight + 'px')}">
<view
class=
"view-tmp1 active"
v-for=
"(item, index) in items"
:index=
"index"
:key=
"index"
:item=
"item"
@
onItemClick=
"onItemClick"
></view>
</view>
<c-status-view
@
onStatusClick=
"onStatusClick"
v-if=
"contentStatus.value"
></c-status-view>
<uni-load-more
:status=
"loadMoreStatus"
:icon-size=
"16"
v-if=
"items.length > 0"
:content-text=
"loadMoreViewContentText"
/>
</scroll-view>
<text
class=
"text-bottom-btn"
@
click=
"onBottomBtnClick"
>
底部按钮
</text>
<view
class=
"com-view-bottom"
:style=
"
{paddingBottom: bottomBtnPaddingBottom}">
<text
class=
"text-bottom-btn"
@
click=
"onBottomBtnClick"
>
底部按钮
</text>
</view>
</view>
</
template
>
...
...
@@ -25,7 +32,19 @@
export
default
{
data
()
{
return
{
title
:
'标题'
,
option
:
{
navBar
:
{
title
:
'添加店员'
,
center
:
{
right
:
{
icon
:
"/static/btn_bar_screen.png"
},
right2
:
{
icon
:
"/static/btn_problem.png"
}
}
}
},
navBarHeight
:
0
,
scrollViewHeight
:
1000
,
refresherEnabled
:
true
,
...
...
@@ -40,53 +59,65 @@
contentStatus
:
{},
items
:
[],
channel
:
"ongoning"
,
firstRequest
:
true
firstRequest
:
true
,
bottomBtnPaddingBottom
:
""
,
}
},
onLoad
(
option
)
{
var
systemInfo
=
uni
.
getSystemInfoSync
();
//scroll-view的高度 = 屏幕高度 -(顶部状态栏高度 + 导航栏高度) -(底部tabBar高度 + 底部安全区域高度)
this
.
scrollViewHeight
=
systemInfo
.
screenHeight
-
(
uni
.
getSystemInfoSync
()
.
statusBarHeight
+
this
.
$refs
.
navBar
.
height
)
-
(
systemInfo
.
safeAreaInsets
.
bottom
)
-
.
statusBarHeight
+
this
.
$refs
.
navBar
.
height
)
-
(
systemInfo
.
safeAreaInsets
.
bottom
)
-
84
/
getApp
().
globalData
.
pxToRpxScale
;
this
.
bottomBtnPaddingBottom
=
systemInfo
.
safeAreaInsets
.
bottom
+
"px"
this
.
init
(
option
);
},
onShow
()
{
if
(
!
this
.
firstRequest
)
{
if
(
!
this
.
firstRequest
)
{
//this.request()
}
},
methods
:
{
init
(
option
)
{
let
_this
=
this
;
setTimeout
(()
=>
{
_this
.
refresherTriggered
=
true
;
},
35
)
this
.
refresh
();
},
onNavBarLeftClick
()
{
uni
.
navigateBack
();
},
refreshInit
()
{
this
.
page
=
1
;
this
.
total_page
=
1
;
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
noMore
;
onClickTitleRightIcon
()
{
console
.
log
(
"click..."
);
},
onClickTitleRightIcon2
()
{
console
.
log
(
"click..."
);
},
onEmptyClick
()
{
this
.
onRefresh
();
},
onBottomBtnClick
()
{
uni
.
navigateTo
({
url
:
"
/pages/repair-apply/repair-apply
"
url
:
""
})
},
onItemClick
(
item
)
{
uni
.
navigateTo
({
url
:
"
/pages/repair-detail/repair-detail
"
url
:
""
})
},
onStatusClick
()
{
this
.
refresh
();
},
refresh
()
{
let
_this
=
this
;
setTimeout
(()
=>
{
_this
.
refresherTriggered
=
true
;
},
35
);
},
onRefresh
(
e
)
{
this
.
refresherTriggered
=
true
;
this
.
refreshInit
();
this
.
page
=
1
;
this
.
total_page
=
1
;
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
noMore
;
this
.
request
();
},
onLoadMore
(
e
)
{
...
...
@@ -100,7 +131,12 @@
request
()
{
this
.
page
=
this
.
page
>
this
.
total_page
?
this
.
total_page
:
this
.
page
;
let
url
=
""
;
if
(
!
url
)
{
if
(
!
url
)
{
let
_this
=
this
;
setTimeout
(()
=>
{
_this
.
refresherTriggered
=
false
;
_this
.
contentStatus
=
constant
.
CONTENT_STATUS
.
EMPTY
;
},
300
);
return
;
}
let
param
=
{
...
...
@@ -109,9 +145,9 @@
};
let
option
=
{
isNeedShowLoading
:
false
};
};
util
.
request
(
url
,
param
,
option
,
{
success
:
this
.
requestSuccess
,
success
:
this
.
requestSuccess
,
fail
:
this
.
requestFail
,
complete
:
this
.
requestComplete
});
...
...
@@ -124,7 +160,7 @@
let
data
=
res
.
data
.
data
;
let
list
=
data
.
list
;
try
{
this
.
total_page
=
util
.
calTotalPage
(
data
.
total_list
);
this
.
total_page
=
util
.
calTotalPage
(
data
.
total_list
);
}
catch
(
e
)
{
this
.
total_page
=
1
;
console
.
log
(
e
);
...
...
@@ -136,9 +172,10 @@
if
(
list
.
length
>
0
)
{
this
.
items
=
this
.
items
.
concat
(
list
);
}
this
.
loadMoreStatus
=
this
.
page
==
this
.
total_page
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
this
.
loadMoreStatus
=
this
.
page
==
this
.
total_page
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
}
this
.
contentStatus
=
this
.
items
.
length
==
0
?
constant
.
CONTENT_STATUS
.
EMPTY
:
{};
this
.
contentStatus
=
this
.
items
.
length
==
0
?
constant
.
CONTENT_STATUS
.
EMPTY
:
{};
},
requestFail
(
res
,
status
)
{
this
.
contentStatus
=
status
;
...
...
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