index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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">{{item.items.__yZMMXcXNnmKq5pTTfPH.value}}</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">{{item.items.__BFdnHQXCEaXwAC4nryK.value}}</view>
  26. </view>
  27. <view class="it">
  28. <view class="label">申请单位:</view>
  29. <view class="name">{{item.items.__VP07fdxAVMa7bSHb8ZU.value}}</view>
  30. </view>
  31. <view class="it">
  32. <view class="label">试验部门:</view>
  33. <view class="name">{{item.items.__DVAKyCmSOS9bvFpome2.value}}</view>
  34. </view>
  35. <view class="tag">{{item.items.__oUywWKvn4BhpnBmxqYT.value}}</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"><button class="btn" style="width: 30%;border-radius: 25px;">新建</button></view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. param: {appId:"__gAPYBW4YxB3UePM3lqO",containTitle:"申请单",opentarget:"detail",viewId:"__km3aURKW95BHxp12XVt" },
  49. list: [],
  50. show: false,
  51. loadMore: true,
  52. pageNum:1
  53. };
  54. },
  55. onLoad(e) {
  56. //this.getaccessToken();
  57. this.getData();
  58. console.log("0000===");
  59. },
  60. methods: {
  61. getaccessToken() {
  62. this.http.request({
  63. url: this.http.urls.accessToken,
  64. data: this.param,
  65. loading: 'false',
  66. success: res => {
  67. //console.log("gfgh==="+JSON.stringify(res));
  68. if(res.data.errcode==0){
  69. uni.removeStorageSync('user');
  70. uni.setStorageSync('user', res.data.data);
  71. this.getData();
  72. console.log("res.data.resultCode==="+res.data.errcode);
  73. }
  74. }
  75. });
  76. }, getData() {
  77. this.http.request({
  78. url: this.http.urls.wt_list+'&_currpage='+this.pageNum,
  79. data: this.param,
  80. method:'POST',
  81. loading: 'false',
  82. success: res => {
  83. console.log("res.data.data.page==="+JSON.stringify(res));
  84. console.log("this.pageNum==="+this.pageNum);
  85. this.loadMore = res.data.data.page > this.pageNum? true : false;
  86. res.data.data.data.forEach(item => {
  87. this.list.push(item);
  88. });
  89. //console.log("this.list==="+JSON.stringify(this.list));
  90. }
  91. });
  92. },
  93. //刷新数据
  94. refresh() {
  95. this.loadMore = true;
  96. this.pageNum = 1;
  97. this.list = [];
  98. this.getData();
  99. console.log("11111===");
  100. },
  101. //跳转到详情
  102. detail(id) {
  103. uni.navigateTo({
  104. url: '/pages/index/detail?id=' + id
  105. });
  106. }
  107. },
  108. //下拉刷新
  109. onPullDownRefresh() {
  110. console.log("222===");
  111. setTimeout(() => {
  112. this.refresh();
  113. uni.stopPullDownRefresh();
  114. }, 1000);
  115. },
  116. //上拉加载
  117. onReachBottom() {
  118. console.log("333===");
  119. if (this.loadMore) {
  120. this.pageNum++;
  121. console.log("this.pageNum==="+this.pageNum);
  122. this.getData();
  123. }
  124. },
  125. //展开搜索
  126. onNavigationBarButtonTap() {
  127. this.show = !this.show;
  128. }
  129. };
  130. </script>
  131. <style lang="scss">
  132. page {
  133. background-color: #f2f3f5;
  134. }
  135. .search {
  136. background-color: white;
  137. padding: 5px 15px;
  138. .input {
  139. margin-bottom: 10px;
  140. }
  141. .f {
  142. padding: 5px;
  143. background-color: white;
  144. }
  145. .c {
  146. background-color: #f44336;
  147. }
  148. }
  149. .list {
  150. padding: 0px 15px;
  151. .item {
  152. margin-top: 10px;
  153. background-color: white;
  154. border-radius: 5px;
  155. overflow: hidden;
  156. padding-bottom: 5px;
  157. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  158. .title {
  159. border-bottom: 1px solid #efefef;
  160. padding: 12px;
  161. .tv {
  162. float: left;
  163. width: 90%;
  164. }
  165. }
  166. .con {
  167. position: relative;
  168. .it {
  169. font-size: 14px;
  170. padding: 5px 12px 5px 12px;
  171. .label {
  172. float: left;
  173. color: #969696;
  174. }
  175. }
  176. .tag {
  177. position: absolute;
  178. top: 10%;
  179. right: 0px;
  180. padding: 3px 10px;
  181. background-color: red;
  182. color: white;
  183. border-radius: 15px 0px 0px 15px;
  184. }
  185. }
  186. }
  187. }
  188. </style>