user-index.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">用户管理</text>
  6. <text class="add" @click="addUser">+添加
  7. </text>
  8. </view>
  9. </view>
  10. <view>
  11. <u-cell-group>
  12. <u-cell :isLink="true" arrow-direction="right" @click="toUserFn(item)"
  13. :value="item.roleName"
  14. v-for="(item,index) in userList">
  15. <u-icon name="account" slot="icon" size="30"></u-icon>
  16. <text slot="title" style="font-size: 40rpx;">{{ item.name }}</text>
  17. </u-cell>
  18. </u-cell-group>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. customerId: '',
  27. userList: []
  28. }
  29. },
  30. onShow() {
  31. let info = uni.getStorageSync('userInfo');
  32. this.customerId = info.customerId;
  33. this.getUserList();
  34. },
  35. onBackPress() {
  36. this.$common.to('/');
  37. return true;
  38. },
  39. methods: {
  40. getUserList() {
  41. this.$api.getUserList({customerId: this.customerId}).then(resp => {
  42. this.userList = resp.data;
  43. })
  44. },
  45. toUserFn(data) {
  46. this.$common.to('/pages/user/addUser?id=' + data.id + '&name=' + data.name + '&roleId=' + data.roleId + '&status=' + data.status)
  47. },
  48. addUser() {
  49. this.$common.to('/pages/user/addUser')
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. .add {
  56. position: absolute;
  57. right: 40rpx;
  58. top: -60rpx;
  59. z-index: 999;
  60. font-size: 40rpx;
  61. color: white;
  62. }
  63. @import '@/common/common.scss'
  64. </style>