江西小程序管理端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
2.9 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="学员评价"></topNavbar>
  4. <view class="pad">
  5. <view class="searchBox">
  6. <searchRow placeholder="搜索学员姓名"></searchRow>
  7. </view>
  8. <view class="tabs">
  9. <view class="tab" :class="{active: this.params.condition==0}" @click="changeTab(0)">全部0</view>
  10. <view class="tab" :class="{active: this.params.condition==1}" @click="changeTab(1)">匿名1</view>
  11. <view class="tab" :class="{active: this.params.condition==2}" @click="changeTab(2)">有图2</view>
  12. <view class="tab" :class="{active: this.params.condition==3}" @click="changeTab(3)">有视频3</view>
  13. </view>
  14. <view class="list">
  15. <view class="card" v-for="(item,index) in list" :key="index">
  16. <commentItem :item="item" />
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import { schoolCommentPage } from '@/config/api.js'
  24. export default {
  25. data() {
  26. return {
  27. list: [],
  28. tabData: [
  29. {id: 0, lab: '全部'},
  30. {id: 1, lab: '有图'},
  31. {id: 2, lab: '匿名'},
  32. {id: 3, lab: '有视频'},
  33. ],
  34. params: {
  35. pageNo: 1,
  36. pageSize: 20,
  37. schoolId: '1590992062959960065',
  38. condition: 0
  39. },
  40. // 0查全部 1有图 2最新 3有视频
  41. total: 20,
  42. status: 'loading'
  43. }
  44. },
  45. onLoad() {
  46. this.schoolCommentPageFn()
  47. },
  48. onPullDownRefresh() {
  49. this.list = []
  50. this.params.pageNo = 1
  51. this.schoolCommentPageFn().then(()=>{uni.stopPullDownRefresh()})
  52. },
  53. onReachBottom() {
  54. if(this.total>this.list.length) {
  55. this.schoolCommentPageFn()
  56. }
  57. },
  58. methods: {
  59. changeTab(val) {
  60. this.params.condition = val
  61. this.initList()
  62. },
  63. initList() {
  64. this.list = []
  65. this.params.pageNo = 1
  66. this.schoolCommentPageFn()
  67. },
  68. async schoolCommentPageFn() {
  69. const {data: res} = await schoolCommentPage(this.params)
  70. this.params.pageNo ++
  71. let arr = res.list.map(item=>{
  72. if(item.images) {
  73. item.images = item.images.split(',')
  74. }
  75. return item
  76. })
  77. this.list.push(...arr)
  78. this.total = res.total
  79. if(this.list.length>=this.total) {
  80. this.status = 'nomore'
  81. }else {
  82. this.status = 'loading'
  83. }
  84. console.log(res)
  85. },
  86. searchFn(val) {
  87. console.log(val)
  88. this.params.name = val
  89. this.list = []
  90. this.params.pageNo = 1
  91. this.schoolCommentPageFn()
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .card {
  98. padding: 28rpx;
  99. margin-bottom: 20rpx;
  100. }
  101. .tabs {
  102. display: flex;
  103. justify-content: space-between;
  104. padding: 24rpx 12rpx;
  105. .tab {
  106. line-height: 76rpx;
  107. font-size: 28rpx;
  108. color: #fff;
  109. &.active {
  110. position: relative;
  111. &::before {
  112. position: absolute;
  113. content: '';
  114. left: 50%;
  115. bottom: 0;
  116. transform: translateX(-50%);
  117. width: 56rpx;
  118. height: 6rpx;
  119. background: #FFFFFF;
  120. border-radius: 3rpx;
  121. }
  122. }
  123. }
  124. }
  125. </style>