cnhis-design-vue 3.2.9-beta.1 → 3.2.9-beta.14
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.
- package/es/components/ai-chat/src/components/ChatMain.js +1 -1
- package/es/components/ai-chat/src/types/index.d.ts +8 -7
- package/es/components/base-search/index.d.ts +6 -2
- package/es/components/base-search/src/index.vue.d.ts +6 -2
- package/es/components/button-print/index.d.ts +7 -45
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +7 -45
- package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +6 -35
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +1 -5
- package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/utils/print.d.ts +4 -3
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/classification/index.d.ts +3 -1
- package/es/components/classification/src/components/search-filter/index.vue.d.ts +2 -0
- package/es/components/classification/src/components/set-classification/index.vue.d.ts +2 -0
- package/es/components/classification/src/index.vue.d.ts +3 -1
- package/es/components/expand-field/index.d.ts +1 -1
- package/es/components/expand-field/src/components/form.vue.d.ts +1 -1
- package/es/components/expand-field/src/index.vue.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
- package/es/components/field-set/src/FieldColor.vue.d.ts +26 -7
- package/es/components/field-set/src/FieldFilter.vue.d.ts +25 -6
- package/es/components/field-set/src/FieldSet.vue.d.ts +65 -29
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/field-set/src/components/edit-dialog.vue.d.ts +1 -1
- package/es/components/field-set/src/components/table-row.vue.d.ts +24 -1
- package/es/components/field-set/src/components/table-row.vue2.js +1 -1
- package/es/components/field-set/src/types/index.d.ts +3 -3
- package/es/components/field-set/src/utils/index.js +1 -1
- package/es/components/iho-chat/index.d.ts +4 -0
- package/es/components/iho-chat/src/Index.vue.d.ts +4 -0
- package/es/components/iho-chat/src/Index.vue2.js +1 -1
- package/es/components/iho-chat/src/api/index.js +1 -1
- package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +1 -0
- package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +2 -0
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
- package/es/components/iho-chat/src/constants/index.d.ts +2 -1
- package/es/components/iho-chat/src/constants/index.js +1 -1
- package/es/components/iho-chat/src/hooks/useSearchUserList.js +1 -1
- package/es/components/iho-chat/src/hooks/useState.js +1 -1
- package/es/components/iho-chat/src/types/index.d.ts +1 -0
- package/es/components/iho-chat/style/index.css +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/index.js +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useRowHeight.d.ts +2 -0
- package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useRowHeight.js +1 -0
- package/es/components/iho-table/src/types/index.d.ts +3 -0
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/quick-search/index.d.ts +6 -2
- package/es/components/quick-search/src/index.vue.d.ts +6 -2
- package/es/components/table-filter/src/components/bi-filter/ValueCfg.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/bi-filter/index.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/render-widget/components/SelectTree.vue.d.ts +51 -0
- package/es/components/table-filter/src/components/render-widget/components/SelectTree.vue.js +1 -0
- package/es/components/table-filter/src/components/render-widget/components/SelectTree.vue2.js +1 -0
- package/es/components/table-filter/src/components/render-widget/components/index.d.ts +49 -1
- package/es/components/table-filter/src/components/render-widget/components/index.js +1 -1
- package/es/components/table-filter/src/components/render-widget/index.vue.js +1 -1
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +65 -0
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
- package/es/components/table-filter/src/hooks/useAdvanced.d.ts +6 -2
- package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
- package/es/components/table-filter/src/types/enums.d.ts +1 -0
- package/es/components/table-filter/src/types/enums.js +1 -1
- package/es/components/table-filter/src/types/index.d.ts +1 -0
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
@@ -74,6 +74,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
74
74
|
updateSessionItem: AnyObject;
|
75
75
|
isUpdateSession: boolean;
|
76
76
|
currentReferenceMsg: AnyObject | null;
|
77
|
+
currentReEditMsg: AnyObject | null;
|
77
78
|
showVideo: boolean;
|
78
79
|
currentAVMsg: AnyObject;
|
79
80
|
currentGroupUser: AnyObject[];
|
@@ -781,6 +782,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
781
782
|
handleContextmenu: (event: MouseEvent, msgId: string) => Promise<void>;
|
782
783
|
setMenuPosition: (event: MouseEvent) => Promise<void>;
|
783
784
|
showMessage: (item: AnyObject) => boolean;
|
785
|
+
showReEdit: (item: AnyObject) => boolean;
|
784
786
|
showReferenceMsg: (item: AnyObject) => any;
|
785
787
|
showBlendMsg: (item: AnyObject) => any;
|
786
788
|
showTemplateMsg: (item: AnyObject, type: "template" | "system") => boolean | undefined;
|
@@ -790,6 +792,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
790
792
|
resetInfo: () => void;
|
791
793
|
setReferenceMsg: (msgItem: AnyObject) => void;
|
792
794
|
handleSelect: (key: string, msgItem: AnyObject) => void;
|
795
|
+
reEdit: (item: AnyObject) => void;
|
793
796
|
NAvatar: any;
|
794
797
|
NImageGroup: any;
|
795
798
|
NImage: any;
|
@@ -1010,6 +1013,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
1010
1013
|
fileChange: (options: import("./types").FileOptions, chatMessageType: import("./constants").MESSAGE_TYPE) => Promise<void>;
|
1011
1014
|
handleMsgSend: () => Promise<void>;
|
1012
1015
|
doSendMessage: (contentInfo: AnyObject) => Promise<void>;
|
1016
|
+
clearInput: () => void;
|
1013
1017
|
NButton: any;
|
1014
1018
|
NPopover: any;
|
1015
1019
|
NTooltip: any;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as s,reactive as o,provide as t,onBeforeUnmount as n,openBlock as r,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as d,withCtx as u,createBlock as l,Fragment as p,createElementVNode as m,renderSlot as h,createCommentVNode as f}from"vue";import{NConfigProvider as g,NSpin as y,NLayout as
|
1
|
+
import{defineComponent as e,ref as s,reactive as o,provide as t,onBeforeUnmount as n,openBlock as r,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as d,withCtx as u,createBlock as l,Fragment as p,createElementVNode as m,renderSlot as h,createCommentVNode as f}from"vue";import{NConfigProvider as g,NSpin as y,NLayout as S,NLayoutContent as v}from"naive-ui";import b from"./components/SiderList.vue.js";import M from"./components/ChatHeader.vue.js";import I from"./components/ChatMain.vue.js";import k from"./components/ChatFooter.vue.js";import T from"./components/ChatSearch.vue.js";import V from"./components/ChatAdd.vue.js";import j from"./components/Video.vue.js";import L from"./components/MultipleVideo.vue.js";import{ChatSock as A}from"./utils/chatSock.js";import{instanceAxios as N,readMessageApi as w}from"./api/index.js";import{useTheme as U}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{remove as _,isNumber as C}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../shared/hooks/useScrollLoading.js";import{CHAT_TYPE as E,SUBSCRIBE_MESSAGE_TYPE as O,AV_STATUS as x}from"./constants/index.js";import{InjectionIChatState as R,InjectionIChatStompClient as G,InjectionIChatEmits as K}from"./types/index.js";import{isAudioOrVideoMessage as B}from"./utils/index.js";import{useSession as P}from"./hooks/useSession.js";import"trtc-sdk-v5";const J={key:0,class:"iho-chat__header"},$={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"},chatBox:{type:Boolean,default:!1},defaultSessionKey:{type:String}},emits:["template-click","unread-message-update"],setup(e,{expose:q,emit:F}){const H=e;N.defaults.baseURL=H.baseURL,N.defaults.headers.Authorization="bearer "+H.token;const z=U(),D=s(!1),W=s(),Y=o({orgId:H.orgId,currentSessionItem:{},id:"",userInfo:{id:H.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null,currentReEditMsg:null,showVideo:!1,currentAVMsg:{},currentGroupUser:[],showMultipleVideo:!1});t(R,Y),t(G,W),t(K,F);const{openSession:Q,closeSession:X,getCurrentSession:Z,setSessionList:ee,setUpdateSessionItem:se,setCurrentSessionItem:oe}=P(Y),te=[];function ne(){const e={headers:{AccessToken:H.token,UserId:H.userId},heartbeatFn(){try{W.value.send("test")}catch(e){W.value.disconnect(),ne()}},connectCb(){console.log("连接成功"),W.value.subscribe("/user/topic/single",(({body:e})=>ie({body:e,chatType:E.SINGLE}))),W.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{authentication:o,currentUser:t,sessionVos:n}=s;if(Object.assign(Y.userInfo,t,o),!(null==n?void 0:n.length))return;ee(n),te.splice(0,te.length),te.push(...n.filter((e=>e.chatType===E.GROUP))),te.forEach((e=>{W.value.subscribe(`/topic/group/${e.receiver}`,(({body:e})=>ie({body:e,chatType:E.GROUP})))})),function(){const e=Y.sessionList.find((e=>e.sessionKey===H.defaultSessionKey));e&&Q(e)}()}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};W.value=new A("/fdp-chat/websocket",e)}async function re(e,s){if(Y.currentMsg=e,e.sessionKey===Y.currentSessionItem.sessionKey)return Y.isAppendMsg=!0,e.sender!==Y.userInfo.id&&await w({chatType:s,messageIdSet:[e.id],receiver:Y.userInfo.id,sender:e.sender}),void oe({lastMessageSendTime:e.sendTime,lastMessage:e.content,sortTime:e.sendTime,unreadNum:0,lastSenderName:e.senderName});const o={lastMessageSendTime:e.sendTime,sortTime:e.sendTime,lastMessage:e.content,sessionKey:e.sessionKey,lastSenderName:e.senderName};se(o)}async function ie({body:e,chatType:s}){try{const o=JSON.parse(e),{messageVo:t,sessionVo:n,chatAvStatusVo:r}=o;switch(o.event){case O.MESSAGE:B(t.content)?!Y.showVideo&&!Y.showMultipleVideo||t.content.avStatus!==x.IN_CALL?(Y.currentMsg=t,Object.assign(Y.currentAVMsg,{strRoomId:t.sessionKey,chatMessageType:t.content.chatMessageType,callMode:t.sender===Y.userInfo.id?"call":"invite",currentMsg:t}),Y.showVideo||Y.showMultipleVideo?re(t,s):Y.showVideo=!0):(W.value.send("/app/chat/send",{},JSON.stringify({chatType:E.SINGLE,receiver:t.sender,content:{chatMessageType:t.content.chatMessageType,avStatus:x.CALL_BUSY}})),console.log("用户忙!")):re(t,s);break;case O.RECALL_MESSAGE:break;case O.AV_STATUS:Object.assign(Y.currentAVMsg,r,{callMode:r.sender===Y.userInfo.id?"call":"invite",checkedIds:[]}),Y.showVideo||Y.showMultipleVideo?console.log("用户忙!"):Y.showMultipleVideo=!0;break;case O.NEW_SESSION:if(s===E.GROUP)return;se(n);break;case O.JOIN:if(s===E.GROUP)return;se(n),W.value.subscribe(`/topic/group/${n.receiver}`,(({body:e})=>ie({body:e,chatType:E.GROUP})));break;case O.LEAVE:X(),_(Y.sessionList,(e=>e.sessionKey===n.sessionKey))}}catch(e){console.log(e)}}return async function(){ne()}(),n((()=>{var e;null==(e=W.value)||e.disconnect()})),q({getUnreadData:function(){return Y.sessionList.filter((e=>C(e.unreadNum)&&e.unreadNum>0))},openSession:Q,closeSession:X,getCurrentSession:Z}),(s,o)=>(r(),i("div",{class:"iho-chat",style:a(c(z))},[d(c(g),{abstract:"",namespace:"iho-chat__popover"},{default:u((()=>[D.value?(r(),l(c(y),{key:0,stroke:"#5585f5"})):(r(),i(p,{key:1},[e.chatBox?f("v-if",!0):(r(),i("div",J,[d(T),d(V,{title:"发起群聊",mode:"create","default-value":[Y.userInfo]},null,8,["default-value"]),m("div",$,[h(s.$slots,"toolbar")])])),d(c(S),{class:"iho-chat__body","has-sider":""},{default:u((()=>[e.chatBox?f("v-if",!0):(r(),l(b,{key:0})),d(c(v),{class:"chat-content"},{default:u((()=>[d(M),d(I),d(k)])),_:1}),h(s.$slots,"external")])),_:3}),Y.showVideo?(r(),l(j,{key:1})):f("v-if",!0),Y.showMultipleVideo?(r(),l(L,{key:2})):f("v-if",!0)],64))])),_:3})],4))}});export{q as default};
|
@@ -1 +1 @@
|
|
1
|
-
import t from"axios";import{createDiscreteApi as e}from"naive-ui";const{message:o}=e(["message"]);function r(t){const e=[];for(const o in t){const r=t[o];Array.isArray(r)?r.forEach((t=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(t)}`)})):e.push(`${encodeURIComponent(o)}=${encodeURIComponent(r)}`)}return e.join("&")}const n=t.create({withCredentials:!0,timeout:5e3});function a(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/openSession",data:r(t)})}function u(t){return n({method:"get",url:"/chat/recordList",params:t})}function s(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/toppingSession",data:r(t)})}function d(t){return n({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/chat/uploadFile",data:t})}function i(t){return n({method:"get",url:"/user/listUser",params:t})}function p(t){return n({method:"get",url:"/user/getUserDetail",params:t})}function c(t){return n({method:"post",url:"/chat/readMessage",data:t})}function
|
1
|
+
import t from"axios";import{createDiscreteApi as e}from"naive-ui";const{message:o}=e(["message"]);function r(t){const e=[];for(const o in t){const r=t[o];Array.isArray(r)?r.forEach((t=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(t)}`)})):e.push(`${encodeURIComponent(o)}=${encodeURIComponent(r)}`)}return e.join("&")}const n=t.create({withCredentials:!0,timeout:5e3});function a(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/openSession",data:r(t)})}function u(t){return n({method:"get",url:"/chat/recordList",params:t})}function s(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/toppingSession",data:r(t)})}function d(t){return n({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/chat/uploadFile",data:t})}function i(t){return n({method:"get",url:"/user/listUser",params:t})}function p(t){return n({method:"get",url:"/user/getUserDetail",params:t})}function c(t){return n({method:"post",url:"/chat/readMessage",data:t})}function m(t){return n({method:"post",url:"/chat/recallMessage",data:t})}function l(t){return n({method:"post",url:"/chat/searchChatRecord",data:t})}function h(t){return n({method:"post",url:"/group/create",data:t})}function f(t){return n({method:"get",url:"/group/user",params:t})}function g(t){return n({method:"post",url:"/group/join",data:t})}function C(t){return n({method:"post",url:"/group/leave",data:t})}function v(t){return n({method:"post",url:"/av/finish",data:t})}function w(t){return n({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/group/update",data:t})}n.interceptors.response.use((t=>{var e,r,n;if(null==(e=t.data)?void 0:e.result)return null==(r=t.data)?void 0:r.data;500==(null==(n=t.data)?void 0:n.code)&&t.data.msg&&o.error(t.data.msg)}));export{v as avFinishApi,u as getHistoryRecordApi,p as getUserDetailApi,h as groupCreateApi,g as groupJoinApi,C as groupLeaveApi,w as groupUpdateApi,f as groupUserApi,n as instanceAxios,i as listUserApi,a as openSessionApi,c as readMessageApi,m as recallMessageApi,l as searchChatRecordApi,s as toppingSessionApi,d as uploadFileApi};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as
|
1
|
+
import{defineComponent as e,ref as t,computed as a,watch as o,openBlock as s,createBlock as i,unref as r,withCtx as n,withDirectives as l,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as f,vShow as h,normalizeStyle as y,createCommentVNode as v,createTextVNode as g}from"vue";import{NModal as w,NImageGroup as b,NImage as k,NInput as M,NIcon as T,NTooltip as _}from"naive-ui";import{SearchOutline as I,DownloadOutline as S}from"@vicons/ionicons5";import{searchChatRecordApi as x}from"../api/index.js";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import{useDebounceFn as A}from"@vueuse/core";import{format as H,isSameWeek as D,isSameMonth as C}from"date-fns";import{last as O}from"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as z}from"../../../../shared/hooks/useScrollLoading.js";import{useState as L}from"../hooks/useState.js";import{getFileSize as U,downloadFile as E}from"../utils/index.js";import"trtc-sdk-v5";const $={class:"label"},F={class:"image-box"},P={class:"file-type"},R={class:"text"},B={class:"name"},G={class:"detail"},N={class:"opt-box"};var q=e({__name:"ChatFile",props:{type:{type:String,default:"image"},visible:{type:Boolean}},setup(e){const q=e,J=j(),{state:K}=L(),Q=t([]),V=t([]),W=t(),X=t(),Y=t(),Z=A(ae,500),ee={page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")};async function te(){var e;try{if(!ee.hasMore)return;ee.page++;const t=await x({orgId:K.orgId,keyword:Y.value,endTime:"",startTime:"",lastSendTime:ee.lastSendTime,memberIdSet:[],page:ee.page,recordType:"image"===q.type?"IMAGE":"FILE",receiver:K.currentSessionItem.receiver,userId:K.userInfo.id});Array.isArray(t)&&0!==t.length&&Array.isArray(t[0].recordList)||(ee.hasMore=!1);let a=t||[];if(Array.isArray(t)&&t.length>0&&(a=t[0].recordList),ee.lastSendTime=null==(e=O(a))?void 0:e.sendTime,"image"===q.type){const e=function(e){const t={};e.forEach((e=>{const a=new Date(e.sendTime);let o=H(a,"yyyy年MM月");D(a,new Date)?o="本周":C(a,new Date)&&(o="本月"),t[o]||(t[o]=[]),t[o].push(e.content.msg)}));return Object.entries(t).map((([e,t])=>({label:e,list:t})))}(a);Q.value=ee.page>1?Q.value.concat(e):e}else{const e=a.map((e=>new Promise((async t=>{const a=await U(e.content.fileUrl);t({...e,size:a})})))),t=await Promise.all(e);V.value=ee.page>1?V.value.concat(t):t}}catch(e){}}function ae(){Object.assign(ee,{page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")}),te()}z(W,(()=>{te()})),z(X,(()=>{te()}));const oe=a((()=>"image"===q.type?"聊天图片":"聊天文件"));function se(e){const{size:t,sendTime:a,senderName:o}=e;return`${t} · ${H(new Date(a),"yyyy/MM/dd HH:mm")} ${o}`}function ie(e){var t;const a=(null==(t=e.content)?void 0:t.msg)||"",o=a.lastIndexOf(".");if(-1!==o){return a.charAt(o+1).toUpperCase()}return"?"}return o((()=>q.visible),(e=>{e?ae():Y.value=""})),(t,a)=>(s(),i(r(w),{preset:"dialog",title:r(oe),"show-icon":!1,"auto-focus":!1,class:"iho-chat-dialog"},{default:n((()=>[l(c("div",{class:"iho-chat-dialog__content iho-chat-image-wrapper",ref_key:"imageRef",ref:W},[m(r(b),{"show-toolbar-tooltip":""},{default:n((()=>[(s(!0),p(d,null,u(Q.value,(e=>(s(),p("div",{class:"image-item",key:e.label},[c("span",$,f(e.label),1),c("div",F,[(s(!0),p(d,null,u(e.list,(e=>(s(),i(r(k),{key:e,width:"80",height:"80",src:e},null,8,["src"])))),128))])])))),128))])),_:1})],512),[[h,"image"===e.type]]),l(c("div",{class:"iho-chat-dialog__content iho-chat-file-wrapper",style:y(r(J))},[m(r(M),{clearable:"",placeholder:"搜索文件",value:Y.value,"onUpdate:value":a[0]||(a[0]=e=>Y.value=e),valueModifiers:{trim:!0},onInput:r(Z)},{prefix:n((()=>[m(r(T),{component:r(I)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"file-list-box",ref_key:"fileRef",ref:X},[(s(!0),p(d,null,u(V.value,((e,t)=>(s(),p("div",{class:"file-item",key:t},[c("span",P,f(ie(e)),1),c("div",R,[c("span",B,f(e.content.msg),1),c("span",G,f(se(e)),1)]),c("div",N,[v(' <n-tooltip :show-arrow="false">\r\n\t\t\t\t\t\t\t<template #trigger>\r\n\t\t\t\t\t\t\t\t<n-icon :size="16" :component="OpenOutline" />\r\n\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t转发\r\n\t\t\t\t\t\t</n-tooltip> '),m(r(_),{"show-arrow":!1},{trigger:n((()=>[m(r(T),{size:16,component:r(S),onClick:()=>r(E)(e.content.fileUr,e.content.msg)},null,8,["component","onClick"])])),default:n((()=>[g(" 下载 ")])),_:2},1024)])])))),128))],512)],4),[[h,"image"!==e.type]])])),_:1},8,["title"]))}});export{q as default};
|
@@ -29,6 +29,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
29
29
|
fileChange: (options: FileOptions, chatMessageType: MESSAGE_TYPE) => Promise<void>;
|
30
30
|
handleMsgSend: () => Promise<void>;
|
31
31
|
doSendMessage: (contentInfo: AnyObject) => Promise<void>;
|
32
|
+
clearInput: () => void;
|
32
33
|
NButton: any;
|
33
34
|
NPopover: any;
|
34
35
|
NTooltip: any;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as n,computed as t,watch as o,withDirectives as
|
1
|
+
import{defineComponent as e,ref as n,computed as t,watch as o,withDirectives as s,openBlock as i,createElementBlock as r,normalizeStyle as a,unref as c,createElementVNode as l,toDisplayString as u,createVNode as f,createCommentVNode as d,withCtx as m,Fragment as g,renderList as p,createBlock as h,createTextVNode as y,mergeProps as v,vShow as M}from"vue";import{NIcon as w,NTooltip as _,NPopover as k,NButton as E,NUpload as C,NUploadTrigger as T}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as x}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{MESSAGE_TYPE as j,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as L,base64ToFile as O}from"../utils/index.js";import{emojis as R}from"../utils/emoji.js";import{uploadFileApi as q}from"../api/index.js";import{CloseCircleOutline as D,CallOutline as $,VideocamOutline as A}from"@vicons/ionicons5";import{xor as H,uniq as J,trim as V,cloneDeep as K}from"lodash-es";import{uuidGenerator as F}from"../../../../shared/utils/index.js";import{useStorage as U}from"@vueuse/core";const G={key:0,class:"reference-content-box"},N={class:"reference-content"},X=["innerHTML"],B={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),P=l("span",null,"最近使用",-1),Q={class:"list-box",style:{"margin-bottom":"8px"}},W=["src"],Y=l("span",null,"默认表情",-1),Z={class:"list-box"},ee=["src"],ne=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),te=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),oe=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),se={class:"btn-box"},ie=l("span",{class:"tip"},"Enter 发送, Ctrl + Enter 换行",-1);var re=e({__name:"ChatFooter",setup(e){const re=n(),{state:ae,sendMessage:ce}=x(),{isGroupChat:le}=b(ae),ue=n(!1),fe=n(""),de=U("commonEmoticons",[]),me=t((()=>({options:ae.currentGroupUser,defaultValue:[ae.userInfo]}))),ge=t((()=>!fe.value.replace(/( |\s|<br>)+/g,"")));function pe(e,n=[]){const t=F(),o=[],s=n.length>0;ae.showVideo||ae.showMultipleVideo||(s?(o.push(...H(n,[ae.userInfo.id])),Object.assign(ae.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:t,chatMessageType:e}),ae.showMultipleVideo=!0):ce({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function he(e){["Enter"].includes(e.key)&&(e.ctrlKey&&(e.preventDefault(),document.execCommand("InsertLineBreak")),function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),_e()))}function ye(){var e;fe.value=(null==(e=re.value)?void 0:e.innerHTML)||""}function ve(e){var n;de.value.unshift(e),de.value=J(de.value).slice(0,26),null==(n=re.value)||n.focus(),document.execCommand("insertHTML",!1,`<img data-msg=${e} data-type=${j.EMOJI} class="emoji--min" src=${R.findEmoji(e)} />`)}async function Me(e){const n=new FormData;return n.append("sender",ae.userInfo.id),n.append("file",e),await q(n)}async function we(e,n){const{file:t,name:o}=e.file,s=await Me(t);if(!s)return console.log("上传失败");ke({chatMessageType:n,msg:n===j.FILE?o:s,url:s})}async function _e(){const{innerHTML:e="",innerText:n="",outerText:t=""}=re.value||{};if(ge.value)return console.log("请输入内容");let o=j.TEXT,s="";if(e){const t=e.match(/<img[^>]*>/gi),i=(t||[]).length;if(n&&0===i)s=n;else if(n||1!==i){if(o=j.BLEND,s=e,null==t?void 0:t.length)for(let e=0;e<i;e++)if(t[e].includes(`data-type="${j.EMOJI}"`)){const n=t[e].match(/data-msg="(.*?)"/);n&&n.length>1&&(s=s.replace(t[e],`[${n[1]}]`))}else{const n=t[e].match(/src\s*=\s*"([^"]*)"/);if(n&&n.length>1){const e=O(n[1]);if(e){const t=await Me(e);s=s.replace(n[1],t||"")}}}}else if(e.includes(j.EMOJI)){o=j.EMOJI;const n=e.match(/data-msg\s*=\s*"([^"]*)"/);n&&(s=n[1])}else{o=j.IMAGE;const n=e.match(/src\s*=\s*"([^"]*)"/);if(n){const e=O(n[1]);if(e){const n=await Me(e);n&&(s=n)}}}}else s=V(n);s&&ke({msg:s,chatMessageType:o,origin:"btn"})}async function ke(e){const{chatMessageType:n=j.TEXT,msg:t,url:o,origin:s=""}=e,i={msg:t,chatMessageType:n};n===j.FILE&&(i.fileUrl=o),"btn"===s&&Ee(),ae.currentReferenceMsg&&([j.TEXT,j.EMOJI,j.BLEND].includes(n)&&(i.referenceContent=K(ae.currentReferenceMsg)),ae.currentReferenceMsg=null),ce({content:i})}function Ee(){re.value.innerHTML="",fe.value=""}return o((()=>[ae.currentReferenceMsg,ae.currentReEditMsg]),(([e,n])=>{var t;if((e||n)&&(null==(t=re.value)||t.focus()),n){const{chatMessageType:e,msg:t}=n.content||{},o=e===j.TEXT?t:`<img data-msg=${t} data-type=${j.EMOJI} class="emoji--min" src=${R.findEmoji(t)} />`;document.execCommand("insertHTML",!1,o),ae.currentReEditMsg=null}})),o((()=>ae.id),(e=>{e&&Ee()})),(e,n)=>s((i(),r("section",{class:"chat-footer",style:a({cursor:c(ae).id?"default":"not-allowed"})},[c(ae).currentReferenceMsg?(i(),r("div",G,[l("div",N,[l("span",null,u(c(ae).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:c(L)(c(ae).currentReferenceMsg.content)},null,8,X)]),f(c(w),{component:c(D),onClick:n[0]||(n[0]=()=>c(ae).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",B,[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(k),{"content-class":"emoji-content",class:"emoji-wrapper",show:ue.value,"onUpdate:show":n[1]||(n[1]=e=>ue.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny"},{icon:m((()=>[S])),_:1})])),default:m((()=>[c(de).length>0?(i(),r(g,{key:0},[P,l("div",Q,[(i(!0),r(g,null,p(c(de),(e=>(i(),h(c(_),{key:e,"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny",onClick:()=>ve(e)},{icon:m((()=>[l("img",{src:c(R).findEmoji(e)},null,8,W)])),_:2},1032,["onClick"])])),default:m((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])],64)):d("v-if",!0),Y,l("div",Z,[(i(!0),r(g,null,p(c(R).default,(([e,n])=>(i(),h(c(_),{key:e,"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny",onClick:()=>ve(e)},{icon:m((()=>[l("img",{src:n},null,8,ee)])),_:2},1032,["onClick"])])),default:m((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])])),_:1},8,["show"])])),default:m((()=>[y(" 表情 ")])),_:1}),f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny",onClick:n[2]||(n[2]=()=>ke({chatMessageType:c(j).EMOJI,msg:0}))},{icon:m((()=>[ne])),_:1})])),default:m((()=>[y(" 点赞 ")])),_:1}),f(c(C),{abstract:"",multiple:"",accept:"image/*",onChange:n[3]||(n[3]=e=>we(e,c(j).IMAGE))},{default:m((()=>[f(c(T),{abstract:""},{default:m((({handleClick:e})=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[te])),_:2},1032,["onClick"])])),default:m((()=>[y(" 上传图片 ")])),_:2},1024)])),_:1})])),_:1}),f(c(C),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:n[4]||(n[4]=e=>we(e,c(j).FILE))},{default:m((()=>[f(c(T),{abstract:""},{default:m((({handleClick:e})=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[oe])),_:2},1032,["onClick"])])),default:m((()=>[y(" 上传文件 ")])),_:2},1024)])),_:1})])),_:1}),c(le)?(i(),r(g,{key:0},[f(I,v(c(me),{onComfirm:n[5]||(n[5]=e=>pe(c(j).AUDIO,e))}),{trigger:m((()=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny"},{icon:m((()=>[f(c(w),{size:"18",component:c($)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 语音通话 ")])),_:1})])),_:1},16),f(I,v(c(me),{onComfirm:n[6]||(n[6]=e=>pe(c(j).VIDEO,e))}),{trigger:m((()=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny"},{icon:m((()=>[f(c(w),{size:"20",component:c(A)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 视频会议 ")])),_:1})])),_:1},16)],64)):(i(),r(g,{key:1},[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny",onClick:n[7]||(n[7]=()=>pe(c(j).AUDIO))},{icon:m((()=>[f(c(w),{size:"18",component:c($)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 语音通话 ")])),_:1}),f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(E),{quaternary:"",size:"tiny",onClick:n[8]||(n[8]=()=>pe(c(j).VIDEO))},{icon:m((()=>[f(c(w),{size:"20",component:c(A)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 视频通话 ")])),_:1})],64))]),s(l("div",{ref_key:"inputRef",ref:re,class:"input-box",contenteditable:"",onKeydown:he,onInput:ye},null,544),[[M,c(ae).id]]),l("div",se,[ie,f(c(E),{type:"primary",round:"",disabled:c(ge),onClick:_e},{default:m((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[M,c(ae).id]])}});export{re as default};
|
@@ -29,6 +29,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
29
29
|
handleContextmenu: (event: MouseEvent, msgId: string) => Promise<void>;
|
30
30
|
setMenuPosition: (event: MouseEvent) => Promise<void>;
|
31
31
|
showMessage: (item: AnyObject) => boolean;
|
32
|
+
showReEdit: (item: AnyObject) => boolean;
|
32
33
|
showReferenceMsg: (item: AnyObject) => any;
|
33
34
|
showBlendMsg: (item: AnyObject) => any;
|
34
35
|
showTemplateMsg: (item: AnyObject, type: 'system' | 'template') => boolean | undefined;
|
@@ -38,6 +39,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
38
39
|
resetInfo: () => void;
|
39
40
|
setReferenceMsg: (msgItem: AnyObject) => void;
|
40
41
|
handleSelect: (key: string, msgItem: AnyObject) => void;
|
42
|
+
reEdit: (item: AnyObject) => void;
|
41
43
|
NAvatar: any;
|
42
44
|
NImageGroup: any;
|
43
45
|
NImage: any;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as r,unref as a,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as
|
1
|
+
import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as r,unref as a,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as g,createElementVNode as v,createTextVNode as y,withModifiers as h,nextTick as T}from"vue";import{NImageGroup as M,NButton as k,NAvatar as _,NImage as x,NIcon as I,NSpace as w,NButtonGroup as C,NTooltip as S}from"naive-ui";import{format as E}from"date-fns";import{getHistoryRecordApi as j,readMessageApi as L}from"../api/index.js";import{useState as b}from"../hooks/useState.js";import{useSession as z}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as H,simplifyMessage as D,getAVTime as R,downloadFile as N}from"../utils/index.js";import{first as O,last as P}from"lodash-es";import q from"./PersonProfile.vue.js";import B from"./MessageTemplate.vue.js";import{emojis as J}from"../utils/emoji.js";import W from"./ContextMenu.js";import"../../../../shared/utils/index.js";import"@vueuse/core";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{CallOutline as U,VideocamOutline as X,DocumentSharp as F,ChatbubbleEllipsesOutline as G,EllipsisHorizontal as K,ArrowDownSharp as Y}from"@vicons/ionicons5";import{useScrollLoading as $}from"../../../../shared/hooks/useScrollLoading.js";const Q={key:0,class:"tip-text"},V={key:1,class:"tip-text"},Z={key:2,class:"message-box"},ee={key:0,class:"content-box"},te={class:"name-box"},ne=["data-time"],se=["onContextmenu"],oe={key:0,class:"reference-content"},ie=["innerHTML"],re=["src"],ae=["innerHTML"],ce=["innerHTML"],le={style:{"margin-left":"8px"}},ue={class:"size"};var me=e({__name:"ChatMain",setup(e){const me=t(),{state:pe,setMsgList:de}=b(),{setCurrentSessionItem:fe,isGroupChat:ge}=z(pe),ve=t(),ye=t(!1),he=t({left:0,top:0}),Te=t(),Me={page:0,hasMore:!0,lastSendTime:E(new Date,"yyyy-MM-dd HH:mm:ss")},ke=n((()=>({"--c-tip-top":ge.value?"1px":"-20px","--c-tip-gap":ge.value?"10px":"0px"})));function _e({nodes:e}){var t,n;const{_ctx:s}=null==(t=e.download)?void 0:t.children,o=s?null==(n=null==s?void 0:s.proxy)?void 0:n.previewSrc:"";return[e.prev,e.next,e.rotateCounterclockwise,e.rotateClockwise,e.resizeToOriginalSize,e.zoomOut,e.zoomIn,l(S,null,{trigger:()=>l(I,{style:"cursor: pointer",color:"rgba(255, 255, 255, 0.75",size:24,component:Y,onClick:()=>o&&N(o,"img")},null),default:()=>"下载"}),e.close]}async function xe(){try{if(!Me.hasMore)return;Me.page++;const e=await j({sessionKey:pe.currentSessionItem.sessionKey,page:Me.page,lastSendTime:Me.lastSendTime});if(!Array.isArray(e)||0===e.length)return Me.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=O(e).id;Me.lastSendTime=P(e).sendTime,de(Me.page>1?[...e,...pe.msgList]:e),1===Me.page&&pe.currentSessionItem.unreadNum&&(await L({chatType:pe.currentSessionItem.chatType,messageIdSet:[t],receiver:pe.userInfo.id,sender:pe.currentSessionItem.receiver}),fe({unreadNum:0}))}catch(e){console.log(e)}}async function Ie(e,t){Te.value=t,async function(e){var t,n,s,o,i,r;ye.value=!0,await T();const{clientX:a,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=me.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=ve.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(r=null==(i=me.value)?void 0:i.scrollTop)?r:0,g=5,v={};a<=m+l/2?v.left=a-m+g+"px":v.right=m+l-a-g+"px";c-p<d/2?v.top=f+g+"px":p+u-c<=d/2?v.bottom=Math.abs(f)+g+"px":v.top=f+c-p-d/2+"px";he.value=v}(e)}function we(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function Ce(e){const{chatMessageType:t}=e.content;return e.sender===pe.userInfo.id&&Date.now()-new Date(e.sendTime).getTime()<864e5&&[A.TEXT,A.EMOJI].includes(t)}function Se(e){const{chatMessageType:t,msg:n=""}=e.content;if(t===A.BLEND){const e=n.match(/<img[^>]*>/gi);return!e||!e.length}return t&&[A.TEXT,A.EMOJI].includes(t)}function Ee(e){const{chatMessageType:t,msg:n=""}=e.content,s=n.match(/<img[^>]*>/gi);return t===A.BLEND&&s&&s.length}function je(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===A.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 Le(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===A.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function be(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=pe.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function ze(e){pe.currentReferenceMsg=e,pe.currentReferenceMsg.content.referenceContent=null,Object.assign(pe.currentReferenceMsg,{chatType:pe.currentSessionItem.chatType,receiver:pe.currentSessionItem.receiver,receiverAvatar:pe.currentSessionItem.avatar,receiverName:pe.currentSessionItem.name})}function Ae(e,t){"reply"===e&&ze(t)}return $(me,(()=>{xe()}),"top",(()=>{ye.value=!1})),s((()=>pe.id),(e=>{e&&(pe.currentReferenceMsg=null,Object.assign(Me,{page:0,hasMore:!0,lastSendTime:E(new Date,"yyyy-MM-dd HH:mm:ss")}),xe())}),{immediate:!0}),s((()=>pe.isAppendMsg),(e=>{e&&(de([...pe.msgList,pe.currentMsg]),async function(){var e,t,n;await T();const s=null!=(t=null==(e=me.value)?void 0:e.scrollHeight)?t:0;null==(n=me.value)||n.scrollTo({top:s,behavior:"auto"})}(),pe.isAppendMsg=!1)}),{immediate:!0}),(e,t)=>(o(),i("div",{class:r(["chat-main",{"home-bg":!a(pe).id}]),ref_key:"chatMainRef",ref:me,style:c(a(ke))},[l(a(M),{"show-toolbar-tooltip":"","render-toolbar":_e},{default:u((()=>[(o(!0),i(m,null,p(a(pe).msgList,((e,t)=>(o(),i(m,{key:e.id},[we(e)?(o(),i("div",{key:0,class:r(["message-item",{"message-item--mine":e.sender==a(pe).userInfo.id}])},[be(e,t)?(o(),i("p",Q,d(e.__sendTime),1)):f("v-if",!0),je(e,"system")||"WITHDRAWN"===e.status?(o(),i(m,{key:1},[je(e,"system")?(o(),g(B,{key:0,data:e},null,8,["data"])):f("v-if",!0),"WITHDRAWN"===e.status?(o(),i("p",V,[v("span",null,d(e.sender==a(pe).userInfo.id?"你":e.senderName)+"撤回了一条消息",1),Ce(e)?(o(),g(a(k),{key:0,size:"tiny",style:{color:"var(--c-primary-color)","margin-left":"5px"},text:"",onClick:()=>function(e){pe.currentReEditMsg=e}(e)},{default:u((()=>[y(" 重新编辑 ")])),_:2},1032,["onClick"])):f("v-if",!0)])):f("v-if",!0)],64)):(o(),i("div",Z,[l(q,{"user-id":e.sender,placement:e.sender==a(pe).userInfo.id?"left":"right"},{trigger:u((()=>[l(a(_),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",ee,[v("div",te,[v("span",{class:"name","data-time":e.__time},d(a(ge)?e.senderName:""),9,ne)]),v("div",{class:r(["content",{emoji:e.content.chatMessageType===a(A).EMOJI,template:e.content.chatMessageType===a(A).TEMPLATE,"template--3":Le(e.content),"audio-video":a(H)(e.content),file:e.content.chatMessageType===a(A).FILE}]),onContextmenu:h((t=>Ie(t,e.id)),["prevent"])},[Se(e)?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",oe,[v("span",null,d(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:a(D)(e.content.referenceContent.content)},null,8,ie)])):f("v-if",!0),e.content.chatMessageType===a(A).EMOJI?(o(),i("img",{key:1,class:r([e.content.referenceContent?"emoji--min":"emoji--big"]),src:a(J).findEmoji(e.__content)},null,10,re)):(o(),i("pre",{key:2,innerHTML:e.__content},null,8,ae))],64)):f("v-if",!0),Ee(e)?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,ce)):f("v-if",!0),je(e,"template")?(o(),g(B,{key:2,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===a(A).IMAGE?(o(),g(a(x),{key:3,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),a(H)(e.content)?(o(),i(m,{key:4},[l(a(I),{class:r({"is-audio":e.content.chatMessageType===a(A).AUDIO}),component:e.content.chatMessageType===a(A).AUDIO?a(U):a(X)},null,8,["class","component"]),v("span",le,d(a(R)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===a(A).FILE?(o(),g(a(w),{key:5,"wrap-item":!1},{default:u((()=>[l(a(I),{class:"icon-file",size:"40",component:a(F)},null,8,["component"]),l(a(w),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[v("span",null,d(e.__content),1),v("span",ue,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(a(C),{class:"quick-menu"},{default:u((()=>[a(H)(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(a(k),{quaternary:"",size:"tiny",onClick:()=>ze(e)},{icon:u((()=>[l(a(I),{size:"17",component:a(G)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(a(k),{quaternary:"",size:"tiny",onClick:t=>Ie(t,e.id)},{icon:u((()=>[l(a(I),{size:"14",component:a(K)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,se)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(a(W),{ref_key:"contextmenuRef",ref:ve,show:ye.value,"onUpdate:show":t[0]||(t[0]=e=>ye.value=e),position:he.value,"msg-id":Te.value,onSelect:Ae},null,8,["show","position","msg-id"])],6))}});export{me as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as a,watch as l,openBlock as t,createBlock as r,unref as s,withCtx as o,createElementVNode as n,createVNode as i,toDisplayString as u,resolveDynamicComponent as c,createElementBlock as d,Fragment as v,renderList as m,withDirectives as p,createTextVNode as f,vShow as
|
1
|
+
import{defineComponent as e,ref as a,watch as l,openBlock as t,createBlock as r,unref as s,withCtx as o,createElementVNode as n,createVNode as i,toDisplayString as u,resolveDynamicComponent as c,createElementBlock as d,Fragment as v,renderList as m,withDirectives as p,createTextVNode as f,vShow as h}from"vue";import{NModal as g,NAvatar as y,NInputGroup as b,NInput as _,NSelect as T,NPopover as k,NTag as M,NIcon as x}from"naive-ui";import{SearchOutline as j}from"@vicons/ionicons5";import{useState as I}from"../hooks/useState.js";import{transformMessage as w,formatTime as S}from"../utils/index.js";import{last as A}from"lodash-es";import{MESSAGE_TYPE as L}from"../constants/index.js";import{searchChatRecordApi as C}from"../api/index.js";import"trtc-sdk-v5";import E from"../../../date-picker/index.js";import{useDebounceFn as H}from"@vueuse/core";import{format as D}from"date-fns";import"../../../../shared/utils/index.js";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as U}from"../../../../shared/hooks/useScrollLoading.js";import{emojis as z}from"../utils/emoji.js";const G={class:"iho-chat-dialog__header"},N=n("span",{class:"left"},"聊天记录",-1),R={class:"center"},B={class:"iho-chat-dialog__content iho-chat-record-wrapper"},O={class:"chat-record-box"},W={class:"msg-box"},J={class:"name-and-time"},P={class:"content"},X=["src"],$=["src"],q=["innerHTML"],F={key:1,class:"no-data"},K={class:"chat-record-box__filter"},Q=n("span",{class:"filter-title"},"添加筛选条件",-1),V={class:"filter-item"},Y=n("span",{class:"label"},"成员:",-1),Z={class:"filter-item"},ee=n("span",{class:"label"},"日期:",-1),ae={class:"time-target"},le={class:"time-target__item"},te=n("span",null,"开始:",-1),re={class:"tip"},se={class:"time-target__item"},oe=n("span",null,"结束:",-1),ne={class:"tip"};var ie=e({__name:"ChatRecord",props:{visible:{type:Boolean}},setup(e){const ie=e,ue={color:"#fff",textColor:"#666"},{state:ce}=I(),de=a(),ve=a([]),me=a(),pe=a([]),fe=a(),he=a(),ge=H(_e,500),ye={page:0,hasMore:!0,lastSendTime:D(new Date,"yyyy-MM-dd HH:mm:ss")};async function be(){var e;try{if(!ye.hasMore)return;ye.page++;const a=await C({orgId:ce.orgId,keyword:me.value,endTime:Me(),startTime:fe.value?fe.value+" 00:00:00":"",lastSendTime:ye.lastSendTime,memberIdSet:pe.value,page:ye.page,recordType:"ALL",receiver:ce.currentSessionItem.receiver,userId:ce.userInfo.id});Array.isArray(a)&&0!==a.length&&Array.isArray(a[0].recordList)||(ye.hasMore=!1);let l=a||[];Array.isArray(a)&&a.length>0&&(l=a[0].recordList.filter((e=>"WITHDRAWN"!==e.status))),ye.lastSendTime=null==(e=A(l))?void 0:e.sendTime,l.forEach((e=>{var a,l,t,r;let s="";switch(e.content.chatMessageType){case L.TEXT:case L.BLEND:s=w(e.content);break;case L.TEMPLATE:s=null==(t=null==(l=null==(a=e.content)?void 0:a.messageTemplate)?void 0:l.setting)?void 0:t.title;break;default:s=null==(r=e.content)?void 0:r.msg}e.__content=s})),ve.value=ye.page>1?ve.value.concat(l):l}catch(e){}}function _e(){Object.assign(ye,{page:0,hasMore:!0,lastSendTime:Me()||D(new Date,"yyyy-MM-dd HH:mm:ss")}),be()}function Te(e){return!!he.value&&e>Date.parse(`${he.value} 23:59:59`)}function ke(e){return!!fe.value&&e<Date.parse(fe.value)}function Me(){return he.value?he.value+" 23:59:59":""}function xe(e){switch(e){case"member":pe.value=[];break;case"start":fe.value=null;break;case"end":he.value=null}}function je(e){return i(v,null,[i("div",{style:"display: flex;align-items: center"},[i(y,{src:e.avatar,round:!0,size:"small"},null),i("span",{style:"margin-left: 10px"},[e.name])])])}return U(de,(()=>{be()})),l([()=>pe.value,()=>fe.value,()=>he.value],(()=>{ie.visible&&_e()}),{deep:!0}),l((()=>ie.visible),(e=>{e?_e():(me.value="",he.value=null,fe.value=null,pe.value=[],ve.value=[])})),(e,a)=>(t(),r(s(g),{preset:"dialog",title:"","show-icon":!1,"auto-focus":!1,class:"iho-chat-dialog"},{header:o((()=>[n("div",G,[N,n("div",R,[i(s(y),{round:"",size:30,src:s(ce).currentSessionItem.avatar},null,8,["src"]),n("span",null,u(s(ce).currentSessionItem.name),1)])])])),default:o((()=>[n("div",B,[i(s(b),null,{default:o((()=>[(t(),r(c((()=>[i(x,{component:j,size:18,color:"#6666"},null),pe.value.length>0?i(M,{closable:!0,bordered:!1,color:ue,onClose:()=>xe("member")},{default:()=>{var e;return[f("成员:")," ",pe.value.length>1?pe.value.length+"人":null==(e=ce.currentGroupUser.find((e=>e.id===pe.value[0])))?void 0:e.name]}}):null,fe.value?i(M,{closable:!0,bordered:!1,color:ue,onClose:()=>xe("start")},{default:()=>[f("起始时间: "),fe.value]}):null,he.value?i(M,{closable:!0,bordered:!1,color:ue,onClose:()=>xe("end")},{default:()=>[f("结束时间: "),he.value]}):null])))),i(s(_),{placeholder:"搜索",value:me.value,"onUpdate:value":a[0]||(a[0]=e=>me.value=e),valueModifiers:{trim:!0},onInput:s(ge)},null,8,["value","onInput"])])),_:1}),n("div",O,[n("div",{class:"chat-record-box__content",ref_key:"recordRef",ref:de},[ve.value.length>0?(t(!0),d(v,{key:0},m(ve.value,(e=>(t(),d("div",{class:"content-item",key:e.id},[i(s(y),{round:"",size:38,src:e.senderAvatar},null,8,["src"]),n("div",W,[n("div",J,[n("span",null,u(e.senderName),1),n("span",null,u(s(S)(e.sendTime).recordTime),1)]),n("div",P,[e.content.chatMessageType===s(L).IMAGE?(t(),d("img",{key:0,src:e.__content},null,8,X)):e.content.chatMessageType===s(L).EMOJI?(t(),d("img",{key:1,class:"emoji",src:s(z).findEmoji(e.__content)},null,8,$)):(t(),d("p",{key:2,innerHTML:e.__content},null,8,q))])])])))),128)):(t(),d("div",F,"没有找到相关记录"))],512),n("div",K,[Q,n("div",V,[Y,i(s(T),{value:pe.value,"onUpdate:value":a[1]||(a[1]=e=>pe.value=e),multiple:"","max-tag-count":1,"render-label":je,options:s(ce).currentGroupUser,"value-field":"id"},null,8,["value","options"])]),n("div",Z,[ee,n("div",ae,[i(s(k),{trigger:"click","show-arrow":!1},{trigger:o((()=>[n("div",le,[te,p(i(s(M),{bordered:!1,color:ue,closable:"",onClose:a[2]||(a[2]=()=>xe("start"))},{default:o((()=>[f(u(fe.value),1)])),_:1},512),[[h,fe.value]]),p(n("span",re,"点击选择",512),[[h,!fe.value]])])])),default:o((()=>[i(s(E),{"formatted-value":fe.value,"onUpdate:formatted-value":a[3]||(a[3]=e=>fe.value=e),type:"date",panel:"",clearable:"","is-date-disabled":Te},null,8,["formatted-value"])])),_:1}),i(s(k),{trigger:"click","show-arrow":!1},{trigger:o((()=>[n("div",se,[oe,p(i(s(M),{bordered:!1,color:ue,closable:"",onClose:a[4]||(a[4]=()=>xe("end"))},{default:o((()=>[f(u(he.value),1)])),_:1},512),[[h,he.value]]),p(n("span",ne,"点击选择",512),[[h,!he.value]])])])),default:o((()=>[i(s(E),{"formatted-value":he.value,"onUpdate:formatted-value":a[5]||(a[5]=e=>he.value=e),type:"date",panel:"",clearable:"","is-date-disabled":ke},null,8,["formatted-value"])])),_:1})])])])])])])),_:1}))}});export{ie as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,useAttrs as t,ref as n,computed as s,watch as i,openBlock as o,createBlock as a,unref as r,withCtx as l,createVNode as c,createTextVNode as u,createElementBlock as m,Fragment as p,renderList as d,createElementVNode as v,toDisplayString as f,createCommentVNode as g,withKeys as _,nextTick as y}from"vue";import{NDrawer as k,NDrawerContent as h,NButton as b,NIcon as I,NAvatar as S,NUpload as w,NUploadTrigger as x,NInput as C,NSpace as U,NSwitch as z,NPopconfirm as j}from"naive-ui";import{ChevronBackOutline as G,ChevronForwardOutline as P,AddOutline as A,RemoveOutline as K,Pencil as R}from"@vicons/ionicons5";import{useState as D}from"../hooks/useState.js";import{useSession as F}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{trim as L,isFunction as B}from"lodash-es";import"../utils/emoji.js";import"../../../../shared/utils/index.js";import N from"./PersonProfile.vue.js";import O from"./ChatAdd.vue.js";import{toppingSessionApi as q,groupLeaveApi as E,groupUpdateApi as H}from"../api/index.js";const J={key:0,class:"chat-set-wrapper"},M={class:"item"},Q={class:"name"},T={key:0,class:"item__right",style:{color:"var(--c-primary-color)"}},V={class:"item user-info"},W={class:"name"},X={class:"item item-column"},Y=v("span",{class:"label"},"群成员",-1),Z={class:"group-box"},$={class:"group-box__item"},ee={class:"name"},te={class:"group-box__item"},ne=v("span",{class:"name"},"添加",-1),se={class:"group-box__item"},ie=v("span",{class:"name"},"移除",-1),oe=["onClick"],ae=v("span",{class:"label"},"群头像",-1),re={class:"item"},le=v("span",{class:"label"},"群名称",-1),ce={class:"item__right"},ue={class:"txt"},me={class:"item"},pe=v("span",{class:"label"},"置顶聊天",-1),de={class:"item item--red"},ve=v("span",{class:"label"},"退出群聊",-1),fe=v("p",{style:{width:"230px"}},"是否确认退出群聊?",-1),ge={class:"item item--red"},_e=v("span",{class:"label"},"解散该群",-1),ye=v("p",{style:{width:"230px"}},"是否确认解散群聊?",-1);var ke=e({__name:"ChatSet",setup(e){const ke=t(),{state:he}=D(),{setCurrentSessionItem:be,isGroupChat:Ie}=F(he),Se=n(),we=n(!1),xe=n(""),Ce=n(!1),Ue=s((()=>{var e,t;return he.userInfo.id===(null==(t=null==(e=he.currentGroupUser)?void 0:e[0])?void 0:t.id)})),ze=s((()=>he.currentGroupUser.map((e=>e.id)))),je=s((()=>he.currentGroupUser?Ue.value?he.currentGroupUser.slice(0,6):he.currentGroupUser.slice(0,7):[]));async function Ge(e){try{await q({sessionKey:he.currentSessionItem.sessionKey,id:he.currentSessionItem.id,topping:e}),be({topping:e})}catch(e){
|
1
|
+
import{defineComponent as e,useAttrs as t,ref as n,computed as s,watch as i,openBlock as o,createBlock as a,unref as r,withCtx as l,createVNode as c,createTextVNode as u,createElementBlock as m,Fragment as p,renderList as d,createElementVNode as v,toDisplayString as f,createCommentVNode as g,withKeys as _,nextTick as y}from"vue";import{NDrawer as k,NDrawerContent as h,NButton as b,NIcon as I,NAvatar as S,NUpload as w,NUploadTrigger as x,NInput as C,NSpace as U,NSwitch as z,NPopconfirm as j}from"naive-ui";import{ChevronBackOutline as G,ChevronForwardOutline as P,AddOutline as A,RemoveOutline as K,Pencil as R}from"@vicons/ionicons5";import{useState as D}from"../hooks/useState.js";import{useSession as F}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{trim as L,isFunction as B}from"lodash-es";import"../utils/emoji.js";import"../../../../shared/utils/index.js";import N from"./PersonProfile.vue.js";import O from"./ChatAdd.vue.js";import{toppingSessionApi as q,groupLeaveApi as E,groupUpdateApi as H}from"../api/index.js";const J={key:0,class:"chat-set-wrapper"},M={class:"item"},Q={class:"name"},T={key:0,class:"item__right",style:{color:"var(--c-primary-color)"}},V={class:"item user-info"},W={class:"name"},X={class:"item item-column"},Y=v("span",{class:"label"},"群成员",-1),Z={class:"group-box"},$={class:"group-box__item"},ee={class:"name"},te={class:"group-box__item"},ne=v("span",{class:"name"},"添加",-1),se={class:"group-box__item"},ie=v("span",{class:"name"},"移除",-1),oe=["onClick"],ae=v("span",{class:"label"},"群头像",-1),re={class:"item"},le=v("span",{class:"label"},"群名称",-1),ce={class:"item__right"},ue={class:"txt"},me={class:"item"},pe=v("span",{class:"label"},"置顶聊天",-1),de={class:"item item--red"},ve=v("span",{class:"label"},"退出群聊",-1),fe=v("p",{style:{width:"230px"}},"是否确认退出群聊?",-1),ge={class:"item item--red"},_e=v("span",{class:"label"},"解散该群",-1),ye=v("p",{style:{width:"230px"}},"是否确认解散群聊?",-1);var ke=e({__name:"ChatSet",setup(e){const ke=t(),{state:he}=D(),{setCurrentSessionItem:be,isGroupChat:Ie}=F(he),Se=n(),we=n(!1),xe=n(""),Ce=n(!1),Ue=s((()=>{var e,t;return he.userInfo.id===(null==(t=null==(e=he.currentGroupUser)?void 0:e[0])?void 0:t.id)})),ze=s((()=>he.currentGroupUser.map((e=>e.id)))),je=s((()=>he.currentGroupUser?Ue.value?he.currentGroupUser.slice(0,6):he.currentGroupUser.slice(0,7):[]));async function Ge(e){try{await q({sessionKey:he.currentSessionItem.sessionKey,id:he.currentSessionItem.id,topping:e}),be({topping:e})}catch(e){}}async function Pe(e){await E({dissolution:!!e,groupId:he.currentSessionItem.receiver,operator:he.userInfo.id,memberIdSet:e?ze.value:[he.userInfo.id]})}async function Ae(){var e;xe.value=he.currentSessionItem.name,we.value=!0,await y(),null==(e=Se.value)||e.select()}async function Ke(e){const t=new FormData,n=Object.assign({id:he.currentSessionItem.receiver},e);for(const e in n)t.append(e,n[e]);await H(t)}async function Re(){we.value=!1;const e=L(xe.value);e&&e!==he.currentSessionItem.name&&(await Ke({name:e}),be({name:e,defaultName:e}))}async function De(e){const{file:t}=e.file,n=new FileReader;n.onload=function(e){var t;(null==(t=e.target)?void 0:t.result)&&be({avatar:e.target.result})},n.readAsDataURL(e.file.file),await Ke({file:t})}function Fe(){B(ke["onUpdate:show"])&&ke["onUpdate:show"](!1)}return i((()=>he.id),(e=>{e||Fe()})),(e,t)=>(o(),a(r(k),{width:320,"trap-focus":!1,"block-scroll":!1,to:".iho-chat",onAfterLeave:t[7]||(t[7]=e=>Ce.value=!1)},{default:l((()=>[c(r(h),null,{header:l((()=>[r(Ie)&&Ce.value?(o(),a(r(b),{key:0,text:"",color:"#666",onClick:t[0]||(t[0]=e=>Ce.value=!1),style:{"font-size":"var(--n-title-font-size)"}},{icon:l((()=>[c(r(I),{size:20,component:r(G)},null,8,["component"])])),default:l((()=>[u(" 返回 ")])),_:1})):r(Ie)?(o(),m(p,{key:1},[u("群设置")],64)):(o(),m(p,{key:2},[u("聊天设置")],64))])),default:l((()=>[r(he).id?(o(),m("div",J,[r(Ie)&&Ce.value?(o(!0),m(p,{key:0},d(r(he).currentGroupUser,((e,t)=>(o(),a(N,{key:e.id,"user-id":e.id,placement:"left"},{trigger:l((()=>[v("div",M,[c(r(S),{round:"",size:40,src:e.avatar},null,8,["src"]),v("span",Q,f(e.name),1),0===t?(o(),m("span",T,"群主")):g("v-if",!0)])])),_:2},1032,["user-id"])))),128)):(o(),m(p,{key:1},[c(N,{"user-id":r(he).currentSessionItem.receiver,onClose:Fe,disabled:!!r(Ie),placement:"bottom-end"},{trigger:l((()=>[v("div",V,[c(r(S),{round:"",size:40,src:r(he).currentSessionItem.avatar},null,8,["src"]),v("span",W,f(r(he).currentSessionItem.name),1),r(Ie)?g("v-if",!0):(o(),a(r(I),{key:0,size:24,component:r(P),class:"item__right"},null,8,["component"]))])])),_:1},8,["user-id","disabled"]),r(Ie)?(o(),m(p,{key:0},[v("div",X,[Y,v("div",Z,[(o(!0),m(p,null,d(r(je),(e=>(o(),a(N,{key:e.id,"user-id":e.id,placement:"left-start"},{trigger:l((()=>[v("div",$,[c(r(S),{round:"",size:40,src:e.avatar},null,8,["src"]),v("span",ee,f(e.name),1)])])),_:2},1032,["user-id"])))),128)),c(O,{mode:"join",disabledIds:r(ze)},{trigger:l((()=>[v("div",te,[c(r(b),{strong:"",secondary:"",circle:""},{icon:l((()=>[c(r(I),{component:r(A)},null,8,["component"])])),_:1}),ne])])),_:1},8,["disabledIds"]),r(Ue)?(o(),a(O,{key:0,title:"移除成员",mode:"remove",options:r(he).currentGroupUser},{trigger:l((()=>[v("div",se,[c(r(b),{strong:"",secondary:"",circle:""},{icon:l((()=>[c(r(I),{component:r(K)},null,8,["component"])])),_:1}),ie])])),_:1},8,["options"])):g("v-if",!0)]),c(r(b),{text:"","icon-placement":"right",color:"#999",onClick:t[1]||(t[1]=e=>Ce.value=!0)},{icon:l((()=>[c(r(I),{component:r(P)},null,8,["component"])])),default:l((()=>[u(" 查看全部群成员 ")])),_:1})]),c(r(w),{abstract:"",multiple:"",accept:"image/*",onChange:De},{default:l((()=>[c(r(x),{abstract:""},{default:l((({handleClick:e})=>[v("div",{class:"item",onClick:e},[ae,c(r(I),{size:20,component:r(P),class:"item__right"},null,8,["component"])],8,oe)])),_:1})])),_:1}),v("div",re,[le,v("div",ce,[we.value?(o(),a(r(C),{key:0,ref_key:"inputRef",ref:Se,value:xe.value,"onUpdate:value":t[2]||(t[2]=e=>xe.value=e),onBlur:Re,onKeydown:t[3]||(t[3]=_((e=>e.target.blur()),["enter"]))},null,8,["value"])):(o(),a(r(U),{key:1,"wrap-item":!1,onClick:Ae,align:"center"},{default:l((()=>[v("span",ue,f(r(he).currentSessionItem.name),1),c(r(b),{text:"",style:{"font-size":"14px","--n-text-color":"#999"}},{default:l((()=>[c(r(I),{component:r(R)},null,8,["component"])])),_:1})])),_:1}))])])],64)):g("v-if",!0),v("div",me,[pe,c(r(z),{value:r(he).currentSessionItem.topping,"onUpdate:value":[t[4]||(t[4]=e=>r(he).currentSessionItem.topping=e),Ge],class:"item__right"},null,8,["value"])]),r(Ie)?(o(),m(p,{key:1},[c(r(j),{onPositiveClick:t[5]||(t[5]=()=>Pe())},{trigger:l((()=>[v("div",de,[ve,c(r(I),{size:20,component:r(P),class:"item__right"},null,8,["component"])])])),default:l((()=>[fe])),_:1}),r(Ue)?(o(),a(r(j),{key:0,onPositiveClick:t[6]||(t[6]=()=>Pe(!0))},{trigger:l((()=>[v("div",ge,[_e,c(r(I),{size:20,component:r(P),class:"item__right"},null,8,["component"])])])),default:l((()=>[ye])),_:1})):g("v-if",!0)],64)):g("v-if",!0)],64))])):g("v-if",!0)])),_:1})])),_:1}))}});export{ke as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as
|
1
|
+
import{defineComponent as e,ref as t,computed as s,withDirectives as o,createVNode as i,vShow as n,isVNode as r}from"vue";import{NButtonGroup as a,NButton as l,NIcon as m}from"naive-ui";import{CopyOutline as c,ChatbubbleEllipsesOutline as d,ReturnDownBack as u,DownloadOutline as p}from"@vicons/ionicons5";import{onClickOutside as g}from"@vueuse/core";import{useState as f}from"../hooks/useState.js";import{useSession as y}from"../hooks/useSession.js";import{MESSAGE_TYPE as w}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as h,downloadFile as v}from"../utils/index.js";import{emojis as I}from"../utils/emoji.js";import{recallMessageApi as T}from"../api/index.js";import{format as M}from"date-fns";var b=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},position:{type:Object},msgId:{type:String}},emits:["update:show","select"],setup(e,{attrs:b,slots:E,emit:j}){const{state:k,setMsgList:S}=f(),{setCurrentSessionItem:x}=y(k),L=[{icon:c,label:"复制",key:"copy"},{icon:d,label:"回复",key:"reply"},{icon:u,label:"撤回",key:"withdraw"},{icon:p,label:"下载",key:"download"}],O=t(null),A=s((()=>k.msgList.find((({id:t})=>t===e.msgId)))),D=s((()=>{if(!e.msgId)return[];if(!(null==A?void 0:A.value))return[];const{content:t={},sendTime:s,sender:o}=A.value,{chatMessageType:i}=t,n=[];return(o!==k.userInfo.id||i===w.TEMPLATE||o===k.userInfo.id&&Date.now()-new Date(s).getTime()>2592e5)&&n.push("withdraw"),[w.TEXT,w.EMOJI,w.BLEND].includes(i)?n.push("download"):h(t)?n.push("copy","relay","reply","download"):i===w.FILE?n.push("copy"):[w.FORWARD,w.TEMPLATE].includes(i)&&n.push("copy","download"),n.length?L.filter((e=>!n.includes(e.key))):L}));return g(O,(e=>{j("update:show",!1)})),()=>{let t;return e.msgId&&D.value?o(i("div",{class:"contextmenu-wrapper",ref:O,style:e.position},[i(a,{vertical:!0},(s=t=D.value.map((t=>i(l,{onClick:()=>async function(t){j("update:show",!1);const{content:s={},sendTime:o,sender:i}=A.value||{},{chatMessageType:n}=s;switch(t){case"copy":if(!s.msg)return console.log("复制内容为空!");if(!navigator||!("clipboard"in navigator))return console.log("当前浏览器版本不支持复制!");try{if(n===w.TEXT)await navigator.clipboard.writeText(s.msg);else{let e;if([w.EMOJI,w.IMAGE].includes(n)){const t=n===w.EMOJI?I.findEmoji(s.msg):s.msg;e=`<img data-msg=${s.msg} data-type=${n} class=${n===w.EMOJI?"emoji--min":""} src=${t} />`}else e=s.msg;await navigator.clipboard.write([new window.ClipboardItem({"text/html":new Blob([e],{type:"text/html"})})])}}catch(e){console.log("复制失败!")}return;case"download":return void v(s.fileUrl,s.msg);case"withdraw":{const t=k.msgList.findIndex((({id:t})=>t===e.msgId)),s=0===t;if(await T({chatType:k.currentSessionItem.chatType,messageIdSet:[e.msgId],receiver:k.currentSessionItem.receiver,sender:k.userInfo.id,isLastMessage:s}),k.msgList[t].status="WITHDRAWN",s){const e=M(new Date,"yyyy-MM-dd HH:mm:ss");x({lastMessageStatus:"WITHDRAWN",lastMessageSendTime:e,sortTime:e,updatedTime:e})}}}j("select",t,A.value)}(t.key),quaternary:!0},{default:()=>t.label,icon:()=>i(m,{component:t.icon},null)}))),"function"==typeof s||"[object Object]"===Object.prototype.toString.call(s)&&!r(s)?t:{default:()=>[t]}))]),[[n,e.show]]):null;var s}}});export{b as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,ref as e,reactive as a,computed as l,openBlock as n,createBlock as o,unref as r,withCtx as s,renderSlot as i,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,createCommentVNode as v,toDisplayString as f,createTextVNode as g,renderList as
|
1
|
+
import{defineComponent as t,ref as e,reactive as a,computed as l,openBlock as n,createBlock as o,unref as r,withCtx as s,renderSlot as i,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,createCommentVNode as v,toDisplayString as f,createTextVNode as g,renderList as y,vShow as k}from"vue";import{NPopover as h,NAvatar as b,NButton as w,NIcon as C}from"naive-ui";import{ChatbubbleEllipses as _,EyeOffOutline as j,EyeOutline as I,Close as z}from"@vicons/ionicons5";import{useState as x}from"../hooks/useState.js";import{useSession as N}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import"../../../../shared/utils/index.js";import{openSessionApi as S,getUserDetailApi as $}from"../api/index.js";const D={class:"person-profile-main"},P={class:"left"},T={class:"profile"},q={class:"profile__text"},B={class:"right"},E={class:"right__content"},O={class:"label"},U={class:"content"};var A=t({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:A}){const F=t,{state:G}=x(),{openSession:H}=N(G),J=e(!1),K=e(!1),L=e(!1),M=a({}),Q=[{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"}],R=l((()=>(M.id&&Q.forEach((t=>{const{key:e}=t;t.value=M[e]})),Q)));async function V(){J.value=!1;const t=await S({chatType:G.currentSessionItem.chatType,receiver:F.userId,sender:G.userInfo.id});H(t),A("close")}async function W(t){if(!t)return;const e=await $({userId:F.userId});(null==e?void 0:e.id)?Object.assign(M,e):M.id=""}function X(t){const{key:e,value:a}=t;return"phone"!==e||L.value?a:(a||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}return(e,a)=>(n(),o(r(h),{raw:"",class:"person-profile-wrapper",show:J.value,"onUpdate:show":[a[3]||(a[3]=t=>J.value=t),W],trigger:t.disabled?"manual":"click","show-arrow":!1,to:"body",shift:""},{trigger:s((()=>[i(e.$slots,"trigger")])),default:s((()=>[M.id?(n(),c(u,{key:0},[d(p("div",D,[p("div",P,[p("div",T,[m(r(b),{src:M.avatar,bordered:"",round:"",size:100,onClickCapture:a[0]||(a[0]=t=>K.value=!0)},null,8,["src"]),v(' <n-upload abstract accept="image/*" @change="onChange">\r\n\t\t\t\t\t\t\t<n-upload-trigger #="{ handleClick }" abstract>\r\n\t\t\t\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t\t\t\tcircle\r\n\t\t\t\t\t\t\t\t\tsecondary\r\n\t\t\t\t\t\t\t\t\tclass="edit-avatar"\r\n\t\t\t\t\t\t\t\t\tv-show="userDetail.id === state.userInfo.id"\r\n\t\t\t\t\t\t\t\t\t@click="handleClick"\r\n\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t<n-icon size="16" color="#666666" :component="Camera" />\r\n\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t</n-button>\r\n\t\t\t\t\t\t\t</n-upload-trigger>\r\n\t\t\t\t\t\t</n-upload> '),p("div",q,[p("h4",null,f(M.name),1),p("p",null,f(M.orgName),1)]),m(r(w),{strong:"",secondary:"",onClick:V},{default:s((()=>[m(r(C),{size:"13",color:"#666666",component:r(_),style:{"margin-right":"6px"}},null,8,["component"]),g(" 发消息 ")])),_:1})])]),p("div",B,[p("div",E,[(n(!0),c(u,null,y(r(R),((t,e)=>(n(),c("div",{class:"info-item",key:e},[p("span",O,f(t.label),1),p("div",U,[p("span",null,f(X(t)),1),"phone"===t.key&&X(t)?(n(),o(r(C),{key:0,size:"16",color:"#666666",component:L.value?r(j):r(I),style:{"margin-left":"10px"},onClick:a[1]||(a[1]=t=>L.value=!L.value)},null,8,["component"])):v("v-if",!0)])])))),128))])])],512),[[k,!K.value]]),d(p("div",{class:"large-avatar",onClick:a[2]||(a[2]=t=>K.value=!1)},[m(r(w),{circle:"",size:"small",secondary:""},{icon:s((()=>[m(r(C),{size:24,component:r(z),color:"#fff"},null,8,["component"])])),_:1}),m(r(b),{size:310,round:"",src:M.avatar},null,8,["src"])],512),[[k,K.value]])],64)):v("v-if",!0)])),_:3},8,["show","trigger"]))}});export{A as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as s,computed as i,watch as a,withDirectives as t,openBlock as n,createElementBlock as l,normalizeStyle as r,unref as o,createBlock as u,createCommentVNode as d,createElementVNode as
|
1
|
+
import{defineComponent as e,ref as s,computed as i,watch as a,withDirectives as t,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 y,createVNode as _,vShow as h}from"vue";import{NSpin as S,NTag as g,NAvatar as x,NBadge as M}from"naive-ui";import{useState as b}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import"trtc-sdk-v5";import{listSort as N,formatTime as L}from"../utils/index.js";import{vFlexibleResize as T}from"../../../../shared/directive/flexibleResize.js";import{promiseTimeout as j}from"@vueuse/shared";const w={class:"sider-list__filter box-shadow"},R=["onClick"],H={class:"avatar-right"},I={class:"name"},z={class:"msg-tip"},K={class:"msg-tip__content"},U={key:0},W=["innerHTML"];var A=e({__name:"SiderList",setup(e){const A="all",B="unread";let D=[];const V=s(300),q=s(),E=s(!1),F=s([{label:"全部",key:A},{label:"未读",key:B}]),G=s("all"),{state:J,emit:O}=b(),{openSession:P,updateSessionList:Q}=C(J),X=i((()=>Math.min(Math.max(V.value,240),360))),Y=i((()=>N(J.sessionList))),Z=i((()=>J.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0)));function $({distance:e}){V.value=V.value+e}function ee(e,s=o(G)){var i;return s===A||(s===B?D.includes(e.sessionKey)||(null!=(i=e.unreadNum)?i:0)>0:void 0)}return a([()=>J.isChangeSession,()=>J.isUpdateSession],(([e,s])=>{e&&(Q(J.currentSessionItem),J.isChangeSession=!1),s&&(Q(J.updateSessionItem),J.isUpdateSession=!1)}),{immediate:!0}),a((()=>Z.value),(e=>{!async function s(i=0){const a=Y.value.every((e=>!!e.name));if(!(i>2))if(a){const s=Y.value.filter((e=>{var s;return+(null!=(s=e.unreadNum)?s:0)>0}));O("unread-message-update",e,s)}else await j(100),s(++i)}()})),(e,s)=>t((n(),l("section",{class:"sider-list",style:r({width:o(X)+"px"})},[E.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",w,[(n(!0),l(m,null,c(F.value,(e=>(n(),u(o(g),{type:G.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,G.value=s,void(s===B&&(D=(Y.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(Z))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),v("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:q},[(n(!0),l(m,null,c(o(Y),(e=>t((n(),l("div",{key:e.id,onClick:()=>o(P)(e),class:y(["sider-list__box__item",{active:e.id===o(J).id},e.topping?"sider-list__box__item--top":""])},[_(o(x),{round:"",size:"large",src:e.avatar},null,8,["src"]),v("div",H,[v("div",I,[v("h4",null,k(e.name),1),v("span",null,k(e.lastMessage?o(L)(e.lastMessageSendTime).siderMsgTime:""),1)]),v("div",z,[v("div",K,["WITHDRAWN"===e.lastMessageStatus?(n(),l("div",U,"撤回了一条消息")):(n(),l("div",{key:1,innerHTML:e.lastMessageContent},null,8,W))]),_(o(M),{value:e.unreadNum>99?"99+":e.unreadNum},null,8,["value"])])])],10,R)),[[h,ee(e)]]))),128))],512)],4)),[[o(T),{mode:"VR",onMove:$}]])}});export{A as default};
|
@@ -1 +1 @@
|
|
1
|
-
var E=(E=>(E.SINGLE="SINGLE",E.GROUP="GROUP",E))(E||{}),
|
1
|
+
var E=(E=>(E.SINGLE="SINGLE",E.GROUP="GROUP",E))(E||{}),S=(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))(S||{}),A=(E=>(E.JOIN="JOIN",E.LEAVE="LEAVE",E.NEW_SESSION="NEW_SESSION",E.MESSAGE="MESSAGE",E.AV_STATUS="AV_STATUS",E.RECALL_MESSAGE="RECALL_MESSAGE",E))(A||{}),L=(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))(L||{});export{L as AV_STATUS,E as CHAT_TYPE,S as MESSAGE_TYPE,A as SUBSCRIBE_MESSAGE_TYPE};
|
@@ -1 +1 @@
|
|
1
|
-
import{ref as e}from"vue";import{isArray as o}from"lodash-es";import{listUserApi as r}from"../api/index.js";import{useDebounceFn as t}from"@vueuse/core";import"../../../../shared/utils/index.js";import"naive-ui";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as s}from"../../../../shared/hooks/useScrollLoading.js";import{useState as a}from"./useState.js";import"../utils/emoji.js";import"trtc-sdk-v5";function i({wrapperRef:i,keywordRef:n,before:p,after:u}){const
|
1
|
+
import{ref as e}from"vue";import{isArray as o}from"lodash-es";import{listUserApi as r}from"../api/index.js";import{useDebounceFn as t}from"@vueuse/core";import"../../../../shared/utils/index.js";import"naive-ui";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as s}from"../../../../shared/hooks/useScrollLoading.js";import{useState as a}from"./useState.js";import"../utils/emoji.js";import"trtc-sdk-v5";function i({wrapperRef:i,keywordRef:n,before:p,after:u}){const m={page:0,hasMore:!0},{state:c}=a(),l=e([]),d=t((function(){Object.assign(m,{page:0,hasMore:!0}),f()}),300);async function f(){const e=(n.value||"").replace(/^\s+|\s+$/g,"");if(!e)return void(p?p():l.value=[]);if(!m.hasMore)return;m.page++,1==m.page&&(l.value=[]);const t=await r({orgId:c.orgId,keyword:e,page:m.page,pageSize:10});o(t.records)&&l.value.length<=+t.total&&(l.value=m.page>1?l.value.concat(t.records):t.records,null==u||u(),l.value.length>=+t.total&&(m.hasMore=!1))}return s(i,(()=>{f()})),{userList:l,handleInput:d}}export{i as useSearchUserList};
|
@@ -1 +1 @@
|
|
1
|
-
import{inject as e}from"vue";import{cloneDeep as t}from"lodash-es";import{formatTime as s,transformMessage as n,getFileSize as i}from"../utils/index.js";import{InjectionIChatState as m,InjectionIChatStompClient as o,InjectionIChatEmits as r}from"../types/index.js";import{MESSAGE_TYPE as c}from"../constants/index.js";import{useIntervalFn as a}from"@vueuse/core";function T(){const T=e(m),d=e(o),g=e(r),{pause:u,resume:p,isActive:f}=a((()=>{const e=t(T.msgList);e.some((e=>{const{sendTime:t}=e;return!(Date.now()-new Date(t).getTime()>=36e5)&&(e.__sendTime=s(t).recordTime,!0)})),T.msgList=e,
|
1
|
+
import{inject as e}from"vue";import{cloneDeep as t}from"lodash-es";import{formatTime as s,transformMessage as n,getFileSize as i}from"../utils/index.js";import{InjectionIChatState as m,InjectionIChatStompClient as o,InjectionIChatEmits as r}from"../types/index.js";import{MESSAGE_TYPE as c}from"../constants/index.js";import{useIntervalFn as a}from"@vueuse/core";function T(){const T=e(m),d=e(o),g=e(r),{pause:u,resume:p,isActive:f}=a((()=>{const e=t(T.msgList);e.some((e=>{const{sendTime:t}=e;return!(Date.now()-new Date(t).getTime()>=36e5)&&(e.__sendTime=s(t).recordTime,!0)})),T.msgList=e,_()||u()}),6e4,{immediate:!1});function _(){return!!T.msgList.length&&T.msgList.some((e=>Date.now()-new Date(e.sendTime).getTime()<36e5))}return{state:T,setMsgList:function(e=[]){u(),T.msgList=t(e).sort(((e,t)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime())),T.msgList.forEach((e=>{var t,m;Object.assign(e,{__time:s(e.sendTime).msgTime,__content:(m=e.content.chatMessageType,[c.TEXT,c.TEXT,c.BLEND].includes(m)?n(e.content):null==(t=e.content)?void 0:t.msg),__sendTime:s(e.sendTime).recordTime}),e.content.chatMessageType!==c.FILE||e.__size||i(e.content.fileUrl).then((t=>{e.__size=t}))})),_()&&p()},stompClient:d,emit:g,sendMessage:async function(e){try{d.value.send("/app/chat/send",{},JSON.stringify({chatType:T.currentSessionItem.chatType,receiver:T.currentSessionItem.receiver,...e}))}catch(e){}}}}export{T as useState};
|