suspen_button.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="suspen-button">
  3. <view class="px-suspen-button">
  4. <view :class="['center-button', 'px-button', { active: open }]" @click.stop="onOpen">
  5. <image v-if="!$slots.center" mode="widthFix" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/most_confidential.png"> </image>
  6. </view>
  7. <view :class="['top-button', 'px-button', 'ot-button', { 'active-top': open, 'hidden-top': !first && !open }]" @click.stop="goSecretDetail(1)">
  8. <image v-if="!$slots.top" mode="widthFix" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/report_choiceness.png"> </image>
  9. </view>
  10. <view :class="['left-button', 'px-button', 'ot-button', { 'active-left': open, 'hidden-left': !first && !open }]" @click.stop="goSecretDetail(2)">
  11. <image v-if="!$slots.bottom" mode="widthFix" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/this_week.png"> </image>
  12. </view>
  13. <view :class="['bottom-button', 'px-button', 'ot-button', { 'active-bottom': open, 'hidden-bottom': !first && !open }]" @click.stop="goSecretDetail(3)">
  14. <image v-if="!$slots.left" mode="widthFix" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/last_week.png"> </image>
  15. </view>
  16. </view>
  17. <view :class="[open ? 'mask-show' : '']" @click.stop="onOpen"> </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. props: {},
  23. data() {
  24. return {
  25. first: true, //样式的一个切换
  26. open: false,
  27. };
  28. },
  29. methods: {
  30. onOpen() {
  31. this.open = !this.open;
  32. this.first = false;
  33. },
  34. /* 绝密标签点击后的跳转 */
  35. goSecretDetail(type) {
  36. uni.navigateTo({
  37. url: "/reportPages/secretDetails/secretDetails?type=" + type,
  38. });
  39. this.onOpen();
  40. },
  41. },
  42. };
  43. </script>
  44. <style lang="scss" scoped>
  45. .suspen-button {
  46. width: 100%;
  47. height: 100%;
  48. }
  49. .mask-show {
  50. position: fixed;
  51. top: 0;
  52. left: 0;
  53. right: 0;
  54. bottom: 0;
  55. transition: transform 0.3s;
  56. background-color: rgba(0, 0, 0, 0.6);
  57. z-index: 900;
  58. transition: all 0.3s ease-in-out 0s;
  59. transform: scale(1, 1);
  60. }
  61. .px-suspen-button {
  62. position: fixed;
  63. z-index: 999;
  64. bottom: 320rpx;
  65. right: 180rpx;
  66. }
  67. .px-button {
  68. position: absolute;
  69. border-radius: 50%;
  70. top: 0rpx;
  71. left: 0rpx;
  72. height: 120rpx;
  73. width: 120rpx;
  74. display: flex;
  75. flex-direction: column;
  76. justify-content: center;
  77. align-items: center;
  78. z-index: 999;
  79. overflow: hidden;
  80. z-index: 999;
  81. image {
  82. width: 100%;
  83. height: 100%;
  84. }
  85. &.center-button {
  86. z-index: 1000;
  87. }
  88. &.ot-button {
  89. display: none;
  90. opacity: 0;
  91. &.active-top {
  92. animation: 0.5s ease top forwards;
  93. display: flex;
  94. }
  95. &.hidden-top {
  96. animation: 0.5s ease hidetop forwards;
  97. display: flex;
  98. }
  99. &.active-left {
  100. animation: 0.5s ease left forwards;
  101. display: flex;
  102. }
  103. &.hidden-left {
  104. animation: 0.5s ease hideleft forwards;
  105. display: flex;
  106. }
  107. &.active-bottom {
  108. animation: 0.5s ease bottom forwards;
  109. display: flex;
  110. }
  111. &.hidden-bottom {
  112. animation: 0.5s ease hidebottom forwards;
  113. display: flex;
  114. }
  115. }
  116. }
  117. @keyframes center {
  118. 0% {
  119. }
  120. 100% {
  121. transform: rotate(315deg);
  122. opacity: 1;
  123. }
  124. }
  125. @keyframes bottom {
  126. 0% {
  127. opacity: 0;
  128. }
  129. 100% {
  130. top: 120rpx;
  131. left: -100rpx;
  132. transform: rotate(360deg);
  133. opacity: 1;
  134. }
  135. }
  136. @keyframes left {
  137. 0% {
  138. opacity: 0;
  139. }
  140. 100% {
  141. top: 0rpx;
  142. left: -180rpx;
  143. transform: rotate(360deg);
  144. opacity: 1;
  145. }
  146. }
  147. @keyframes top {
  148. 0% {
  149. opacity: 0;
  150. }
  151. 100% {
  152. top: -120rpx;
  153. left: -90rpx;
  154. transform: rotate(360deg);
  155. opacity: 1;
  156. }
  157. }
  158. @keyframes hideleft {
  159. 0% {
  160. top: 0rpx;
  161. left: -180rpx;
  162. opacity: 1;
  163. }
  164. 100% {
  165. top: 0rpx;
  166. left: 0rpx;
  167. transform: rotate(360deg);
  168. opacity: 0;
  169. }
  170. }
  171. @keyframes hidebottom {
  172. 0% {
  173. top: 100rpx;
  174. left: -120rpx;
  175. opacity: 1;
  176. }
  177. 100% {
  178. top: 0rpx;
  179. left: 0rpx;
  180. transform: rotate(360deg);
  181. opacity: 0;
  182. }
  183. }
  184. @keyframes hidetop {
  185. 0% {
  186. top: -100rpx;
  187. left: -120rpx;
  188. opacity: 1;
  189. }
  190. 100% {
  191. top: 0rpx;
  192. left: 0rpx;
  193. transform: rotate(360deg);
  194. opacity: 0;
  195. }
  196. }
  197. </style>