subscribeListAll.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. }
  51. },
  52. onLoad(options) {
  53. console.log(options);
  54. // 二维码中场馆id
  55. },
  56. onShow() {
  57. this.tableList = []
  58. this.getTableList()
  59. },
  60. onReady() {},
  61. methods: {
  62. // 跳转详情
  63. handleJumpClick(item) {
  64. uni.navigateTo({
  65. url: '/pagesMain/subscribeInfo?item=' + encodeURIComponent(JSON.stringify(item))
  66. })
  67. },
  68. // 下拉刷新
  69. onRefresh() {
  70. this.triggered = true
  71. this.isOver = false
  72. this.pageIndex = 1
  73. this.tableList = []
  74. this.getTableList()
  75. },
  76. // 重置下拉刷新状态
  77. onRestore() {
  78. this.triggered = 'restore'
  79. this.triggered = false
  80. },
  81. // 懒加载
  82. handleLoadMore() {
  83. if (!this.isOver) {
  84. this.pageIndex++
  85. this.getTableList()
  86. }
  87. },
  88. // 获取列表数据
  89. getTableList() {
  90. // id:场馆id
  91. NET.request(API.getSubscribeList, {
  92. page: this.pageIndex,
  93. size: 10,
  94. }, 'POST').then(res => {
  95. this.triggered = false
  96. this.tableList = this.tableList.concat(res.data.row)
  97. this.isOver = res.data.row.length != 10
  98. }).catch(error => {
  99. this.triggered = false
  100. this.$refs.uTips.show({
  101. title: error.message,
  102. type: 'warning',
  103. })
  104. })
  105. }
  106. },
  107. }
  108. </script>
  109. <style>
  110. page {
  111. width: 100%;
  112. height: 100%;
  113. background-color: #f7f7f7;
  114. }
  115. </style>
  116. <style lang="scss" scoped>
  117. @import "@/static/css/themes.scss";
  118. .content {
  119. width: 100%;
  120. float: left;
  121. .scroll-box {
  122. width: 100%;
  123. height: 100vh;
  124. padding-bottom: 10px;
  125. box-sizing: border-box;
  126. .class-card {
  127. .class-content {
  128. padding: 5px 15px;
  129. }
  130. .student-name {
  131. height: 20px;
  132. display: inline-block;
  133. padding: 0 10px;
  134. margin-right: 5px;
  135. background-color: $mainColor;
  136. border-radius: 10px;
  137. line-height: 20px;
  138. color: #FFFFFF;
  139. }
  140. .class-name {
  141. height: 20px;
  142. display: inline-block;
  143. font-weight: bold;
  144. font-size: 14px;
  145. line-height: 20px;
  146. }
  147. .class-info-text {
  148. color: #999999;
  149. margin-bottom: 5px;
  150. /deep/.u-icon {
  151. margin-right: 5px;
  152. font-size: 14px;
  153. color: #000000;
  154. }
  155. }
  156. }
  157. .class-foot {
  158. padding: 10px 15px;
  159. text-align: right;
  160. }
  161. }
  162. }
  163. </style>