cnhis-design-vue 3.2.6-release.2 → 3.2.6

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 (59) hide show
  1. package/es/components/button-print/src/utils/print.d.ts +4 -2
  2. package/es/components/button-print/src/utils/print.js +1 -1
  3. package/es/components/fabric-chart/src/constants/index.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/temperature/useCenter.d.ts +1 -0
  5. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/temperature/useOther.d.ts +2 -2
  7. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  9. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  10. package/es/components/form-render/index.js +1 -1
  11. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  12. package/es/components/form-render/src/utils/index.d.ts +1 -0
  13. package/es/components/form-render/src/utils/index.js +1 -1
  14. package/es/components/iho-chat/index.d.ts +497 -19
  15. package/es/components/iho-chat/src/Index.vue.d.ts +502 -24
  16. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  17. package/es/components/iho-chat/src/api/index.d.ts +5 -0
  18. package/es/components/iho-chat/src/api/index.js +1 -1
  19. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +89 -0
  20. package/es/components/iho-chat/src/components/ChatAdd.vue.js +1 -0
  21. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -0
  22. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  23. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +94 -4
  24. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  25. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +129 -3
  26. package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
  27. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +24 -2
  28. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  29. package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +0 -1
  30. package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
  31. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  32. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +16 -1
  33. package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
  34. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +133 -0
  35. package/es/components/iho-chat/src/components/MultipleVideo.vue.js +1 -0
  36. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -0
  37. package/es/components/iho-chat/src/components/PersonProfile.vue.d.ts +15 -1
  38. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  39. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  40. package/es/components/iho-chat/src/components/Video.vue.d.ts +24 -13
  41. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  42. package/es/components/iho-chat/src/constants/index.d.ts +10 -1
  43. package/es/components/iho-chat/src/constants/index.js +1 -1
  44. package/es/components/iho-chat/src/hooks/index.d.ts +1 -0
  45. package/es/components/iho-chat/src/hooks/index.js +1 -1
  46. package/es/components/iho-chat/src/hooks/useSession.d.ts +1 -0
  47. package/es/components/iho-chat/src/hooks/useSession.js +1 -1
  48. package/es/components/iho-chat/src/hooks/useState.d.ts +5 -0
  49. package/es/components/iho-chat/src/hooks/useState.js +1 -1
  50. package/es/components/iho-chat/src/hooks/useVideo.d.ts +24 -0
  51. package/es/components/iho-chat/src/hooks/useVideo.js +1 -0
  52. package/es/components/iho-chat/src/types/index.d.ts +3 -0
  53. package/es/components/iho-chat/src/utils/index.d.ts +2 -1
  54. package/es/components/iho-chat/src/utils/index.js +1 -1
  55. package/es/components/iho-chat/style/index.css +1 -1
  56. package/es/components/index.css +1 -1
  57. package/es/components/index.js +1 -1
  58. package/es/shared/package.json.js +1 -1
  59. package/package.json +2 -2
