evaluateList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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">
  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-content" slot="foot" style="display: flex;">
  23. <view class="class-foot-label">评价信息:</view>
  24. <view class="class-foot-content">
  25. <u-rate :count="5" v-model="item.level" :active-color="mainColor" disabled></u-rate>
  26. <view class="class-foot-text">{{item.content}}</view>
  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. },
  98. }
  99. </script>
  100. <style>
  101. page {
  102. width: 100%;
  103. height: 100%;
  104. background-color: #f7f7f7;
  105. }
  106. </style>
  107. <style lang="scss" scoped>
  108. @import "@/static/css/themes.scss";
  109. .content {
  110. width: 100%;
  111. float: left;
  112. .scroll-box {
  113. width: 100%;
  114. height: 100vh;
  115. padding-bottom: 10px;
  116. box-sizing: border-box;
  117. .class-card {
  118. .class-content {
  119. padding: 5px 15px;
  120. }
  121. .student-name {
  122. height: 20px;
  123. display: inline-block;
  124. padding: 0 10px;
  125. margin-right: 5px;
  126. background-color: $mainColor;
  127. border-radius: 10px;
  128. line-height: 20px;
  129. color: #FFFFFF;
  130. }
  131. .class-name {
  132. height: 20px;
  133. display: inline-block;
  134. font-weight: bold;
  135. font-size: 14px;
  136. line-height: 20px;
  137. }
  138. .class-info-text {
  139. color: #999999;
  140. margin-bottom: 5px;
  141. /deep/.u-icon {
  142. margin-right: 5px;
  143. font-size: 14px;
  144. color: #000000;
  145. }
  146. }
  147. .class-foot-label {
  148. width: 60px;
  149. color: #999999;
  150. }
  151. .class-foot-content {
  152. flex: 1;
  153. .class-foot-text {
  154. width: 100%;
  155. margin: 5px 0;
  156. float: left;
  157. color: #666666;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. </style>