safeAccess.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <!-- 安全准入 -->
  2. <template>
  3. <view id="safeAccess">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="for-box" v-for="(item,index) in infoList" :key="index" @click="goInfoPage(item)">
  6. <view class="name-box">
  7. <view :class="item.auditStatus==0?'typeColor1':(item.auditStatus==1?'typeColor2':(item.auditStatus==2?'typeColor3':''))">{{item.auditStatus==0?'待审核':(item.auditStatus==1?'未通过':(item.auditStatus==2?'已通过':''))}}</view>
  8. <view>{{item.subjectName}}准入申请</view>
  9. </view>
  10. <view class="time-box">
  11. <view></view>
  12. <view>{{item.auditStatus==0?'申请时间:' + item.creatTime:(item.auditStatus==1?'审核未通过时间:' + item.rejectTime:(item.auditStatus==2?'有效期:' + item.auditTime + ' 至 ' + item.validEndTime:''))}}</view>
  13. </view>
  14. </view>
  15. <view class="get-null-box" v-if="getData.nullDataType">暂无更多数据</view>
  16. </scroll-view>
  17. <view class="bottom-button-box" @click="goChooseALaboratory">准入申请</view>
  18. </view>
  19. </template>
  20. <script>
  21. import { listapply } from '@/api/apiDemo/index.js'
  22. export default {
  23. data() {
  24. return {
  25. //数据列表
  26. infoList:[],
  27. //列表请求参数
  28. getData:{
  29. page:1,
  30. pageSize:20,
  31. getType:true,
  32. nullDataType:true,
  33. }
  34. }
  35. },
  36. onLoad() {
  37. },
  38. onShow(){
  39. this.clearData();
  40. this.getList();
  41. },
  42. methods: {
  43. //清除
  44. clearData(){
  45. this.infoList = [];
  46. this.getData.page = 1;
  47. this.getData.getType = true;
  48. this.getData.nullDataType = true;
  49. },
  50. //去准入详情
  51. goInfoPage(item){
  52. item.infoId = item.id;
  53. uni.navigateTo({
  54. url:'/pages_student/accessApplication/applicationDetails?item='+encodeURIComponent(JSON.stringify(item))
  55. })
  56. },
  57. //去选择实验室
  58. goChooseALaboratory(){
  59. uni.navigateTo({
  60. url:'/pages_student/accessApplication/newApplication'
  61. })
  62. // uni.navigateTo({
  63. // url:'/pages_student/workbench/safeAccess/chooseALaboratory'
  64. // })
  65. },
  66. //滚动事件
  67. scrollGet(){
  68. if(this.getData.getType){
  69. this.getData.page += 1;
  70. this.getList();
  71. }
  72. },
  73. //获取列表数据
  74. async getList(){
  75. let self = this;
  76. let obj = {
  77. pageNum:this.getData.page,
  78. pageSize:this.getData.pageSize,
  79. // recordContent:"-1",
  80. // userId:uni.getStorageSync('userId'),
  81. }
  82. const {data} = await listapply(obj)
  83. if(data.code==200){
  84. for(let i=0;i<data.rows.length;i++){
  85. // item.auditTime + ' 至 ' + item.validEndTime
  86. if(data.rows[i].auditTime){
  87. let leftTiem = data.rows[i].auditTime.split(' ');
  88. data.rows[i].auditTime = leftTiem[0];
  89. }
  90. if(data.rows[i].validEndTime){
  91. let rightTuem = data.rows[i].validEndTime.split(' ');
  92. data.rows[i].validEndTime = rightTuem[0];
  93. }
  94. }
  95. if(self.page==1){
  96. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  97. self.infoList = data.rows;
  98. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  99. self.infoList = data.rows;
  100. self.getData.getType = false;
  101. self.getData.nullDataType = true;
  102. }else{
  103. self.getData.getType = false;
  104. self.getData.nullDataType = true;
  105. }
  106. }else{
  107. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  108. self.infoList = self.infoList.concat(data.rows)
  109. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  110. self.infoList = self.infoList.concat(data.rows);
  111. self.getData.getType = false;
  112. self.getData.nullDataType = true;
  113. }else{
  114. self.getData.getType = false;
  115. self.getData.nullDataType = true;
  116. }
  117. }
  118. }
  119. },
  120. }
  121. }
  122. </script>
  123. <style lang="stylus" scoped>
  124. #safeAccess{
  125. height:100%;
  126. width:100%;
  127. display flex
  128. flex-direction column
  129. .info-max-box{
  130. flex:1;
  131. overflow: scroll
  132. .for-box:nth-child(1){
  133. border:none;
  134. }
  135. .for-box{
  136. background #fff
  137. border-radius:20rpx;
  138. margin:20rpx;
  139. overflow hidden
  140. .name-box{
  141. display flex;
  142. margin:20rpx 0;
  143. view:nth-child(1){
  144. height:36rpx;
  145. text-align center;
  146. width:100rpx;
  147. line-height:36rpx;
  148. font-size:20rpx;
  149. margin:0 18rpx 0 23rpx;
  150. }
  151. view:nth-child(2){
  152. flex:1;
  153. font-size:28rpx;
  154. margin-right:20rpx;
  155. }
  156. .typeColor1{
  157. border-radius:6rpx;
  158. color:#F6A71D;
  159. background rgba(246,167,29,0.2)
  160. }
  161. .typeColor2{
  162. border-radius:6rpx;
  163. color:#FF5555;
  164. background rgba(255,85,85,0.2)
  165. }
  166. .typeColor3{
  167. border-radius:6rpx;
  168. color:#30A23D;
  169. background rgba(48,162,61,0.2)
  170. }
  171. .typeColor4{
  172. border-radius:6rpx;
  173. color:#F6A71D;
  174. background rgba(246,167,29,0.2)
  175. }
  176. }
  177. .time-box{
  178. display flex;
  179. height:36rpx;
  180. margin:20rpx 0;
  181. view:nth-child(1){
  182. width:100rpx;
  183. line-height:36rpx;
  184. font-size:20rpx;
  185. margin:0 18rpx 0 23rpx;
  186. }
  187. view:nth-child(2){
  188. flex:1;
  189. font-size:28rpx;
  190. }
  191. }
  192. }
  193. .get-null-box{
  194. height:100rpx;
  195. line-height:100rpx;
  196. color:#999;
  197. text-align center
  198. }
  199. }
  200. .bottom-button-box{
  201. border-radius:20rpx;
  202. margin:20rpx 50rpx;
  203. width: 650rpx;
  204. height: 100rpx;
  205. line-height: 100rpx;
  206. background: #0183FA;
  207. font-size: 30rpx;
  208. color: #FFFFFF;
  209. text-align center;
  210. }
  211. }
  212. </style>