meViolation.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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>违规项:{{item.reason}}</view>
  7. <view>违规时间:{{item.createTime}}</view>
  8. <view>处理方式:{{item.treatmentMethod}}</view>
  9. </view>
  10. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  11. </scroll-view>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. examViolationMyAppList
  17. } from '@/pages_student/api/index.js'
  18. export default {
  19. data() {
  20. return {
  21. total: 0,
  22. dataList: [],
  23. getDataType: false,
  24. // 查询参数
  25. queryParams: {
  26. page: 1,
  27. pageSize: 10,
  28. },
  29. }
  30. },
  31. onLoad() {
  32. },
  33. onShow() {
  34. this.getList();
  35. },
  36. methods: {
  37. //滚动加载事件
  38. scrollGet() {
  39. let self = this;
  40. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  41. this.$set(this, 'getDataType', true);
  42. } else {
  43. this.queryParams.page += 1;
  44. this.$nextTick(() => {
  45. this.getList();
  46. })
  47. }
  48. },
  49. //获取数据列表
  50. async getList() {
  51. let self = this;
  52. let obj = JSON.parse(JSON.stringify(this.queryParams));
  53. obj.deptId = this.facultyIndex ? this.facultyList[this.facultyIndex].deptId : '';
  54. obj.typeId = this.subjectIndex ? this.subjectList[this.subjectIndex].typeId : '';
  55. obj.levelId = this.levelIndex ? this.levelList[this.levelIndex].levelId : '';
  56. const {
  57. data
  58. } = await examViolationMyAppList(obj);
  59. if (data.code == 200) {
  60. if (self.queryParams.page == 1) {
  61. this.dataList = data.data.records;
  62. this.total = data.data.total;
  63. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  64. this.$set(this, 'getDataType', true);
  65. }
  66. } else {
  67. this.dataList = [...this.dataList, ...data.data.records]
  68. this.total = data.data.total;
  69. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  70. this.$set(this, 'getDataType', true);
  71. }
  72. }
  73. }
  74. },
  75. }
  76. }
  77. </script>
  78. <style lang="stylus" scoped>
  79. #meViolation {
  80. height: 100%;
  81. display flex;
  82. flex-direction column;
  83. .max-list-box {
  84. flex: 1;
  85. overflow-y: scroll;
  86. .for-list-box {
  87. background #fff;
  88. border-top: 1rpx solid #E0E0E0;
  89. padding: 20rpx;
  90. view {
  91. display: block;
  92. overflow: hidden;
  93. text-overflow: ellipsis;
  94. white-space: nowrap;
  95. }
  96. }
  97. .get-data-null-p {
  98. text-align: center;
  99. line-height: 80rpx;
  100. padding-bottom: 40px;
  101. color: #999;
  102. }
  103. }
  104. }
  105. </style>