extraLessonsList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 :foot-border-top="false" padding="0" margin="10px" borderRadius="40" v-for="(item, index) in tableList" :key="index"
  7. class="card-container" @click="goToDetail(item)">
  8. <view class="card-content" slot="head" style="display: flex;">
  9. <view class="card-img">
  10. <u-avatar :src="item.url" size="100"></u-avatar>
  11. </view>
  12. <view>
  13. <view class="card-title">{{item.name}}</view>
  14. <view class="card-info-text">手机号:{{item.phone}}</view>
  15. <view class="card-info-text">地址:{{item.address}}</view>
  16. </view>
  17. </view>
  18. <view class="card-content" slot="body">
  19. <view class="card-info-text">{{item.remark}}</view>
  20. </view>
  21. <view class="card-content" slot="foot" style="padding-top: 0;">
  22. <view class="card-info-text" style="text-align: right;">{{item.time}}</view>
  23. </view>
  24. </u-card>
  25. <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
  26. </scroll-view>
  27. <u-top-tips ref="uTips"></u-top-tips>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. mapGetters
  33. } from 'vuex'
  34. const NET = require('@/utils/request')
  35. const API = require('@/config/api')
  36. export default {
  37. computed: {
  38. ...mapGetters([
  39. 'mainColor'
  40. ])
  41. },
  42. data() {
  43. return {
  44. triggered: false,
  45. isOver: false,
  46. pageIndex: 1,
  47. tableList: [],
  48. }
  49. },
  50. onLoad() {
  51. this.getTableList()
  52. },
  53. onReady() {},
  54. methods: {
  55. // 下拉刷新
  56. onRefresh() {
  57. this.triggered = true
  58. this.isOver = false
  59. this.pageIndex = 1
  60. this.tableList = []
  61. this.getTableList()
  62. },
  63. // 重置下拉刷新状态
  64. onRestore() {
  65. this.triggered = 'restore'
  66. this.triggered = false
  67. },
  68. // 懒加载
  69. handleLoadMore() {
  70. if (!this.isOver) {
  71. this.pageIndex++
  72. this.getTableList()
  73. }
  74. },
  75. // 获取列表数据
  76. getTableList() {
  77. NET.request(API.getExtraLessonsList, {
  78. page: this.pageIndex,
  79. size: 10,
  80. }, 'POST').then(res => {
  81. this.triggered = false
  82. this.tableList = this.tableList.concat(res.data.row)
  83. this.isOver = res.data.row.length != 10
  84. }).catch(error => {
  85. this.triggered = false
  86. this.$refs.uTips.show({
  87. title: error.message,
  88. type: 'warning',
  89. })
  90. })
  91. },
  92. goToDetail(item) {
  93. uni.navigateTo({
  94. url: '/pagesMain/evaluateDetail?id=' + item.id
  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. box-sizing: border-box;
  116. padding-bottom: 10px;
  117. .card-container {
  118. .card-content {
  119. padding: 10px 15px;
  120. }
  121. .card-img {
  122. width: 50px;
  123. height: 50px;
  124. margin-right: 10px;
  125. display: flex;
  126. align-items: center;
  127. justify-content: center;
  128. }
  129. .card-title {
  130. font-size: 14px;
  131. line-height: 20px;
  132. }
  133. .card-info-text {
  134. color: #999999;
  135. }
  136. }
  137. }
  138. }
  139. </style>