酷炫直播运营系统小程序版本

user-filter.vue 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="dialog_mask" @touchmove.stop.prevent="moveStop" @click="clearMask">
  3. <scroll-view class="mask_container" scroll-y="true" :class="bg_type=='dark'?'dialog_dark_mask':''" @click.stop="moveStop">
  4. <view :class="['userFilterItem',staffInfo.id == 0 ? 'active':'']" @click="changeUser('all')">全部</view>
  5. <view :class="['userFilterItem',staffInfo.id == item.id ? 'active':'']" v-for="(item,index) in staffList" :key="index+'staffList'" @click="changeUser(index)">{{item.real_name}}</view>
  6. </scroll-view>
  7. </view>
  8. </template>
  9. <script>
  10. // 工作人员筛选
  11. export default {
  12. name: "user-filter",
  13. props:['staffInfo','bg_type'],
  14. data() {
  15. return {
  16. staffList:[]
  17. };
  18. },
  19. mounted() {
  20. // if(this.$store.state.staffList&&this.$store.state.staffList.length!=0){
  21. // this.staffList= this.$store.state.staffList
  22. // }else{
  23. this.get_staffList()
  24. // }
  25. },
  26. methods: {
  27. clearMask(){
  28. this.$emit('clearMask')
  29. },
  30. changeUser(val){
  31. let data = val
  32. if(val=='all'){
  33. data = {name:'全部',id:0}
  34. }else{
  35. data = this.staffList[val]
  36. }
  37. this.$emit('changeUser',data)
  38. },
  39. moveStop() {},
  40. get_staffList() {//工作人员
  41. uni.showLoading({title: '加载中'});
  42. this.$req(this.$api.userListForFilter, 'get', {}, (res) => {
  43. uni.hideLoading()
  44. if (res && res.errno == 0) {
  45. this.$store.state.staffList = res.rst;
  46. this.staffList = res.rst;
  47. } else if (res.errno != 4002) {
  48. this.$message({
  49. message: res.err,
  50. type: "warning"
  51. })
  52. }
  53. }, (err) => {
  54. uni.hideLoading()
  55. })
  56. },
  57. }
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .dialog_mask {
  62. width: 100%;
  63. height: 100%;
  64. position: absolute;
  65. left: 0;
  66. background: rgba(0, 0, 0, 0.5);
  67. z-index: 3;
  68. }
  69. .mask_container {
  70. width: 100%;
  71. padding: 10rpx;
  72. background: #FFFFFF;
  73. overflow-y: auto;
  74. display: flex;
  75. align-items: flex-start;
  76. flex-wrap: wrap;
  77. max-height: 60vh;
  78. .userFilterItem{
  79. background: #F8F7FC;
  80. border: 2rpx solid #F8F7FC;
  81. font-size: 24rpx;
  82. line-height: 44rpx;
  83. height: 48rpx;
  84. margin: 15rpx;
  85. padding: 0 10rpx;
  86. border-radius: 8rpx;
  87. display: inline-block;
  88. color: #555555;
  89. &.active{
  90. color: #5B80F4;
  91. background: #FFFFFF;
  92. border-color: #5B80F4;
  93. }
  94. }
  95. }
  96. .dialog_dark_mask{
  97. background: #3D4453;
  98. .userFilterItem{
  99. background: #464D5B;
  100. color: #FFFFFF;
  101. border-color: #464D5B;
  102. &.active{
  103. color: #5B80F4;
  104. background: #3D4453;
  105. border-color: #5B80F4;
  106. }
  107. }
  108. }
  109. </style>