index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view>
  3. <view class="search" v-if="show">
  4. <u-divider text="展开搜索"></u-divider>
  5. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  6. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  7. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  8. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  9. <u--input v-model="param.xx" placeholder="输入条件" class="input" clearable></u--input>
  10. <view class="flex">
  11. <view class="f"><button class="btn c" @click="clear()">重置</button></view>
  12. <view class="f"><button class="btn" @click="search()">搜索</button></view>
  13. </view>
  14. </view>
  15. <view class="list">
  16. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item.id)">
  17. <view class="title">
  18. <text class="tv">便携式储能电源</text>
  19. <text class="icon">&#xe631;</text>
  20. <view class="clear"></view>
  21. </view>
  22. <view class="con">
  23. <view class="it">
  24. <view class="label">设备型号:</view>
  25. <view class="name">PMQ104M10005</view>
  26. </view>
  27. <view class="it">
  28. <view class="label">借用人部门:</view>
  29. <view class="name">工业设计与操纵环境研究所</view>
  30. </view>
  31. <view class="it">
  32. <view class="label">借用人:</view>
  33. <view class="name">腾飞</view>
  34. </view>
  35. <view class="tag">撰写</view>
  36. </view>
  37. </view>
  38. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  39. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  40. </view>
  41. <view class="footer">
  42. <view class="flex">
  43. <view class="f"><button class="btn br" @click="go('/pages/model/return?op=设备归还')">归还设备</button></view>
  44. <view class="f"><button class="btn br" @click="go('/pages/model/return?op=设备借用')">借用设备</button></view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. param: { pageNum: 1, pageSize: 10, userId: this.getUser().id, orderByColumn: 'createTime', isAsc: 'desc' },
  54. list: [{}, {}, {}, {}, {}],
  55. show: false,
  56. loadMore: true
  57. };
  58. },
  59. onLoad(e) {
  60. //this.getData();
  61. },
  62. methods: {
  63. getData() {
  64. this.http.request({
  65. url: this.http.urls.user_task_record_list,
  66. data: this.param,
  67. loading: 'false',
  68. success: res => {
  69. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  70. res.data.rows.forEach(item => {
  71. this.list.push(item);
  72. });
  73. }
  74. });
  75. },
  76. //刷新数据
  77. refresh() {
  78. this.loadMore = true;
  79. this.param.pageNum = 1;
  80. this.list = [];
  81. this.getData();
  82. },
  83. //跳转到详情
  84. detail(id) {
  85. uni.navigateTo({
  86. url: '/pages/index/detail?id=' + id
  87. });
  88. },
  89. go(url) {
  90. uni.navigateTo({
  91. url: url
  92. });
  93. }
  94. },
  95. //下拉刷新
  96. onPullDownRefresh() {
  97. setTimeout(() => {
  98. this.refresh();
  99. uni.stopPullDownRefresh();
  100. }, 1000);
  101. },
  102. //上拉加载
  103. onReachBottom() {
  104. if (this.loadMore) {
  105. this.param.pageNum++;
  106. this.getData();
  107. }
  108. },
  109. //展开搜索
  110. onNavigationBarButtonTap() {
  111. this.show = !this.show;
  112. }
  113. };
  114. </script>
  115. <style lang="scss">
  116. page {
  117. background-color: #f2f3f5;
  118. }
  119. .list {
  120. padding: 0px 15px 80px 15px;
  121. .item {
  122. margin-top: 10px;
  123. background-color: white;
  124. border-radius: 5px;
  125. overflow: hidden;
  126. padding-bottom: 5px;
  127. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  128. .title {
  129. border-bottom: 1px solid #efefef;
  130. padding: 12px;
  131. color: $font-c1;
  132. .tv {
  133. float: left;
  134. width: 90%;
  135. }
  136. }
  137. .con {
  138. position: relative;
  139. .it {
  140. font-size: 14px;
  141. padding: 5px 12px 5px 12px;
  142. .label {
  143. float: left;
  144. color: #969696;
  145. width: 90px;
  146. text-align: right;
  147. }
  148. .name{
  149. color: $font-c;
  150. }
  151. }
  152. .tag {
  153. position: absolute;
  154. top: 10%;
  155. right: 0px;
  156. padding: 3px 10px;
  157. background-color: #F44336;
  158. color: white;
  159. font-size: 14px;
  160. border-radius: 15px 0px 0px 15px;
  161. }
  162. }
  163. }
  164. }
  165. .br {
  166. border-radius: 25px;
  167. }
  168. </style>