redPackTip.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div class="msg-item-common tip-wrap">
  3. <i class="redpack-icon"></i>
  4. <span>{{info.to == userId ? $t('public.you') : toUser.nick_name }}</span>{{$t('redPacket.drawed')}}
  5. <span>{{info.from == userId ? $t('public.you') : fromUser.nick_name}}</span>{{$t('redPacket.whos')}}
  6. <span class="text" @click="$packetGet(packetGetInfo,true)">{{$t('chat.redpack')}}</span>
  7. </div>
  8. </template>
  9. <script>
  10. import { mapState } from 'vuex'
  11. export default {
  12. name: 'redPackTip',
  13. props: ['info', 'msgItem'],
  14. data () {
  15. return ({
  16. fromUser: {},
  17. toUser: {}
  18. })
  19. },
  20. computed: {
  21. ...mapState([
  22. 'userId',
  23. 'group'
  24. ]),
  25. ...mapState({
  26. members: state => state.group.members
  27. }),
  28. packetGetInfo () {
  29. let packetGetInfo = {
  30. userId: this.info.from,
  31. content: {
  32. trxId: this.info.content.redpack_trx_id
  33. }
  34. }
  35. return packetGetInfo
  36. }
  37. },
  38. created () {
  39. this.fromUser = (this.members && this.members[parseInt(this.info.from)]) || {}
  40. this.toUser = (this.members && this.members[this.info.to]) || {}
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .tip-wrap{
  46. text-align: center;
  47. font-size: 12px;
  48. color: #999999;
  49. line-height: 30px;
  50. .redpack-icon{
  51. display: inline-block;
  52. margin-right: 4px;
  53. vertical-align: middle;
  54. background: url('../../assets/icon-packet.png') no-repeat;
  55. width: 21px;
  56. height: 21px;
  57. background-size: 100%;
  58. }
  59. span{
  60. display: inline-block;
  61. margin: 0 2px;
  62. }
  63. .text{
  64. color: #e99c57;
  65. font-weight: bold;
  66. cursor: pointer;
  67. }
  68. }
  69. </style>