inputbar.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // comps/inputbar/inputbar.js
  2. let msgType = require("../../../utils/msgtype.js");
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. username: {
  9. type: Object,
  10. value: {}
  11. },
  12. chatType: {
  13. type: String,
  14. value: msgType.chatType.SINGLE_CHAT,
  15. },
  16. },
  17. /**
  18. * 组件的初始数据
  19. */
  20. data: {
  21. __comps__: {
  22. main: null,
  23. emoji: null,
  24. image: null,
  25. location: null,
  26. video: null,
  27. ptopcall: null
  28. },
  29. },
  30. /**
  31. * 组件的方法列表
  32. */
  33. methods: {
  34. // 事件有长度限制:仅限 26 字符
  35. toggleRecordModal() {
  36. this.triggerEvent(
  37. "tapSendAudio",
  38. null,
  39. {
  40. bubbles: true,
  41. composed: true
  42. }
  43. );
  44. },
  45. onMakeVideoCall(evt) {
  46. this.triggerEvent('makeVideoCall', evt.detail)
  47. },
  48. onMakeAudioCall(evt) {
  49. this.triggerEvent('makeAudioCall', evt.detail)
  50. },
  51. sendVideo() {
  52. this.data.__comps__.video.sendVideo();
  53. },
  54. openCamera() {
  55. this.data.__comps__.image.openCamera();
  56. },
  57. openEmoji() {
  58. // this.data.__comps__.emoji.openEmoji();
  59. },
  60. cancelEmoji() {
  61. // this.data.__comps__.emoji.cancelEmoji();
  62. },
  63. sendImage() {
  64. this.data.__comps__.image.sendImage();
  65. },
  66. sendLocation() {
  67. // this.data.__comps__.location.sendLocation();
  68. },
  69. emojiAction(evt) {
  70. this.data.__comps__.main.emojiAction(evt.detail.msg);
  71. },
  72. callVideo() {
  73. console.log('this.data.__comps__.ptopcall', this.data.__comps__.ptopcall)
  74. console.log('username', this.data.username)
  75. if (this.data.username.groupId) {
  76. this.data.__comps__.ptopcall.show('group')
  77. } else {
  78. this.data.__comps__.ptopcall.show('contact')
  79. }
  80. }
  81. },
  82. // lifetimes
  83. created() { },
  84. attached() { },
  85. moved() { },
  86. detached() { },
  87. ready() {
  88. this.setData({
  89. isIPX: getApp().globalData.isIPX
  90. })
  91. let comps = this.data.__comps__;
  92. comps.main = this.selectComponent("#chat-suit-main");
  93. comps.emoji = this.selectComponent("#chat-suit-emoji");
  94. comps.image = this.selectComponent("#chat-suit-image");
  95. comps.ptopcall = this.selectComponent("#chat-suit-ptopcall")
  96. // comps.location = this.selectComponent("#chat-suit-location");
  97. comps.video = this.selectComponent("#chat-suit-video");
  98. },
  99. })