visitLogList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="log" >
  3. <view class="" v-if="list.length">
  4. <u-list @scrolltolower="scrolltolower" height="90vh">
  5. <view v-for="(item,index) in list" :key="index" class="log-item">
  6. <view class="log-item-content">
  7. <view class="log-item-content-left">
  8. <image style="width: 80rpx;height: 80rpx;border-radius: 50%;" :src="item.teacher.teacher_photo" mode=""></image>
  9. <view class="log-item-content-left-text">
  10. <view class="">
  11. {{item.teacher.teacher_name}}
  12. </view>
  13. <view class="">
  14. {{item.teacher.teacher_number}}
  15. </view>
  16. </view>
  17. </view>
  18. <view class="log-item-content-right">
  19. <view :style="`background:${item.color} ;` " class="log-item-content-right-color">
  20. </view>
  21. <view :style="{color : item.state==1 ? '#43B3FF' : item.state==2 ? '#05cca1' : '#FE6B6B'}" class="log-item-content-right-text">
  22. {{item.state_text}}
  23. </view>
  24. </view>
  25. </view>
  26. <view class="log-item-info">
  27. <view style="color: #999;">
  28. 拜访人
  29. </view>
  30. <view>
  31. {{item.student.student_name}}
  32. </view>
  33. </view>
  34. <view class="log-item-info">
  35. <view style="color: #999;">
  36. 拜访时间
  37. </view>
  38. <view>
  39. {{item.visit_time_str}}
  40. </view>
  41. </view>
  42. <view style="border: 0;padding-bottom: 0;" class="log-item-info">
  43. <view style="color: #999;">
  44. 拜访事由
  45. </view>
  46. <view>
  47. {{item.reason}}
  48. </view>
  49. </view>
  50. <view style="border: 0;padding-bottom: 0;" class="log-item-info">
  51. <view style="color: #999;">
  52. 备注
  53. </view>
  54. <view>
  55. {{item.notes}}
  56. </view>
  57. </view>
  58. </view>
  59. <u-loadmore status="nomore" v-if="is_bottom"/>
  60. </u-list>
  61. </view>
  62. <view class="" v-else>
  63. <u-empty mode="data" ></u-empty>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import { getVisitList } from "@/common/api/visit.js"
  69. export default {
  70. name: "visitLogList",
  71. props : {
  72. stu_school_id : {
  73. type : Number,
  74. default : '',
  75. }
  76. },
  77. data() {
  78. return {
  79. list : [],
  80. is_showed : false, //第一次展示的时候查询一次,后续不需要
  81. page : 1,
  82. is_bottom : false,
  83. };
  84. },
  85. methods : {
  86. scrolltolower(){
  87. if(this.is_bottom==true) return
  88. this.$api.sendRequest({
  89. url: getVisitList,
  90. method : 'post',
  91. data : {
  92. stu_school_id : this.stu_school_id,
  93. size : 10,
  94. page : this.page
  95. },
  96. success: res => {
  97. console.log(res,"xiala");
  98. if(res.data.data.length==0){
  99. this.is_bottom=true
  100. }else{
  101. res.data.data.map(item=>{
  102. this.list.push(item)
  103. })
  104. this.page++
  105. }
  106. }
  107. })
  108. },
  109. setShow(){
  110. if(this.is_showed==false){
  111. this.getVisitList()
  112. this.is_showed=true
  113. }
  114. },
  115. getVisitList(){
  116. this.$api.sendRequest({
  117. url: getVisitList,
  118. method : 'post',
  119. data : {
  120. stu_school_id : this.stu_school_id,
  121. size : 10,
  122. },
  123. success: res => {
  124. console.log(res,"baifangjlu");
  125. this.list=res.data.data
  126. this.page++
  127. }
  128. })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .log {
  135. box-sizing: border-box;
  136. width: 100%;
  137. height: 60vh;
  138. .log-item {
  139. padding: 32rpx;
  140. box-sizing: border-box;
  141. margin-bottom: 32rpx;
  142. width: 100%;
  143. background: #ffffff;
  144. border-radius: 5.33px;
  145. box-shadow: 0px 0px 6.67px 0px rgba(147, 147, 147, 0.10);
  146. .log-item-info {
  147. width: 100%;
  148. padding: 24rpx 0;
  149. border-bottom: 1px solid #f2f2f2;
  150. display: flex;
  151. justify-content: space-between;
  152. }
  153. .log-item-content {
  154. width: 100%;
  155. border-bottom: 1px solid #f2f2f2;
  156. font-size: 24rpx;
  157. padding-bottom: 24rpx;
  158. display: flex;
  159. align-items: center;
  160. }
  161. .log-item-content-left {
  162. display: flex;
  163. align-items: center;
  164. flex: 1;
  165. .log-item-content-left-text {
  166. margin-left: 32rpx;
  167. }
  168. }
  169. .log-item-content-right {
  170. display: flex;
  171. align-items: center;
  172. }
  173. .log-item-content-right-color {
  174. width: 20rpx;
  175. height: 20rpx;
  176. border-radius: 50%;
  177. margin-right: 20rpx;
  178. }
  179. }
  180. }
  181. </style>