zlgztzs.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view>
  3. <view class="main" v-if="list.length>0 && isLoaded">
  4. <view v-for="(item, index) in list" :key="index">
  5. <uni-card>
  6. <view>
  7. <view class="main-item">
  8. <view class="name-align-zlzgtzs">单位名称:</view>
  9. <view class="conts">{{ item.dwmc }}</view>
  10. </view>
  11. <view class="main-item">
  12. <view class="name-align-zlzgtzs">被检查单位:</view>
  13. <view class="conts">{{ item.bjcdw }}</view>
  14. </view>
  15. <view class="main-item">
  16. <view class="name-align-zlzgtzs">检查日期:</view>
  17. <view class="conts">{{ item.jcrq }}</view>
  18. </view>
  19. <view class="an-niu" @click.native="onClick(item.id)" link>
  20. <text class="detail">查看</text>
  21. </view>
  22. </view>
  23. </uni-card>
  24. </view>
  25. </view>
  26. <view v-else-if="list.length==0 && isLoaded" style="text-align: center;">
  27. <view class="text-gray" style="padding-top: 20px;">
  28. <img :src="tan90" alt="暂无数据" />
  29. </view>
  30. </view>
  31. <!-- 加载中 -->
  32. <isLodingModel></isLodingModel>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getZlgztzsPage
  38. } from '@/api/zlgztzs';
  39. import config from '@/config'
  40. const baseUrlImg = config.baseUrlImg
  41. export default {
  42. data() {
  43. return {
  44. tan90: `${baseUrlImg}/tan90.png`,
  45. list: [],
  46. isLoaded:false,
  47. loading:false,
  48. queryParams: {
  49. pageNo: 1,
  50. pageSize: 10
  51. },
  52. // 总条数
  53. total: 0,
  54. }
  55. },
  56. onShow() {
  57. this.list=[]
  58. this.getData()
  59. },
  60. watch: {
  61. loading: {
  62. handler(newLength, oldLength) {
  63. this.$modal.isLoadingModel(this.loading)
  64. },
  65. immediate: true
  66. }
  67. },
  68. methods: {
  69. getData() {
  70. this.loading = true
  71. getZlgztzsPage(this.queryParams).then(response => {
  72. this.isLoaded = true;
  73. this.list = [...this.list, ...response.data.list]
  74. this.loading = false
  75. console.log(this.list, 'reponse');
  76. // this.list = reponse.data.list
  77. })
  78. },
  79. onClick(val){
  80. this.isLoaded = false
  81. uni.navigateTo({
  82. url: `/pagesA/fire/zlgztzs/see_zlgztzs/see_zlgztzs?id=${val}`
  83. });
  84. }
  85. },
  86. // 触底的事件
  87. onReachBottom() {
  88. // 判断是否还有下一页数据
  89. if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total)
  90. return uni.showToast({
  91. title: `数据加载完毕`
  92. });
  93. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  94. if (this.loading) return;
  95. this.queryParams.pageNo += 1;
  96. this.getData(this.queryParams.pageNo);
  97. },
  98. }
  99. </script>
  100. <style lang="scss" scope>
  101. body {
  102. background-color: #f5f7f9;
  103. }
  104. page {
  105. background-color: #f5f7f9 !important;
  106. }
  107. .uni-container {
  108. height: 100%;
  109. }
  110. /deep/.uni-card {
  111. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  112. border-radius: 30rpx;
  113. }
  114. .main {
  115. margin-left: 5%;
  116. margin-top: 30rpx;
  117. width: 90%;
  118. .main-item {
  119. display: flex;
  120. margin-bottom: 15rpx;
  121. color: #728f90;
  122. }
  123. }
  124. .an-niu {
  125. float: right;
  126. font-size: 10px;
  127. text-align: center;
  128. display: flex;
  129. color: #fff;
  130. margin-bottom:20rpx;
  131. .detail {
  132. width: 72px;
  133. height: 60rpx;
  134. border-radius: 30px;
  135. background-color: #f7c41e;
  136. margin-right: 20rpx;
  137. text-align: center;
  138. line-height: 60rpx;
  139. }
  140. }
  141. </style>