evaluateList.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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" :foot-border-top="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
  7. :key="index" class="class-card" @click="goToDetail(item)">
  8. <view class="class-content" slot="head" style="padding-top: 10px;">
  9. <view class="class-name">{{item.name}}</view>
  10. </view>
  11. <view class="class-content" slot="body">
  12. <view class="class-info-text">
  13. <u-icon name="clock"></u-icon>
  14. {{item.classStartHours}}-{{item.classEndHours}}&nbsp;&nbsp;{{item.classStartDate}}-{{item.classEndDate}}
  15. </view>
  16. <view class="class-info-text">
  17. <u-icon name="map"></u-icon>
  18. {{item.address}}
  19. </view>
  20. <view class="class-info-text">
  21. <u-icon name="account"></u-icon>
  22. 学员人数:<text>{{item.studentCount}}</text>人
  23. </view>
  24. <view class="class-info-text">
  25. <u-icon name="tags"></u-icon>
  26. 教练评价:<text>{{item.totalCount}}</text>条
  27. </view>
  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. 'mainColor'
  45. ])
  46. },
  47. data() {
  48. return {
  49. triggered: false,
  50. isOver: false,
  51. pageIndex: 1,
  52. tableList: [],
  53. }
  54. },
  55. onLoad() {
  56. this.getTableList()
  57. },
  58. onReady() {},
  59. methods: {
  60. // 下拉刷新
  61. onRefresh() {
  62. this.triggered = true
  63. this.isOver = false
  64. this.pageIndex = 1
  65. this.tableList = []
  66. this.getTableList()
  67. },
  68. // 重置下拉刷新状态
  69. onRestore() {
  70. this.triggered = 'restore'
  71. this.triggered = false
  72. },
  73. // 懒加载
  74. handleLoadMore() {
  75. if (!this.isOver) {
  76. this.pageIndex++
  77. this.getTableList()
  78. }
  79. },
  80. // 获取列表数据
  81. getTableList() {
  82. NET.request(API.getEvaluateList, {
  83. page: this.pageIndex,
  84. size: 10,
  85. }, 'POST').then(res => {
  86. this.triggered = false
  87. this.tableList = this.tableList.concat(res.data.row)
  88. this.isOver = res.data.row.length != 10
  89. }).catch(error => {
  90. this.triggered = false
  91. this.$refs.uTips.show({
  92. title: error.message,
  93. type: 'warning',
  94. })
  95. })
  96. },
  97. goToDetail(item) {
  98. uni.navigateTo({
  99. url: '/pagesMain/evaluateDetail?id=' + item.id
  100. });
  101. }
  102. },
  103. }
  104. </script>
  105. <style>
  106. page {
  107. width: 100%;
  108. height: 100%;
  109. background-color: #f7f7f7;
  110. }
  111. </style>
  112. <style lang="scss" scoped>
  113. @import "@/static/css/themes.scss";
  114. .content {
  115. width: 100%;
  116. float: left;
  117. .scroll-box {
  118. width: 100%;
  119. height: 100vh;
  120. box-sizing: border-box;
  121. padding-bottom: 10px;
  122. .class-card {
  123. .class-content {
  124. padding: 5px 15px;
  125. }
  126. .class-name {
  127. height: 20px;
  128. display: inline-block;
  129. font-weight: bold;
  130. font-size: 14px;
  131. line-height: 20px;
  132. }
  133. .class-info-text {
  134. color: #999999;
  135. margin-bottom: 5px;
  136. /deep/.u-icon {
  137. margin-right: 5px;
  138. font-size: 14px;
  139. color: #000000;
  140. }
  141. text {
  142. color: $mainColor;
  143. }
  144. }
  145. }
  146. }
  147. }
  148. </style>