head_filter.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <view class="head_filter row-justify-sb center p-lr30">
  4. <view class="filter_item r-100 bg-rgba-255" @click="startAnimation">
  5. <text class="text-color-fff size-28 sys-weight-600 p-r10">汇总统计-公司</text>
  6. <uni-icons :animation="animationData" class="dropdown-icon" :type="type" size="16"
  7. color="#fff"></uni-icons>
  8. </view>
  9. <view class="filter_item last_item r-100 bg-rgba-255" @click="startAnimation">
  10. <text class="text-color-fff size-28 sys-weight-600 p-r10">周数据</text>
  11. <uni-icons :animation="animationData" class="dropdown-icon" type="down" size="16"
  12. color="#fff"></uni-icons>
  13. </view>
  14. <view class="filter_item last_item r-100 bg-rgba-255 row-justify-c center">
  15. <uni-icons type="calendar" size="18" color="#fff"></uni-icons>
  16. <text class="text-color-fff size-28 sys-weight-600 m-l10">2024</text>
  17. </view>
  18. </view>
  19. <uni-popup background-color="#fff" ref="popup" type="bottom" border-radius="10px"
  20. @touchmove.stop.prevent="moveHandle">
  21. <EnSelect ref="system" @onChange="onChange"></EnSelect>
  22. </uni-popup>
  23. </view>
  24. </template>
  25. <script>
  26. import EnSelect from "@/components/en-utils/en-select/en-select.vue";
  27. export default {
  28. name: 'head_filter',
  29. components: {
  30. EnSelect
  31. },
  32. props:{
  33. userStatusList:{
  34. type: Array,
  35. default: function () {
  36. return []
  37. }
  38. }
  39. },
  40. data() {
  41. return {
  42. type: 'down',
  43. animationData: {},
  44. isRote: false,
  45. animation: null,
  46. };
  47. },
  48. mounted() {
  49. },
  50. methods: {
  51. onChange(type) {
  52. this.$refs.popup.close('bottom')
  53. this.$emit('onTopSelect', type)
  54. },
  55. startAnimation() {
  56. //旋转角度
  57. this.$refs.popup.open('bottom')
  58. let rota = 180;
  59. //判断是否展开
  60. if (this.isRote) {
  61. rota = 0;
  62. //标记未展开
  63. this.isRote = false;
  64. //隐藏需要隐藏的内容
  65. this.showAddPople = false;
  66. } else {
  67. this.isRote = true;
  68. //显示隐藏的内容
  69. this.showAddPople = true;
  70. }
  71. //创建动画
  72. this.animation = uni.createAnimation();
  73. //设置旋转角度
  74. this.animation.rotate(rota).step()
  75. //导出动画
  76. this.animationData = this.animation.export()
  77. },
  78. moveHandle() {
  79. return false
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .head_filter {
  86. height: 35px;
  87. line-height: 36px;
  88. text-align: center;
  89. .filter_item {
  90. line-height: 36px;
  91. border: 2rpx solid rgba(255, 255, 255, 0.7);
  92. }
  93. .filter_item:first-child {
  94. width: 290rpx;
  95. }
  96. .last_item {
  97. width: 180rpx;
  98. }
  99. }
  100. .dropdown-icon {
  101. display: inline-block;
  102. transition: transform 0.3s ease-in-out;
  103. /* 添加平滑的旋转动画 */
  104. }
  105. </style>