cnhis-design-vue 3.2.14-beta.14 → 3.2.14-beta.15
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.
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as s,reactive as t,computed as o,provide as n,onBeforeUnmount as
|
1
|
+
import{defineComponent as e,ref as s,reactive as t,computed as o,provide as n,onBeforeUnmount as r,watch as i,openBlock as a,createElementBlock as c,normalizeStyle as u,unref as d,createVNode as l,withCtx as p,createBlock as m,Fragment as h,createElementVNode as f,renderSlot as S,createCommentVNode as y}from"vue";import{NConfigProvider as v,NSpin as g,NLayout as b,NLayoutContent as M}from"naive-ui";import I from"./components/SiderList.vue.js";import k from"./components/ChatHeader.vue.js";import L from"./components/ChatMain.vue.js";import T from"./components/ChatFooter.vue.js";import V from"./components/ChatSearch.vue.js";import j from"./components/ChatAdd.vue.js";import w from"./components/Video.vue.js";import U from"./components/MultipleVideo.vue.js";import{ChatSock as N}from"./utils/chatSock.js";import{instanceAxios as _,readMessageApi as A}from"./api/index.js";import{useTheme as C}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as O}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import{promiseTimeout as E}from"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../shared/hooks/useScrollLoading.js";import{CHAT_TYPE as R,SUBSCRIBE_MESSAGE_TYPE as x,AV_STATUS as G}from"./constants/index.js";import{InjectionIChatState as K,InjectionIChatStompClient as P,InjectionIChatEmits as B,InjectionIChatUnreadTotal as J}from"./types/index.js";import{isAudioOrVideoMessage as $,listSort as q}from"./utils/index.js";import{useSession as F}from"./hooks/useSession.js";import"trtc-sdk-v5";const H={key:0,class:"iho-chat__header"},z={class:"toolbar"};var D=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"},chatBox:{type:Boolean,default:!1},defaultSessionKey:{type:String},show:{type:Boolean,default:!0}},emits:["template-click","unread-message-update"],setup(e,{expose:D,emit:W}){const Y=e;_.defaults.baseURL=Y.baseURL,_.defaults.headers.Authorization="bearer "+Y.token;const Q=C(),X=s(!1),Z=s(),ee=t({orgId:Y.orgId,currentSessionItem:{},id:"",userInfo:{id:Y.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null,currentReEditMsg:null,showVideo:!1,currentAVMsg:{},currentGroupUser:[],showMultipleVideo:!1}),se=o((()=>ee.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0)));n(K,ee),n(P,Z),n(B,W),n(J,se);const{openSession:te,closeSession:oe,getCurrentSession:ne,setSessionList:re,setUpdateSessionItem:ie,setCurrentSessionItem:ae,updateSessionList:ce,isEnded:ue}=F(ee),de=[];function le(){const e={headers:{AccessToken:Y.token,UserId:Y.userId},heartbeatFn(){try{Z.value.send("test")}catch(e){Z.value.disconnect(),le()}},connectCb(){console.log("连接成功"),Z.value.subscribe("/user/topic/single",(({body:e})=>me({body:e,chatType:R.SINGLE}))),Z.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{authentication:t,currentUser:o,sessionVos:n}=s;if(Object.assign(ee.userInfo,o,t),!(null==n?void 0:n.length))return;re(n),de.splice(0,de.length),de.push(...n.filter((e=>e.chatType===R.GROUP))),de.forEach((e=>{Z.value.subscribe(`/topic/group/${e.receiver}`,(({body:e})=>me({body:e,chatType:R.GROUP})))})),function(){const e=ee.sessionList.find((e=>e.sessionKey===Y.defaultSessionKey));e&&te(e)}()}catch(e){console.log(e)}}))},errorCb(e,s){}};Z.value=new N("/fdp-chat/websocket",e)}async function pe(e,s){if(ee.currentMsg=e,e.sessionKey===ee.currentSessionItem.sessionKey)return ee.isAppendMsg=!0,e.sender!==ee.userInfo.id&&await A({chatType:s,messageIdSet:[e.id],receiver:ee.userInfo.id,sender:e.sender}),void ae({lastMessageSendTime:e.sendTime,lastMessage:e.content,sortTime:e.sendTime,unreadNum:0,lastSenderName:e.senderName});const t={lastMessageSendTime:e.sendTime,sortTime:e.sendTime,lastMessage:e.content,sessionKey:e.sessionKey,lastSenderName:e.senderName,sender:e.sender};ie(t)}async function me({body:e,chatType:s}){try{const t=JSON.parse(e),{messageVo:o,sessionVo:n,chatAvStatusVo:r}=t;switch(t.event){case x.MESSAGE:$(o.content)?!ee.showVideo&&!ee.showMultipleVideo||o.content.avStatus!==G.IN_CALL?(ee.currentMsg=o,Object.assign(ee.currentAVMsg,{strRoomId:o.sessionKey,chatMessageType:o.content.chatMessageType,callMode:o.sender===ee.userInfo.id?"call":"invite",currentMsg:o}),ee.showVideo||ee.showMultipleVideo?pe(o,s):ee.showVideo=!0):(Z.value.send("/app/chat/send",{},JSON.stringify({chatType:R.SINGLE,receiver:o.sender,content:{chatMessageType:o.content.chatMessageType,avStatus:G.CALL_BUSY}})),console.log("用户忙!")):pe(o,s);break;case x.RECALL_MESSAGE:break;case x.AV_STATUS:Object.assign(ee.currentAVMsg,r,{callMode:r.sender===ee.userInfo.id?"call":"invite",checkedIds:[]}),ee.showVideo||ee.showMultipleVideo?console.log("用户忙!"):ee.showMultipleVideo=!0;break;case x.NEW_SESSION:if(s===R.GROUP)return;ie(n);break;case x.JOIN_GROUP:if(s===R.GROUP)return;ie(n),Z.value.subscribe(`/topic/group/${n.receiver}`,(({body:e})=>me({body:e,chatType:R.GROUP})));case x.LEAVE_GROUP:}}catch(e){console.log(e)}}return async function(){le()}(),r((()=>{var e;null==(e=Z.value)||e.disconnect()})),i((()=>se.value),(e=>{!async function s(t=0){const o=q(ee.sessionList),n=o.every((e=>!!e.name));if(!(t>2))if(n){const s=o.filter((e=>{var s;return+(null!=(s=e.unreadNum)?s:0)>0}));W("unread-message-update",e,s)}else await E(100),s(++t)}()})),i([()=>ee.isChangeSession,()=>ee.isUpdateSession],(([e,s])=>{e&&(ce(ee.currentSessionItem),ee.isChangeSession=!1),s&&(ce(ee.updateSessionItem),ee.isUpdateSession=!1)}),{immediate:!0}),D({getUnreadData:function(){return ee.sessionList.filter((e=>O(e.unreadNum)&&e.unreadNum>0))},openSession:te,closeSession:oe,getCurrentSession:ne}),(s,t)=>e.show?(a(),c("div",{key:0,class:"iho-chat",style:u(d(Q))},[l(d(v),{abstract:"",namespace:"iho-chat__popover"},{default:p((()=>[X.value?(a(),m(d(g),{key:0,stroke:"#5585f5"})):(a(),c(h,{key:1},[e.chatBox?y("v-if",!0):(a(),c("div",H,[l(V),l(j,{title:"发起群聊",mode:"create","default-value":[ee.userInfo]},null,8,["default-value"]),f("div",z,[S(s.$slots,"toolbar")])])),l(d(b),{class:"iho-chat__body","has-sider":""},{default:p((()=>[e.chatBox?y("v-if",!0):(a(),m(I,{key:0})),l(d(M),{class:"chat-content",style:u({"--c-pointer-events":d(ue)?"none":"unset","--c-cursor":d(ue)?"not-allowed":"unset"})},{default:p((()=>[l(k),l(L),l(T)])),_:1},8,["style"]),S(s.$slots,"external")])),_:3}),ee.showVideo?(a(),m(w,{key:1})):y("v-if",!0),ee.showMultipleVideo?(a(),m(U,{key:2})):y("v-if",!0)],64))])),_:3})],4)):y("v-if",!0)}});export{D as default};
|
@@ -1 +1 @@
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.2.14-beta.
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.2.14-beta.15",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.14-beta.15",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cnhis-design-vue",
|
3
|
-
"version": "3.2.14-beta.
|
3
|
+
"version": "3.2.14-beta.15",
|
4
4
|
"license": "ISC",
|
5
5
|
"module": "./es/components/index.js",
|
6
6
|
"main": "./es/components/index.js",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"iOS 7",
|
73
73
|
"last 3 iOS versions"
|
74
74
|
],
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "1d18dc2180ef025bad0471208b9111e90165e02e"
|
76
76
|
}
|