evaluateList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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">
  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}}&nbsp;&nbsp;{{item.residue}}课时
  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.list)
  88. this.isOver = res.data.list.length != 10
  89. }).catch(error => {
  90. this.triggered = false
  91. this.$refs.uTips.show({
  92. title: error.data.msg,
  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. .class-card {
  116. .class-content {
  117. padding: 5px 15px;
  118. }
  119. .student-name {
  120. height: 20px;
  121. display: inline-block;
  122. padding: 0 10px;
  123. margin-right: 5px;
  124. background-color: $mainColor;
  125. border-radius: 10px;
  126. line-height: 20px;
  127. color: #FFFFFF;
  128. }
  129. .class-name {
  130. height: 20px;
  131. display: inline-block;
  132. font-weight: bold;
  133. font-size: 14px;
  134. line-height: 20px;
  135. }
  136. .class-info-text {
  137. color: #999999;
  138. margin-bottom: 5px;
  139. /deep/.u-icon {
  140. margin-right: 5px;
  141. font-size: 14px;
  142. color: #000000;
  143. }
  144. }
  145. .class-foot-label {
  146. width: 60px;
  147. color: #999999;
  148. }
  149. .class-foot-content {
  150. flex: 1;
  151. .class-foot-text {
  152. width: 100%;
  153. margin: 5px 0;
  154. float: left;
  155. color: #666666;
  156. }
  157. }
  158. }
  159. }
  160. }
  161. </style>