index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="">
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 40px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar left-icon="back" left-text="返回" title="用户管理" @clickLeft="clickLeft"></uni-nav-bar>
  7. </view>
  8. <view class="uinput-box">
  9. <view class="uinputs">
  10. <u-input v-model="argument.username" :type="type" :border="border" placeholder="请输入用户名称" input-align="center"
  11. :clearable="border" :custom-style="uinputstyle" @input="searchinput" />
  12. <u-icon name="search" class="search" size="30" @click="search"></u-icon>
  13. </view>
  14. </view>
  15. <view class="userlists">
  16. <view class="userlist-li" v-for="(item,index) in userlists" :kex="index" @click="userOperation(userlists[index])">
  17. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/fourMoodBase/touxiang.png'" mode=""></image>
  18. <p class="userlist-li-city">{{item.username}}</p>
  19. <p class="userlist-li-eamil">{{item.mobile}}</p>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="addindent" @click="clickRight">
  24. 新 增 用 户
  25. </view>
  26. <view class="top" v-if="isTop" @click="top">
  27. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. Debounce,
  34. Throttle
  35. } from "../../../util/anitthro.js"
  36. export default {
  37. data() {
  38. return {
  39. value: '',
  40. type: 'text',
  41. border: false,
  42. uinputstyle: {
  43. "margin": "16rpx 0",
  44. 'background': "#f3f3f3",
  45. "border-radius": "25px"
  46. },
  47. userlists: [],
  48. argument: {
  49. page: 1,
  50. page_size: 10,
  51. username: ''
  52. },
  53. isTop:false,
  54. addtf:false
  55. }
  56. },
  57. methods: {
  58. async getState(argument) {
  59. const res = await this.$myRequest({
  60. url: '/api/api_gateway?method=user.login.users_info',
  61. data: {
  62. page: argument.page,
  63. page_size: argument.page_size,
  64. username: argument.username
  65. }
  66. })
  67. this.userlists = this.userlists.concat(res.data)
  68. },
  69. clickRight() { //跳转增加用户页面
  70. if(this.addtf){
  71. uni.navigateTo({
  72. url: './addusers',
  73. })
  74. }else{
  75. uni.showToast({
  76. title: "您暂无权限进行此操作,如有需要,请联系管理员",
  77. icon: "none"
  78. })
  79. }
  80. },
  81. clickLeft(){
  82. uni.switchTab({
  83. url:"../../index/index"
  84. })
  85. },
  86. userOperation(item) { //跳转用户信息页面
  87. item = JSON.stringify(item)
  88. uni.navigateTo({
  89. url: './useroperation?item=' + item,
  90. })
  91. },
  92. search() { //搜索用户
  93. this.userlists = []
  94. this.getState(this.argument)
  95. },
  96. searchinput() {
  97. this.argument.page=1
  98. Debounce(() => {
  99. this.userlists = []
  100. this.getState(this.argument)
  101. }, 1000)()
  102. },
  103. top() {
  104. uni.pageScrollTo({
  105. scrollTop: 0,
  106. duration: 500
  107. })
  108. }
  109. }, //user.login.users_info
  110. onLoad() {
  111. this.getState(this.argument)
  112. uni.getStorage({
  113. key:"jurisdiction",
  114. success:(res)=>{
  115. console.log(JSON.parse(res.data))
  116. let items = JSON.parse(res.data).filter((item)=>{
  117. return item.purview_name == "系统管理"
  118. })
  119. let items2 = items[0].children.filter((item)=>{
  120. return item.purview_name == "用户管理"
  121. })
  122. var arr = items2[0].children
  123. console.log(arr)
  124. for(var i =0;i<arr.length;i++){
  125. switch (arr[i].purview_name){
  126. case "添加用户":
  127. this.addtf = true
  128. break
  129. }
  130. }
  131. },
  132. })
  133. },
  134. onReachBottom() {
  135. this.argument.page++
  136. this.getState(this.argument)
  137. },
  138. onPullDownRefresh() {
  139. this.getState(this.argument)
  140. setTimeout(function() {
  141. uni.stopPullDownRefresh(); //停止下拉刷新动画
  142. }, 1000);
  143. },
  144. onBackPress(options) {
  145. if (options.from === 'navigateBack') {
  146. return false;
  147. }
  148. this.clickLeft();
  149. return true;
  150. },
  151. onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
  152. if (e.scrollTop > 200) { //距离大于200时显示
  153. this.isTop = true
  154. } else { //距离小于200时隐藏
  155. this.isTop = false
  156. }
  157. },
  158. }
  159. </script>
  160. 1
  161. <style lang="scss">
  162. /deep/.uni-icons{
  163. font-size: 40rpx !important;
  164. }
  165. .uinput-box {
  166. position: fixed;
  167. top: 84px;
  168. z-index: 100;
  169. background-color: white;
  170. width: 100%;
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. .uinputs {
  175. width: 95%;
  176. position: relative;
  177. .search {
  178. position: absolute;
  179. top: 40rpx;
  180. left: 200rpx;
  181. }
  182. }
  183. }
  184. .userlists {
  185. width: 100%;
  186. position: relative;
  187. top: 180rpx;
  188. .userlist-li {
  189. width: 46%;
  190. height: 270rpx;
  191. margin: 20rpx 0 0 20rpx;
  192. float: left;
  193. box-shadow: 0 0 10rpx #bcb9ca;
  194. text-align: center;
  195. image {
  196. width: 80rpx;
  197. height: 80rpx;
  198. margin: 40rpx 0 20rpx;
  199. }
  200. }
  201. }
  202. .addindent{
  203. width: 100%;
  204. position: fixed;
  205. bottom: 0;
  206. left: 0;
  207. height: 80rpx;
  208. text-align: center;
  209. line-height: 80rpx;
  210. background-color: #71cd9a;
  211. color: #ffffff;
  212. font-size: 16px;
  213. }
  214. .top {
  215. position: fixed;
  216. right: 30px;
  217. bottom: 100px;
  218. z-index: 100;
  219. image{
  220. width: 100rpx;
  221. height: 100rpx;
  222. }
  223. }
  224. </style>