index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view>
  3. <view :class="'lt-msg ddflex'+(about.greyTheme==1?' grayTheme':'')" @click="jumpConversation()" :style="'bottom:'+bottom+';'">
  4. <view class="ddflex" style="position: relative;width: 100%;height: 100%;">
  5. <image src="../../static/pages/images/lt.png"></image>
  6. <view class="lt-msg-num" v-if="unReadSpotNum>0">{{unReadSpotNum}}</view>
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. const app = getApp();
  13. const req = require("../../utils/request.js");
  14. let disp = require("../../hxChatSDK/utils/broadcast");
  15. export default {
  16. data() {
  17. return {
  18. picUrlss: req.public.picUrls,
  19. unReadSpotNum: 0,
  20. about:''
  21. };
  22. },
  23. components: {},
  24. props: {
  25. bottom: {
  26. type: String,
  27. default: '200rpx',
  28. }
  29. },
  30. watch: {},
  31. async mounted() {
  32. //发起获取未读消息通知
  33. disp.fire("em.main.ready");
  34. //监听未读消息数
  35. disp.on("em.unreadspot", this.onChatPageUnreadspot);
  36. this.about = await req.getsysConfig()
  37. },
  38. onUnload() {
  39. disp.off("em.unreadspot", this.onChatPageUnreadspot)
  40. },
  41. methods: {
  42. onChatPageUnreadspot(message) {
  43. this.unReadSpotNum = getApp().globalData.unReadMessageNum > 99 ?
  44. "99+" : getApp().globalData.unReadMessageNum;
  45. },
  46. jumpConversation() {
  47. req.jumpConversation();
  48. },
  49. }
  50. };
  51. </script>
  52. <style>
  53. @import "./index.css";
  54. </style>