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.

179 lines
4.2 KiB

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