index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
  6. <view class="list-scroll-view">
  7. <view class="one_1">
  8. <view class="list" v-for="(item,index) in list" :key="index">
  9. <view class="name textOver">
  10. {{item.name||'暂无'}}
  11. </view>
  12. <view class="other_1">
  13. 身份证号:<text>{{item.card||'暂无'}}</text>
  14. </view>
  15. <view class="other_1">
  16. 手机号:<text>{{item.phone||'暂无'}}</text>
  17. </view>
  18. <view class="other_1">
  19. 状态:<text>{{item.zhStatus||'暂无'}}</text>
  20. </view>
  21. <view class="other_1">
  22. 审核结果:<text>{{item.cause||'暂无'}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </scroll-view>
  28. </view>
  29. <view class="is_bottom" v-if="is_bottom">
  30. <text>{{config.bottom_title}}</text>
  31. </view>
  32. </view>
  33. </mobile-frame>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. // 系统设置
  40. config: {},
  41. user: {},
  42. searchInfo: {},
  43. list: [],
  44. total: 0,
  45. page: 0,
  46. skip: 0,
  47. limit: 10,
  48. statusList: [],
  49. // 数据是否触底
  50. is_bottom: false,
  51. scrollTop: 0
  52. };
  53. },
  54. onLoad: async function(e) {
  55. const that = this;
  56. that.searchConfig();
  57. await that.watchLogin();
  58. },
  59. onPullDownRefresh: async function() {
  60. const that = this;
  61. that.clearPage();
  62. await that.search();
  63. uni.stopPullDownRefresh();
  64. },
  65. methods: {
  66. watchLogin() {
  67. const that = this;
  68. uni.getStorage({
  69. key: 'token',
  70. success: async (res) => {
  71. let user = that.$jwt(res.data);
  72. if (user) that.$set(that, `user`, user);
  73. // 查询其他信息
  74. await that.searchOther();
  75. await that.search();
  76. },
  77. fail: (err) => {}
  78. })
  79. },
  80. // 查询基本设置
  81. searchConfig() {
  82. const that = this;
  83. uni.getStorage({
  84. key: 'config',
  85. success: function(res) {
  86. if (res.data) that.$set(that, `config`, res.data)
  87. },
  88. fail: function(err) {
  89. console.log(err);
  90. }
  91. })
  92. },
  93. async search() {
  94. const that = this;
  95. let info = {
  96. skip: that.skip,
  97. limit: that.limit,
  98. user_id: that.user.id
  99. }
  100. const res = await that.$api(`/userleader`, `GET`, {
  101. ...info,
  102. ...that.searchInfo
  103. })
  104. if (res.errcode == '0') {
  105. let list = [...that.list, ...res.data]
  106. for (let val of list) {
  107. let status = that.statusList.find(i => i.value == val.status)
  108. if (status) val.zhStatus = status.label;
  109. }
  110. that.$set(that, `list`, list)
  111. that.$set(that, `total`, res.total)
  112. } else {
  113. uni.showToast({
  114. title: res.errmsg,
  115. });
  116. }
  117. },
  118. // 查询其他信息
  119. async searchOther() {
  120. const that = this;
  121. let res;
  122. res = await that.$api(`/dictData`, 'GET', {
  123. code: "exam_status"
  124. });
  125. if (res.errcode == '0') that.$set(that, `statusList`, res.data)
  126. },
  127. // 分页
  128. toPage() {
  129. const that = this;
  130. let list = that.list;
  131. let limit = that.limit;
  132. if (that.total > list.length) {
  133. uni.showLoading({
  134. title: '加载中',
  135. mask: true
  136. })
  137. let page = that.page + 1;
  138. that.$set(that, `page`, page)
  139. let skip = page * limit;
  140. that.$set(that, `skip`, skip)
  141. that.search();
  142. uni.hideLoading();
  143. } else that.$set(that, `is_bottom`, true)
  144. },
  145. toScroll(e) {
  146. const that = this;
  147. let up = that.scrollTop;
  148. that.$set(that, `scrollTop`, e.detail.scrollTop);
  149. let num = Math.sign(up - e.detail.scrollTop);
  150. if (num == 1) that.$set(that, `is_bottom`, false);
  151. },
  152. // 清空列表
  153. clearPage() {
  154. const that = this;
  155. that.$set(that, `list`, [])
  156. that.$set(that, `skip`, 0)
  157. that.$set(that, `limit`, 6)
  158. that.$set(that, `page`, 0)
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. .main {
  165. display: flex;
  166. flex-direction: column;
  167. width: 100vw;
  168. height: 100vh;
  169. .one {
  170. position: relative;
  171. flex-grow: 1;
  172. .one_1 {
  173. display: flex;
  174. justify-content: space-between;
  175. flex-wrap: wrap;
  176. .list {
  177. width: 100%;
  178. background: #fff;
  179. padding: 2vw;
  180. border-radius: 5px;
  181. margin: 2vw 1vw 0 1vw;
  182. border: 1px solid var(--f1Color);
  183. .name {
  184. font-size: var(--font15Size);
  185. margin: 0 0 2vw 0;
  186. }
  187. .other_1 {
  188. font-size: var(--font14Size);
  189. text {
  190. color: var(--f85Color);
  191. }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. .scroll-view {
  198. position: absolute;
  199. top: 0;
  200. left: 0;
  201. right: 0;
  202. bottom: 0;
  203. .list-scroll-view {
  204. display: flex;
  205. flex-direction: column;
  206. }
  207. }
  208. .is_bottom {
  209. text-align: center;
  210. text {
  211. padding: 2vw 0;
  212. display: inline-block;
  213. color: #858585;
  214. font-size: 14px;
  215. }
  216. }
  217. </style>