forward.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view>
  3. <view v-for="(item,index) in chatItem">
  4. <chatItem @linkTo="linkForward" :value="item" :index="index"></chatItem>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import chatItem from '@/components/chatItem.vue'
  10. export default {
  11. name:'forward',
  12. components:{chatItem},
  13. data() {
  14. return {
  15. msgContext:'',
  16. msgType:0
  17. };
  18. },
  19. onShow(){
  20. this.$socket.queryChats('', this.userData.user.operId,(res) => {
  21. if (res.success) {
  22. this.$u.vuex('chatItem', res.chats)
  23. }
  24. });
  25. },
  26. onLoad({msgContext,msgType}) {
  27. this.msgContext = msgContext
  28. this.msgType = msgType
  29. },
  30. methods:{
  31. linkForward({chatId,chatType}){
  32. let action = chatType ==1 ? 'send2Group' : 'send2Friend'
  33. this.$socket[action](chatId, this.userData.user.operId, this.msgContext, this.msgType, res => {
  34. if (res.success) {
  35. uni.showToast({
  36. icon:'success',
  37. title:'转发成功'
  38. })
  39. this.$socket.createChatList(this.userData.user.operId, chatId, this.msgContext, this.msgType, res => {})
  40. }
  41. });
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. </style>