toast-confirm.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="toastConfirm" v-if="show">
  3. <view class="toastBody">
  4. <view class="icon">
  5. <view class="star star1"></view>
  6. <view class="star star2"></view>
  7. <view class="star star3"></view>
  8. <view class="iconImg"></view>
  9. </view>
  10. <view class="title">{{ title }}</view>
  11. <view class="content">{{ content }}</view>
  12. <view class="confirmBtns">
  13. <view class="btn cancel" @click="confirm(false)">取消</view>
  14. <view class="btn confirm" @click="confirm(true)">确定</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. props: {
  22. show: {
  23. type: Boolean,
  24. default: false
  25. },
  26. title: {
  27. type: String,
  28. default: '温馨提醒'
  29. },
  30. content: {
  31. type: String,
  32. default: '请确认内容信息'
  33. }
  34. },
  35. methods:{
  36. confirm(flag) {
  37. this.$emit('confirm', flag)
  38. }
  39. }
  40. }
  41. </script>
  42. <style scoped lang="scss">
  43. .toastConfirm {
  44. position: fixed;
  45. top: 0;
  46. left: 0;
  47. bottom: 0;
  48. right: 0;
  49. background: rgba(0,0,0,.8);
  50. display: flex;
  51. align-items: center;
  52. justify-content: center;
  53. z-index: 99;
  54. .toastBody {
  55. width: calc(100% - 130rpx);
  56. padding: 40rpx;
  57. padding-top: 100rpx;
  58. box-sizing: border-box;
  59. background-color: #FFFFFF;
  60. position: relative;
  61. border-radius: 26rpx;
  62. .icon {
  63. width: 126rpx;
  64. height: 126rpx;
  65. border-radius: 50%;
  66. background: linear-gradient(180deg, #F97C55 0%, #F44545 100%);
  67. display: flex;
  68. align-items: center;
  69. justify-content: center;
  70. position: absolute;
  71. left: 50%;
  72. top: 0;
  73. transform: translate(-50%, -50%);
  74. .iconImg {
  75. width: 70rpx;
  76. height: 70rpx;
  77. background-position: center;
  78. background-repeat: no-repeat;
  79. background-size: 100%;
  80. background-image: url(../static/gift/6.png);
  81. }
  82. .star {
  83. position: absolute;
  84. &::before, &:after {
  85. content: "";
  86. display: block;
  87. width: 16rpx;
  88. height: 16rpx;
  89. transform: rotateZ(45deg) skew(30deg, 30deg);
  90. background: linear-gradient(180deg, #F97C55 0%, #F44545 100%);
  91. position: absolute;
  92. }
  93. &:after {
  94. transform: rotate(90deg) rotateZ(45deg) skew(30deg, 30deg);
  95. }
  96. &.star1 {
  97. right: 0rpx;
  98. top: -10rpx;
  99. }
  100. &.star2 {
  101. left: -16rpx;
  102. bottom: 16rpx;
  103. transform: scale(0.5);
  104. }
  105. &.star3 {
  106. right: -30rpx;
  107. top: 18rpx;
  108. transform: scale(0.5);
  109. }
  110. }
  111. }
  112. .title {
  113. color: #333333;
  114. font-size: 36rpx;
  115. line-height: 50rpx;
  116. text-align: center;
  117. margin-bottom: 20rpx;
  118. font-weight: bold;
  119. }
  120. .content {
  121. color: #333333;
  122. font-size: 32rpx;
  123. line-height: 44rpx;
  124. text-align: center;
  125. margin-bottom: 40rpx;
  126. }
  127. .confirmBtns{
  128. width: 100%;
  129. padding: 0 10rpx;
  130. box-sizing: border-box;
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. .btn {
  135. width: 242rpx;
  136. height: 88rpx;
  137. text-align: center;
  138. line-height: 88rpx;
  139. border-radius: 88rpx;
  140. font-size: 32rpx;
  141. &.cancel {
  142. color: #999999;
  143. background-color: #E9E9E9;
  144. }
  145. &.confirm {
  146. color: #FFFFFF;
  147. background: linear-gradient(93deg, #F97C55 0%, #F44545 100%);
  148. }
  149. }
  150. }
  151. }
  152. }
  153. </style>