index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="">
  3. <view class="">
  4. <view style="position: fixed;z-index: 100;">
  5. <uni-nav-bar @clickRight="clickRight" left-icon="back" left-text="返回" right-icon="plus" title="用户管理"></uni-nav-bar>
  6. </view>
  7. <view class="uinput-box">
  8. <view class="uinputs">
  9. <u-input v-model="argument.username" :type="type" :border="border" placeholder="请输入用户名称" input-align="center"
  10. :clearable="border" :custom-style="uinputstyle" @input="searchinput" />
  11. <u-icon name="search" class="search" size="30" @click="search"></u-icon>
  12. </view>
  13. </view>
  14. <view class="userlists">
  15. <view class="userlist-li" v-for="(item,index) in userlists" :kex="index" @click="userOperation(userlists[index])">
  16. <image src="../../../static/image/fourMoodBase/touxiang.png" mode=""></image>
  17. <p class="userlist-li-city">{{item.username}}</p>
  18. <p class="userlist-li-eamil">{{item.mobile}}</p>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. Debounce,
  27. Throttle
  28. } from "../../../util/anitthro.js"
  29. export default {
  30. data() {
  31. return {
  32. value: '',
  33. type: 'text',
  34. border: false,
  35. uinputstyle: {
  36. "margin": "16rpx 0",
  37. 'background': "#f3f3f3",
  38. "border-radius": "25px"
  39. },
  40. userlists: [],
  41. argument: {
  42. page: 1,
  43. page_size: 10,
  44. username: ''
  45. }
  46. }
  47. },
  48. methods: {
  49. async getState(argument) {
  50. const res = await this.$myRequest({
  51. url: '/api/api_gateway?method=user.login.users_info',
  52. data: {
  53. page: argument.page,
  54. page_size: argument.page_size,
  55. username: argument.username
  56. }
  57. })
  58. this.userlists = this.userlists.concat(res.data)
  59. },
  60. clickRight() { //跳转增加用户页面
  61. uni.navigateTo({
  62. url: './addusers',
  63. })
  64. },
  65. userOperation(item) { //跳转用户信息页面
  66. item = JSON.stringify(item)
  67. uni.navigateTo({
  68. url: './useroperation?item=' + item,
  69. })
  70. },
  71. search() { //搜索用户
  72. this.userlists = []
  73. this.getState(this.argument)
  74. },
  75. searchinput() {
  76. this.argument.page=1
  77. Debounce(() => {
  78. this.userlists = []
  79. this.getState(this.argument)
  80. }, 1000)()
  81. }
  82. }, //user.login.users_info
  83. onLoad() {
  84. this.getState(this.argument)
  85. },
  86. onReachBottom() {
  87. this.argument.page++
  88. this.getState(this.argument)
  89. },
  90. onPullDownRefresh() {
  91. this.getState(this.argument)
  92. setTimeout(function() {
  93. uni.stopPullDownRefresh(); //停止下拉刷新动画
  94. }, 1000);
  95. }
  96. }
  97. </script>
  98. 1
  99. <style lang="scss">
  100. .uinput-box {
  101. position: fixed;
  102. top: 89rpx;
  103. z-index: 100;
  104. background-color: white;
  105. width: 100%;
  106. display: flex;
  107. justify-content: center;
  108. align-items: center;
  109. .uinputs {
  110. width: 95%;
  111. position: relative;
  112. .search {
  113. position: absolute;
  114. top: 40rpx;
  115. left: 200rpx;
  116. }
  117. }
  118. }
  119. .userlists {
  120. width: 100%;
  121. position: relative;
  122. top: 180rpx;
  123. .userlist-li {
  124. width: 46%;
  125. height: 270rpx;
  126. margin: 20rpx 0 0 20rpx;
  127. float: left;
  128. box-shadow: 0 0 10rpx #bcb9ca;
  129. text-align: center;
  130. image {
  131. width: 80rpx;
  132. height: 80rpx;
  133. margin: 40rpx 0 20rpx;
  134. }
  135. }
  136. }
  137. </style>