redPackTip.vue 1.6 KB

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