cnhis-design-vue 3.2.7-beta.30 → 3.2.7-beta.31
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/iho-chat/index.d.ts +2 -3
- package/es/components/iho-chat/src/Index.vue.d.ts +2 -3
- package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/iho-chat/src/components/SiderList.vue.d.ts +2 -3
- package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
- package/es/components/iho-chat/src/hooks/useSession.d.ts +1 -1
- package/es/components/iho-chat/src/hooks/useSession.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/scale-view/index.d.ts +23 -1
- package/es/components/scale-view/src/ScaleView.vue.d.ts +23 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/scale-view/src/components/EvaluateCountdown.vue.d.ts +21 -1
- package/es/components/scale-view/src/components/EvaluateCountdown.vue2.js +1 -1
- package/es/components/scale-view/src/components/formitem/r-select.js +1 -1
- package/es/components/scale-view/src/directive/drag-move.d.ts +3 -0
- package/es/components/scale-view/src/directive/drag-move.js +1 -0
- package/es/components/scale-view/src/hooks/scaleview-computed.d.ts +1 -0
- package/es/components/scale-view/src/hooks/scaleview-computed.js +1 -1
- package/es/components/scale-view/style/index.css +1 -1
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
@@ -725,8 +725,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
725
725
|
showSeq: boolean;
|
726
726
|
footerFlag: boolean;
|
727
727
|
fieldDescribeMode: "column" | "tooltip";
|
728
|
-
customColumns: FieldSetColumnItem[];
|
729
728
|
showSearch: boolean;
|
729
|
+
customColumns: FieldSetColumnItem[];
|
730
730
|
showSortPriority: boolean;
|
731
731
|
showHeadFilter: boolean;
|
732
732
|
}>;
|
@@ -115,11 +115,10 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
115
115
|
state: import("./src/types").IState;
|
116
116
|
emit: (event: string, ...args: any[]) => void;
|
117
117
|
openSession: (item: import("../../shared/types").AnyObject) => Promise<void>;
|
118
|
-
|
119
|
-
setSessionList: (list: import("../../shared/types").AnyObject[]) => void;
|
118
|
+
updateSessionList: (sessionItem: import("../../shared/types").AnyObject) => void;
|
120
119
|
currentWidth: import("vue").ComputedRef<number>;
|
121
120
|
sessionList: import("vue").ComputedRef<import("../../shared/types").AnyObject[]>;
|
122
|
-
|
121
|
+
unreadTotal: import("vue").ComputedRef<number>;
|
123
122
|
changeWidth: ({ distance }: import("../../shared/types").AnyObject) => void;
|
124
123
|
handleFilter: (key: string) => void;
|
125
124
|
showSession: (item: import("../../shared/types").AnyObject, currentKey?: string) => boolean | undefined;
|
@@ -120,11 +120,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
120
120
|
state: IState;
|
121
121
|
emit: (event: string, ...args: any[]) => void;
|
122
122
|
openSession: (item: AnyObject) => Promise<void>;
|
123
|
-
|
124
|
-
setSessionList: (list: AnyObject[]) => void;
|
123
|
+
updateSessionList: (sessionItem: AnyObject) => void;
|
125
124
|
currentWidth: import("vue").ComputedRef<number>;
|
126
125
|
sessionList: import("vue").ComputedRef<AnyObject[]>;
|
127
|
-
|
126
|
+
unreadTotal: import("vue").ComputedRef<number>;
|
128
127
|
changeWidth: ({ distance }: AnyObject) => void;
|
129
128
|
handleFilter: (key: string) => void;
|
130
129
|
showSession: (item: AnyObject, currentKey?: string) => boolean | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as
|
1
|
+
import{defineComponent as e,ref as t,computed as o,openBlock as r,createElementBlock as i,Fragment as a,unref as s,createElementVNode as n,createVNode as l,withCtx as c,toDisplayString as u,createTextVNode as m,normalizeProps as h,guardReactiveProps as d,createCommentVNode as v}from"vue";import{NAvatar as p,NTooltip as f,NButton as g,NIcon as w}from"naive-ui";import{useState as _}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import y from"./PersonProfile.vue.js";import j from"./ChatSet.vue.js";import C from"./ChatFile.vue.js";import k from"./ChatRecord.vue.js";import z from"./ChatAdd.vue.js";import{PersonAddOutline as S}from"@vicons/ionicons5";const q={key:0,class:"chat-header box-shadow"},U={class:"chat-header__left"},I={class:"name"},G={class:"chat-header__right"},x=n("i",{class:"chat--iconfont chat--icon-image"},null,-1),P=n("i",{class:"chat--iconfont chat--icon-folder"},null,-1),A=n("i",{class:"chat--iconfont chat--icon-list-search"},null,-1),F=n("i",{class:"chat--iconfont chat--icon-set"},null,-1);var H=e({__name:"ChatHeader",setup(e){const{state:H}=_(),{isGroupChat:R}=b(H),V=t(!1),B=t(!1),D=t("image"),E=t(!1),J=o((()=>{const e=H.currentGroupUser.map((e=>e.id));return R.value?{mode:"join",disabledIds:e}:{mode:"create",defaultValue:H.currentGroupUser}}));function K(e){D.value=e,B.value=!0}return(e,t)=>(r(),i(a,null,[s(H).id?(r(),i("section",q,[n("div",U,[l(y,{"user-id":s(H).currentSessionItem.receiver,disabled:s(R),placement:"bottom"},{trigger:c((()=>[l(s(p),{round:"",size:30,src:s(H).currentSessionItem.avatar},null,8,["src"])])),_:1},8,["user-id","disabled"]),n("span",I,u(s(H).currentSessionItem.name),1)]),n("div",G,[l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[0]||(t[0]=()=>K("image"))},{icon:c((()=>[x])),_:1})])),default:c((()=>[m(" 图片 ")])),_:1}),l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[1]||(t[1]=()=>K("file"))},{icon:c((()=>[P])),_:1})])),default:c((()=>[m(" 文件 ")])),_:1}),l(z,h(d(s(J))),{trigger:c((()=>[l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny"},{icon:c((()=>[l(s(w),{size:"18",component:s(S)},null,8,["component"])])),_:1})])),default:c((()=>[m(" 添加成员 ")])),_:1})])),_:1},16),l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>E.value=!0)},{icon:c((()=>[A])),_:1})])),default:c((()=>[m(" 聊天记录 ")])),_:1}),l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[3]||(t[3]=()=>V.value=!0)},{icon:c((()=>[F])),_:1})])),default:c((()=>[m(" 聊天设置 ")])),_:1})])])):v("v-if",!0),l(j,{show:V.value,"onUpdate:show":t[4]||(t[4]=e=>V.value=e)},null,8,["show"]),l(C,{show:B.value,"onUpdate:show":t[5]||(t[5]=e=>B.value=e),type:D.value,visible:B.value},null,8,["show","type","visible"]),l(k,{show:E.value,"onUpdate:show":t[6]||(t[6]=e=>E.value=e),visible:E.value},null,8,["show","visible"])],64))}});export{H as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as v,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as _,NIcon as k,NSpace as x,NButtonGroup as I,NButton as S}from"naive-ui";import{format as w}from"date-fns";import{getHistoryRecordApi as L,readMessageApi as j}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import{MESSAGE_TYPE as b}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as z,getAVTime as H}from"../utils/index.js";import{first as D,last as R}from"lodash-es";import N from"./PersonProfile.vue.js";import O from"./MessageTemplate.vue.js";import{emojis as P}from"../utils/emoji.js";import q from"./ContextMenu.js";import{useScrollLoading as B}from"../hooks/useScrollLoading.js";import{CallOutline as U,VideocamOutline as F,DocumentSharp as G,ChatbubbleEllipsesOutline as J,EllipsisHorizontal as K}from"@vicons/ionicons5";const X={key:0,class:"time"},Y={key:2,class:"message-box"},$={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W=["onContextmenu"],Z={key:0,class:"reference-content"},ee=["innerHTML"],te=["innerHTML"],ne=["src"],se={style:{"margin-left":"8px"}},oe={class:"size"};var ie=e({__name:"ChatMain",setup(e){const ie=t(),{state:ae,setMsgList:re}=E(),{setCurrentSessionItem:ce,isGroupChat:le}=C(ae),ue=t(),me=t(!1),pe=t({left:0,top:0}),de=t(),fe={page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")},ve=n((()=>({"--c-tip-top":le.value?"1px":"-20px","--c-tip-gap":le.value?"10px":"0px"})));async function ge(){try{if(!fe.hasMore)return;fe.page++;const e=await L({sessionKey:ae.currentSessionItem.sessionKey,page:fe.page,lastSendTime:fe.lastSendTime});if(!Array.isArray(e)||0===e.length)return fe.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=D(e).id;fe.lastSendTime=R(e).sendTime,re(fe.page>1?[...e,...ae.msgList]:e),1===fe.page&&ae.currentSessionItem.unreadNum&&(await j({chatType:ae.currentSessionItem.chatType,messageIdSet:[t],receiver:ae.userInfo.id,sender:ae.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}async function ye(e,t){de.value=t,async function(e){var t,n,s,o,i,a;me.value=!0,await h();const{clientX:r,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=ie.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=ue.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(a=null==(i=ie.value)?void 0:i.scrollTop)?a:0,v=5,g={};r<=m+l/2?g.left=r-m+v+"px":g.right=m+l-r-v+"px";c-p<d/2?g.top=f+v+"px":p+u-c<=d/2?g.bottom=Math.abs(f)+v+"px":g.top=f+c-p-d/2+"px";pe.value=g}(e)}function he(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==b.TEMPLATE||!!n}function Te(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===b.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function Me(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===b.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function _e(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ae.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function ke(e){ae.currentReferenceMsg=e,Object.assign(ae.currentReferenceMsg,{chatType:ae.currentSessionItem.chatType,receiver:ae.currentSessionItem.receiver,receiverAvatar:ae.currentSessionItem.avatar,receiverName:ae.currentSessionItem.name})}function xe(e,t){"reply"===e&&ke(t)}return B(ie,(()=>{ge()}),"top",(()=>{me.value=!1})),s((()=>ae.id),(e=>{e&&(ae.currentReferenceMsg=null,Object.assign(fe,{page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")}),ge())}),{immediate:!0}),s((()=>ae.isAppendMsg),(e=>{e&&(re([...ae.msgList,ae.currentMsg]),ae.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ie.value)?void 0:e.scrollHeight)?t:0;null==(n=ie.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(ae).id}]),ref_key:"chatMainRef",ref:ie,style:c(r(ve))},[l(r(T),{"show-toolbar-tooltip":""},{default:u((()=>[(o(!0),i(m,null,p(r(ae).msgList,((e,t)=>(o(),i(m,{key:e.id},[he(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ae).userInfo.id}])},[_e(e,t)?(o(),i("p",X,d(e.__sendTime),1)):f("v-if",!0),Te(e,"system")?(o(),v(O,{key:1,data:e},null,8,["data"])):(o(),i("div",Y,[l(N,{"user-id":e.sender},{trigger:u((()=>[l(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",$,[g("div",Q,[g("span",{class:"name","data-time":e.__time},d(r(le)?e.senderName:""),9,V)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(b).EMOJI,template:e.content.chatMessageType===r(b).TEMPLATE,"template--3":Me(e.content),"audio-video":r(A)(e.content),file:e.content.chatMessageType===r(b).FILE}]),onContextmenu:y((t=>ye(t,e.id)),["prevent"])},[e.content.chatMessageType===r(b).TEXT?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",Z,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(z)(e.content.referenceContent.content)},null,8,ee)])):f("v-if",!0),g("pre",null,d(e.__content),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).BLEND?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,te)):f("v-if",!0),e.content.chatMessageType===r(b).EMOJI?(o(),i("img",{key:2,src:r(P).findEmoji(e.__content)},null,8,ne)):f("v-if",!0),Te(e,"template")?(o(),v(O,{key:3,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===r(b).IMAGE?(o(),v(r(_),{key:4,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),r(A)(e.content)?(o(),i(m,{key:5},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(b).AUDIO}),component:e.content.chatMessageType===r(b).AUDIO?r(U):r(F)},null,8,["class","component"]),g("span",se,d(r(H)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).FILE?(o(),v(r(x),{key:6,"wrap-item":!1},{default:u((()=>[l(r(k),{class:"icon-file",size:"40",component:r(G)},null,8,["component"]),l(r(x),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[g("span",null,d(e.__content),1),g("span",oe,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(r(I),{class:"quick-menu"},{default:u((()=>[r(A)(e.content)?f("v-if",!0):(o(),i(m,{key:0},[f(' <n-button quaternary size="tiny">\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(r(S),{quaternary:"",size:"tiny",onClick:()=>ke(e)},{icon:u((()=>[l(r(k),{size:"17",component:r(J)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(r(S),{quaternary:"",size:"tiny",onClick:t=>ye(t,e.id)},{icon:u((()=>[l(r(k),{size:"14",component:r(K)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,W)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(r(q),{ref_key:"contextmenuRef",ref:ue,show:me.value,"onUpdate:show":t[0]||(t[0]=e=>me.value=e),position:pe.value,"msg-id":de.value,onSelect:xe},null,8,["show","position","msg-id"])],6))}});export{ie as default};
|
1
|
+
import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as v,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as _,NIcon as k,NSpace as x,NButtonGroup as I,NButton as S}from"naive-ui";import{format as w}from"date-fns";import{getHistoryRecordApi as L,readMessageApi as j}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import{MESSAGE_TYPE as b}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as z,getAVTime as H}from"../utils/index.js";import{first as D,last as R}from"lodash-es";import N from"./PersonProfile.vue.js";import O from"./MessageTemplate.vue.js";import{emojis as P}from"../utils/emoji.js";import q from"./ContextMenu.js";import{useScrollLoading as B}from"../hooks/useScrollLoading.js";import{CallOutline as U,VideocamOutline as F,DocumentSharp as G,ChatbubbleEllipsesOutline as J,EllipsisHorizontal as K}from"@vicons/ionicons5";const X={key:0,class:"time"},Y={key:2,class:"message-box"},$={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W=["onContextmenu"],Z={key:0,class:"reference-content"},ee=["innerHTML"],te=["innerHTML"],ne=["src"],se={style:{"margin-left":"8px"}},oe={class:"size"};var ie=e({__name:"ChatMain",setup(e){const ie=t(),{state:ae,setMsgList:re}=E(),{setCurrentSessionItem:ce,isGroupChat:le}=C(ae),ue=t(),me=t(!1),pe=t({left:0,top:0}),de=t(),fe={page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")},ve=n((()=>({"--c-tip-top":le.value?"1px":"-20px","--c-tip-gap":le.value?"10px":"0px"})));async function ge(){try{if(!fe.hasMore)return;fe.page++;const e=await L({sessionKey:ae.currentSessionItem.sessionKey,page:fe.page,lastSendTime:fe.lastSendTime});if(!Array.isArray(e)||0===e.length)return fe.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=D(e).id;fe.lastSendTime=R(e).sendTime,re(fe.page>1?[...e,...ae.msgList]:e),1===fe.page&&ae.currentSessionItem.unreadNum&&(await j({chatType:ae.currentSessionItem.chatType,messageIdSet:[t],receiver:ae.userInfo.id,sender:ae.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}async function ye(e,t){de.value=t,async function(e){var t,n,s,o,i,a;me.value=!0,await h();const{clientX:r,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=ie.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=ue.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(a=null==(i=ie.value)?void 0:i.scrollTop)?a:0,v=5,g={};r<=m+l/2?g.left=r-m+v+"px":g.right=m+l-r-v+"px";c-p<d/2?g.top=f+v+"px":p+u-c<=d/2?g.bottom=Math.abs(f)+v+"px":g.top=f+c-p-d/2+"px";pe.value=g}(e)}function he(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==b.TEMPLATE||!!n}function Te(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===b.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function Me(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===b.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function _e(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ae.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function ke(e){ae.currentReferenceMsg=e,Object.assign(ae.currentReferenceMsg,{chatType:ae.currentSessionItem.chatType,receiver:ae.currentSessionItem.receiver,receiverAvatar:ae.currentSessionItem.avatar,receiverName:ae.currentSessionItem.name})}function xe(e,t){"reply"===e&&ke(t)}return B(ie,(()=>{ge()}),"top",(()=>{me.value=!1})),s((()=>ae.id),(e=>{e&&(ae.currentReferenceMsg=null,Object.assign(fe,{page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")}),ge())}),{immediate:!0}),s((()=>ae.isAppendMsg),(e=>{e&&(re([...ae.msgList,ae.currentMsg]),ae.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ie.value)?void 0:e.scrollHeight)?t:0;null==(n=ie.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(ae).id}]),ref_key:"chatMainRef",ref:ie,style:c(r(ve))},[l(r(T),{"show-toolbar-tooltip":""},{default:u((()=>[(o(!0),i(m,null,p(r(ae).msgList,((e,t)=>(o(),i(m,{key:e.id},[he(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ae).userInfo.id}])},[_e(e,t)?(o(),i("p",X,d(e.__sendTime),1)):f("v-if",!0),Te(e,"system")?(o(),v(O,{key:1,data:e},null,8,["data"])):(o(),i("div",Y,[l(N,{"user-id":e.sender},{trigger:u((()=>[l(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",$,[g("div",Q,[g("span",{class:"name","data-time":e.__time},d(r(le)?e.senderName:""),9,V)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(b).EMOJI,template:e.content.chatMessageType===r(b).TEMPLATE,"template--3":Me(e.content),"audio-video":r(A)(e.content),file:e.content.chatMessageType===r(b).FILE}]),onContextmenu:y((t=>ye(t,e.id)),["prevent"])},[e.content.chatMessageType===r(b).TEXT?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",Z,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(z)(e.content.referenceContent.content)},null,8,ee)])):f("v-if",!0),g("pre",null,d(e.__content),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).BLEND?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,te)):f("v-if",!0),e.content.chatMessageType===r(b).EMOJI?(o(),i("img",{key:2,src:r(P).findEmoji(e.__content)},null,8,ne)):f("v-if",!0),Te(e,"template")?(o(),v(O,{key:3,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===r(b).IMAGE?(o(),v(r(_),{key:4,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),r(A)(e.content)?(o(),i(m,{key:5},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(b).AUDIO}),component:e.content.chatMessageType===r(b).AUDIO?r(U):r(F)},null,8,["class","component"]),g("span",se,d(r(H)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).FILE?(o(),v(r(x),{key:6,"wrap-item":!1},{default:u((()=>[l(r(k),{class:"icon-file",size:"40",component:r(G)},null,8,["component"]),l(r(x),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[g("span",null,d(e.__content),1),g("span",oe,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(r(I),{class:"quick-menu"},{default:u((()=>[r(A)(e.content)?f("v-if",!0):(o(),i(m,{key:0},[f(' <n-button quaternary size="tiny">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(r(S),{quaternary:"",size:"tiny",onClick:()=>ke(e)},{icon:u((()=>[l(r(k),{size:"17",component:r(J)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(r(S),{quaternary:"",size:"tiny",onClick:t=>ye(t,e.id)},{icon:u((()=>[l(r(k),{size:"14",component:r(K)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,W)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(r(q),{ref_key:"contextmenuRef",ref:ue,show:me.value,"onUpdate:show":t[0]||(t[0]=e=>me.value=e),position:pe.value,"msg-id":de.value,onSelect:xe},null,8,["show","position","msg-id"])],6))}});export{ie as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,useAttrs as s,openBlock as t,createBlock as o,unref as i,withCtx as r,createVNode as n,createElementVNode as a,toDisplayString as m}from"vue";import{NDrawer as c,NDrawerContent as l,NAvatar as p,NIcon as u,NSwitch as d}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as h}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{isFunction as S}from"lodash-es";import"../utils/emoji.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as _}from"../api/index.js";const I={class:"chat-set-wrapper"},j={class:"item user-info"},
|
1
|
+
import{defineComponent as e,useAttrs as s,openBlock as t,createBlock as o,unref as i,withCtx as r,createVNode as n,createElementVNode as a,toDisplayString as m}from"vue";import{NDrawer as c,NDrawerContent as l,NAvatar as p,NIcon as u,NSwitch as d}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as h}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{isFunction as S}from"lodash-es";import"../utils/emoji.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as _}from"../api/index.js";const I={class:"chat-set-wrapper"},j={class:"item user-info"},b={class:"name"},w={class:"item"},k=a("span",{class:"label"},"置顶聊天",-1);var y=e({__name:"ChatSet",setup(e){const y=s(),{state:C}=h(),{setCurrentSessionItem:U,isGroupChat:x}=v(C);async function z(e){try{await _({sessionKey:C.currentSessionItem.sessionKey,id:C.currentSessionItem.id,topping:e}),U({topping:e})}catch(e){console.log(e)}}function K(){S(y["onUpdate:show"])&&y["onUpdate:show"](!1)}return(e,s)=>(t(),o(i(c),{width:320,"trap-focus":!1,"block-scroll":!1,to:".iho-chat"},{default:r((()=>[n(i(l),{title:"聊天设置"},{default:r((()=>[a("div",I,[n(g,{"user-id":i(C).currentSessionItem.receiver,onClose:K,disabled:!!i(x),placement:"bottom-end"},{trigger:r((()=>[a("div",j,[n(i(p),{round:"",size:40,src:i(C).currentSessionItem.avatar},null,8,["src"]),a("span",b,m(i(C).currentSessionItem.name),1),n(i(u),{size:24,component:i(f),class:"item__right"},null,8,["component"])])])),_:1},8,["user-id","disabled"]),a("div",w,[k,n(i(d),{value:i(C).currentSessionItem.topping,"onUpdate:value":[s[0]||(s[0]=e=>i(C).currentSessionItem.topping=e),z],class:"item__right"},null,8,["value"])])])])),_:1})])),_:1}))}});export{y as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as a,reactive as l,computed as o,openBlock as
|
1
|
+
import{defineComponent as e,ref as a,reactive as l,computed as o,openBlock as s,createBlock as n,unref as i,createSlots as t,withCtx as r,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,vShow as v,toDisplayString as f,createTextVNode as y,renderList as k,createCommentVNode as h,renderSlot as g}from"vue";import{NPopover as b,NAvatar as _,NUpload as w,NUploadTrigger as C,NButton as I,NIcon as j}from"naive-ui";import{Camera as z,ChatbubbleEllipses as x,EyeOffOutline as N,EyeOutline as S,Close as $}from"@vicons/ionicons5";import{useState as D}from"../hooks/useState.js";import{useSession as P}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import{openSessionApi as T,getUserDetailApi as q,uploadFileApi as B}from"../api/index.js";const E={class:"person-profile-main"},F={class:"left"},O={class:"profile"},U={class:"profile__text"},A={class:"right"},G={class:"right__content"},H={class:"label"},J={class:"content"};var K=e({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:K}){const L=e,{state:M}=D(),{openSession:Q}=P(M),R=a(!1),V=a(!1),W=a(!1),X=l({}),Y=[{label:"机构",value:"",key:"orgName"},{label:"姓名",value:"",key:"name"},{label:"归属科室",value:"",key:"deptName"},{label:"业务科室",value:"",key:"businessDeptNames"},{label:"手机号",value:"",key:"phone"},{label:"岗位",value:"",key:"post"},{label:"工号",value:"",key:"jobId"},{label:"性别",value:"",key:"orgName"}],Z=o((()=>(X.id&&Y.forEach((e=>{const{key:a}=e;e.value=X[a]})),Y)));async function ee(){R.value=!1;const e=await T({chatType:M.currentSessionItem.chatType,receiver:L.userId,sender:M.userInfo.id});Q(e),K("close")}async function ae(e){if(!e)return;const a=await q({userId:L.userId});(null==a?void 0:a.id)?Object.assign(X,a):X.id=""}function le(e){const{key:a,value:l}=e;return"phone"!==a||W.value?l:(l||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}async function oe(e){const{file:a,name:l}=e.file,o=new FormData;o.append("sender",M.userInfo.id),o.append("file",a);const s=await B(o);if(X.avatar=s,!s)return console.log("上传失败")}return(a,l)=>(s(),n(i(b),{raw:"",class:"person-profile-wrapper",show:R.value,"onUpdate:show":[l[3]||(l[3]=e=>R.value=e),ae],trigger:e.disabled?"manual":"click","show-arrow":!1,shift:""},t({default:r((()=>[X.id?(s(),c(u,{key:0},[d(p("div",E,[p("div",F,[p("div",O,[m(i(_),{src:X.avatar,bordered:"",round:"",size:100,onClickCapture:l[0]||(l[0]=e=>V.value=!0)},null,8,["src"]),m(i(w),{abstract:"",accept:"image/*",onChange:oe},{default:r((()=>[m(i(C),{abstract:""},{default:r((({handleClick:e})=>[d(m(i(I),{circle:"",secondary:"",class:"edit-avatar",onClick:e},{icon:r((()=>[m(i(j),{size:"16",color:"#666666",component:i(z)},null,8,["component"])])),_:2},1032,["onClick"]),[[v,X.id===i(M).userInfo.id]])])),_:1})])),_:1}),p("div",U,[p("h4",null,f(X.name),1),p("p",null,f(X.orgName),1)]),m(i(I),{strong:"",secondary:"",onClick:ee},{default:r((()=>[m(i(j),{size:"13",color:"#666666",component:i(x),style:{"margin-right":"6px"}},null,8,["component"]),y(" 发消息 ")])),_:1})])]),p("div",A,[p("div",G,[(s(!0),c(u,null,k(i(Z),((e,a)=>(s(),c("div",{class:"info-item",key:a},[p("span",H,f(e.label),1),p("div",J,[p("span",null,f(le(e)),1),"phone"===e.key&&le(e)?(s(),n(i(j),{key:0,size:"16",color:"#666666",component:W.value?i(N):i(S),style:{"margin-left":"10px"},onClick:l[1]||(l[1]=e=>W.value=!W.value)},null,8,["component"])):h("v-if",!0)])])))),128))])])],512),[[v,!V.value]]),d(p("div",{class:"large-avatar",onClick:l[2]||(l[2]=e=>V.value=!1)},[m(i(I),{circle:"",size:"small",secondary:""},{icon:r((()=>[m(i(j),{size:24,component:i($),color:"#fff"},null,8,["component"])])),_:1}),m(i(_),{size:310,round:"",src:X.avatar},null,8,["src"])],512),[[v,V.value]])],64)):h("v-if",!0)])),_:2},[k(a.$slots,((e,l)=>({name:l,fn:r((()=>[g(a.$slots,l)]))})))]),1032,["show","trigger"]))}});export{K as default};
|
@@ -17,11 +17,10 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
17
17
|
state: import("../types").IState;
|
18
18
|
emit: (event: string, ...args: any[]) => void;
|
19
19
|
openSession: (item: AnyObject) => Promise<void>;
|
20
|
-
|
21
|
-
setSessionList: (list: AnyObject[]) => void;
|
20
|
+
updateSessionList: (sessionItem: AnyObject) => void;
|
22
21
|
currentWidth: import("vue").ComputedRef<number>;
|
23
22
|
sessionList: import("vue").ComputedRef<AnyObject[]>;
|
24
|
-
|
23
|
+
unreadTotal: import("vue").ComputedRef<number>;
|
25
24
|
changeWidth: ({ distance }: AnyObject) => void;
|
26
25
|
handleFilter: (key: string) => void;
|
27
26
|
showSession: (item: AnyObject, currentKey?: string) => boolean | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as s,computed as i,watch as
|
1
|
+
import{defineComponent as e,ref as s,computed as i,watch as t,withDirectives as a,openBlock as l,createElementBlock as n,normalizeStyle as r,unref as o,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 x,NBadge as b}from"naive-ui";import{useState as M}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import"trtc-sdk-v5";import{listSort as L,formatTime as N}from"../utils/index.js";import{vFlexibleResize as j}from"../../../../shared/directive/flexibleResize.js";const T={class:"sider-list__filter box-shadow"},w=["onClick"],R={class:"avatar-right"},z={class:"name"},H={class:"msg-tip"},I={class:"msg-tip__content"},K=["innerHTML"];var U=e({__name:"SiderList",setup(e){const U="all",B="unread";let V=[];const q=s(300),A=s(),D=s(!1),E=s([{label:"全部",key:U},{label:"未读",key:B}]),F=s("all"),{state:G,emit:J}=M(),{openSession:O,updateSessionList:P}=C(G),Q=i((()=>Math.min(Math.max(q.value,240),360))),W=i((()=>L(G.sessionList))),X=i((()=>G.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0)));function Y({distance:e}){q.value=q.value+e}function Z(e,s=o(F)){var i;return s===U||(s===B?V.includes(e.sessionKey)||(null!=(i=e.unreadNum)?i:0)>0:void 0)}return t([()=>G.isChangeSession,()=>G.isUpdateSession],(([e,s])=>{e&&(P(G.currentSessionItem),G.isChangeSession=!1),s&&(P(G.updateSessionItem),G.isUpdateSession=!1)}),{immediate:!0}),t((()=>X.value),(e=>{const s=W.value.filter((e=>{var s;return+(null!=(s=e.unreadNum)?s:0)>0}));J("unread-message-update",e,s)})),(e,s)=>a((l(),n("section",{class:"sider-list",style:r({width:o(Q)+"px"})},[D.value?(l(),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> '),m("div",T,[(l(!0),n(v,null,c(E.value,(e=>(l(),u(o(g),{type:F.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,F.value=s,void(s===B&&(V=(W.value.filter((e=>{var s;return(null!=(s=e.unreadNum)?s:0)>0}))||[]).map((e=>e.sessionKey))));var s}},{default:p((()=>[f(k(e.label)+"("+k(o(X))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),m("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:A},[(l(!0),n(v,null,c(o(W),(e=>a((l(),n("div",{key:e.id,onClick:()=>o(O)(e),class:_(["sider-list__box__item",{active:e.id===o(G).id},e.topping?"sider-list__box__item--top":""])},[y(o(x),{round:"",size:"large",src:e.avatar},null,8,["src"]),m("div",R,[m("div",z,[m("h4",null,k(e.name),1),m("span",null,k(e.lastMessage?o(N)(e.lastMessageSendTime).siderMsgTime:""),1)]),m("div",H,[m("div",I,[m("div",{innerHTML:e.lastMessageContent},null,8,K)]),y(o(b),{value:e.unreadNum>99?"99+":e.unreadNum},null,8,["value"])])])],10,w)),[[h,Z(e)]]))),128))],512)],4)),[[o(j),{mode:"VR",onMove:Y}]])}});export{U as default};
|
@@ -6,7 +6,7 @@ export declare function useSession(state: IState): {
|
|
6
6
|
getCurrentSession: () => AnyObject | null;
|
7
7
|
setCurrentSessionItem: (item: AnyObject) => void;
|
8
8
|
setUpdateSessionItem: (item: AnyObject) => void;
|
9
|
-
unreadTotal: import("vue").ComputedRef<number>;
|
10
9
|
setSessionList: (list: AnyObject[]) => void;
|
11
10
|
isGroupChat: import("vue").ComputedRef<boolean>;
|
11
|
+
updateSessionList: (sessionItem: AnyObject) => void;
|
12
12
|
};
|
@@ -1 +1 @@
|
|
1
|
-
import{computed as e}from"vue";import{simplifyMessage as s}from"../utils/index.js";import{cloneDeep as
|
1
|
+
import{computed as e}from"vue";import{simplifyMessage as s}from"../utils/index.js";import{cloneDeep as n,isArray as t,uniqBy as i}from"lodash-es";import{CHAT_TYPE as o}from"../constants/index.js";import{groupUserApi as r}from"../api/index.js";function a(e){return e.chatType===o.GROUP}function c(e){const{lastMessage:n,lastSenderName:t=""}=e,i=s(n)||"";return a(e)&&t?t+": "+i:i}function u(s){const u=e((()=>a(s.currentSessionItem)));function m(e){Object.assign(s.currentSessionItem,e,{lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:Reflect.has(e,"lastMessage")?c({...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)}function d(e){s.sessionList=n(i(e,"id")),s.sessionList.forEach((e=>{Object.assign(e,{lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:c(e)}),e.receiver===s.userInfo.id&&(e.unreadNum=0),e.chatType!==o.GROUP||e.name||r({id:e.receiver}).then((s=>{t(s)&&(e.name=s.map((e=>e.name)).join(","))}))}))}return{openSession:async function(e){const i=s.currentSessionItem.sessionKey;if(m(e),i!==s.currentSessionItem.sessionKey)if(u.value){const n=await r({id:e.receiver});s.currentGroupUser=t(n)?n:[]}else s.currentGroupUser=[s.userInfo,{...n(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 t=s.sessionList.find((s=>s.sessionKey===e.sessionKey)),i={...e,lastMessageContent:c({...e,chatType:e.chatType||(null==t?void 0:t.chatType)})};s.updateSessionItem=t?{...n(t),...i}:i,s.isUpdateSession=!0},setSessionList:d,isGroupChat:u,updateSessionList:function(e){!e.id||s.sessionList.map((e=>e.id)).includes(e.id)?s.sessionList.some((n=>{if(n.sessionKey===e.sessionKey){let{unreadNum:t=0}=n;return Object.assign(n,e),e.sessionKey!==s.currentSessionItem.sessionKey&&(n.unreadNum=++t),!0}})):d([...s.sessionList,e])}}}export{u as useSession};
|