cnhis-design-vue 3.2.6-release.0 → 3.2.6-release.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/es/components/callback/src/components/render/popupMaps.d.ts +6 -2
  2. package/es/components/expand-field/index.d.ts +1109 -321
  3. package/es/components/expand-field/src/components/FormItemPerson.vue.d.ts +1109 -321
  4. package/es/components/expand-field/src/components/PersonModal.vue.d.ts +1109 -321
  5. package/es/components/expand-field/src/components/form.vue.d.ts +1109 -321
  6. package/es/components/expand-field/src/index.vue.d.ts +1109 -321
  7. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  8. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  9. package/es/components/form-config/index.d.ts +12 -4
  10. package/es/components/form-config/src/FormConfig.vue.d.ts +12 -4
  11. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +6 -2
  12. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +6 -2
  13. package/es/components/form-render/index.d.ts +6 -2
  14. package/es/components/form-render/src/FormRender.vue.d.ts +5 -1
  15. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  16. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +6 -2
  17. package/es/components/form-render/src/FormRenderWrapper.vue2.js +1 -1
  18. package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
  19. package/es/components/form-render/src/types/index.d.ts +4 -1
  20. package/es/components/iho-chat/index.d.ts +57 -27
  21. package/es/components/iho-chat/src/Index.vue.d.ts +58 -27
  22. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  23. package/es/components/iho-chat/src/api/index.js +1 -1
  24. package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +1 -1
  25. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +9 -26
  26. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  27. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +2 -2
  28. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +3 -2
  29. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  30. package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +1 -1
  31. package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +10 -3
  32. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  33. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  34. package/es/components/iho-chat/src/components/Video.vue.d.ts +30 -25
  35. package/es/components/iho-chat/src/components/Video.vue.js +1 -0
  36. package/es/components/iho-chat/src/components/Video.vue2.js +1 -0
  37. package/es/components/iho-chat/src/hooks/useSession.js +1 -1
  38. package/es/components/iho-chat/src/types/index.d.ts +2 -0
  39. package/es/components/iho-chat/src/utils/index.d.ts +1 -1
  40. package/es/components/iho-chat/src/utils/index.js +1 -1
  41. package/es/components/iho-chat/style/index.css +1 -1
  42. package/es/components/index.css +1 -1
  43. package/es/components/info-header/index.d.ts +12 -4
  44. package/es/components/info-header/src/InfoHeader.vue.d.ts +12 -4
  45. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +6 -2
  46. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +6 -2
  47. package/es/components/recommend-search/index.d.ts +8 -8
  48. package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +8 -8
  49. package/es/components/recommend-search/src/components/BaseSearch.d.ts +1 -1
  50. package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +3 -3
  51. package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +3 -3
  52. package/es/components/select-person/index.d.ts +1109 -321
  53. package/es/components/select-person/index.js +1 -1
  54. package/es/components/select-person/src/SelectPerson.vue.d.ts +4 -10
  55. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  56. package/es/components/select-person/src/SelectPersonType.vue.d.ts +314 -0
  57. package/es/components/select-person/src/SelectPersonType.vue.js +1 -0
  58. package/es/components/select-person/src/SelectPersonType.vue2.js +1 -0
  59. package/es/components/select-person/src/components/SearchMultiple.vue.js +1 -0
  60. package/es/components/select-person/src/components/SearchOrgAndStaff.vue.js +1 -0
  61. package/es/components/select-person/src/constants/index.d.ts +2 -0
  62. package/es/components/select-person/src/constants/index.js +1 -0
  63. package/es/components/select-person/src/index.vue.d.ts +1385 -0
  64. package/es/components/select-person/src/index.vue.js +1 -0
  65. package/es/components/select-person/src/index.vue2.js +1 -0
  66. package/es/components/shortcut-setter/index.d.ts +6 -2
  67. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -2
  68. package/es/shared/hooks/useAsyncQueue/index.d.ts +3 -0
  69. package/es/shared/hooks/useAsyncQueue/index.js +1 -1
  70. package/es/shared/package.json.js +1 -1
  71. package/package.json +2 -2
  72. package/es/components/select-person/src/SearchMultiple.vue.js +0 -1
  73. package/es/components/select-person/src/SearchOrgAndStaff.vue.js +0 -1
  74. /package/es/components/select-person/src/{SearchMultiple.vue.d.ts → components/SearchMultiple.vue.d.ts} +0 -0
  75. /package/es/components/select-person/src/{SearchMultiple.vue2.js → components/SearchMultiple.vue2.js} +0 -0
  76. /package/es/components/select-person/src/{SearchOrgAndStaff.vue.d.ts → components/SearchOrgAndStaff.vue.d.ts} +0 -0
  77. /package/es/components/select-person/src/{SearchOrgAndStaff.vue2.js → components/SearchOrgAndStaff.vue2.js} +0 -0
@@ -3,6 +3,7 @@ import { ChatSock } from './utils/chatSock';
3
3
  import { AnyObject } from '../../../shared/types';
4
4
  import { MESSAGE_TYPE } from './constants';
5
5
  import { IState } from './types';
