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
5b742ec9
Commit
5b742ec9
authored
Jul 31, 2023
by
tangfh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+
parent
4f14b7c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
227 additions
and
56 deletions
+227
-56
base-list.vue
pages/template/base-list.vue
+214
-0
base-page.vue
pages/template/base-page.vue
+13
-56
No files found.
pages/template/base-list.vue
0 → 100644
View file @
5b742ec9
<
template
>
<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=
"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=
"detail || items.length > 0"
:style=
"
{'min-height': (scrollViewHeight + 'px')}">
</view>
<c-status-view
@
onStatusClick=
"onStatusClick"
v-if=
"contentStatus.value"
></c-status-view>
<uni-load-more
:status=
"loadMoreStatus"
:icon-size=
"16"
v-if=
"detail || items.length > 0"
:content-text=
"loadMoreViewContentText"
/>
</scroll-view>
<view
class=
"com-view-bottom"
:style=
"
{paddingBottom: bottomBtnPaddingBottom}">
<text
class=
"text-bottom-btn"
@
click=
"onBottomBtnClick"
>
{{
detail
.
btnText
}}
</text>
</view>
</view>
</
template
>
<
script
>
import
MSC
from
'./../../utils/mishang_constant.js'
import
constant
from
'./../../utils/constant.js'
import
util
from
'./../../utils/util.js'
export
default
{
data
()
{
return
{
option
:
{
navBar
:
{
title
:
'店铺信息认证'
,
center
:
{
right
:
{
icon
:
""
},
right2
:
{
icon
:
""
}
}
}
},
navBarHeight
:
0
,
scrollViewHeight
:
1000
,
refresherEnabled
:
true
,
refresherTriggered
:
false
,
loadMoreViewContentText
:
{
contentnomore
:
"到底啦~"
},
loadMoreStatus
:
'noMore'
,
page
:
1
,
total_page
:
1
,
loadMoreStatus
:
null
,
contentStatus
:
{},
items
:
[],
channel
:
"ongoning"
,
firstRequest
:
true
,
bottomBtnPaddingBottom
:
""
,
detail
:
{
btnText
:
"下一步"
,
},
}
},
onLoad
(
option
)
{
var
systemInfo
=
uni
.
getSystemInfoSync
();
//scroll-view的高度 = 屏幕高度 -(顶部状态栏高度 + 导航栏高度) -(底部tabBar高度 + 底部安全区域高度)
this
.
scrollViewHeight
=
systemInfo
.
screenHeight
-
(
uni
.
getSystemInfoSync
()
.
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
&&
this
.
page
==
1
)
{
this
.
refreshFlag
=
true
;
this
.
getList
();
}
},
methods
:
{
init
(
option
)
{
this
.
refresh
();
},
onNavBarLeftClick
()
{
uni
.
navigateBack
();
},
onClickTitleRightIcon
()
{
console
.
log
(
"click..."
);
},
onClickTitleRightIcon2
()
{
console
.
log
(
"click..."
);
},
onEmptyClick
()
{
this
.
onRefresh
();
},
onBottomBtnClick
()
{
uni
.
navigateTo
({
url
:
""
})
},
onItemClick
(
item
)
{
uni
.
navigateTo
({
url
:
""
})
},
onStatusClick
()
{
this
.
refresh
();
},
refresh
()
{
let
_this
=
this
;
setTimeout
(()
=>
{
_this
.
refresherTriggered
=
true
;
},
35
);
},
onRefresh
(
e
)
{
this
.
refresherTriggered
=
true
;
this
.
page
=
1
;
this
.
total_page
=
1
;
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
noMore
;
this
.
request
();
},
onLoadMore
(
e
)
{
if
(
constant
.
LOAD_STATUS
.
noMore
==
this
.
loadMoreStatus
)
{
return
;
}
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
loading
;
this
.
page
++
;
this
.
request
();
},
request
()
{
this
.
page
=
this
.
page
>
this
.
total_page
?
this
.
total_page
:
this
.
page
;
let
url
=
""
;
if
(
!
url
)
{
let
_this
=
this
;
setTimeout
(()
=>
{
_this
.
refresherTriggered
=
false
;
_this
.
contentStatus
=
constant
.
CONTENT_STATUS
.
EMPTY
;
},
300
);
return
;
}
let
param
=
{
channel
:
this
.
channel
,
page
:
this
.
page
};
let
option
=
{
isNeedShowLoading
:
false
};
util
.
request
(
url
,
param
,
option
,
{
success
:
this
.
requestSuccess
,
fail
:
this
.
requestFail
,
complete
:
this
.
requestComplete
});
},
requestSuccess
(
res
)
{
if
(
res
.
data
.
code
>
0
)
{
this
.
contentStatus
==
this
.
items
.
length
==
0
?
constant
.
CONTENT_STATUS
.
ERROR
:
null
;
return
;
}
let
data
=
res
.
data
.
data
;
let
list
=
data
.
list
;
try
{
this
.
total_page
=
util
.
calTotalPage
(
data
.
total_list
);
}
catch
(
e
)
{
this
.
total_page
=
1
;
console
.
log
(
e
);
}
if
(
this
.
refresherTriggered
||
this
.
items
.
length
==
0
)
{
this
.
items
=
list
;
this
.
loadMoreStatus
=
this
.
total_page
==
1
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
}
else
if
(
this
.
loadMoreStatus
==
constant
.
LOAD_STATUS
.
loading
)
{
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
.
contentStatus
=
this
.
items
.
length
==
0
?
constant
.
CONTENT_STATUS
.
EMPTY
:
{};
},
requestFail
(
res
,
status
)
{
this
.
contentStatus
=
status
;
},
requestComplete
()
{
if
(
this
.
refresherTriggered
)
{
this
.
refresherTriggered
=
false
;
if
(
this
.
total_page
>
1
)
{
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
more
;
}
}
else
if
(
this
.
loadMoreStatus
==
constant
.
LOAD_STATUS
.
loading
)
{
if
(
this
.
page
>
this
.
total_page
)
{
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
noMore
;
this
.
page
=
this
.
total_page
}
else
{
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
more
;
}
}
this
.
refreshFlag
=
false
this
.
firstRequest
=
false
uni
.
hideLoading
()
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.image-fashion-logo
{
width
:
136rpx
;
}
</
style
>
pages/template/base-page.vue
View file @
5b742ec9
...
@@ -2,22 +2,20 @@
...
@@ -2,22 +2,20 @@
<view
class=
"content"
>
<view
class=
"content"
>
<!-- [uni-nav-bar 自定义导航栏](https://uniapp.dcloud.net.cn/component/uniui/uni-nav-bar.html) -->
<!-- [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"
<uni-nav-bar
ref=
"navBar"
class=
"uni-navi-bar"
status-bar=
"true"
:border=
"false"
color=
"#333333"
fixed=
"true"
left-icon=
"left"
left-text=
"返回"
left-icon=
"left"
left-text=
"返回"
:title=
"option.navBar.title"
:title=
"option.navBar.title"
:titleRightIcon=
"option.navBar.center.right.icon"
:titleRightIcon2=
"option.navBar.center.right2.icon"
:titleRightIcon=
"option.navBar.center.right.icon"
@
clickLeft=
"onNavBarLeftClick"
@
onClickTitleRightIcon=
"onClickTitleRightIcon"
:titleRightIcon2=
"option.navBar.center.right2.icon"
@
clickLeft=
"onNavBarLeftClick"
@
onClickTitleRightIcon=
"onClickTitleRightIcon"
@
onClickTitleRightIcon2=
"onClickTitleRightIcon2"
>
@
onClickTitleRightIcon2=
"onClickTitleRightIcon2"
>
</uni-nav-bar>
</uni-nav-bar>
<scroll-view
class=
"scroll-view"
scroll-y=
"true"
enable-back-to-top=
"true"
:refresher-enabled=
"refresherEnabled"
<scroll-view
class=
"scroll-view"
scroll-y=
"true"
enable-back-to-top=
"true"
:refresher-enabled=
"refresherEnabled"
@
refresherrefresh=
"onRefresh"
@
scrolltolower=
"onLoadMore"
:refresher-triggered=
"refresherTriggered"
@
refresherrefresh=
"onRefresh"
:refresher-triggered=
"refresherTriggered"
:style=
"
{'height':(scrollViewHeight+'px')}">
:style=
"
{'height':(scrollViewHeight+'px')}">
<view
class=
"flex-column"
v-if=
"detail || items.length > 0"
:style=
"
{'min-height': (scrollViewHeight + 'px')}">
<view
class=
"flex-column"
v-if=
"detail"
:style=
"
{'min-height': (scrollViewHeight + 'px')}">
</view>
</view>
<c-status-view
@
onStatusClick=
"onStatusClick"
v-if=
"contentStatus.value"
></c-status-view>
<c-status-view
@
onStatusClick=
"onStatusClick"
v-if=
"contentStatus.value"
></c-status-view>
<uni-load-more
:status=
"loadMoreStatus"
:icon-size=
"16"
v-if=
"detail
|| items.length > 0
"
<uni-load-more
:status=
"loadMoreStatus"
:icon-size=
"16"
v-if=
"detail"
:content-text=
"loadMoreViewContentText"
/>
:content-text=
"loadMoreViewContentText"
/>
</scroll-view>
</scroll-view>
<view
class=
"com-view-bottom"
:style=
"
{paddingBottom: bottomBtnPaddingBottom}">
<view
class=
"com-view-bottom"
:style=
"
{paddingBottom: bottomBtnPaddingBottom}">
...
@@ -35,7 +33,7 @@
...
@@ -35,7 +33,7 @@
return
{
return
{
option
:
{
option
:
{
navBar
:
{
navBar
:
{
title
:
'
店铺信息认证
'
,
title
:
'
标题
'
,
center
:
{
center
:
{
right
:
{
right
:
{
icon
:
""
icon
:
""
...
@@ -120,21 +118,9 @@
...
@@ -120,21 +118,9 @@
},
},
onRefresh
(
e
)
{
onRefresh
(
e
)
{
this
.
refresherTriggered
=
true
;
this
.
refresherTriggered
=
true
;
this
.
page
=
1
;
this
.
total_page
=
1
;
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
noMore
;
this
.
request
();
this
.
request
();
},
}
onLoadMore
(
e
)
{
if
(
constant
.
LOAD_STATUS
.
noMore
==
this
.
loadMoreStatus
)
{
return
;
}
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
loading
;
this
.
page
++
;
this
.
request
();
},
request
()
{
request
()
{
this
.
page
=
this
.
page
>
this
.
total_page
?
this
.
total_page
:
this
.
page
;
let
url
=
""
;
let
url
=
""
;
if
(
!
url
)
{
if
(
!
url
)
{
let
_this
=
this
;
let
_this
=
this
;
...
@@ -163,42 +149,13 @@
...
@@ -163,42 +149,13 @@
return
;
return
;
}
}
let
data
=
res
.
data
.
data
;
let
data
=
res
.
data
.
data
;
let
list
=
data
.
list
;
this
.
detail
=
data
;
try
{
this
.
total_page
=
util
.
calTotalPage
(
data
.
total_list
);
}
catch
(
e
)
{
this
.
total_page
=
1
;
console
.
log
(
e
);
}
if
(
this
.
refresherTriggered
||
this
.
items
.
length
==
0
)
{
this
.
items
=
list
;
this
.
loadMoreStatus
=
this
.
total_page
==
1
?
constant
.
LOAD_STATUS
.
noMore
:
constant
.
LOAD_STATUS
.
more
;
}
else
if
(
this
.
loadMoreStatus
==
constant
.
LOAD_STATUS
.
loading
)
{
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
.
contentStatus
=
this
.
items
.
length
==
0
?
constant
.
CONTENT_STATUS
.
EMPTY
:
{};
},
},
requestFail
(
res
,
status
)
{
requestFail
(
res
,
status
)
{
this
.
contentStatus
=
status
;
this
.
contentStatus
=
status
;
},
},
requestComplete
()
{
requestComplete
()
{
if
(
this
.
refresherTriggered
)
{
this
.
refresherTriggered
=
false
;
this
.
refresherTriggered
=
false
;
if
(
this
.
total_page
>
1
)
{
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
more
;
}
}
else
if
(
this
.
loadMoreStatus
==
constant
.
LOAD_STATUS
.
loading
)
{
if
(
this
.
page
>
this
.
total_page
)
{
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
noMore
;
this
.
page
=
this
.
total_page
}
else
{
this
.
loadMoreStatus
=
constant
.
LOAD_STATUS
.
more
;
}
}
this
.
refreshFlag
=
false
this
.
refreshFlag
=
false
this
.
firstRequest
=
false
this
.
firstRequest
=
false
uni
.
hideLoading
()
uni
.
hideLoading
()
...
@@ -211,4 +168,4 @@
...
@@ -211,4 +168,4 @@
.image-fashion-logo
{
.image-fashion-logo
{
width
:
136rpx
;
width
:
136rpx
;
}
}
</
style
>
</
style
>
\ No newline at end of file
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