index.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import IComponentServer from "../IComponentServer";
  2. import { TUIChatStoreType } from "../types";
  3. import { useStore } from "vuex";
  4. import store from "@/store";
  5. /**
  6. * class TUIProfileServer
  7. *
  8. * TUIProfile 逻辑主体
  9. */
  10. export default class TUIProfileServer extends IComponentServer {
  11. public TUICore: any;
  12. public store = store.state.timStore;
  13. public currentStore: any = {};
  14. constructor(TUICore: any) {
  15. super();
  16. this.TUICore = uni.$TUIKit;
  17. this.bindTIMEvent();
  18. }
  19. /**
  20. * 组件销毁
  21. */
  22. public destroyed() {
  23. this.unbindTIMEvent();
  24. }
  25. /**
  26. * /////////////////////////////////////////////////////////////////////////////////
  27. * //
  28. * // TIM 事件监听注册接口
  29. * //
  30. * /////////////////////////////////////////////////////////////////////////////////
  31. */
  32. private bindTIMEvent() {
  33. this.TUICore.on(
  34. uni.$TIM.EVENT.PROFILE_UPDATED,
  35. this.handleProfileUpdated,
  36. this
  37. );
  38. }
  39. private unbindTIMEvent() {
  40. this.TUICore.off(uni.$TIM.EVENT.PROFILE_UPDATED, this.handleProfileUpdated);
  41. }
  42. private handleProfileUpdated(event: any) {
  43. console.log(event)
  44. }
  45. }