redPacket.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="red-packet" :class="info.userId == userId ? 'me' : 'you'">
  3. <div class="top"
  4. :class="{'lose-bg': isLoseBg, 'unopen': info.ext.grabbed == 0}">
  5. <i class="red-packet-icon"></i>
  6. <div class="word">
  7. <p>{{info.content.title}}</p>
  8. <p class="bot-text" v-if="info.ext.grabbed == 1">{{$t('redPacket.received')}}</p>
  9. <p class="bot-text" v-else-if="info.ext.redpack_status == 1">{{$t('redPacket.lootAll')}}</p>
  10. <p class="bot-text" v-else-if="info.ext.redpack_status == 2">{{$t('redPacket.expired')}}</p>
  11. </div>
  12. </div>
  13. <div class="bot">
  14. {{info.content.tokenType || 'EOS'}}{{$t('chat.redpack')}}
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'redPacket',
  21. props: ['info'],
  22. computed: {
  23. userId () {
  24. return this.$store.state.userId
  25. },
  26. isLoseBg () {
  27. return this.info.ext.redpack_status != 0 || this.info.ext.grabbed == 1
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="scss" scoped>
  33. .red-packet{
  34. width: 210px;
  35. border-radius: 6px;
  36. margin-top: 5px;
  37. overflow: hidden;
  38. cursor: pointer;
  39. .top{
  40. height: 70px;
  41. line-height: 70px;
  42. font-size: 14px;
  43. padding-left: 14px;
  44. background-color: #e99c57;
  45. .word{
  46. color: #ffffff;
  47. display: inline-block;
  48. width: 140px;
  49. vertical-align: middle;
  50. p{
  51. @include ellipsis();
  52. line-height: 1.2;
  53. &:first-child{
  54. margin-bottom: 6px;
  55. }
  56. }
  57. }
  58. }
  59. .unopen {
  60. background-color: #e99c57;
  61. .red-packet-icon {
  62. background: url('./img/unopen-packet.png') no-repeat;
  63. width: 36px;
  64. height: 44px;
  65. background-size: 100%;
  66. }
  67. }
  68. .lose-bg{
  69. background-color: #f6d7bc !important;
  70. .red-packet-icon{
  71. background: url('./img/open-packet.png') no-repeat;
  72. width: 36px;
  73. height: 51px;
  74. background-size: 100%;
  75. }
  76. }
  77. .bot{
  78. background-color: #ffffff;
  79. color: #999999;
  80. padding-left: 14px;
  81. font-size: 12px;
  82. height: 26px;
  83. line-height: 26px;
  84. }
  85. &.you{
  86. float: left;
  87. }
  88. &.me{
  89. float: right;
  90. .top{
  91. text-align: left;
  92. }
  93. .bot{
  94. text-align: left;
  95. }
  96. }
  97. .tips{
  98. display: inline-block;
  99. }
  100. .red-packet-icon{
  101. display: inline-block;
  102. vertical-align: middle;
  103. margin-right: 8px;
  104. }
  105. }
  106. .bot-text{
  107. font-size: 12px;
  108. }
  109. </style>