packet.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="dialog" @touchmove.stop="">
  3. <view class="dialog-body">
  4. <view>
  5. <image class="avatar" :src="sender.avatar" />
  6. <view class="username">{{sender.name}}</view>
  7. <view class="note" v-if="!info.mines.length">{{info.note}}</view>
  8. <view class="odds">{{mine}}</view>
  9. <view class="placeholder"></view>
  10. <view class="empty" v-if="!info.can">手慢了,红包已被抢光了</view>
  11. <image v-else class="open" src="/static/khb.png" @tap="$emit('open')" />
  12. <view class="log" @tap="$emit('logs')">看看大家的手气 &gt; </view>
  13. <view class="emoji" @tap="$emit('close')">&#xe8e7;</view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. info: {
  22. type: Object,
  23. required: true
  24. }
  25. },
  26. computed: {
  27. sender() {
  28. return this.info.sender;
  29. },
  30. mine() {
  31. const {mines, count} = this.info;
  32. if (!mines.length) return count + '包';
  33. const string = '单双三四五六七八九'.charAt(mines.length-1) + '雷';
  34. return count + '包' + string;
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .dialog {
  41. z-index: 1000;
  42. position: fixed;
  43. top: 0;
  44. left: 0;
  45. width: 100vw;
  46. height: 100vh;
  47. background-color: rgba(#000, .5);
  48. &-body {
  49. background-color: #d4533d;
  50. border-radius: $uni-border-radius-base;
  51. width: 540upx;
  52. height: 780upx;
  53. margin: 10vh auto;
  54. position: relative;
  55. overflow: hidden;
  56. color: #c3a774;
  57. font-weight: bold;
  58. box-shadow: 0 0 8upx rgba(0,0,0,0.3);
  59. &::before {
  60. z-index: 0;
  61. position: absolute;
  62. display: block;
  63. width: 600upx;
  64. height: 620upx;
  65. content: '';
  66. top: -40upx;
  67. left: -30upx;
  68. background-color: #db5443;
  69. border-radius: 600upx/300upx;
  70. box-shadow: 0 4px 4upx rgba(0,0,0,0.1);
  71. }
  72. > view {
  73. position: relative;
  74. z-index: 10;
  75. width: 100%;
  76. height: 100%;
  77. display: flex;
  78. flex-direction: column;
  79. justify-content: center;
  80. align-items: center;
  81. padding: $uni-spacing-col-lg $uni-spacing-row-lg;
  82. box-sizing: border-box;
  83. }
  84. }
  85. .emoji {
  86. position: absolute;
  87. width: 76upx;
  88. height: 76upx;
  89. line-height: 76upx;
  90. text-align: center;
  91. top: 10upx;
  92. right: 10upx;
  93. color: #777;
  94. }
  95. .avatar {
  96. width: 100upx;
  97. height: 100upx;
  98. border-radius: $uni-border-radius-base;
  99. background-color: #ddd;
  100. margin-top: 20upx;
  101. }
  102. .username {
  103. margin-top: 10upx;
  104. font-size: 28upx;
  105. }
  106. .note {
  107. padding: $uni-spacing-col-lg $uni-spacing-row-base;
  108. }
  109. .placeholder {
  110. flex: 1;
  111. width: 10upx;
  112. }
  113. .open {
  114. width: 150upx;
  115. height: 150upx;
  116. border-radius: 50%;
  117. margin-bottom: 60upx;
  118. }
  119. .log {
  120. font-weight: normal;
  121. text-decoration: underline;
  122. font-size: 28upx;
  123. }
  124. .empty {
  125. margin-bottom: 220upx;
  126. color: #fff;
  127. }
  128. }
  129. </style>