@@ -1 +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
+ import{defineComponent as e,ref as o,computed as n,watch as s,openBlock as t,createElementBlock as r,withDirectives as a,createElementVNode as i,vShow as c,createVNode as l,unref as u,toDisplayString as d,Fragment as E,normalizeClass as v,withCtx as m}from"vue";import{NAvatar as f,NButton as p,NIcon as I}from"naive-ui";import{Mic as T,MicOffCircle as V,Call as A}from"@vicons/ionicons5";import"date-fns";import"lodash-es";import{AV_STATUS as R,CHAT_TYPE as g}from"../constants/index.js";import"../utils/emoji.js";import{avFinishApi as _}from"../api/index.js";import{useVideo as M}from"../hooks/useVideo.js";import y from"trtc-sdk-v5";const N={class:"video-wrapper"},S={class:"user"},w={class:"name"},O={class:"tip"},k={class:"opt-btn"},L={class:"btn"},h=i("span",null,"静音",-1),D=i("span",null,"拒接",-1),C={class:"btn"},b=i("span",null,"挂断",-1),x=i("span",null,"接听",-1);var U=e({__name:"Video",setup(e){const{sendMessage:U,state:j,trtc:z,timing:H,voiceOpen:B,isAudio:F,isCall:X,startTimer:G,resetTimer:J,toggleAudio:P,messageTypeText:$,time:q}=M(),K=o(),Q=o(),W=o(!1);let Y=null;const Z=n((()=>{var e,o,n;return X.value?{avatar:j.currentSessionItem.avatar,name:j.currentSessionItem.name,userId:j.currentSessionItem.receiver}:{avatar:null==(e=j.currentAVMsg.currentMsg)?void 0:e.senderAvatar,name:null==(o=j.currentAVMsg.currentMsg)?void 0:o.senderName,userId:null==(n=j.currentAVMsg.currentMsg)?void 0:n.sender}})),ee=n((()=>W.value?F.value?H.value:"":X.value?"正在呼叫...":`邀请你${$.value}问诊...`)),oe=n((()=>{var e,o;return null==(o=null==(e=j.currentAVMsg.currentMsg)?void 0:e.content)?void 0:o.avStatus}));async function ne(e=R.FINISHED){U({chatType:g.SINGLE,content:{msg:e===R.FINISHED?""+q.seconds:"s",chatMessageType:j.currentAVMsg.chatMessageType,avStatus:e},receiver:Z.value.userId}),await _({recordId:j.currentAVMsg.currentMsg.id,status:e,duration:e===R.FINISHED?q.seconds:0})}async function se(){const e=await y.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(j.showVideo=!1);try{if(await z.enterRoom({strRoomId:j.currentAVMsg.strRoomId,sdkAppId:parseInt(j.userInfo.sdkAppID),userId:j.userInfo.id,userSig:j.userInfo.userSig}),X.value||(W.value=!0,G()),function(){if(z.on(y.EVENT.ERROR,ue),z.on(y.EVENT.REMOTE_USER_ENTER,ce),z.on(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.on(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.on(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.startLocalAudio(),F.value)return;await z.startLocalVideo({view:Q.value})}catch(e){console.log("error :>> ",e),j.showVideo=!1}}function te(){X.value&&!W.value?ne(R.CANCELED):ne()}async function re(){try{if(j.showVideo=!1,function(){if(z.off(y.EVENT.ERROR,ue),z.off(y.EVENT.REMOTE_USER_ENTER,ce),z.off(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.off(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.off(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.exitRoom(),await z.stopLocalAudio(),F.value)return;await z.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ae(e){const{userId:o,streamType:n}=e;try{await z.startRemoteVideo({userId:o,streamType:n,view:K.value})}catch(e){console.log("error :>> ",e)}}function ie(e){}function ce(){W.value=!0,G()}function le(e){console.log("event :>> 对方已挂断",e),re()}function ue(e){console.log("error :>> ",e),j.showVideo=!1}return s((()=>oe.value),(e=>{j.showVideo&&(e===R.IN_CALL?async function(){X.value?se():(Y&&clearTimeout(Y),Y=setTimeout((async()=>{W.value||ne(R.NO_RESPONSE)}),6e4))}():re())}),{immediate:!0}),(e,o)=>(t(),r("div",N,[a(i("div",{class:"video-box",ref_key:"videoRef",ref:K},null,512),[[c,W.value]]),a(i("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:Q},null,512),[[c,W.value]]),a(i("div",S,[l(u(f),{size:58,round:"",src:u(Z).avatar},null,8,["src"]),i("span",w,d(u(Z).name),1),i("span",O,d(u(ee)),1)],512),[[c,u(F)||!W.value]]),i("div",k,[i("div",L,[u(X)&&!W.value||W.value?(t(),r(E,{key:0},[l(u(p),{circle:"",onClick:u(P),class:v({bordered:u(B)})},{icon:m((()=>[l(u(I),{size:"30",color:u(B)?"#fff":"#626262",component:u(B)?u(T):u(V)},null,8,["color","component"])])),_:1},8,["onClick","class"]),h],64)):(t(),r(E,{key:1},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>ne(u(R).REJECTED))},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),D],64))]),i("div",C,[u(X)&&!W.value||W.value?(t(),r(E,{key:0},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:te},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),b],64)):(t(),r(E,{key:1},[l(u(p),{circle:"",color:"#2ac98b",onClick:se},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),x],64))])])]))}});export{U as default};
@@ -1,3 +1,10 @@
1
+ /**
2
+ * 订阅消息类别
3
+ */
4
+ export declare enum CHAT_TYPE {
5
+ SINGLE = "SINGLE",
6
+ GROUP = "GROUP"
7
+ }
1
8
  /**
2
9
  * 聊天消息类型
3
10
  */
@@ -20,13 +27,15 @@ export declare enum SUBSCRIBE_MESSAGE_TYPE {
20
27
  JOIN = "JOIN",
21
28
  LEAVE = "LEAVE",
22
29
  NEW_SESSION = "NEW_SESSION",
23
- MESSAGE = "MESSAGE"
30
+ MESSAGE = "MESSAGE",
31
+ AV_STATUS = "AV_STATUS"
24
32
  }
25
33
  /**
26
34
  * 音视频接通状态
27
35
  */
28
36
  export declare enum AV_STATUS {
29
37
  IN_CALL = "IN_CALL",
38
+ CALL_BUSY = "CALL_BUSY",
30
39
  NO_RESPONSE = "NO_RESPONSE",
31
40
  FINISHED = "FINISHED",
32
41
  REJECTED = "REJECTED",
@@ -1 +1 @@
1
- var E=(E=>(E.TEXT="TEXT",E.FILE="FILE",E.EMOJI="EMOJI",E.IMAGE="IMAGE",E.TEMPLATE="TEMPLATE",E.BLEND="BLEND",E.FORWARD="FORWARD",E.QUICK_REPLY="QUICK_REPLY",E.AUDIO="AUDIO",E.VIDEO="VIDEO",E))(E||{}),I=(E=>(E.JOIN="JOIN",E.LEAVE="LEAVE",E.NEW_SESSION="NEW_SESSION",E.MESSAGE="MESSAGE",E))(I||{}),N=(E=>(E.IN_CALL="IN_CALL",E.NO_RESPONSE="NO_RESPONSE",E.FINISHED="FINISHED",E.REJECTED="REJECTED",E.CANCELED="CANCELED",E))(N||{});export{N as AV_STATUS,E as MESSAGE_TYPE,I as SUBSCRIBE_MESSAGE_TYPE};
1
+ var E=(E=>(E.SINGLE="SINGLE",E.GROUP="GROUP",E))(E||{}),I=(E=>(E.TEXT="TEXT",E.FILE="FILE",E.EMOJI="EMOJI",E.IMAGE="IMAGE",E.TEMPLATE="TEMPLATE",E.BLEND="BLEND",E.FORWARD="FORWARD",E.QUICK_REPLY="QUICK_REPLY",E.AUDIO="AUDIO",E.VIDEO="VIDEO",E))(I||{}),S=(E=>(E.JOIN="JOIN",E.LEAVE="LEAVE",E.NEW_SESSION="NEW_SESSION",E.MESSAGE="MESSAGE",E.AV_STATUS="AV_STATUS",E))(S||{}),A=(E=>(E.IN_CALL="IN_CALL",E.CALL_BUSY="CALL_BUSY",E.NO_RESPONSE="NO_RESPONSE",E.FINISHED="FINISHED",E.REJECTED="REJECTED",E.CANCELED="CANCELED",E))(A||{});export{A as AV_STATUS,E as CHAT_TYPE,I as MESSAGE_TYPE,S as SUBSCRIBE_MESSAGE_TYPE};
@@ -1,2 +1,3 @@
1
1
  export * from './useState';
2
2
  export * from './useSession';
3
+ export * from './useVideo';
@@ -1 +1 @@
1
- export{useState}from"./useState.js";export{useSession}from"./useSession.js";
1
+ export{useState}from"./useState.js";export{useSession}from"./useSession.js";export{useVideo}from"./useVideo.js";
@@ -8,4 +8,5 @@ export declare function useSession(state: IState): {
8
8
  setUpdateSessionItem: (item: AnyObject) => void;
9
9
  unreadTotal: import("vue").ComputedRef<number>;
10
10
  setSessionList: (list: AnyObject[]) => void;
11
+ isGroupChat: import("vue").ComputedRef<boolean>;
11
12
  };
@@ -1 +1 @@
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};
1
+ import{computed as e}from"vue";import{simplifyMessage as s}from"../utils/index.js";import{cloneDeep as t,isArray as n,uniqBy as i}from"lodash-es";import{CHAT_TYPE as o}from"../constants/index.js";import{groupUserApi as r}from"../api/index.js";function u(e){return e.chatType===o.GROUP}function a(e){const{lastMessage:t,lastSenderName:n=""}=e,i=s(t);return u(e)&&n?n+": "+i:i}function c(s){const o=e((()=>s.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0))),c=e((()=>u(s.currentSessionItem)));function m(e){Object.assign(s.currentSessionItem,e,{lastMessageContent:e.lastMessage?a({...e,chatType:e.chatType||s.currentSessionItem.chatType}):s.currentSessionItem.lastMessageContent}),s.isChangeSession=!0,s.id!==s.currentSessionItem.id&&(s.msgList=[],s.id=s.currentSessionItem.id)}return{openSession:async function(e){const i=s.currentSessionItem.sessionKey;if(m(e),i!==s.currentSessionItem.sessionKey)if(c.value){const t=await r({id:e.receiver});s.currentGroupUser=n(t)?t:[]}else s.currentGroupUser=[s.userInfo,{...t(e),id:e.receiver}]},closeSession:function(){if(!s.id)return null;const{currentSessionItem:e}=s;return s.currentSessionItem={},s.msgList=[],s.id="",e},getCurrentSession:function(){return s.id?s.currentSessionItem:null},setCurrentSessionItem:m,setUpdateSessionItem:function(e){const n=s.sessionList.find((s=>s.sessionKey===e.sessionKey)),i={...e,lastMessageContent:a({...e,chatType:e.chatType||(null==n?void 0:n.chatType)})};s.updateSessionItem=n?{...t(n),...i}:i,s.isUpdateSession=!0},unreadTotal:o,setSessionList:function(e){s.sessionList=i(e,"id").map((e=>({...e,lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:a(e)})))},isGroupChat:c}}export{c as useSession};
@@ -4,4 +4,9 @@ export declare function useState(): {
4
4
  setMsgList: (list?: AnyObject[]) => void;
5
5
  stompClient: import("vue").Ref<import("../utils/chatSock").ChatSock>;
6
6
  emit: (event: string, ...args: any[]) => void;
7
+ sendMessage: (message: {
8
+ chatType?: string;
9
+ content: AnyObject;
10
+ receiver?: string;
11
+ }) => Promise<void>;
7
12
  };
@@ -1 +1 @@
1
- import{inject as t}from"vue";import{formatTime as e,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as s,InjectionIChatStompClient as i,InjectionIChatEmits as m}from"../types/index.js";import{MESSAGE_TYPE as o}from"../constants/index.js";function r(){const r=t(s),c=t(i),T=t(m);return{state:r,setMsgList:function(t=[]){r.msgList=t.map((t=>{var s,i,m;return Object.assign(t,{__time:e(t.sendTime).msgTime,__content:(m=t.content.chatMessageType,[o.TEXT,o.TEXT].includes(m)?n(null==(s=t.content)?void 0:s.msg):null==(i=t.content)?void 0:i.msg)}),t})).sort(((t,e)=>new Date(e.sendTime).getTime()-new Date(t.sendTime).getTime()))},stompClient:c,emit:T}}export{r as useState};
1
+ import{inject as e}from"vue";import{formatTime as t,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as s,InjectionIChatStompClient as i,InjectionIChatEmits as o}from"../types/index.js";import{MESSAGE_TYPE as r}from"../constants/index.js";function m(){const m=e(s),c=e(i),a=e(o);return{state:m,setMsgList:function(e=[]){m.msgList=e.map((e=>{var s,i,o;return Object.assign(e,{__time:t(e.sendTime).msgTime,__content:(o=e.content.chatMessageType,[r.TEXT,r.TEXT].includes(o)?n(null==(s=e.content)?void 0:s.msg):null==(i=e.content)?void 0:i.msg)}),e})).sort(((e,t)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime()))},stompClient:c,emit:a,sendMessage:async function(e){try{c.value.send("/app/chat/send",{},JSON.stringify({chatType:m.currentSessionItem.chatType,receiver:m.currentSessionItem.receiver,...e}))}catch(e){console.log("error :>> ",e)}}}}export{m as useState};
@@ -0,0 +1,24 @@
1
+ import TRTC from 'trtc-sdk-v5';
2
+ export declare function useVideo(): {
3
+ state: import("../types").IState;
4
+ sendMessage: (message: {
5
+ chatType?: string | undefined;
6
+ content: import("../../../../shared/types").AnyObject;
7
+ receiver?: string | undefined;
8
+ }) => Promise<void>;
9
+ trtc: TRTC;
10
+ timing: import("vue").Ref<string>;
11
+ voiceOpen: import("vue").Ref<boolean>;
12
+ videocamOpen: import("vue").Ref<boolean>;
13
+ isAudio: import("vue").ComputedRef<boolean>;
14
+ isCall: import("vue").ComputedRef<boolean>;
15
+ startTimer: () => void;
16
+ resetTimer: () => void;
17
+ toggleAudio: () => Promise<void>;
18
+ toggleVideo: () => Promise<void>;
19
+ messageTypeText: import("vue").ComputedRef<"语音" | "视频">;
20
+ time: {
21
+ timer: any;
22
+ seconds: number;
23
+ };
24
+ };
@@ -0,0 +1 @@
1
+ import{ref as e,computed as t,onBeforeUnmount as s}from"vue";import{useState as a}from"./useState.js";import{MESSAGE_TYPE as i}from"../constants/index.js";import o from"trtc-sdk-v5";import{formatSeconds as n}from"../utils/index.js";function r(){const r={timer:null,seconds:0},{state:u,sendMessage:l}=a(),c=e(""),m=e(!0),d=e(!0),v=t((()=>u.currentAVMsg.chatMessageType===i.AUDIO)),p=t((()=>"call"===u.currentAVMsg.callMode)),g=t((()=>v.value?"语音":"视频")),f=o.create();function A(){c.value="00:00:00",r.timer&&clearInterval(r.timer),r.timer=null,r.seconds=0}return s((()=>{A()})),{state:u,sendMessage:l,trtc:f,timing:c,voiceOpen:m,videocamOpen:d,isAudio:v,isCall:p,startTimer:function(){A(),r.timer=setInterval((()=>{r.seconds++,c.value=n(r.seconds)}),1e3)},resetTimer:A,toggleAudio:async function(){await f.updateLocalAudio({mute:!m.value}),m.value=!m.value},toggleVideo:async function(){await f.updateLocalVideo({mute:!d.value}),d.value=!d.value},messageTypeText:g,time:r}}export{r as useVideo};
@@ -16,6 +16,9 @@ export type IState = {
16
16
  currentReferenceMsg: null | AnyObject;
17
17
  showVideo: boolean;
18
18
  currentAVMsg: AnyObject;
19
+ userList: AnyObject[];
20
+ currentGroupUser: AnyObject[];
21
+ showMultipleVideo: boolean;
19
22
  };
20
23
  export declare const InjectionIChatState: InjectionKey<IState>;
21
24
  export declare const InjectionIChatStompClient: InjectionKey<Ref<ChatSock>>;
@@ -6,8 +6,9 @@ export declare function formatTime(dateStr: string): {
6
6
  };
7
7
  export declare function listSort(list: AnyObject[]): AnyObject[];
8
8
  export declare function transformMessage(content: string): string;
9
+ export declare function getAVTime(msg: string): string;
9
10
  export declare function simplifyMessage(lastMessage: AnyObject): any;
10
11
  export declare function downloadFile(url: string, filename: string): void;
11
12
  export declare function getFileSize(url: string): Promise<unknown>;
12
- export declare function genTestUserSig(sdkAppId: number, userId: string, sdkSecretKey: string): any;
13
13
  export declare function isAudioOrVideoMessage(message: AnyObject): boolean;
14
+ export declare function formatSeconds(seconds: number): string;
@@ -1 +1 @@
1
- import{isToday as e,format as t,isYesterday as n}from"date-fns";import{cloneDeep as r}from"lodash-es";import{MESSAGE_TYPE as s}from"../constants/index.js";import{emojis as o}from"./emoji.js";function a(r){const s=new Date(r);let o,a;if(e(s))o=a=t(s,"HH:mm");else{o=n(s)?"昨天":t(s,"MM-dd");const e=s.getFullYear(),r=(new Date).getFullYear();a=t(s,e<r?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}return{siderMsgTime:o,msgTime:a,recordTime:function(r){const s=new Date(r),o=Date.now()-s.getTime();if(o<6e4)return"刚刚";if(o<36e5)return Math.ceil(o/1e3/60)+"分钟前";if(e(s))return"今天 "+t(s,"HH:mm");if(n(s))return"昨天 "+t(s,"HH:mm");{const e=s.getFullYear(),n=(new Date).getFullYear();return t(s,e<n?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}}(r)}}function i(e){return r(e).sort(((e,t)=>e.topping&&!t.topping?-1:!e.topping&&t.topping?1:new Date(t.sortTime).getTime()-new Date(e.sortTime).getTime()))}function c(e){if(!e)return"";const t=e=>new RegExp("\\n*\\["+(e||"")+"(code|pre|div|span|p|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)]\\n*","g");return e=e.toString().replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/@(\S+)(\s+?|$)/g,'@<a href="javascript:;">$1</a>$2').replace(t(),"<$1 $2>").replace(t("/"),"</$1>").replace(/\n/g,"<br>")}function u(e){var t;const{chatMessageType:n,msg:r,messageTemplate:a}=e;switch(n){case s.TEXT:return c(r);case s.IMAGE:return"[图片]";case s.FILE:return"[文件]";case s.EMOJI:return`<img alt=${r} src=${o.findEmoji(r)}>`;case s.TEMPLATE:return null==(t=null==a?void 0:a.setting)?void 0:t.title;case s.VIDEO:return"[视频通话]";case s.AUDIO:return"[语音通话]";default:return"其他消息"}}function l(e,t){const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(r){if(200===n.status){const r=window.URL.createObjectURL(n.response),s=document.createElement("a");s.href=r,s.download=t,s.dispatchEvent(new MouseEvent("click")),window.URL.revokeObjectURL(e)}},n.send()}function d(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("HEAD",e,!0),r.onreadystatechange=()=>{var e;if(4===r.readyState&&200===r.status){let n=null!=(e=r.getResponseHeader("Content-Length"))?e:0;const s=+n;s>1048576?n=(s/1048576).toFixed(2)+"M":s>1024?n=(s/1024).toFixed(2)+"K":n+="B",t(n)}},r.send()}))}function m(e,t,n){const r=e,s=n;null!=r&&""!==s||alert("请先配置好您的账号信息: SDKAPPID 及 SDKSECRETKEY \r\n\r\nPlease configure your SDKAPPID/SDKSECRETKEY in js/debug/GenerateTestUserSig.js");return new window.LibGenerateTestUserSig(r,s,604800).genTestUserSig(t)}function p(e){return[s.AUDIO,s.VIDEO].includes(e.chatMessageType)}export{l as downloadFile,a as formatTime,m as genTestUserSig,d as getFileSize,p as isAudioOrVideoMessage,i as listSort,u as simplifyMessage,c as transformMessage};
1
+ import{isToday as e,format as t,isYesterday as n,startOfDay as r}from"date-fns";import{cloneDeep as o,isNumber as s,isNaN as a}from"lodash-es";import{MESSAGE_TYPE as i}from"../constants/index.js";import{emojis as c}from"./emoji.js";function u(r){const o=new Date(r);let s,a;if(e(o))s=a=t(o,"HH:mm");else{s=n(o)?"昨天":t(o,"MM-dd");const e=o.getFullYear(),r=(new Date).getFullYear();a=t(o,e<r?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}return{siderMsgTime:s,msgTime:a,recordTime:function(r){const o=new Date(r),s=Date.now()-o.getTime();if(s<6e4)return"刚刚";if(s<36e5)return Math.ceil(s/1e3/60)+"分钟前";if(e(o))return"今天 "+t(o,"HH:mm");if(n(o))return"昨天 "+t(o,"HH:mm");{const e=o.getFullYear(),n=(new Date).getFullYear();return t(o,e<n?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}}(r)}}function l(e){return o(e).sort(((e,t)=>e.topping&&!t.topping?-1:!e.topping&&t.topping?1:new Date(t.sortTime).getTime()-new Date(e.sortTime).getTime()))}function m(e){if(!e)return"";const t=e=>new RegExp("\\n*\\["+(e||"")+"(code|pre|div|span|p|table|thead|th|tbody|tr|td|ul|li|ol|li|dl|dt|dd|h2|h3|h4|h5)([\\s\\S]*?)]\\n*","g");return e=e.toString().replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/@(\S+)(\s+?|$)/g,'@<a href="javascript:;">$1</a>$2').replace(t(),"<$1 $2>").replace(t("/"),"</$1>").replace(/\n/g,"<br>")}function p(e){if(e&&s(+e)&&!a(+e)){const t=w(+e),n=t.split(":");let r=t;return 3===n.length&&"00"===n[0]&&(r=`${n[1]}:${n[2]}`),"通话时长 "+r}return"已取消"}function d(e){var t;if(!e)return"";const{chatMessageType:n,msg:r,messageTemplate:o}=e,s=H(e)?p(r):"";switch(n){case i.TEXT:return m(r);case i.IMAGE:return"[图片]";case i.FILE:return"[文件]";case i.EMOJI:return`<img alt=${r} src=${c.findEmoji(r)}>`;case i.TEMPLATE:return null==(t=null==o?void 0:o.setting)?void 0:t.title;case i.VIDEO:return`[视频通话]${s}`;case i.AUDIO:return`[语音通话]${s}`;default:return"其他消息"}}function g(e,t){const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(r){if(200===n.status){const r=window.URL.createObjectURL(n.response),o=document.createElement("a");o.href=r,o.download=t,o.dispatchEvent(new MouseEvent("click")),window.URL.revokeObjectURL(e)}},n.send()}function f(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("HEAD",e,!0),r.onreadystatechange=()=>{var e;if(4===r.readyState&&200===r.status){let n=null!=(e=r.getResponseHeader("Content-Length"))?e:0;const o=+n;o>1048576?n=(o/1048576).toFixed(2)+"M":o>1024?n=(o/1024).toFixed(2)+"K":n+="B",t(n)}},r.send()}))}function H(e){return e&&[i.AUDIO,i.VIDEO].includes(e.chatMessageType)}function w(e){const n=r(new Date);return n.setSeconds(e),t(n,"HH:mm:ss")}export{g as downloadFile,w as formatSeconds,u as formatTime,p as getAVTime,f as getFileSize,H as isAudioOrVideoMessage,l as listSort,d as simplifyMessage,m as transformMessage};