meViolation.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <!-- 我的违规 -->
  2. <template>
  3. <view id="meViolation">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="max-list-box">
  5. <view class="for-list-box" v-for="(item,index) in dataList" :key="index">
  6. <view class="left-box">
  7. <view>违规时间:{{item.createTime}}</view>
  8. <view>{{item.violationContent}}</view>
  9. </view>
  10. <view class="right-box" :class="{'colorA':item.penaltyType!=0}">线下约谈</view>
  11. <img src="@/pages_student/images/icon_wdwg_gd.png" v-if="item.penaltyType==0">
  12. </view>
  13. <view class="get-null-box" v-if="getData.nullDataType">暂无更多数据</view>
  14. </scroll-view>
  15. </view>
  16. </template>
  17. <script>
  18. import { getViolationList } from '@/api/index.js'
  19. export default {
  20. data() {
  21. return {
  22. dataList:[],
  23. //列表请求参数
  24. getData:{
  25. page:1,
  26. pageSize:20,
  27. getType:true,
  28. nullDataType:true,
  29. }
  30. }
  31. },
  32. onLoad() {
  33. },
  34. onShow(){
  35. this.clearData();
  36. this.getList();
  37. },
  38. methods: {
  39. //去考试
  40. goExamList(item){
  41. if(item.penaltyType == 0){
  42. uni.navigateTo({
  43. url: '/pages_student/workbench/exam/examList?violationId='+encodeURIComponent(JSON.stringify(item.id))
  44. });
  45. }
  46. },
  47. //清除
  48. clearData(){
  49. this.infoList = [];
  50. this.getData.page = 1;
  51. this.getData.getType = true;
  52. this.getData.nullDataType = true;
  53. },
  54. //滚动事件
  55. scrollGet(){
  56. if(this.getData.getType){
  57. this.getData.page += 1;
  58. this.getList();
  59. }
  60. },
  61. // 查询违规记录列表 (用户端)
  62. async getList(){
  63. let self = this;
  64. let obj = {
  65. pageNum:this.getData.page,
  66. pageSize:this.getData.pageSize,
  67. }
  68. let {data} = await getViolationList(obj)
  69. if(data.code==200){
  70. if(self.getData.page==1){
  71. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  72. self.dataList = data.rows;
  73. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  74. self.dataList = data.rows;
  75. self.getData.getType = false;
  76. self.getData.nullDataType = true;
  77. }else{
  78. self.getData.getType = false;
  79. self.getData.nullDataType = true;
  80. }
  81. }else{
  82. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  83. self.dataList = self.dataList.concat(data.rows)
  84. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  85. self.dataList = self.dataList.concat(data.rows);
  86. self.getData.getType = false;
  87. self.getData.nullDataType = true;
  88. }else{
  89. self.getData.getType = false;
  90. self.getData.nullDataType = true;
  91. }
  92. }
  93. }
  94. },
  95. }
  96. }
  97. </script>
  98. <style lang="stylus" scoped>
  99. #meViolation{
  100. height:100%;
  101. width:100%;
  102. display flex
  103. .max-list-box{
  104. flex:1;
  105. overflow: scroll
  106. .for-list-box{
  107. background #fff
  108. border-top:1rpx solid #E0E0E0;
  109. display flex
  110. .left-box{
  111. flex:1;
  112. view:nth-child(1){
  113. line-height:22rpx;
  114. font-size:22rpx;
  115. margin:21rpx 0 0 19rpx;
  116. color: #666
  117. }
  118. view:nth-child(2){
  119. line-height:29rpx;
  120. font-size:29rpx;
  121. margin:27rpx 0 0 19rpx;
  122. color: #333
  123. }
  124. }
  125. .right-box{
  126. line-height:120rpx;
  127. width:140rpx;
  128. color:#0183FA;
  129. text-align: right
  130. margin-right:20rpx;
  131. }
  132. .colorA{
  133. color:#999;
  134. margin-right:60rpx;
  135. }
  136. img{
  137. height:20rpx;
  138. width:20rpx;
  139. margin:51rpx 20rpx 50rpx 0;
  140. }
  141. }
  142. .get-null-box{
  143. height:100rpx;
  144. line-height:100rpx;
  145. color:#999;
  146. text-align center
  147. }
  148. }
  149. }
  150. </style>