news-list.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="container club clearfix">
  3. <view class="club-main">
  4. <view v-if="isEmpty" class="empty-container">
  5. <image class="club-empty-image" src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png" mode="aspectFit"></image>
  6. <view class="txt">暂无公告~</view>
  7. </view>
  8. <view v-else class="club-list">
  9. <scroll-view scroll-y="true">
  10. <view class="list" v-for="(item, index) in clubList" :key="index" @tap='detail(item)'>
  11. <view class="list-left">
  12. <text class="iconfont icon-xiaochengxu"></text>
  13. <text class="txt">{{item.name == null ? item.username : item.name}}</text>
  14. </view>
  15. <view class="list-right">2022年03月07日</view>
  16. </view>
  17. <!--加载loadding-->
  18. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  19. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text='nomoreText'></tui-nomore>
  20. <!--加载loadding-->
  21. </scroll-view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import authorize from '@/common/config/authorize.js'
  28. import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
  29. import tuiNomore from '@/components/tui-components/nomore/nomore'
  30. export default {
  31. components:{
  32. tuiLoadmore,
  33. tuiNomore,
  34. },
  35. data() {
  36. return {
  37. serviceProviderId:'',
  38. isShowClose:false,
  39. searchInputVal:'',
  40. isEmpty:false,
  41. listQuery:{
  42. searchWord:'',
  43. pageNum:1,
  44. pageSize:20,
  45. },
  46. nomoreText: '上拉显示更多',
  47. hasNextPage:false,
  48. loadding: false,
  49. pullUpOn: true,
  50. pullFlag: true,
  51. allowDataStatus:true,
  52. wrapperHeight:'100%',
  53. scrollHeight:'',
  54. deleteAddressId:'',
  55. currPage:'',//当前页面
  56. prevPage:'',//上一个页面
  57. tabCurrentIndex:0,
  58. listStatus:1,
  59. clubList:[],
  60. isIphoneX:this.$store.state.isIphoneX,
  61. show_index:0,//控制显示那个组件
  62. }
  63. },
  64. onLoad(){
  65. this.setScrollHeight()
  66. },
  67. methods: {
  68. setScrollHeight() {
  69. // 窗口高度 - 底部距离
  70. setTimeout(()=> {
  71. const query = wx.createSelectorQuery().in(this)
  72. query.selectAll('.add-btn').boundingClientRect()
  73. query.exec(res => {
  74. if(res[0][0]){
  75. let winHeight = this.$api.getWindowHeight(),
  76. eleTop = res[0][0].top - 1
  77. this.scrollHeight = eleTop
  78. }
  79. })
  80. }, 500)
  81. },
  82. searchClubList(){
  83. this.listQuery.pageNum=1
  84. this.GetFindAllClubList()
  85. },
  86. GetFindAllClubList(){
  87. this.SellerService.GetFindAllClubList(this.listQuery).then(response =>{
  88. let responseData = response.data
  89. if(responseData.list&&responseData.list.length > 0){
  90. this.isEmpty = false
  91. this.hasNextPage = response.data.hasNextPage
  92. this.clubList =responseData.list
  93. this.pullFlag = false
  94. setTimeout(()=>{this.pullFlag = true},500)
  95. if(this.hasNextPage){
  96. this.pullUpOn = false
  97. this.nomoreText = '上拉显示更多'
  98. }else{
  99. this.pullUpOn = true
  100. this.loadding = false
  101. this.nomoreText = '已至底部'
  102. }
  103. }else{
  104. this.isEmpty = true
  105. }
  106. }).catch(error =>{
  107. this.$util.msg(error.msg,2000)
  108. })
  109. },
  110. getOnReachBottomData(){
  111. this.listQuery.pageNum+=1
  112. this.SellerService.GetFindAllClubList(this.listQuery).then(response =>{
  113. let responseData = response.data
  114. if(responseData.list&&responseData.list.length > 0){
  115. this.hasNextPage = response.data.hasNextPage
  116. this.clubList = this.clubList.concat(responseData.list)
  117. this.pullFlag = false// 防上拉暴滑
  118. setTimeout(()=>{this.pullFlag = true},500)
  119. if(this.hasNextPage){
  120. this.pullUpOn = false
  121. this.nomoreText = '上拉显示更多'
  122. }else{
  123. this.pullUpOn = false
  124. this.loadding = false
  125. this.nomoreText = '已至底部'
  126. }
  127. }
  128. }).catch(error =>{
  129. this.$util.msg(error.msg,2000)
  130. })
  131. },
  132. detail(item){// 跳转公告详情
  133. this.$api.navigateTo(`/pages/service/news-detailes?id=${item.id}`)
  134. },
  135. },
  136. onReachBottom() {
  137. if(this.hasNextPage){
  138. this.loadding = true
  139. this.pullUpOn = true
  140. this.getOnReachBottomData()
  141. }
  142. },
  143. onPullDownRefresh() {
  144. setTimeout(() => {
  145. this.listQuery.pageNum = 1
  146. this.GetFindAllClubList()
  147. uni.stopPullDownRefresh()
  148. }, 200)
  149. },
  150. onShow() {
  151. this.$api.getStorage().then(response =>{
  152. this.serviceProviderId = response.serviceProviderId
  153. this.GetFindAllClubList()
  154. })
  155. }
  156. }
  157. </script>
  158. <style lang='scss'>
  159. page {
  160. height: auto;
  161. }
  162. page,.container{
  163. /* padding-bottom: 120upx; */
  164. background: #FFFFFF;
  165. }
  166. .container{
  167. position: relative;
  168. }
  169. .club-main{
  170. width: 100%;
  171. height: auto;
  172. box-sizing: border-box;
  173. padding: 0 24rpx;
  174. .list{
  175. display: flex;
  176. align-items: center;
  177. width: 100%;
  178. height: 100rpx;
  179. line-height: 100rpx;
  180. background: #FFFFFF;
  181. position: relative;
  182. border-bottom: 1px solid #EBEBEB;
  183. .list-left{
  184. display: flex;
  185. flex: 8;
  186. .icon-xiaochengxu{
  187. font-size: $font-size-22;
  188. color: #999999;
  189. margin-right: 10rpx;
  190. }
  191. .txt{
  192. display: flex;
  193. flex: 1;
  194. font-size: $font-size-26;
  195. color: $text-color;
  196. text-overflow: ellipsis;
  197. overflow: hidden;
  198. display: -webkit-box;
  199. -webkit-line-clamp: 1;
  200. line-clamp: 1;
  201. -webkit-box-orient: vertical;
  202. }
  203. }
  204. .list-right{
  205. font-size: $font-size-24;
  206. color: #999999;
  207. text-align: right;
  208. }
  209. }
  210. }
  211. </style>