home.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="contianer">
  3. <view class="">
  4. </view>
  5. <view class="list" v-if="false">
  6. <view @click="clickItem(item,index)" v-for="(item,index) in list" :key="index" class="list-item">
  7. <view class="list-item-img">
  8. <!-- <image v-if="item." style="width:72rpx;height: 72rpx;margin-right: 20rpx;" src="@/static/image/male.png" mode=""></image> -->
  9. <image style="width:72rpx;height: 72rpx;margin-right: 20rpx;" src="@/static/image/female.png"
  10. mode=""></image>
  11. <view class="list-item-name">
  12. 我是 {{item.school.school_name}} {{item.role.title}}
  13. </view>
  14. </view>
  15. <view class="list-item-active">
  16. <uni-icons v-if="active == item.id" style="color:rgba(5,204,161, 1) ;" type="checkmarkempty"
  17. size="24"></uni-icons>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. active: 0,
  28. list: []
  29. }
  30. },
  31. methods: {
  32. clickItem(item, index) {
  33. this.$api.sendRequest({
  34. url: '/mobile/selectRole',
  35. data: {
  36. role_id: item.role_id,
  37. school_id: item.school.id,
  38. },
  39. success: res => {
  40. console.log(res);
  41. this.active = item.id
  42. this.$store.commit('setInfo', item)
  43. this.$store.commit('setRoleInfo', res.data)
  44. let url = item.role.title == '维修人员' ?
  45. '/pages/fixedAssetsProcessed/fixedAssetsProcessed' :
  46. '/pages/homePage/homePage'
  47. uni.navigateTo({
  48. url: url
  49. })
  50. },
  51. })
  52. },
  53. getUserList() {
  54. this.$api.sendRequest({
  55. url: '/mobile/getRole',
  56. success: res => {
  57. this.list = res.data
  58. let info = res.data[0]
  59. this.$store.commit('setInfo', info)
  60. this.active = info.id
  61. }
  62. })
  63. }
  64. },
  65. mounted() {
  66. this.getUserList()
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .contianer {
  72. padding: 48rpx;
  73. .list {
  74. width: 100%;
  75. }
  76. .list-item {
  77. height: 94rpx;
  78. width: 100%;
  79. border-radius: 10rpx;
  80. background-color: #fff;
  81. display: flex;
  82. align-items: center;
  83. justify-content: space-between;
  84. margin-bottom: 32rpx;
  85. box-shadow: -0.67px 0px 5px 0.67px rgba(46, 46, 46, 0.28);
  86. .list-item-img {
  87. margin-left: 32rpx;
  88. border-radius: 50%;
  89. display: flex;
  90. align-items: center;
  91. }
  92. .list-item-active {
  93. margin-right: 32rpx;
  94. }
  95. }
  96. }
  97. </style>