chatroom.wxml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <view class="chatroom">
  2. <view class="header">
  3. <!-- display number of people in the room -->
  4. <view class="left"></view>
  5. <!-- room name -->
  6. <view class="middle">{{groupName}}</view>
  7. <!-- reserved -->
  8. <view class="right"></view>
  9. </view>
  10. <!-- chats -->
  11. <scroll-view
  12. class="body"
  13. scroll-y
  14. scroll-with-animation="{{scrollWithAnimation}}"
  15. scroll-top="{{scrollTop}}"
  16. scroll-into-view="{{scrollToMessage}}"
  17. bindscrolltoupper="onScrollToUpper"
  18. >
  19. <view
  20. wx:for="{{chats}}"
  21. wx:key="{{item._id}}"
  22. id="item-{{index}}"
  23. class="message {{openId == item._openid ? 'message__self' : ''}}"
  24. >
  25. <image
  26. class="avatar"
  27. src="{{item.avatar}}"
  28. mode="scaleToFill"
  29. ></image>
  30. <view class="main">
  31. <view class="nickname">{{item.nickName}}</view>
  32. <block wx:if="{{item.msgType === 'image'}}">
  33. <view class="image-wrapper">
  34. <view class="loading" wx:if="{{item.writeStatus > -1}}">{{item.writeStatus}}%</view>
  35. <image
  36. src="{{item.tempFilePath || item.imgFileID}}"
  37. data-fileid="{{item.tempFilePath || item.imgFileID}}"
  38. class="image-content"
  39. style="{{item.imgStyle}}"
  40. mode="scallToFill"
  41. bindtap="onMessageImageTap"></image>
  42. </view>
  43. </block>
  44. <block wx:else>
  45. <view class="text-wrapper">
  46. <view class="loading" wx:if="{{item.writeStatus === 'pending'}}">···</view>
  47. <view class="text-content">{{item.textContent}}</view>
  48. </view>
  49. </block>
  50. </view>
  51. </view>
  52. </scroll-view>
  53. <!-- message sender -->
  54. <view class="footer">
  55. <view class="message-sender" wx:if="{{userInfo}}">
  56. <input
  57. class="text-input"
  58. type="text"
  59. confirm-type="send"
  60. bindconfirm="onConfirmSendText"
  61. cursor-spacing="20"
  62. value="{{textInputValue}}"
  63. ></input>
  64. <image
  65. src="./photo.png"
  66. class="btn-send-image"
  67. mode="scaleToFill"
  68. bindtap="onChooseImage"
  69. ></image>
  70. </view>
  71. <view class="message-sender" wx:if="{{!userInfo}}">
  72. <button
  73. open-type="getUserInfo"
  74. bindgetuserinfo="onGetUserInfo"
  75. class="userinfo"
  76. >请先登录后参与聊天</button>
  77. </view>
  78. </view>
  79. </view>