subscribeList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
  4. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
  5. @refresherrestore="onRestore">
  6. <u-card :head-border-bottom="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
  7. :key="index" class="class-card" @click="handleJumpClick(item)">
  8. <view class="class-content" slot="head" style="padding-top: 10px;">
  9. <view class="student-name">{{item.studentName}}</view>
  10. <view class="class-name">{{item.name}}</view>
  11. </view>
  12. <view class="class-content" slot="body">
  13. <view class="class-info-text">
  14. <u-icon name="clock"></u-icon>
  15. {{item.classStartDate}}&nbsp;&nbsp;{{item.classStartHours}}
  16. </view>
  17. <view class="class-info-text">
  18. <u-icon name="map"></u-icon>
  19. {{item.address}}
  20. </view>
  21. </view>
  22. <!-- <view class="class-foot" slot="foot">
  23. <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
  24. :hair-line="false" plain>已预约</u-button>
  25. </view> -->
  26. </u-card>
  27. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  28. </scroll-view>
  29. <u-top-tips ref="uTips"></u-top-tips>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. mapGetters
  35. } from 'vuex'
  36. const NET = require('@/utils/request')
  37. const API = require('@/config/api')
  38. export default {
  39. computed: {
  40. ...mapGetters([
  41. 'handleDefaultCustomStyle',
  42. ])
  43. },
  44. data() {
  45. return {
  46. triggered: false,
  47. isOver: false,
  48. pageIndex: 1,
  49. tableList: [],
  50. venueId: null
  51. }
  52. },
  53. onLoad(options) {
  54. console.log(options);
  55. // 二维码中场馆id
  56. this.venueId = options.venueId
  57. },
  58. onShow() {
  59. this.tableList = []
  60. this.getTableList()
  61. },
  62. onReady() {},
  63. methods: {
  64. // 跳转详情
  65. handleJumpClick(item) {
  66. uni.navigateTo({
  67. url: '/pagesMain/subscribeInfo?item=' + encodeURIComponent(JSON.stringify(item)) + '&venueId=' + this.venueId
  68. })
  69. },
  70. // 下拉刷新
  71. onRefresh() {
  72. this.triggered = true
  73. this.isOver = false
  74. this.pageIndex = 1
  75. this.tableList = []
  76. this.getTableList()
  77. },
  78. // 重置下拉刷新状态
  79. onRestore() {
  80. this.triggered = 'restore'
  81. this.triggered = false
  82. },
  83. // 懒加载
  84. handleLoadMore() {
  85. if (!this.isOver) {
  86. this.pageIndex++
  87. this.getTableList()
  88. }
  89. },
  90. // 获取列表数据
  91. getTableList() {
  92. // id:场馆id
  93. NET.request(API.getSubscribeList, {
  94. id: this.venueId,
  95. page: this.pageIndex,
  96. size: 10,
  97. }, 'POST').then(res => {
  98. this.triggered = false
  99. this.tableList = this.tableList.concat(res.data.row)
  100. this.isOver = res.data.row.length != 10
  101. }).catch(error => {
  102. this.triggered = false
  103. this.$refs.uTips.show({
  104. title: error.message,
  105. type: 'warning',
  106. })
  107. })
  108. }
  109. },
  110. }
  111. </script>
  112. <style>
  113. page {
  114. width: 100%;
  115. height: 100%;
  116. background-color: #f7f7f7;
  117. }
  118. </style>
  119. <style lang="scss" scoped>
  120. @import "@/static/css/themes.scss";
  121. .content {
  122. width: 100%;
  123. float: left;
  124. .scroll-box {
  125. width: 100%;
  126. height: 100vh;
  127. padding-bottom: 10px;
  128. box-sizing: border-box;
  129. .class-card {
  130. .class-content {
  131. padding: 5px 15px;
  132. }
  133. .student-name {
  134. height: 20px;
  135. display: inline-block;
  136. padding: 0 10px;
  137. margin-right: 5px;
  138. background-color: $mainColor;
  139. border-radius: 10px;
  140. line-height: 20px;
  141. color: #FFFFFF;
  142. }
  143. .class-name {
  144. height: 20px;
  145. display: inline-block;
  146. font-weight: bold;
  147. font-size: 14px;
  148. line-height: 20px;
  149. }
  150. .class-info-text {
  151. color: #999999;
  152. margin-bottom: 5px;
  153. /deep/.u-icon {
  154. margin-right: 5px;
  155. font-size: 14px;
  156. color: #000000;
  157. }
  158. }
  159. }
  160. .class-foot {
  161. padding: 10px 15px;
  162. text-align: right;
  163. }
  164. }
  165. }
  166. </style>