activity_on_1.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view>
  3. <view class="tui-alert-class tui-alert-box" :class="[show?'tui-alert-show':'tui-alert-hide']" @touchmove.stop.prevent="discard">
  4. <image src="https://admin-b.caimei365.com/userfiles/1/images/photo/2020/08/icon-alert%402x.png" mode="" @click.stop="handleClick"></image>
  5. <text class="iconfont icon-iconfontguanbi" @click.stop="handleClickCancel"></text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name:"tuiAlert",
  12. props: {
  13. //控制显示
  14. show: {
  15. type: Boolean,
  16. default: false
  17. },
  18. //提示信息字体大小
  19. size: {
  20. type: Number,
  21. default: 30
  22. },
  23. //提示信息字体颜色
  24. color: {
  25. type: String,
  26. default: "#333"
  27. },
  28. //按钮字体颜色
  29. btnColor: {
  30. type: String,
  31. default: "#EB0909"
  32. },
  33. btnText:{
  34. type: String,
  35. default: ""
  36. },
  37. //点击遮罩 是否可关闭
  38. maskClosable: {
  39. type: Boolean,
  40. default: false
  41. }
  42. },
  43. methods: {
  44. handleClick(e) {
  45. console.log(e);
  46. if (!this.show) return;
  47. this.$emit('click',false);
  48. },
  49. handleClickCancel() {
  50. this.$emit('cancel',false);
  51. },
  52. discard(){
  53. //丢弃
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. .tui-alert-box {
  60. width: 100%;
  61. height: 100%;
  62. display: flex;
  63. align-items: center;
  64. justify-content: center;
  65. flex-direction: column;
  66. position: fixed;
  67. left: 0;
  68. top: 100%;
  69. opacity: 0;
  70. background: rgba(0,0,0,.5);
  71. z-index: 99990;
  72. image{
  73. width: 560rpx;
  74. height: 784rpx;
  75. margin-top: 100rpx;
  76. }
  77. }
  78. .tui-alert-show {
  79. top: 0;
  80. opacity: 1;
  81. animation:rundtop 0.5s;
  82. }
  83. .tui-alert-hide{
  84. top: 100%;
  85. opacity: 0;
  86. animation:rundbottom 0.5s;
  87. }
  88. .icon-iconfontguanbi{
  89. display: block;
  90. width: 100rpx;
  91. height: 100rpx;
  92. line-height: 100rpx;
  93. text-align: center;
  94. color: #FFFFFF;
  95. position: absolute;
  96. bottom: 10%;
  97. left: 50%;
  98. font-size: $font-size-48;
  99. font-weight: bold;
  100. margin-left: -50rpx;
  101. }
  102. .tui-alert-mask-show {
  103. visibility: visible;
  104. opacity: 1;
  105. }
  106. .tui-alert-btn {
  107. width: 100%;
  108. height: 90rpx;
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. background-color: #fff;
  113. box-sizing: border-box;
  114. position: relative;
  115. font-size: 32rpx;
  116. line-height: 32rpx;
  117. }
  118. .tui-alert-btn-hover {
  119. background-color: #f7f7f7;
  120. }
  121. .tui-alert-btn::before {
  122. width: 100%;
  123. content: "";
  124. position: absolute;
  125. border-top: 1rpx solid #E0E0E0;
  126. -webkit-transform: scaleY(0.5);
  127. transform: scaleY(0.5);
  128. left: 0;
  129. top: 0;
  130. }
  131. @keyframes rundtop{
  132. 0%{top: 100%;opacity: 0;}
  133. 100%{top:0;opacity: 1;}
  134. }
  135. @keyframes rundbottom{
  136. 0%{top: 0;opacity: 1;}
  137. 100%{top:100%;opacity: 0;}
  138. }
  139. </style>