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.

156 lines
3.8 KiB

9 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <view class="status_bar"></view>
  4. <view class="navH"></view>
  5. <view class="pad">
  6. <view class="searchBox">
  7. <searchRow placeholder="搜索学员姓名" @searchFn="searchFn"></searchRow>
  8. </view>
  9. <view class="tabs">
  10. <view class="tab" :class="{active: this.params.condition==0}" @click="changeTab(0)">全部{{ totalType.total1 }}</view>
  11. <view class="tab" :class="{active: this.params.condition==1}" @click="changeTab(1)">匿名{{ totalType.total2 }}</view>
  12. <view class="tab" :class="{active: this.params.condition==2}" @click="changeTab(2)">有图{{ totalType.total3 }}</view>
  13. <view class="tab" :class="{active: this.params.condition==3}" @click="changeTab(3)">有视频{{ totalType.total4 }}</view>
  14. </view>
  15. <view class="list" v-if="list.length">
  16. <view class="card" v-for="(item,index) in list" :key="index">
  17. <commentItem :item="item"/>
  18. </view>
  19. </view>
  20. <view style="padding-bottom: 20rpx;" v-if="list.length>5">
  21. <u-loadmore :status="status" />
  22. </view>
  23. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  24. </view>
  25. <UserTab name ='学员评价'></UserTab>
  26. </view>
  27. </template>
  28. <script>
  29. import { coachCommentPage, pageCoachCommentTotal } from '@/config/api.js'
  30. export default {
  31. data() {
  32. return {
  33. list: [],
  34. params: {
  35. pageNo: 1,
  36. pageSize: 20,
  37. schoolId: '',
  38. condition: 0,
  39. studentName: '',
  40. coachType: '3', //1.教练 2.模拟教练 3.模拟器老师
  41. },
  42. // 0查全部 1有图 2最新 3有视频
  43. total: 20,
  44. status: 'loading',
  45. totalType: {}
  46. }
  47. },
  48. created() {
  49. this.params.schoolId = this.vuex_schoolId
  50. // if(this.identity=='实操教练') {
  51. // this.params.coachType = 1
  52. // }else if(this.identity=='考场模拟教练'){
  53. // this.params.coachType = 2
  54. // }else if(this.identity=='模拟器老师'){
  55. // this.params.coachType = 3
  56. // }
  57. this.coachCommentPageFn()
  58. this.pageCoachCommentTotalFn()
  59. },
  60. methods: {
  61. // 查条数
  62. async pageCoachCommentTotalFn() {
  63. let obj = {
  64. coachType : 3,
  65. coachId : this.vuex_coachId,
  66. schoolId : this.params.schoolId
  67. }
  68. let {data: res} = await pageCoachCommentTotal(obj)
  69. this.totalType = {
  70. total1: res.total1,
  71. total2: res.total2,
  72. total3: res.total3,
  73. total4: res.total4,
  74. }
  75. },
  76. loadMore() {
  77. if(this.total>this.list.length) {
  78. this.coachCommentPageFn()
  79. }
  80. },
  81. searchFn(val) {
  82. this.params.studentName = val
  83. this.initList()
  84. },
  85. changeTab(val) {
  86. if(this.params.condition == val) return
  87. this.params.condition = val
  88. this.initList()
  89. },
  90. initList() {
  91. this.list = []
  92. this.params.pageNo = 1
  93. this.status = 'loading'
  94. this.coachCommentPageFn()
  95. },
  96. async coachCommentPageFn() {
  97. var {data: res} = await coachCommentPage(this.params)
  98. this.params.pageNo ++
  99. let arr = res.list.map(item=>{
  100. if(item.images) {
  101. item.images = item.images.split(',')
  102. }
  103. return item
  104. })
  105. this.list.push(...arr)
  106. this.total = res.total
  107. if(this.list.length>=this.total) {
  108. this.status = 'nomore'
  109. }else {
  110. this.status = 'loading'
  111. }
  112. console.log(res)
  113. },
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .navH {
  119. width: 100%;
  120. height: 90rpx;
  121. }
  122. .card {
  123. padding: 28rpx;
  124. margin-bottom: 20rpx;
  125. }
  126. .tabs {
  127. display: flex;
  128. justify-content: space-between;
  129. padding: 24rpx 12rpx;
  130. .tab {
  131. line-height: 76rpx;
  132. font-size: 28rpx;
  133. color: #fff;
  134. &.active {
  135. position: relative;
  136. &::before {
  137. position: absolute;
  138. content: '';
  139. left: 50%;
  140. bottom: 0;
  141. transform: translateX(-50%);
  142. width: 56rpx;
  143. height: 6rpx;
  144. background: #FFFFFF;
  145. border-radius: 3rpx;
  146. }
  147. }
  148. }
  149. }
  150. </style>