6
+ import { isAudioOrVideoMessage } from './utils';
6
7
  declare const _default: import("vue").DefineComponent<{
7
8
  token: {
8
9
  type: StringConstructor;
@@ -46,7 +47,6 @@ declare const _default: import("vue").DefineComponent<{
46
47
  cssVars: import("vue").ComputedRef<AnyObject>;
47
48
  loading: import("vue").Ref<boolean>;
48
49
  stompClient: import("vue").Ref<ChatSock | undefined>;
49
- showAv: import("vue").Ref<boolean>;
50
50
  state: {
51
51
  orgId: string | number;
52
52
  currentSessionItem: AnyObject;
@@ -60,6 +60,8 @@ declare const _default: import("vue").DefineComponent<{
60
60
  updateSessionItem: AnyObject;
61
61
  isUpdateSession: boolean;
62
62
  currentReferenceMsg: AnyObject | null;
63
+ showVideo: boolean;
64
+ currentAVMsg: AnyObject;
63
65
  };
64
66
  reConnention: number;
65
67
  openSession: (item: AnyObject) => Promise<void>;
@@ -272,7 +274,7 @@ declare const _default: import("vue").DefineComponent<{
272
274
  fileRef: import("vue").Ref<any>;
273
275
  keyword: import("vue").Ref<any>;
274
276
  handleInput: () => void;
275
- currentInfo: {
277
+ pageInfo: {
276
278
  page: number;
277
279
  hasMore: boolean;
278
280
  lastSendTime: string;
@@ -329,7 +331,7 @@ declare const _default: import("vue").DefineComponent<{
329
331
  startTime: import("vue").Ref<any>;
330
332
  endTime: import("vue").Ref<any>;
331
333
  handleInput: () => void;
332
- currentInfo: {
334
+ pageInfo: {
333
335
  page: number;
334
336
  hasMore: boolean;
335
337
  lastSendTime: string;
@@ -447,7 +449,7 @@ declare const _default: import("vue").DefineComponent<{
447
449
  setMsgList: (list?: AnyObject[]) => void;
448
450
  setCurrentSessionItem: (item: AnyObject) => void;
449
451
  showMenu: import("vue").Ref<boolean>;
450
- currentInfo: {
452
+ pageInfo: {
451
453
  page: number;
452
454
  hasMore: boolean;
453
455
  lastSendTime: string;
@@ -623,30 +625,18 @@ declare const _default: import("vue").DefineComponent<{
623
625
  formatTime: typeof import("./utils").formatTime;
624
626
  downloadFile: typeof import("./utils").downloadFile;
625
627
  simplifyMessage: typeof import("./utils").simplifyMessage;
628
+ isAudioOrVideoMessage: typeof isAudioOrVideoMessage;
626
629
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
627
630
  ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
628
631
  EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
629
632
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
630
- ChatFooter: import("vue").DefineComponent<{
631
- showAv: {
632
- type: BooleanConstructor;
633
- default: boolean;
634
- };
635
- }, {
636
- props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
637
- showAv: {
638
- type: BooleanConstructor;
639
- default: boolean;
640
- };
641
- }>> & {}>>;
633
+ ChatFooter: import("vue").DefineComponent<{}, {
642
634
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
643
635
  content: import("vue").Ref<string>;
644
636
  state: IState;
645
637
  stompClient: import("vue").Ref<ChatSock>;
646
638
  setCurrentSessionItem: (item: AnyObject) => void;
647
639
  showEmoji: import("vue").Ref<boolean>;
648
- showVideo: import("vue").Ref<boolean>;
649
- callMode: import("vue").Ref<string>;
650
640
  handleCall: (chatMessageType: string) => void;
651
641
  handleKeyDown: (event: KeyboardEvent) => void;
652
642
  isWrap: (event: KeyboardEvent) => boolean;
@@ -670,25 +660,26 @@ declare const _default: import("vue").DefineComponent<{
670
660
  };
671
661
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
672
662
  CloseCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
663
+ CallOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
664
+ VideocamOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
673
665
  simplifyMessage: typeof import("./utils").simplifyMessage;
674
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
675
- showAv: {
676
- type: BooleanConstructor;
677
- default: boolean;
678
- };
679
- }>>, {
680
- showAv: boolean;
681
- }>;
666
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
682
667
  ChatSearch: import("vue").DefineComponent<{}, {
683
668
  cssVars: import("vue").ComputedRef<AnyObject>;
669
+ listRef: import("vue").Ref<any>;
684
670
  inputRef: import("vue").Ref<any>;
685
671
  showSearch: import("vue").Ref<boolean>;
686
672
  keyword: import("vue").Ref<any>;
687
673
  userList: import("vue").Ref<any>;
688
674
  state: IState;
689
675
  openSession: (item: AnyObject) => Promise<void>;
690
- handleInput: () => Promise<void>;
676
+ pageInfo: {
677
+ page: number;
678
+ hasMore: boolean;
679
+ };
680
+ handleInput: () => void;
691
681
  handleSearch: () => Promise<void>;
682
+ resetAndSearch: () => void;
692
683
  addSession: (userId: string) => Promise<void>;
693
684
  NPopover: any;
694
685
  NButton: any;
@@ -697,6 +688,46 @@ declare const _default: import("vue").DefineComponent<{
697
688
  NIcon: any;
698
689
  SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
699
690
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
691
+ Video: import("vue").DefineComponent<{}, {
692
+ time: {
693
+ timer: any;
694
+ seconds: number;
695
+ };
696
+ state: IState;
697
+ videoRef: import("vue").Ref<any>;
698
+ selfVideoRef: import("vue").Ref<any>;
699
+ tipContent: import("vue").Ref<any>;
700
+ isConnect: import("vue").Ref<boolean>;
701
+ voiceOpen: import("vue").Ref<boolean>;
702
+ messageType: import("vue").ComputedRef<any>;
703
+ callMode: import("vue").ComputedRef<any>;
704
+ info: import("vue").ComputedRef<{
705
+ sessionKey: any;
706
+ avatar: any;
707
+ name: any;
708
+ userId: any;
709
+ }>;
710
+ trtc: import("trtc-sdk-v5").default;
711
+ handleEnter: () => Promise<void>;
712
+ handleExit: () => Promise<void>;
713
+ installEventHandlers: () => void;
714
+ uninstallEventHandlers: () => void;
715
+ handleRemoteVideoAvailable: (event: any) => Promise<void>;
716
+ handleRemoteAudioAvailable: (event: any) => void;
717
+ handleRemoteUserEnter: () => void;
718
+ handleRemoteUserExit: (event: any) => void;
719
+ startTimer: () => void;
720
+ resetTimer: () => void;
721
+ formatSeconds: (seconds: number) => string;
722
+ toggleAudio: () => Promise<void>;
723
+ NButton: any;
724
+ NAvatar: any;
725
+ NIcon: any;
726
+ Call: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
727
+ MicOffCircle: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
728
+ Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
729
+ MESSAGE_TYPE: typeof MESSAGE_TYPE;
730
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
700
731
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("template-click" | "unread-message-update")[], "template-click" | "unread-message-update", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
701
732
  token: {
702
733
  type: StringConstructor;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,reactive as o,provide as t,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as u,withCtx as d,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as v,NLayout as S,NLayoutContent as g}from"naive-ui";import b from"./components/SiderList.vue.js";import I from"./components/ChatHeader.vue.js";import y from"./components/ChatMain.vue.js";import k from"./components/ChatFooter.vue.js";import j from"./components/ChatSearch.vue.js";import{ChatSock as _}from"./utils/chatSock.js";import{instanceAxios as C,readMessageApi as L}from"./api/index.js";import{useTheme as N}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as x}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as M}from"./constants/index.js";import{InjectionIChatState as U,InjectionIChatStompClient as T,InjectionIChatEmits as w}from"./types/index.js";import{isAudioOrVideo as A}from"./utils/index.js";import{useSession as E}from"./hooks/useSession.js";const O={class:"iho-chat__header"},R={class:"toolbar"};var V=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:V,emit:q}){const J=e;C.defaults.baseURL=J.baseURL,C.defaults.headers.Authorization="bearer "+J.token;const F=N(),G=s(!1),H=s(),$=s(!1),z=o({orgId:J.orgId,currentSessionItem:{},id:"",userInfo:{id:J.userId,sdkAppId:1600034888},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null});t(U,z),t(T,H),t(w,q);const{openSession:D,closeSession:W,getCurrentSession:B,setSessionList:K,setUpdateSessionItem:P}=E(z);function Q(){const e={headers:{AccessToken:J.token,UserId:J.userId},heartbeatFn(){try{H.value.send("test")}catch(e){H.value.disconnect(),Q()}},connectCb(){console.log("连接成功"),H.value.subscribe("/user/topic/single",(async({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:o,sessionVo:t}=s;switch(s.event){case M.MESSAGE:{if(s.messageVo.sender===z.userInfo.id)return;const e={receiver:o.sender,lastMessageSendTime:o.sendTime,sortTime:o.sendTime,lastMessage:o.content};o.sender===z.currentSessionItem.receiver&&(z.currentMsg=o,A(o.content)||(z.isAppendMsg=!0,await L({chatType:"SINGLE",messageIdSet:o.id,receiver:z.userInfo.id,sender:o.sender})),e.unreadNum=0),P(e),A(o.content)&&($.value=!0);break}case M.NEW_SESSION:P(t)}}catch(e){console.log(e)}})),H.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{currentUser:o,sessionVos:t}=s;if(console.log("body",s),Object.assign(z.userInfo,o),!(null==t?void 0:t.length))return;K(t)}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};H.value=new _("/fdp-chat/websocket",e)}return async function(){Q()}(),r((()=>{var e;null==(e=H.value)||e.disconnect()})),V({getUnreadData:function(){return z.sessionList.filter((e=>x(e.unreadNum)&&e.unreadNum>0))},openSession:D,closeSession:W,getCurrentSession:B}),(e,s)=>(n(),i("div",{class:"iho-chat",style:a(c(F))},[u(c(f),{abstract:"",namespace:"iho-chat__popover"},{default:d((()=>[G.value?(n(),m(c(v),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",O,[u(j),l("div",R,[h(e.$slots,"toolbar")])]),u(c(S),{class:"iho-chat__body","has-sider":""},{default:d((()=>[u(b),u(c(g),{class:"chat-content"},{default:d((()=>[u(I),u(y),u(k,{"show-av":$.value},null,8,["show-av"])])),_:1}),h(e.$slots,"external")])),_:3})],64))])),_:3})],4))}});export{V as default};
1
+ import{defineComponent as e,ref as s,reactive as o,provide as t,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as d,withCtx as u,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as g,NLayout as v,NLayoutContent as S}from"naive-ui";import b from"./components/SiderList.vue.js";import y from"./components/ChatHeader.vue.js";import I from"./components/ChatMain.vue.js";import j from"./components/ChatFooter.vue.js";import k from"./components/ChatSearch.vue.js";import M from"./components/Video.vue.js";import{ChatSock as _}from"./utils/chatSock.js";import{instanceAxios as N,readMessageApi as C}from"./api/index.js";import{useTheme as L}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as V}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as x}from"./constants/index.js";import{InjectionIChatState as A,InjectionIChatStompClient as T,InjectionIChatEmits as U}from"./types/index.js";import{isAudioOrVideoMessage as w}from"./utils/index.js";import{useSession as E}from"./hooks/useSession.js";const O={class:"iho-chat__header"},R={class:"toolbar"};var q=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:q,emit:J}){const F=e;N.defaults.baseURL=F.baseURL,N.defaults.headers.Authorization="bearer "+F.token;const G=L(),H=s(!1),K=s(),$=o({orgId:F.orgId,currentSessionItem:{},id:"",userInfo:{id:F.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null,showVideo:!1,currentAVMsg:{}});t(A,$),t(T,K),t(U,J);const{openSession:z,closeSession:D,getCurrentSession:W,setSessionList:B,setUpdateSessionItem:P}=E($);function Q(){const e={headers:{AccessToken:F.token,UserId:F.userId},heartbeatFn(){try{K.value.send("test")}catch(e){K.value.disconnect(),Q()}},connectCb(){console.log("连接成功"),K.value.subscribe("/user/topic/single",(async({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:o,sessionVo:t}=s;switch(s.event){case x.MESSAGE:{if(s.messageVo.sender===$.userInfo.id)return;const e={receiver:o.sender,lastMessageSendTime:o.sendTime,sortTime:o.sendTime,lastMessage:o.content,avatar:o.senderAvatar,name:o.senderName,sessionKey:o.sessionKey};o.sender===$.currentSessionItem.receiver&&($.currentMsg=o,w(o.content)||($.isAppendMsg=!0,await C({chatType:"SINGLE",messageIdSet:[o.id],receiver:$.userInfo.id,sender:o.sender})),e.unreadNum=0),P(e),w(o.content)&&($.currentAVMsg.messageType=o.content.chatMessageType,$.currentAVMsg.callMode="invite",$.showVideo=!0);break}case x.NEW_SESSION:P(t)}}catch(e){console.log(e)}})),K.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{authentication:o,currentUser:t,sessionVos:r}=s;if(console.log("body",s),Object.assign($.userInfo,t,o),!(null==r?void 0:r.length))return;B(r)}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};K.value=new _("/fdp-chat/websocket",e)}return async function(){Q()}(),r((()=>{var e;null==(e=K.value)||e.disconnect()})),q({getUnreadData:function(){return $.sessionList.filter((e=>V(e.unreadNum)&&e.unreadNum>0))},openSession:z,closeSession:D,getCurrentSession:W}),(e,s)=>(n(),i("div",{class:"iho-chat",style:a(c(G))},[d(c(f),{abstract:"",namespace:"iho-chat__popover"},{default:u((()=>[H.value?(n(),m(c(g),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",O,[d(k),l("div",R,[h(e.$slots,"toolbar")])]),d(c(v),{class:"iho-chat__body","has-sider":""},{default:u((()=>[d(b),d(c(S),{class:"chat-content"},{default:u((()=>[d(y),d(I),d(j)])),_:1}),h(e.$slots,"external")])),_:3}),d(M)],64))])),_:3})],4))}});export{q as default};
@@ -1 +1 @@
1
- import t from"axios";function e(t){const e=[];for(const o in t){const n=t[o];Array.isArray(n)?n.forEach((t=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(t)}`)})):e.push(`${encodeURIComponent(o)}=${encodeURIComponent(n)}`)}return e.join("&")}const o=t.create({withCredentials:!0,timeout:5e3});function n(t){return o({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/chat/openSession",data:e(t)})}function r(t){return o({method:"get",url:"/chat/recordList",params:t})}function a(t){return o({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/chat/toppingSession",data:e(t)})}function u(t){return o({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/chat/uploadFile",data:t})}function s(t){return o({method:"get",url:"/user/listUser",params:t})}function d(t){return o({method:"get",url:"/user/getUserDetail",params:t})}function c(t){return o({method:"post",url:"/chat/readMessage",data:t})}function i(t){return o({method:"post",url:"/chat/searchChatRecord",data:t})}o.interceptors.response.use((t=>{var e,o;if(null==(e=t.data)?void 0:e.result)return null==(o=t.data)?void 0:o.data;console.log("请求错误")}));export{r as getHistoryRecordApi,d as getUserDetailApi,o as instanceAxios,s as listUserApi,n as openSessionApi,c as readMessageApi,i as searchChatRecordApi,a as toppingSessionApi,u as uploadFileApi};
1
+ import t from"axios";function e(t){const e=[];for(const o in t){const n=t[o];Array.isArray(n)?n.forEach((t=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(t)}`)})):e.push(`${encodeURIComponent(o)}=${encodeURIComponent(n)}`)}return e.join("&")}const o=t.create({withCredentials:!0,timeout:5e3});function n(t){return o({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/openSession",data:e(t)})}function r(t){return o({method:"get",url:"/chat/recordList",params:t})}function a(t){return o({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/toppingSession",data:e(t)})}function s(t){return o({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/chat/uploadFile",data:t})}function u(t){return o({method:"get",url:"/user/listUser",params:t})}function d(t){return o({method:"get",url:"/user/getUserDetail",params:t})}function i(t){return o({method:"post",url:"/chat/readMessage",data:t})}function c(t){return o({method:"post",url:"/chat/searchChatRecord",data:t})}o.interceptors.response.use((t=>{var e,o;if(null==(e=t.data)?void 0:e.result)return null==(o=t.data)?void 0:o.data;console.log("请求错误")}));export{r as getHistoryRecordApi,d as getUserDetailApi,o as instanceAxios,u as listUserApi,n as openSessionApi,i as readMessageApi,c as searchChatRecordApi,a as toppingSessionApi,s as uploadFileApi};
@@ -26,7 +26,7 @@ declare const _default: import("vue").DefineComponent<{
26
26
  fileRef: import("vue").Ref<any>;
27
27
  keyword: import("vue").Ref<any>;
28
28
  handleInput: () => void;
29
- currentInfo: {
29
+ pageInfo: {
30
30
  page: number;
31
31
  hasMore: boolean;
32
32
  lastSendTime: string;
@@ -2,35 +2,23 @@ import { UploadFileInfo } from 'naive-ui';
2
2
  import { AnyObject } from '../../../../shared/types';
3
3
  import { MESSAGE_TYPE } from '../constants';
4
4
  import { simplifyMessage } from '../utils';
5
- declare const _default: import("vue").DefineComponent<{
6
- showAv: {
7
- type: BooleanConstructor;
8
- default: boolean;
9
- };
10
- }, {
11
- props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
12
- showAv: {
13
- type: BooleanConstructor;
14
- default: boolean;
15
- };
16
- }>> & {}>>;
5
+ type FileOptions = {
6
+ file: UploadFileInfo;
7
+ fileList: Array<UploadFileInfo>;
8
+ };
9
+ declare const _default: import("vue").DefineComponent<{}, {
17
10
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
18
11
  content: import("vue").Ref<string>;
19
12
  state: import("../types").IState;
20
13
  stompClient: import("vue").Ref<import("../utils/chatSock").ChatSock>;
21
14
  setCurrentSessionItem: (item: AnyObject) => void;
22
15
  showEmoji: import("vue").Ref<boolean>;
23
- showVideo: import("vue").Ref<boolean>;
24
- callMode: import("vue").Ref<string>;
25
16
  handleCall: (chatMessageType: string) => void;
26
17
  handleKeyDown: (event: KeyboardEvent) => void;
27
18
  isWrap: (event: KeyboardEvent) => boolean;
28
19
  handleInput: () => void;
29
20
  selectEmoji: (name: string) => void;
30
- fileChange: (options: {
31
- file: UploadFileInfo;
32
- fileList: Array<UploadFileInfo>;
33
- }, chatMessageType: MESSAGE_TYPE) => Promise<void>;
21
+ fileChange: (options: FileOptions, chatMessageType: MESSAGE_TYPE) => Promise<void>;
34
22
  handleMsgSend: () => void;
35
23
  sendMessage: (contentInfo: AnyObject) => Promise<void>;
36
24
  NButton: any;
@@ -45,13 +33,8 @@ declare const _default: import("vue").DefineComponent<{
45
33
  };
46
34
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
47
35
  CloseCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
36
+ CallOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
37
+ VideocamOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
48
38
  simplifyMessage: typeof simplifyMessage;
49
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
50
- showAv: {
51
- type: BooleanConstructor;
52
- default: boolean;
53
- };
54
- }>>, {
55
- showAv: boolean;
56
- }>;
39
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
57
40
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,withDirectives as i,openBlock as o,createElementBlock as s,normalizeStyle as a,unref as r,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as m,renderList as p,createBlock as g,createTextVNode as v,vShow as y}from"vue";import{NIcon as h,NPopover as M,NButton as k,NTooltip as E,NUpload as C,NUploadTrigger as b}from"naive-ui";import{format as T}from"date-fns";import{useState as x}from"../hooks/useState.js";import{useSession as I}from"../hooks/useSession.js";import{emojis as w}from"../utils/emoji.js";import{MESSAGE_TYPE as _}from"../constants/index.js";import{uploadFileApi as S}from"../api/index.js";import{CloseCircleOutline as z}from"@vicons/ionicons5";import{cloneDeep as A}from"lodash-es";import{simplifyMessage as O}from"../utils/index.js";const R={key:0,class:"reference-content-box"},j={class:"reference-content"},D=["innerHTML"],L={class:"tool-box"},q=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),F={class:"emoji-box"},H=l("span",null,"默认表情",-1),K={class:"list-box"},N=["src"],V=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),G=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),U=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),J={class:"btn-box"},B=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var P=e({__name:"ChatFooter",props:{showAv:{type:Boolean,default:!1}},setup(e){const P=e,X=t(),Y=t(""),{state:Q,stompClient:W}=x(),{setCurrentSessionItem:Z}=I(Q),$=t(!1),ee=t(!1);function te(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),oe()))}function ne(){var e,t;Y.value=(null==(t=null==(e=X.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ie(e,t){const{file:n,name:i}=e.file,o=new FormData;o.append("sender",Q.userInfo.id),o.append("file",n);const s=await S(o);if(!s)return console.log("上传失败");se({chatMessageType:t,msg:t===_.FILE?i:s,url:s})}function oe(){if(!(Y.value.length>2e3))return Y.value?void se({msg:Y.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function se(e){const{chatMessageType:t=_.TEXT,msg:n,url:i}=e,o={msg:n,chatMessageType:t};t===_.FILE&&(o.fileUrl=i),[_.TEXT,_.BLEND].includes(t)&&(X.value.innerHTML="",Y.value=""),Q.currentReferenceMsg&&(o.referenceContent=A(Q.currentReferenceMsg),Q.currentReferenceMsg=null);const s=T(new Date,"yyyy-MM-dd HH:mm:ss");Q.currentMsg={content:o,sender:Q.userInfo.id,senderName:Q.userInfo.name,senderAvatar:Q.userInfo.avatar,id:"",sendTime:s,sending:!0,fail:!1},[_.AUDIO,_.VIDEO].includes(t)||(Q.isAppendMsg=!0),Z({lastMessageSendTime:s,lastMessage:o,sortTime:s});try{W.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:o,receiver:Q.currentSessionItem.receiver})),Q.currentMsg={...Q.currentMsg,fail:!1}}catch(e){Q.currentMsg={...Q.currentMsg,fail:!0}}finally{Q.currentMsg={...Q.currentMsg,sending:!1}}}return t(""),n((()=>Q.currentReferenceMsg),(e=>{var t;e&&(null==(t=X.value)||t.focus())})),n((()=>P.showAv),(e=>{e&&(ee.value=!0)})),(e,t)=>i((o(),s("section",{class:"chat-footer",style:a({cursor:r(Q).id?"default":"not-allowed"})},[r(Q).currentReferenceMsg?(o(),s("div",R,[l("div",j,[l("span",null,c(r(Q).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:r(O)(r(Q).currentReferenceMsg.content)},null,8,D)]),u(r(h),{component:r(z),onClick:t[0]||(t[0]=()=>r(Q).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",L,[u(r(M),{show:$.value,"onUpdate:show":t[1]||(t[1]=e=>$.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(r(k),{quaternary:"",size:"tiny"},{icon:f((()=>[q])),_:1})])),default:f((()=>[l("div",F,[d(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),H,l("div",K,[(o(!0),s(m,null,p(r(w).default,(([e,t])=>(o(),g(r(E),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(r(k),{quaternary:"",size:"tiny",onClick:()=>function(e){$.value=!1,se({chatMessageType:_.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,N)])),_:2},1032,["onClick"])])),default:f((()=>[v(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(r(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>se({chatMessageType:r(_).EMOJI,msg:0}))},{icon:f((()=>[V])),_:1}),u(r(C),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ie(e,r(_).IMAGE))},{default:f((()=>[u(r(b),{abstract:""},{default:f((({handleClick:e})=>[u(r(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[G])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(r(C),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ie(e,r(_).FILE))},{default:f((()=>[u(r(b),{abstract:""},{default:f((({handleClick:e})=>[u(r(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[U])),_:2},1032,["onClick"])])),_:1})])),_:1}),d(' <n-button quaternary size="tiny" @click="() => handleCall(MESSAGE_TYPE.AUDIO)">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<n-icon size="18" :component="CallOutline" />\n\t\t\t\t</template>\n\t\t\t</n-button>\n\t\t\t<n-button quaternary size="tiny" @click="() => handleCall(MESSAGE_TYPE.VIDEO)">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<n-icon size="20" :component="VideocamOutline" />\n\t\t\t\t</template>\n\t\t\t</n-button> ')]),i(l("div",{ref_key:"inputRef",ref:X,class:"input-box",contenteditable:"",onKeydown:te,onInput:ne},null,544),[[y,r(Q).id]]),l("div",J,[B,u(r(k),{type:"primary",round:"",disabled:!Y.value,onClick:oe},{default:f((()=>[v("发送")])),_:1},8,["disabled"])]),d(' <Video v-model:show="showVideo" :call-mode="callMode" /> ')],4)),[[y,r(Q).id]])}});export{P as default};
1
+ import{defineComponent as e,ref as n,watch as t,withDirectives as s,openBlock as i,createElementBlock as r,normalizeStyle as o,unref as a,createElementVNode as c,toDisplayString as l,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as m,renderList as p,createBlock as g,createTextVNode as y,vShow as v}from"vue";import{NIcon as h,NPopover as M,NButton as k,NTooltip as C,NUpload as T,NUploadTrigger as x}from"naive-ui";import{format as I}from"date-fns";import{useState as _}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{emojis as E}from"../utils/emoji.js";import{MESSAGE_TYPE as w}from"../constants/index.js";import{uploadFileApi as z}from"../api/index.js";import{CloseCircleOutline as R,CallOutline as j,VideocamOutline as D}from"@vicons/ionicons5";import{cloneDeep as L}from"lodash-es";import{simplifyMessage as S}from"../utils/index.js";const q={key:0,class:"reference-content-box"},A={class:"reference-content"},O=["innerHTML"],F={class:"tool-box"},H=c("i",{class:"chat--iconfont chat--icon-face"},null,-1),K={class:"emoji-box"},N=c("span",null,"默认表情",-1),V={class:"list-box"},U=["src"],J=c("i",{class:"chat--iconfont chat--icon-good"},null,-1),G=c("i",{class:"chat--iconfont chat--icon-image"},null,-1),X=c("i",{class:"chat--iconfont chat--icon-folder"},null,-1),B={class:"btn-box"},P=c("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Q=e({__name:"ChatFooter",setup(e){const Q=n(),W=n(""),{state:Y,stompClient:Z}=_(),{setCurrentSessionItem:$}=b(Y),ee=n(!1);function ne(e){Y.currentAVMsg.messageType=e,Y.currentAVMsg.callMode="call",Y.showVideo=!0,oe({chatMessageType:e,msg:""})}function te(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),re()))}function se(){var e,n;W.value=(null==(n=null==(e=Q.value)?void 0:e.innerText)?void 0:n.trim())||""}async function ie(e,n){const{file:t,name:s}=e.file,i=new FormData;i.append("sender",Y.userInfo.id),i.append("file",t);const r=await z(i);if(!r)return console.log("上传失败");oe({chatMessageType:n,msg:n===w.FILE?s:r,url:r})}function re(){if(!(W.value.length>2e3))return W.value?void oe({msg:W.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function oe(e){const{chatMessageType:n=w.TEXT,msg:t,url:s}=e,i={msg:t,chatMessageType:n};n===w.FILE&&(i.fileUrl=s),[w.TEXT,w.BLEND].includes(n)&&(Q.value.innerHTML="",W.value=""),Y.currentReferenceMsg&&(i.referenceContent=L(Y.currentReferenceMsg),Y.currentReferenceMsg=null);const r=I(new Date,"yyyy-MM-dd HH:mm:ss");Y.currentMsg={content:i,sender:Y.userInfo.id,senderName:Y.userInfo.name,senderAvatar:Y.userInfo.avatar,id:"",sendTime:r,sending:!0,fail:!1},[w.AUDIO,w.VIDEO].includes(n)||(Y.isAppendMsg=!0),$({lastMessageSendTime:r,lastMessage:i,sortTime:r});try{Z.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:Y.currentSessionItem.receiver})),Y.currentMsg={...Y.currentMsg,fail:!1}}catch(e){Y.currentMsg={...Y.currentMsg,fail:!0}}finally{Y.currentMsg={...Y.currentMsg,sending:!1}}}return t((()=>Y.currentReferenceMsg),(e=>{var n;e&&(null==(n=Q.value)||n.focus())})),(e,n)=>s((i(),r("section",{class:"chat-footer",style:o({cursor:a(Y).id?"default":"not-allowed"})},[a(Y).currentReferenceMsg?(i(),r("div",q,[c("div",A,[c("span",null,l(a(Y).currentReferenceMsg.senderName)+":",1),c("pre",{innerHTML:a(S)(a(Y).currentReferenceMsg.content)},null,8,O)]),u(a(h),{component:a(R),onClick:n[0]||(n[0]=()=>a(Y).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),c("div",F,[u(a(M),{show:ee.value,"onUpdate:show":n[1]||(n[1]=e=>ee.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[H])),_:1})])),default:f((()=>[c("div",K,[d(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),N,c("div",V,[(i(!0),r(m,null,p(a(E).default,(([e,n])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){ee.value=!1,oe({chatMessageType:w.EMOJI,msg:e})}(e)},{icon:f((()=>[c("img",{src:n},null,8,U)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+l(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:n[2]||(n[2]=()=>oe({chatMessageType:a(w).EMOJI,msg:0}))},{icon:f((()=>[J])),_:1}),u(a(T),{abstract:"",multiple:"",accept:"image/*",onChange:n[3]||(n[3]=e=>ie(e,a(w).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[G])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(T),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:n[4]||(n[4]=e=>ie(e,a(w).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[X])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:n[5]||(n[5]=()=>ne(a(w).AUDIO))},{icon:f((()=>[u(a(h),{size:"18",component:a(j)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:n[6]||(n[6]=()=>ne(a(w).VIDEO))},{icon:f((()=>[u(a(h),{size:"20",component:a(D)},null,8,["component"])])),_:1})]),s(c("div",{ref_key:"inputRef",ref:Q,class:"input-box",contenteditable:"",onKeydown:te,onInput:se},null,544),[[v,a(Y).id]]),c("div",B,[P,u(a(k),{type:"primary",round:"",disabled:!W.value,onClick:re},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[v,a(Y).id]])}});export{Q as default};
@@ -161,7 +161,7 @@ declare const _default: import("vue").DefineComponent<{}, {
161
161
  fileRef: import("vue").Ref<any>;
162
162
  keyword: import("vue").Ref<any>;
163
163
  handleInput: () => void;
164
- currentInfo: {
164
+ pageInfo: {
165
165
  page: number;
166
166
  hasMore: boolean;
167
167
  lastSendTime: string;
@@ -218,7 +218,7 @@ declare const _default: import("vue").DefineComponent<{}, {
218
218
  startTime: import("vue").Ref<any>;
219
219
  endTime: import("vue").Ref<any>;
220
220
  handleInput: () => void;
221
- currentInfo: {
221
+ pageInfo: {
222
222
  page: number;
223
223
  hasMore: boolean;
224
224
  lastSendTime: string;
@@ -1,5 +1,5 @@
1
1
  import { AnyObject } from '../../../../shared/types';
2
- import { formatTime, downloadFile, simplifyMessage } from '../utils';
2
+ import { formatTime, downloadFile, simplifyMessage, isAudioOrVideoMessage } from '../utils';
3
3
  import { MESSAGE_TYPE } from '../constants';
4
4
  declare const _default: import("vue").DefineComponent<{}, {
5
5
  chatMainRef: import("vue").Ref<HTMLElement | undefined>;
@@ -7,7 +7,7 @@ declare const _default: import("vue").DefineComponent<{}, {
7
7
  setMsgList: (list?: AnyObject[]) => void;
8
8
  setCurrentSessionItem: (item: AnyObject) => void;
9
9
  showMenu: import("vue").Ref<boolean>;
10
- currentInfo: {
10
+ pageInfo: {
11
11
  page: number;
12
12
  hasMore: boolean;
13
13
  lastSendTime: string;
@@ -183,6 +183,7 @@ declare const _default: import("vue").DefineComponent<{}, {
183
183
  formatTime: typeof formatTime;
184
184
  downloadFile: typeof downloadFile;
185
185
  simplifyMessage: typeof simplifyMessage;
186
+ isAudioOrVideoMessage: typeof isAudioOrVideoMessage;
186
187
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
187
188
  ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
188
189
  EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,openBlock as s,createElementBlock as i,normalizeClass as o,unref as r,createVNode as a,withCtx as c,Fragment as l,renderList as m,toDisplayString as u,createCommentVNode as d,createBlock as p,withModifiers as f,createElementVNode as v}from"vue";import{NImageGroup as y,NAvatar as g,NImage as T,NButtonGroup as M,NButton as h,NIcon as k}from"naive-ui";import{format as _}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as S}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as I}from"../hooks/useSession.js";import{first as j,last as C,isNumber as A}from"lodash-es";import H from"./PersonProfile.vue.js";import b from"./MessageTemplate.vue.js";import{emojis as w}from"../utils/emoji.js";import x from"./ContextMenu.js";import{formatTime as z,simplifyMessage as N,downloadFile as O}from"../utils/index.js";import{MESSAGE_TYPE as P}from"../constants/index.js";import{useScrollLoading as q}from"../hooks/useScrollLoading.js";import{ChatbubbleEllipsesOutline as D,EllipsisHorizontal as R}from"@vicons/ionicons5";const G={key:0,class:"time"},U={key:2,class:"message-box"},J=["data-time"],K={key:0,class:"reference-content"},F=["innerHTML"],X=["innerHTML"],B=["src"],Q=["href","onClick"],V=v("i",{class:"chat--iconfont chat--icon-face"},null,-1);var W=e({__name:"ChatMain",setup(e){const W=t(),{state:Y,setMsgList:Z}=L(),{setCurrentSessionItem:$}=I(Y),ee=t(!1),te={page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")};async function ne(){try{if(!te.hasMore)return;te.page++;const e=await E({sessionKey:Y.currentSessionItem.sessionKey,page:te.page,lastSendTime:te.lastSendTime});if(!Array.isArray(e)||0===e.length)return te.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=j(e).id;te.lastSendTime=C(e).sendTime,Z(te.page>1?[...e,...Y.msgList]:e),1===te.page&&Y.currentSessionItem.unreadNum&&(await S({chatType:"SINGLE",messageIdSet:[t],receiver:Y.userInfo.id,sender:Y.currentSessionItem.receiver}),$({unreadNum:0}))}catch(e){console.log(e)}}function se(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==P.TEMPLATE||!!n}function ie(e,t){var n,s;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===P.TEMPLATE)return"system"===t?2==(null==(n=null==o?void 0:o.setting)?void 0:n.style.id):2!=(null==(s=null==o?void 0:o.setting)?void 0:s.style.id)}function oe(e){var t,n;const{chatMessageType:s,messageTemplate:i}=e;return s===P.TEMPLATE&&3==(null==(n=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:n.id)}function re(e,t){var n;const s=A(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(n=Y.msgList[t-1])?void 0:n.sendTime;return s-(0===t?0:A(i)?i:Date.parse(i))>3e5}return q(W,(()=>{ne()}),"top"),n((()=>Y.id),(e=>{e&&(Object.assign(te,{page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")}),ne())}),{immediate:!0}),n((()=>Y.isAppendMsg),(e=>{e&&(Z([...Y.msgList,Y.currentMsg]),Y.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=W.value)?void 0:e.scrollHeight)?t:0;null==(n=W.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(s(),i("div",{class:o(["chat-main",{"home-bg":!r(Y).id}]),ref_key:"chatMainRef",ref:W},[a(r(y),{"show-toolbar-tooltip":""},{default:c((()=>[(s(!0),i(l,null,m(r(Y).msgList,((e,n)=>(s(),i(l,{key:n},[se(e)?(s(),i("div",{key:0,class:o(["message-item",{"message-item--mine":e.sender==r(Y).userInfo.id}])},[re(e,n)?(s(),i("p",G,u(r(z)(e.sendTime).recordTime),1)):d("v-if",!0),ie(e,"system")?(s(),p(b,{key:1,data:e},null,8,["data"])):(s(),i("div",U,[a(H,{"user-id":e.sender},{trigger:c((()=>[a(r(g),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(s(),i("div",{key:0,class:o(["content",{emoji:e.content.chatMessageType===r(P).EMOJI,template:e.content.chatMessageType===r(P).TEMPLATE,"template--3":oe(e.content)}]),"data-time":e.__time,onContextmenu:t[0]||(t[0]=f((e=>ee.value=!0),["prevent"]))},[e.content.chatMessageType===r(P).TEXT?(s(),i(l,{key:0},[e.content.referenceContent?(s(),i("div",K,[v("span",null,u(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:r(N)(e.content.referenceContent.content)},null,8,F)])):d("v-if",!0),v("pre",{innerHTML:e.__content},null,8,X)],64)):d("v-if",!0),e.content.chatMessageType===r(P).EMOJI?(s(),i("img",{key:1,src:r(w).findEmoji(e.__content)},null,8,B)):d("v-if",!0),ie(e,"template")?(s(),p(b,{key:2,data:e},null,8,["data"])):d("v-if",!0),e.content.chatMessageType===r(P).IMAGE?(s(),p(r(T),{key:3,width:"240",src:e.__content},null,8,["src"])):d("v-if",!0),e.content.chatMessageType===r(P).FILE?(s(),i("a",{key:4,href:e.content.fileUrl,onClick:f((()=>r(O)(e.content.fileUrl,e.__content)),["prevent"])},u(e.__content),9,Q)):d("v-if",!0),d(' <div class="quick-menu">\n\t\t\t\t\t\t\t\t\t<n-icon :component="AddCircleOutline" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="ChatbubbleEllipsesOutline" @click="() => setReferenceMsg(item)" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\n\t\t\t\t\t\t\t\t</div> '),a(r(M),{class:"quick-menu"},{default:c((()=>[a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[V])),_:1}),a(r(h),{quaternary:"",size:"tiny",onClick:()=>{return t=e,Y.currentReferenceMsg=t,void Object.assign(Y.currentReferenceMsg,{chatType:"SINGLE",receiver:Y.currentSessionItem.receiver,receiverAvatar:Y.currentSessionItem.avatar,receiverName:Y.currentSessionItem.name});var t}},{icon:c((()=>[a(r(k),{size:"17",component:r(D)},null,8,["component"])])),_:2},1032,["onClick"]),a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[a(r(k),{component:r(R)},null,8,["component"])])),_:1})])),_:2},1024)],42,J)):d("v-if",!0)]))],2)):d("v-if",!0)],64)))),128))])),_:1}),a(r(x),{show:ee.value,"onUpdate:show":t[1]||(t[1]=e=>ee.value=e)},null,8,["show"])],2))}});export{W as default};
1
+ import{defineComponent as e,ref as t,watch as n,openBlock as s,createElementBlock as i,normalizeClass as o,unref as r,createVNode as a,withCtx as c,Fragment as l,renderList as m,toDisplayString as u,createCommentVNode as d,createBlock as p,withModifiers as f,createElementVNode as v}from"vue";import{NImageGroup as y,NAvatar as g,NImage as T,NButtonGroup as M,NButton as h,NIcon as k}from"naive-ui";import{format as _}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as S}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as I}from"../hooks/useSession.js";import{first as j,last as C,isNumber as A}from"lodash-es";import H from"./PersonProfile.vue.js";import b from"./MessageTemplate.vue.js";import{emojis as w}from"../utils/emoji.js";import x from"./ContextMenu.js";import{formatTime as z,simplifyMessage as N,isAudioOrVideoMessage as O,downloadFile as P}from"../utils/index.js";import{MESSAGE_TYPE as q}from"../constants/index.js";import{useScrollLoading as D}from"../hooks/useScrollLoading.js";import{ChatbubbleEllipsesOutline as R,EllipsisHorizontal as G}from"@vicons/ionicons5";const U={key:0,class:"time"},J={key:2,class:"message-box"},K=["data-time"],F={key:0,class:"reference-content"},X=["innerHTML"],B=["innerHTML"],Q=["src"],V={key:4},W=["href","onClick"],Y=v("i",{class:"chat--iconfont chat--icon-face"},null,-1);var Z=e({__name:"ChatMain",setup(e){const Z=t(),{state:$,setMsgList:ee}=L(),{setCurrentSessionItem:te}=I($),ne=t(!1),se={page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")};async function ie(){try{if(!se.hasMore)return;se.page++;const e=await E({sessionKey:$.currentSessionItem.sessionKey,page:se.page,lastSendTime:se.lastSendTime});if(!Array.isArray(e)||0===e.length)return se.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=j(e).id;se.lastSendTime=C(e).sendTime,ee(se.page>1?[...e,...$.msgList]:e),1===se.page&&$.currentSessionItem.unreadNum&&(await S({chatType:"SINGLE",messageIdSet:[t],receiver:$.userInfo.id,sender:$.currentSessionItem.receiver}),te({unreadNum:0}))}catch(e){console.log(e)}}function oe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==q.TEMPLATE||!!n}function re(e,t){var n,s;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===q.TEMPLATE)return"system"===t?2==(null==(n=null==o?void 0:o.setting)?void 0:n.style.id):2!=(null==(s=null==o?void 0:o.setting)?void 0:s.style.id)}function ae(e){var t,n;const{chatMessageType:s,messageTemplate:i}=e;return s===q.TEMPLATE&&3==(null==(n=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:n.id)}function ce(e,t){var n;const s=A(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(n=$.msgList[t-1])?void 0:n.sendTime;return s-(0===t?0:A(i)?i:Date.parse(i))>3e5}return D(Z,(()=>{ie()}),"top"),n((()=>$.id),(e=>{e&&(Object.assign(se,{page:0,hasMore:!0,lastSendTime:_(new Date,"yyyy-MM-dd HH:mm:ss")}),ie())}),{immediate:!0}),n((()=>$.isAppendMsg),(e=>{e&&(ee([...$.msgList,$.currentMsg]),$.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=Z.value)?void 0:e.scrollHeight)?t:0;null==(n=Z.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(s(),i("div",{class:o(["chat-main",{"home-bg":!r($).id}]),ref_key:"chatMainRef",ref:Z},[a(r(y),{"show-toolbar-tooltip":""},{default:c((()=>[(s(!0),i(l,null,m(r($).msgList,((e,n)=>(s(),i(l,{key:n},[oe(e)?(s(),i("div",{key:0,class:o(["message-item",{"message-item--mine":e.sender==r($).userInfo.id}])},[ce(e,n)?(s(),i("p",U,u(r(z)(e.sendTime).recordTime),1)):d("v-if",!0),re(e,"system")?(s(),p(b,{key:1,data:e},null,8,["data"])):(s(),i("div",J,[a(H,{"user-id":e.sender},{trigger:c((()=>[a(r(g),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(s(),i("div",{key:0,class:o(["content",{emoji:e.content.chatMessageType===r(q).EMOJI,template:e.content.chatMessageType===r(q).TEMPLATE,"template--3":ae(e.content)}]),"data-time":e.__time,onContextmenu:t[0]||(t[0]=f((e=>ne.value=!0),["prevent"]))},[e.content.chatMessageType===r(q).TEXT?(s(),i(l,{key:0},[e.content.referenceContent?(s(),i("div",F,[v("span",null,u(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:r(N)(e.content.referenceContent.content)},null,8,X)])):d("v-if",!0),v("pre",{innerHTML:e.__content},null,8,B)],64)):d("v-if",!0),e.content.chatMessageType===r(q).EMOJI?(s(),i("img",{key:1,src:r(w).findEmoji(e.__content)},null,8,Q)):d("v-if",!0),re(e,"template")?(s(),p(b,{key:2,data:e},null,8,["data"])):d("v-if",!0),e.content.chatMessageType===r(q).IMAGE?(s(),p(r(T),{key:3,width:"240",src:e.__content},null,8,["src"])):d("v-if",!0),r(O)(e.content)?(s(),i("span",V,"音视频通话")):d("v-if",!0),e.content.chatMessageType===r(q).FILE?(s(),i("a",{key:5,href:e.content.fileUrl,onClick:f((()=>r(P)(e.content.fileUrl,e.__content)),["prevent"])},u(e.__content),9,W)):d("v-if",!0),d(' <div class="quick-menu">\n\t\t\t\t\t\t\t\t\t<n-icon :component="AddCircleOutline" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="ChatbubbleEllipsesOutline" @click="() => setReferenceMsg(item)" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\n\t\t\t\t\t\t\t\t</div> '),a(r(M),{class:"quick-menu"},{default:c((()=>[a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[Y])),_:1}),a(r(h),{quaternary:"",size:"tiny",onClick:()=>{return t=e,$.currentReferenceMsg=t,void Object.assign($.currentReferenceMsg,{chatType:"SINGLE",receiver:$.currentSessionItem.receiver,receiverAvatar:$.currentSessionItem.avatar,receiverName:$.currentSessionItem.name});var t}},{icon:c((()=>[a(r(k),{size:"17",component:r(R)},null,8,["component"])])),_:2},1032,["onClick"]),a(r(h),{quaternary:"",size:"tiny"},{icon:c((()=>[a(r(k),{component:r(G)},null,8,["component"])])),_:1})])),_:2},1024)],42,K)):d("v-if",!0)]))],2)):d("v-if",!0)],64)))),128))])),_:1}),a(r(x),{show:ne.value,"onUpdate:show":t[1]||(t[1]=e=>ne.value=e)},null,8,["show"])],2))}});export{Z as default};
@@ -24,7 +24,7 @@ declare const _default: import("vue").DefineComponent<{
24
24
  startTime: import("vue").Ref<any>;
25
25
  endTime: import("vue").Ref<any>;
26
26
  handleInput: () => void;
27
- currentInfo: {
27
+ pageInfo: {
28
28
  page: number;
29
29
  hasMore: boolean;
30
30
  lastSendTime: string;
@@ -1,13 +1,20 @@
1
+ import { AnyObject } from '../../../../shared/types';
1
2
  declare const _default: import("vue").DefineComponent<{}, {
2
- cssVars: import("vue").ComputedRef<import("../../../../shared/types").AnyObject>;
3
+ cssVars: import("vue").ComputedRef<AnyObject>;
4
+ listRef: import("vue").Ref<any>;
3
5
  inputRef: import("vue").Ref<any>;
4
6
  showSearch: import("vue").Ref<boolean>;
5
7
  keyword: import("vue").Ref<any>;
6
8
  userList: import("vue").Ref<any>;
7
9
  state: import("../types").IState;
8
- openSession: (item: import("../../../../shared/types").AnyObject) => Promise<void>;
9
- handleInput: () => Promise<void>;
10
+ openSession: (item: AnyObject) => Promise<void>;
11
+ pageInfo: {
12
+ page: number;
13
+ hasMore: boolean;
14
+ };
15
+ handleInput: () => void;
10
16
  handleSearch: () => Promise<void>;
17
+ resetAndSearch: () => void;
11
18
  addSession: (userId: string) => Promise<void>;
12
19
  NPopover: any;
13
20
  NButton: any;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,watch as s,nextTick as r,openBlock as a,createBlock as t,unref as n,withCtx as i,createVNode as l,createTextVNode as u,createElementVNode as f,normalizeStyle as c,createElementBlock as p,Fragment as m,renderList as v,toDisplayString as d}from"vue";import{NPopover as h,NButton as k,NIcon as w,NInput as y,NAvatar as g}from"naive-ui";import{SearchOutline as j}from"@vicons/ionicons5";import{useState as I}from"../hooks/useState.js";import{useSession as S}from"../hooks/useSession.js";import{listUserApi as _,openSessionApi as x}from"../api/index.js";import{isArray as C}from"lodash-es";import{useDebounceFn as b}from"@vueuse/core";import{useTheme as z}from"../../../../shared/hooks/useTheme.js";import"date-fns";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";const T={class:"user-list-wrapper"},U=["onClick"],D={class:"user-info"},E=f("span",null,"职务",-1),G=f("span",null,"部门",-1);var H=e({__name:"ChatSearch",setup(e){const H=z(),L=o(),M=o(!1),N=o(),R=o(),{state:q}=I(),{openSession:A}=S(q),B=b((async function(){if(!N.value)return void(R.value=[]);const e=await _({orgId:q.orgId,keyword:N.value});if(!C(e))return;R.value=e}),300);return s((()=>M.value),(async e=>{var o;e&&(await r(),null==(o=L.value)||o.focus())})),(e,o)=>(a(),t(n(h),{show:M.value,"onUpdate:show":o[1]||(o[1]=e=>M.value=e),placement:"top",trigger:"click","display-directive":"show","show-arrow":!1,delay:0,overlap:""},{trigger:i((()=>[l(n(k),{color:"#ffffff4D",class:"search-trigger-btn"},{icon:i((()=>[l(n(w),{component:n(j),color:"#ffffff80"},null,8,["component"])])),default:i((()=>[u(" 搜索联系人 ")])),_:1})])),default:i((()=>[f("div",{class:"popover-search",style:c(n(H))},[l(n(y),{ref_key:"inputRef",ref:L,size:"small",clearable:"",autofocus:"",value:N.value,"onUpdate:value":o[0]||(o[0]=e=>N.value=e),valueModifiers:{trim:!0},onInput:n(B)},{prefix:i((()=>[l(n(w),{color:"#ffffff80",component:n(j)},null,8,["component"])])),_:1},8,["value","onInput"]),f("div",T,[(a(!0),p(m,null,v(R.value,(e=>(a(),p("div",{class:"user-item",key:e.id,onClick:()=>async function(e){M.value=!1;const o=await x({chatType:"SINGLE",receiver:e,sender:q.userInfo.id});A(o)}(e.id)},[l(n(g),{round:"",size:32,src:e.avatar},null,8,["src"]),f("div",D,[f("span",null,d(e.name),1),E,G])],8,U)))),128))])],4)])),_:1},8,["show"]))}});export{H as default};
1
+ import{defineComponent as e,ref as o,watch as s,nextTick as a,openBlock as r,createBlock as t,unref as n,withCtx as i,createVNode as l,createTextVNode as u,createElementVNode as c,normalizeStyle as p,createElementBlock as f,Fragment as m,renderList as d,toDisplayString as v}from"vue";import{NPopover as h,NButton as g,NIcon as k,NInput as w,NAvatar as y}from"naive-ui";import{SearchOutline as j}from"@vicons/ionicons5";import{useState as S}from"../hooks/useState.js";import{useSession as _}from"../hooks/useSession.js";import{listUserApi as I,openSessionApi as M}from"../api/index.js";import{isArray as x}from"lodash-es";import{useDebounceFn as C}from"@vueuse/core";import{useTheme as b}from"../../../../shared/hooks/useTheme.js";import"date-fns";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as z}from"../hooks/useScrollLoading.js";const L=["onClick"],N={class:"user-info"};var R=e({__name:"ChatSearch",setup(e){const R=b(),T=o(),U=o(),D=o(!1),E=o(),G=o(),{state:H}=S(),{openSession:O}=_(H),q={page:0,hasMore:!0},A=C((function(){Object.assign(q,{page:0,hasMore:!0}),B()}),300);async function B(){if(!E.value)return void(G.value=[]);if(!q.hasMore)return;q.page++;const e=await I({orgId:H.orgId,keyword:E.value,page:q.page,pageSize:10});x(e.records)&&q.page<=+e.total&&(G.value=q.page>1?G.value.concat(e.records):e.records,q.page==e.total&&(q.hasMore=!1,console.log("没有更多消息了")))}return z(T,(()=>{B()})),s((()=>D.value),(async e=>{var o;e&&(await a(),null==(o=U.value)||o.focus())})),(e,o)=>(r(),t(n(h),{show:D.value,"onUpdate:show":o[1]||(o[1]=e=>D.value=e),placement:"top",trigger:"click","display-directive":"show","show-arrow":!1,delay:0,overlap:""},{trigger:i((()=>[l(n(g),{color:"#ffffff4D",class:"search-trigger-btn"},{icon:i((()=>[l(n(k),{component:n(j),color:"#ffffff80"},null,8,["component"])])),default:i((()=>[u(" 搜索联系人 ")])),_:1})])),default:i((()=>[c("div",{class:"popover-search",style:p(n(R))},[l(n(w),{ref_key:"inputRef",ref:U,size:"small",clearable:"",autofocus:"",value:E.value,"onUpdate:value":o[0]||(o[0]=e=>E.value=e),valueModifiers:{trim:!0},onInput:n(A)},{prefix:i((()=>[l(n(k),{color:"#ffffff80",component:n(j)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"user-list-wrapper",ref_key:"listRef",ref:T},[(r(!0),f(m,null,d(G.value,(e=>(r(),f("div",{class:"user-item",key:e.id,onClick:()=>async function(e){D.value=!1;const o=await M({chatType:"SINGLE",receiver:e,sender:H.userInfo.id});O(o)}(e.id)},[l(n(y),{round:"",size:32,src:e.avatar},null,8,["src"]),c("div",N,[c("span",null,v(e.name),1),c("span",null,v(e.deptName),1),c("span",null,v(e.post),1)])],8,L)))),128))],512)],4)])),_:1},8,["show"]))}});export{R as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,computed as i,watch as t,withDirectives as a,openBlock as n,createElementBlock as l,normalizeStyle as r,unref as o,createBlock as u,createCommentVNode as d,createElementVNode as v,Fragment as m,renderList as c,withCtx as p,createTextVNode as f,toDisplayString as k,normalizeClass as _,createVNode as h,vShow as y}from"vue";import{NSpin as S,NTag as g,NAvatar as b,NBadge as x}from"naive-ui";import{useState as M}from"../hooks/useState.js";import{useSession as L}from"../hooks/useSession.js";import{vFlexibleResize as C}from"../../../../shared/directive/flexibleResize.js";import{listSort as j,formatTime as N}from"../utils/index.js";const T={class:"sider-list__filter box-shadow"},w=["onClick"],I={class:"avatar-right"},R={class:"name"},z={class:"msg-tip"},H={class:"msg-tip__content"},U=["innerHTML"];var B=e({__name:"SiderList",setup(e){const B="all",E="unread",O=s(300),V=s(),q=s(!1),A=s([{label:"全部",key:B},{label:"未读",key:E}]),D=s("all"),{state:F,emit:G}=M(),{openSession:J,unreadTotal:K,setSessionList:P}=L(F),Q=i((()=>Math.min(Math.max(O.value,240),360))),W=i((()=>j(F.sessionList)));function X(e){!e.id||F.sessionList.map((e=>e.id)).includes(e.id)?F.sessionList.forEach((s=>{if(s.receiver===e.receiver){let{unreadNum:i=0}=s;Object.assign(s,e),e.receiver!==F.currentSessionItem.receiver&&(s.unreadNum=++i)}})):P([...F.sessionList,e])}function Y({distance:e}){O.value=O.value+e}function Z(e,s=o(D)){var i;return s===B||(s===E?(null!=(i=e.unreadNum)?i:0)>0:void 0)}return t([()=>F.isChangeSession,()=>F.isUpdateSession],(([e,s])=>{e&&(X(F.currentSessionItem),F.isChangeSession=!1),s&&(X(F.updateSessionItem),F.isUpdateSession=!1)}),{immediate:!0}),t((()=>K.value),(e=>{const s=W.value.filter((e=>Z(e,E)));G("unread-message-update",e,s)})),(e,s)=>a((n(),l("section",{class:"sider-list",style:r({width:o(Q)+"px"})},[q.value?(n(),u(o(S),{key:0,stroke:"#5585f5"})):d("v-if",!0),d(' <n-input v-else placeholder="输入用户名模糊搜索" v-model:value="keyword" @keyup.enter="handleSearch"></n-input> '),v("div",T,[(n(!0),l(m,null,c(A.value,(e=>(n(),u(o(g),{type:D.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,void(D.value=s);var s}},{default:p((()=>[f(k(e.label)+"("+k(o(K))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),v("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:V},[(n(!0),l(m,null,c(o(W),(e=>a((n(),l("div",{key:e.id,onClick:()=>o(J)(e),class:_(["sider-list__box__item",{active:e.id===o(F).id},e.topping?"sider-list__box__item--top":""])},[h(o(b),{round:"",size:"large",src:e.avatar},null,8,["src"]),v("div",I,[v("div",R,[v("h4",null,k(e.name),1),v("span",null,k(e.lastMessage?o(N)(e.lastMessageSendTime).siderMsgTime:""),1)]),v("div",z,[v("div",H,[v("div",{innerHTML:e.lastMessageContent},null,8,U)]),h(o(x),{value:e.unreadNum>99?"99+":e.unreadNum},null,8,["value"])])])],10,w)),[[y,Z(e)]]))),128))],512)],4)),[[o(C),{mode:"VR",onMove:Y}]])}});export{B as default};
1
+ import{defineComponent as e,ref as s,computed as i,watch as n,withDirectives as t,openBlock as a,createElementBlock as l,normalizeStyle as o,unref as r,createBlock as u,createCommentVNode as d,createElementVNode as m,Fragment as v,renderList as c,withCtx as p,createTextVNode as f,toDisplayString as k,normalizeClass as _,createVNode as y,vShow as h}from"vue";import{NSpin as S,NTag as g,NAvatar as b,NBadge as x}from"naive-ui";import{useState as M}from"../hooks/useState.js";import{useSession as L}from"../hooks/useSession.js";import{vFlexibleResize as C}from"../../../../shared/directive/flexibleResize.js";import{listSort as j,formatTime as N}from"../utils/index.js";const T={class:"sider-list__filter box-shadow"},w=["onClick"],I={class:"avatar-right"},R={class:"name"},z={class:"msg-tip"},H={class:"msg-tip__content"},K=["innerHTML"];var U=e({__name:"SiderList",setup(e){const U="all",B="unread",E=s(300),O=s(),V=s(!1),q=s([{label:"全部",key:U},{label:"未读",key:B}]),A=s("all"),{state:D,emit:F}=M(),{openSession:G,unreadTotal:J,setSessionList:P}=L(D),Q=i((()=>Math.min(Math.max(E.value,240),360))),W=i((()=>j(D.sessionList)));function X(e){!e.id||D.sessionList.map((e=>e.id)).includes(e.id)?D.sessionList.forEach((s=>{if(s.receiver===e.receiver){let{unreadNum:i=0}=s;Object.assign(s,e),e.sessionKey!==D.currentSessionItem.sessionKey&&(s.unreadNum=++i)}})):P([...D.sessionList,e])}function Y({distance:e}){E.value=E.value+e}function Z(e,s=r(A)){var i;return s===U||(s===B?(null!=(i=e.unreadNum)?i:0)>0:void 0)}return n([()=>D.isChangeSession,()=>D.isUpdateSession],(([e,s])=>{e&&(X(D.currentSessionItem),D.isChangeSession=!1),s&&(X(D.updateSessionItem),D.isUpdateSession=!1)}),{immediate:!0}),n((()=>J.value),(e=>{const s=W.value.filter((e=>Z(e,B)));F("unread-message-update",e,s)})),(e,s)=>t((a(),l("section",{class:"sider-list",style:o({width:r(Q)+"px"})},[V.value?(a(),u(r(S),{key:0,stroke:"#5585f5"})):d("v-if",!0),d(' <n-input v-else placeholder="输入用户名模糊搜索" v-model:value="keyword" @keyup.enter="handleSearch"></n-input> '),m("div",T,[(a(!0),l(v,null,c(q.value,(e=>(a(),u(r(g),{type:A.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,void(A.value=s);var s}},{default:p((()=>[f(k(e.label)+"("+k(r(J))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),m("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:O},[(a(!0),l(v,null,c(r(W),(e=>t((a(),l("div",{key:e.id,onClick:()=>r(G)(e),class:_(["sider-list__box__item",{active:e.id===r(D).id},e.topping?"sider-list__box__item--top":""])},[y(r(b),{round:"",size:"large",src:e.avatar},null,8,["src"]),m("div",I,[m("div",R,[m("h4",null,k(e.name),1),m("span",null,k(e.lastMessage?r(N)(e.lastMessageSendTime).siderMsgTime:""),1)]),m("div",z,[m("div",H,[m("div",{innerHTML:e.lastMessageContent},null,8,K)]),y(r(x),{value:e.unreadNum>99?"99+":e.unreadNum},null,8,["value"])])])],10,w)),[[h,Z(e)]]))),128))],512)],4)),[[r(C),{mode:"VR",onMove:Y}]])}});export{U as default};
@@ -1,38 +1,43 @@
1
1
  import TRTC from 'trtc-sdk-v5';
2
- declare const _default: import("vue").DefineComponent<{
3
- show: {
4
- type: BooleanConstructor;
5
- default: boolean;
2
+ import { MESSAGE_TYPE } from '../constants';
3
+ declare const _default: import("vue").DefineComponent<{}, {
4
+ time: {
5
+ timer: any;
6
+ seconds: number;
6
7
  };
7
- }, {
8
- props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
9
- show: {
10
- type: BooleanConstructor;
11
- default: boolean;
12
- };
13
- }>> & {
14
- "onUpdate:show"?: ((...args: any[]) => any) | undefined;
15
- }>>;
16
- emit: (event: "update:show", ...args: any[]) => void;
17
8
  state: import("../types").IState;
18
9
  videoRef: import("vue").Ref<any>;
19
10
  selfVideoRef: import("vue").Ref<any>;
11
+ tipContent: import("vue").Ref<any>;
12
+ isConnect: import("vue").Ref<boolean>;
13
+ voiceOpen: import("vue").Ref<boolean>;
14
+ messageType: import("vue").ComputedRef<any>;
15
+ callMode: import("vue").ComputedRef<any>;
16
+ info: import("vue").ComputedRef<{
17
+ sessionKey: any;
18
+ avatar: any;
19
+ name: any;
20
+ userId: any;
21
+ }>;
20
22
  trtc: TRTC;
21
23
  handleEnter: () => Promise<void>;
24
+ handleExit: () => Promise<void>;
22
25
  installEventHandlers: () => void;
26
+ uninstallEventHandlers: () => void;
27
+ handleRemoteVideoAvailable: (event: any) => Promise<void>;
28
+ handleRemoteAudioAvailable: (event: any) => void;
29
+ handleRemoteUserEnter: () => void;
30
+ handleRemoteUserExit: (event: any) => void;
31
+ startTimer: () => void;
32
+ resetTimer: () => void;
33
+ formatSeconds: (seconds: number) => string;
34
+ toggleAudio: () => Promise<void>;
23
35
  NButton: any;
24
36
  NAvatar: any;
25
37
  NIcon: any;
26
- Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
27
38
  Call: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
28
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:show"[], "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
29
- show: {
30
- type: BooleanConstructor;
31
- default: boolean;
32
- };
33
- }>> & {
34
- "onUpdate:show"?: ((...args: any[]) => any) | undefined;
35
- }, {
36
- show: boolean;
37
- }>;
39
+ MicOffCircle: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
40
+ Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
41
+ MESSAGE_TYPE: typeof MESSAGE_TYPE;
42
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
38
43
  export default _default;
@@ -0,0 +1 @@
1
+ import e from"./Video.vue2.js";import r from"../../../../_virtual/_plugin-vue_export-helper.js";var o=r(e,[["__file","Video.vue"]]);export{o as default};
@@ -0,0 +1 @@
1
+ import{defineComponent as e,ref as o,computed as s,watch as n,withDirectives as a,openBlock as t,createElementBlock as l,createElementVNode as r,vShow as i,createVNode as c,unref as u,toDisplayString as v,Fragment as d,normalizeClass as m,withCtx as f}from"vue";import{NAvatar as p,NButton as E,NIcon as I}from"naive-ui";import{Mic as A,MicOffCircle as V,Call as _}from"@vicons/ionicons5";import{useState as T}from"../hooks/useState.js";import{startOfDay as y,format as R}from"date-fns";import"lodash-es";import{MESSAGE_TYPE as O}from"../constants/index.js";import"../utils/emoji.js";import S from"trtc-sdk-v5";const w={class:"video-wrapper"},k={class:"user"},D={class:"name"},L={class:"tip"},U={class:"opt-btn"},g={class:"btn"},h=r("span",null,"静音",-1),M=r("span",null,"拒接",-1),N={class:"btn"},b=r("span",null,"挂断",-1),x=r("span",null,"接听",-1);var z=e({__name:"Video",setup(e){const z={timer:null,seconds:0},{state:K}=T(),j=o(),B=o(),H=o(),C=o(!1),X=o(!0),q=s((()=>K.currentAVMsg.messageType)),F=s((()=>K.currentAVMsg.callMode)),G=s((()=>"call"===F.value?{sessionKey:K.currentSessionItem.sessionKey,avatar:K.currentSessionItem.avatar,name:K.currentSessionItem.name,userId:K.currentSessionItem.receiver}:{sessionKey:K.updateSessionItem.sessionKey,avatar:K.updateSessionItem.avatar,name:K.updateSessionItem.name,userId:K.updateSessionItem.receiver})),J=S.create();async function P(){const e=await S.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(K.showVideo=!1);try{if(await J.enterRoom({strRoomId:G.value.sessionKey,sdkAppId:parseInt(K.userInfo.sdkAppID),userId:K.userInfo.id,userSig:K.userInfo.userSig}),"invite"===F.value&&(C.value=!0,ee()),function(){if(J.on(S.EVENT.REMOTE_USER_ENTER,Z),J.on(S.EVENT.REMOTE_AUDIO_AVAILABLE,Y),J.on(S.EVENT.REMOTE_USER_EXIT,$),q.value===O.AUDIO)return;J.on(S.EVENT.REMOTE_VIDEO_AVAILABLE,W)}(),await J.startLocalAudio(),q.value===O.AUDIO)return;await J.startLocalVideo({view:B.value})}catch(e){console.log("error :>> ",e),K.showVideo=!1}}async function Q(){try{if(K.showVideo=!1,function(){if(J.off(S.EVENT.REMOTE_USER_ENTER,Z),J.off(S.EVENT.REMOTE_AUDIO_AVAILABLE,Y),J.off(S.EVENT.REMOTE_USER_EXIT,$),q.value===O.AUDIO)return;J.off(S.EVENT.REMOTE_VIDEO_AVAILABLE,W)}(),await J.exitRoom(),await J.stopLocalAudio(),q.value===O.AUDIO)return;await J.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function W(e){const{userId:o,streamType:s}=e;try{await J.startRemoteVideo({userId:o,streamType:s,view:j.value})}catch(e){console.log("error :>> ",e)}}function Y(e){C.value=!0}function Z(){ee()}function $(e){console.log("event :>> 对方已挂断",e),Q()}function ee(){oe(),z.timer=setInterval((()=>{console.log("time.seconds :>> ",z.seconds),z.seconds++,q.value===O.AUDIO&&(H.value=function(e){const o=y(new Date);return o.setSeconds(e),R(o,"HH:mm:ss")}(z.seconds))}),1e3)}function oe(){H.value="00:00:00",z.timer&&clearInterval(z.timer),z.timer=null,z.seconds=0}async function se(){await J.updateLocalAudio({mute:!X.value}),X.value=!X.value}return n((()=>K.showVideo),(e=>{e?"call"===F.value?(P(),H.value="正在呼叫..."):q.value===O.AUDIO?H.value="邀请你语音问诊...":H.value="邀请你视频问诊...":(C.value=!1,oe())})),(e,o)=>a((t(),l("div",w,[a(r("div",{class:"video-box",ref_key:"videoRef",ref:j},null,512),[[i,C.value]]),a(r("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:B},null,512),[[i,C.value]]),a(r("div",k,[c(u(p),{size:58,round:"",src:u(G).avatar},null,8,["src"]),r("span",D,v(u(G).name),1),r("span",L,v(H.value),1)],512),[[i,u(q)===u(O).AUDIO||!C.value]]),r("div",U,[r("div",g,["call"===u(F)&&!C.value||C.value?(t(),l(d,{key:0},[c(u(E),{circle:"",onClick:se,class:m({bordered:X.value})},{icon:f((()=>[c(u(I),{size:"30",color:X.value?"#fff":"#626262",component:X.value?u(A):u(V)},null,8,["color","component"])])),_:1},8,["class"]),h],64)):(t(),l(d,{key:1},[c(u(E),{circle:"",color:"#f17568",class:"btn--rotate"},{icon:f((()=>[c(u(I),{size:"30",component:u(_)},null,8,["component"])])),_:1}),M],64))]),r("div",N,["call"===u(F)&&!C.value||C.value?(t(),l(d,{key:0},[c(u(E),{circle:"",color:"#f17568",class:"btn--rotate",onClick:Q},{icon:f((()=>[c(u(I),{size:"30",component:u(_)},null,8,["component"])])),_:1}),b],64)):(t(),l(d,{key:1},[c(u(E),{circle:"",color:"#2ac98b",onClick:P},{icon:f((()=>[c(u(I),{size:"30",component:u(_)},null,8,["component"])])),_:1}),x],64))])])],512)),[[i,u(K).showVideo]])}});export{z as default};
@@ -1 +1 @@
1
- import{computed as s}from"vue";import{simplifyMessage as e,isAudioOrVideo as t}from"../utils/index.js";import{uniqBy as n}from"lodash-es";function i(i){function o(s){Object.assign(i.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):i.currentSessionItem.lastMessageContent||""}),i.isChangeSession=!0,i.id!==i.currentSessionItem.id&&(i.msgList=[],i.id=i.currentSessionItem.id)}return{openSession:async function(s){o(s)},closeSession:function(){if(!i.id)return null;const{currentSessionItem:s}=i;return i.currentSessionItem={},i.msgList=[],i.id="",s},getCurrentSession:function(){return i.id?i.currentSessionItem:null},setCurrentSessionItem:o,setUpdateSessionItem:function(s){Object.assign(i.updateSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),t(s.lastMessage)||(i.isUpdateSession=!0)},unreadTotal:s((()=>i.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){i.sessionList=n(s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:Reflect.has(s,"lastMessageContent")?s.lastMessageContent:t?e(t):""}})),"id")}}}export{i as useSession};
1
+ import{computed as s}from"vue";import{simplifyMessage as e,isAudioOrVideoMessage as t}from"../utils/index.js";import{uniqBy as n}from"lodash-es";function i(i){function o(s){Object.assign(i.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):i.currentSessionItem.lastMessageContent||""}),i.isChangeSession=!0,i.id!==i.currentSessionItem.id&&(i.msgList=[],i.id=i.currentSessionItem.id)}return{openSession:async function(s){o(s)},closeSession:function(){if(!i.id)return null;const{currentSessionItem:s}=i;return i.currentSessionItem={},i.msgList=[],i.id="",s},getCurrentSession:function(){return i.id?i.currentSessionItem:null},setCurrentSessionItem:o,setUpdateSessionItem:function(s){Object.assign(i.updateSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),t(s.lastMessage)||(i.isUpdateSession=!0)},unreadTotal:s((()=>i.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){i.sessionList=n(s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:Reflect.has(s,"lastMessageContent")?s.lastMessageContent:t?e(t):""}})),"id")}}}export{i as useSession};
@@ -14,6 +14,8 @@ export type IState = {
14
14
  updateSessionItem: AnyObject;
15
15
  isUpdateSession: boolean;
16
16
  currentReferenceMsg: null | AnyObject;
17
+ showVideo: boolean;
18
+ currentAVMsg: AnyObject;
17
19
  };
18
20
  export declare const InjectionIChatState: InjectionKey<IState>;
19
21
  export declare const InjectionIChatStompClient: InjectionKey<Ref<ChatSock>>;