suspen_button.vue 4.5 KB

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