tip.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="app">
  3. <view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'red_envelope_tip'">
  4. <image src="/static/img/chat-red-v2.svg"></image>
  5. <text v-if="user.uid == inItem.lq.uid">
  6. 你领取{{inItem.send.name}}
  7. </text>
  8. <text v-else>
  9. {{inItem.lq.name}} 领取您的
  10. </text>
  11. <text class="red" @tap="tapRed">红包</text>
  12. <text v-if="inItem.is_completed">,你的红包已被领完。</text>
  13. </view>
  14. <view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'tip'">
  15. {{item.data}}
  16. </view>
  17. <view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'group_del'">
  18. {{inItem.nickname}}已被移除群聊
  19. </view>
  20. <view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'withdraw'">
  21. <text v-if="item.sendUser.uid == user.uid">你撤回了一条消息</text>
  22. <text v-else>{{item.sendUser.nickname}}撤回了一条消息</text>
  23. </view>
  24. </view>
  25. </template>
  26. <style lang="scss">
  27. .red_envelope_tip{color:$ic-default-text ;font-size: 14px;padding: 10px;}
  28. .red_envelope_tip image{width: 15px;height: 15px;}
  29. .red_envelope_tip .red{color: #f25642;}
  30. </style>
  31. <script>
  32. import {mapState,mapMutations } from 'vuex';
  33. export default {
  34. computed: mapState(['user','sysData']),
  35. name: 'tip',
  36. props:{
  37. item : {
  38. type: Object,
  39. default: ()=>{return {data:{}} }
  40. }
  41. },
  42. watch:{
  43. item:{
  44. immediate:true,
  45. handler(val) {
  46. if(val.type == 'red_envelope_tip'){
  47. this.inItem = JSON.parse(val.data);
  48. }
  49. if(val.type == 'group_del')
  50. this.inItem = JSON.parse(val.data);
  51. }
  52. }
  53. },
  54. data() {
  55. return{
  56. inItem:{}
  57. }
  58. },
  59. created() {
  60. },
  61. mounted() {
  62. },
  63. methods: {
  64. tapRed:function(){
  65. uni.navigateTo({ url:"/pages/chat/redpack/look?id=" + this.inItem.id});
  66. }
  67. }
  68. }
  69. </script>
  70. <style>
  71. </style>