subscribeListAll.vue 4.0 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;display:flex;justify-content: space-between;">
  9. <view>
  10. <view class="student-name">{{item.studentName}}</view>
  11. <view class="class-name">{{item.name}}</view>
  12. </view>
  13. <view class="class-name">{{ item.experience ? '已确认' : '未确认' }}</view>
  14. </view>
  15. <view class="class-content" slot="body">
  16. <view class="class-info-text">
  17. <u-icon name="clock"></u-icon>
  18. {{item.classStartDate}}&nbsp;&nbsp;{{item.classStartHours}}
  19. </view>
  20. <view class="class-info-text">
  21. <u-icon name="map"></u-icon>
  22. {{item.address}}
  23. </view>
  24. </view>
  25. <!-- <view class="class-foot" slot="foot">
  26. <u-button type="default" shape="circle" :ripple="true" :custom-style="handleDefaultCustomStyle" size="mini"
  27. :hair-line="false" plain>已预约</u-button>
  28. </view> -->
  29. </u-card>
  30. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  31. </scroll-view>
  32. <u-top-tips ref="uTips"></u-top-tips>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. mapGetters
  38. } from 'vuex'
  39. const NET = require('@/utils/request')
  40. const API = require('@/config/api')
  41. export default {
  42. computed: {
  43. ...mapGetters([
  44. 'handleDefaultCustomStyle',
  45. ])
  46. },
  47. data() {
  48. return {
  49. triggered: false,
  50. isOver: false,
  51. pageIndex: 1,
  52. tableList: [],
  53. }
  54. },
  55. onLoad(options) {
  56. console.log(options);
  57. // 二维码中场馆id
  58. },
  59. onShow() {
  60. this.tableList = []
  61. this.getTableList()
  62. },
  63. onReady() {},
  64. methods: {
  65. // 跳转详情
  66. handleJumpClick(item) {
  67. uni.navigateTo({
  68. url: '/pagesMain/subscribeInfo?item=' + encodeURIComponent(JSON.stringify(item))
  69. })
  70. },
  71. // 下拉刷新
  72. onRefresh() {
  73. this.triggered = true
  74. this.isOver = false
  75. this.pageIndex = 1
  76. this.tableList = []
  77. this.getTableList()
  78. },
  79. // 重置下拉刷新状态
  80. onRestore() {
  81. this.triggered = 'restore'
  82. this.triggered = false
  83. },
  84. // 懒加载
  85. handleLoadMore() {
  86. if (!this.isOver) {
  87. this.pageIndex++
  88. this.getTableList()
  89. }
  90. },
  91. // 获取列表数据
  92. getTableList() {
  93. // id:场馆id
  94. NET.request(API.getSubscribeList, {
  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>