head_filter.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. data() {
  33. return {
  34. type: 'down',
  35. animationData: {},
  36. isRote: false,
  37. animation: null,
  38. };
  39. },
  40. methods: {
  41. onChange(type) {
  42. this.$refs.popup.close('bottom')
  43. this.$emit('onTopSelect', type)
  44. },
  45. startAnimation() {
  46. //旋转角度
  47. this.$refs.popup.open('bottom')
  48. let rota = 180;
  49. //判断是否展开
  50. if (this.isRote) {
  51. rota = 0;
  52. //标记未展开
  53. this.isRote = false;
  54. //隐藏需要隐藏的内容
  55. this.showAddPople = false;
  56. } else {
  57. this.isRote = true;
  58. //显示隐藏的内容
  59. this.showAddPople = true;
  60. }
  61. //创建动画
  62. this.animation = uni.createAnimation();
  63. //设置旋转角度
  64. this.animation.rotate(rota).step()
  65. //导出动画
  66. this.animationData = this.animation.export()
  67. },
  68. moveHandle() {
  69. return false
  70. },
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .head_filter {
  76. height: 35px;
  77. line-height: 36px;
  78. text-align: center;
  79. .filter_item {
  80. line-height: 36px;
  81. border: 2rpx solid rgba(255, 255, 255, 0.7);
  82. }
  83. .filter_item:first-child {
  84. width: 290rpx;
  85. }
  86. .last_item {
  87. width: 180rpx;
  88. }
  89. }
  90. .dropdown-icon {
  91. display: inline-block;
  92. transition: transform 0.3s ease-in-out;
  93. /* 添加平滑的旋转动画 */
  94. }
  95. </style>