list.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="mobile-item-container">
  3. <Navbar title="用户管理" bgColor="#fff" :h5Show="false"></Navbar>
  4. <view style="padding: 16px 0 10px;">
  5. <u-search :show-action="true" actionText="搜索" :animation="true" height="40px"></u-search>
  6. </view>
  7. <view v-if="list && list.length > 0">
  8. <u-cell v-for="(item, index) in list" :key="index" :isLink="true" :border="true" @click="navigateTo(item)">
  9. <u-avatar slot="icon" v-if="item.avatar" :src="item.avatar"></u-avatar>
  10. <u-avatar slot="icon" v-else :text="item.nickName.substring(0, 1)" randomBgColor></u-avatar>
  11. <view slot="title">
  12. <view style="display: flex; padding: 8px 0;">
  13. <text style="font-size: 18px; font-weight: bold;">{{item.nickName}}</text>
  14. <u-tag :text="item.delFlag == 0 ? '启用' : '停用'" :type="item.delFlag == 0 ? 'primary' : 'error'" shape="circle" size="mini" style="margin-left: 8px;"></u-tag>
  15. </view>
  16. <view style="display: flex; justify-content:space-between;">
  17. <text>账户:{{item.userName}}</text>
  18. <text>电话:{{item.phonenumber}}</text>
  19. </view>
  20. <view>
  21. <text>邮件:{{item.email}}</text>
  22. </view>
  23. </view>
  24. <view slot="label">
  25. </view>
  26. </u-cell>
  27. <!-- <u-loadmore :status="status" /> -->
  28. </view>
  29. <u-empty v-else></u-empty>
  30. <FloatButton type="primary" icon="plus" @click="navigateTo"></FloatButton>
  31. </view>
  32. </template>
  33. <script>
  34. import * as UserManageApi from '@/api/work/userManage'
  35. import Navbar from '@/components/navbar/Navbar'
  36. import FloatButton from '@/components/button/FloatButton'
  37. export default {
  38. components: {
  39. Navbar,
  40. FloatButton
  41. },
  42. data () {
  43. return {
  44. params: {
  45. pageNum: 0,
  46. pageSize: 10
  47. },
  48. list: []
  49. }
  50. },
  51. onLoad () {
  52. this.loadData();
  53. },
  54. methods: {
  55. // 加载用户列表数据
  56. loadData () {
  57. //const app = this
  58. this.params.pageNum += 1;
  59. UserManageApi.userList(this.params).then(res => {
  60. this.list = res.rows;
  61. })
  62. },
  63. navigateTo (user) {
  64. if (user) {
  65. uni.navigateTo({ url: '/pages/work/user/edit?id=' + user.userId })
  66. } else {
  67. uni.navigateTo({ url: '/pages/work/user/edit' })
  68. }
  69. }
  70. }
  71. }
  72. </script>