redPackTip.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <div class="tip-wrap">
  3. <i class="redpack-icon"></i>
  4. <template v-if="isMe">
  5. <span>{{group.members[info.to].nick_name}}</span>领取了你的<span @click="$packetGet(info)" class="text">红包</span>
  6. </template>
  7. <template v-else>
  8. 你领取了<span>{{group.members[info.from].nick_name}}</span>的<span @click="$packetGet(info)" class="text">红包</span>
  9. </template>
  10. </div>
  11. </template>
  12. <script>
  13. import { mapState } from 'vuex'
  14. export default {
  15. name: 'redPackTip',
  16. props: ['info'],
  17. computed: {
  18. ...mapState([
  19. 'userId',
  20. 'group'
  21. ]),
  22. isMe () {
  23. return this.info.from == this.userId
  24. }
  25. }
  26. }
  27. </script>
  28. <style lang="scss" scoped>
  29. .tip-wrap{
  30. text-align: center;
  31. font-size: 14px;
  32. color: #999999;
  33. line-height: 30px;
  34. .redpack-icon{
  35. display: inline-block;
  36. margin-right: 4px;
  37. vertical-align: middle;
  38. background: url('../../assets/icon-packet.png') no-repeat;
  39. width: 21px;
  40. height: 21px;
  41. background-size: 100%;
  42. }
  43. span{
  44. display: inline-block;
  45. margin: 0 2px;
  46. }
  47. .text{
  48. color: #e99c57;
  49. font-weight: bold;
  50. cursor: pointer;
  51. }
  52. }
  53. </style>