cnhis-design-vue 3.2.3-release.2 → 3.2.3-release.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. package/es/components/biunique-chat/index.d.ts +36 -3
  2. package/es/components/biunique-chat/src/Index.vue.d.ts +36 -3
  3. package/es/components/biunique-chat/src/Index.vue2.js +1 -1
  4. package/es/components/biunique-chat/src/api/index.d.ts +2 -1
  5. package/es/components/biunique-chat/src/api/index.js +1 -1
  6. package/es/components/biunique-chat/src/components/ChatFooter.vue.d.ts +3 -1
  7. package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
  8. package/es/components/biunique-chat/src/components/ChatMain.vue.d.ts +5 -2
  9. package/es/components/biunique-chat/src/components/ChatMain.vue2.js +1 -1
  10. package/es/components/biunique-chat/src/components/ChatSearch.vue.d.ts +17 -0
  11. package/es/components/biunique-chat/src/components/ChatSearch.vue.js +1 -0
  12. package/es/components/biunique-chat/src/components/ChatSearch.vue2.js +1 -0
  13. package/es/components/biunique-chat/src/hooks/useScrollLoading.d.ts +2 -0
  14. package/es/components/biunique-chat/src/hooks/useScrollLoading.js +1 -0
  15. package/es/components/biunique-chat/src/hooks/useSession.js +1 -1
  16. package/es/components/biunique-chat/src/hooks/useState.js +1 -1
  17. package/es/components/biunique-chat/src/types/index.d.ts +1 -0
  18. package/es/components/biunique-chat/style/index.css +1 -1
  19. package/es/components/button-print/index.d.ts +5 -2
  20. package/es/components/button-print/src/ButtonPrint.vue.d.ts +5 -2
  21. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  22. package/es/components/button-print/src/utils/print.d.ts +2 -2
  23. package/es/components/button-print/src/utils/print.js +1 -1
  24. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  25. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  26. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  27. package/es/components/form-render/src/hooks/useFieldVisitor.js +1 -1
  28. package/es/components/guide/src/renderer.d.ts +2 -2
  29. package/es/components/index.css +1 -1
  30. package/es/components/scale-view/src/components/formitem/standard-modal.d.ts +1 -1
  31. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  32. package/es/shared/directive/flexibleResize.js +1 -1
  33. package/es/shared/package.json.js +1 -1
  34. package/es/shared/types/business.d.ts +1 -0
  35. package/es/shared/utils/index.d.ts +3 -3
  36. package/package.json +2 -2
@@ -4,6 +4,10 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
4
4
  type: StringConstructor;
5
5
  required: true;
6
6
  };
7
+ orgId: {
8
+ type: (NumberConstructor | StringConstructor)[];
9
+ required: true;
10
+ };
7
11
  userId: {
8
12
  type: StringConstructor;
9
13
  required: true;
@@ -18,6 +22,10 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
18
22
  type: StringConstructor;
19
23
  required: true;
20
24
  };
25
+ orgId: {
26
+ type: (NumberConstructor | StringConstructor)[];
27
+ required: true;
28
+ };
21
29
  userId: {
22
30
  type: StringConstructor;
23
31
  required: true;
@@ -35,6 +43,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
35
43
  loading: import("vue").Ref<boolean>;
36
44
  stompClient: import("vue").Ref<import("./src/utils/chatSock").ChatSock | undefined>;
37
45
  state: {
46
+ orgId: string | number;
38
47
  currentSessionItem: import("../../shared/types").AnyObject;
39
48
  id: string;
40
49
  userInfo: import("../../shared/types").AnyObject;
@@ -1141,15 +1150,18 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1141
1150
  chatMainRef: import("vue").Ref<HTMLElement | undefined>;
1142
1151
  state: import("./src/types").IState;
1143
1152
  setMsgList: (list?: import("../../shared/types").AnyObject[]) => void;
1144
- page: number;
1153
+ currentInfo: {
1154
+ page: number;
1155
+ hasMore: boolean;
1156
+ };
1145
1157
  getHistoryRecord: () => Promise<void>;
1146
- accessSession: () => Promise<void>;
1147
1158
  showMessage: (item: import("../../shared/types").AnyObject) => boolean;
1148
1159
  showTemplateMsg: (item: import("../../shared/types").AnyObject, type: "template" | "system") => boolean | undefined;
1149
1160
  isTemplate3: (content: import("../../shared/types").AnyObject) => boolean;
1150
1161
  needShowTime: (item: import("../../shared/types").AnyObject, index: number) => boolean;
1151
1162
  setScrollToButtom: () => Promise<void>;
1152
1163
  getIntervalMsgTime: (time: string) => string;
1164
+ resetInfo: () => void;
1153
1165
  NAvatar: any;
1154
1166
  NImageGroup: import("vue").DefineComponent<{
1155
1167
  showToolbar: {
@@ -1490,10 +1502,12 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1490
1502
  state: import("./src/types").IState;
1491
1503
  stompClient: import("vue").Ref<import("./src/utils/chatSock").ChatSock>;
1492
1504
  setCurrentSessionItem: (item: import("../../shared/types").AnyObject) => void;
1505
+ showEmoji: import("vue").Ref<boolean>;
1493
1506
  handleKeyDown: (event: KeyboardEvent) => void;
1494
1507
  isWrap: (event: KeyboardEvent) => boolean;
1495
1508
  handleInput: () => void;
1496
- onChange: (options: {
1509
+ selectEmoji: (index: string | number) => void;
1510
+ fileChange: (options: {
1497
1511
  file: import("naive-ui").UploadFileInfo;
1498
1512
  fileList: import("naive-ui").UploadFileInfo[];
1499
1513
  }, chatMessageType: import("./src/constants").MESSAGE_TYPE) => Promise<void>;
@@ -1516,11 +1530,30 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1516
1530
  alt: string[];
1517
1531
  MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
1518
1532
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1533
+ ChatSearch: import("vue").DefineComponent<{}, {
1534
+ showSearch: import("vue").Ref<boolean>;
1535
+ keyword: import("vue").Ref<any>;
1536
+ userList: import("vue").Ref<any>;
1537
+ state: import("./src/types").IState;
1538
+ entrySession: (item: import("../../shared/types").AnyObject) => void;
1539
+ handleSearch: () => Promise<void>;
1540
+ openSession: (userId: string) => Promise<void>;
1541
+ NPopover: any;
1542
+ NButton: any;
1543
+ NAvatar: any;
1544
+ NInput: any;
1545
+ NIcon: any;
1546
+ SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1547
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1519
1548
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("template-click" | "unread-message-update")[], "template-click" | "unread-message-update", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1520
1549
  token: {
1521
1550
  type: StringConstructor;
1522
1551
  required: true;
1523
1552
  };
1553
+ orgId: {
1554
+ type: (NumberConstructor | StringConstructor)[];
1555
+ required: true;
1556
+ };
1524
1557
  userId: {
1525
1558
  type: StringConstructor;
1526
1559
  required: true;
@@ -7,6 +7,10 @@ declare const _default: import("vue").DefineComponent<{
7
7
  type: StringConstructor;
8
8
  required: true;
9
9
  };
10
+ orgId: {
11
+ type: (NumberConstructor | StringConstructor)[];
12
+ required: true;
13
+ };
10
14
  userId: {
11
15
  type: StringConstructor;
12
16
  required: true;
@@ -21,6 +25,10 @@ declare const _default: import("vue").DefineComponent<{
21
25
  type: StringConstructor;
22
26
  required: true;
23
27
  };
28
+ orgId: {
29
+ type: (NumberConstructor | StringConstructor)[];
30
+ required: true;
31
+ };
24
32
  userId: {
25
33
  type: StringConstructor;
26
34
  required: true;
@@ -38,6 +46,7 @@ declare const _default: import("vue").DefineComponent<{
38
46
  loading: import("vue").Ref<boolean>;
39
47
  stompClient: import("vue").Ref<ChatSock | undefined>;
40
48
  state: {
49
+ orgId: string | number;
41
50
  currentSessionItem: AnyObject;
42
51
  id: string;
43
52
  userInfo: AnyObject;
@@ -1144,15 +1153,18 @@ declare const _default: import("vue").DefineComponent<{
1144
1153
  chatMainRef: import("vue").Ref<HTMLElement | undefined>;
1145
1154
  state: IState;
1146
1155
  setMsgList: (list?: AnyObject[]) => void;
1147
- page: number;
1156
+ currentInfo: {
1157
+ page: number;
1158
+ hasMore: boolean;
1159
+ };
1148
1160
  getHistoryRecord: () => Promise<void>;
1149
- accessSession: () => Promise<void>;
1150
1161
  showMessage: (item: AnyObject) => boolean;
1151
1162
  showTemplateMsg: (item: AnyObject, type: "template" | "system") => boolean | undefined;
1152
1163
  isTemplate3: (content: AnyObject) => boolean;
1153
1164
  needShowTime: (item: AnyObject, index: number) => boolean;
1154
1165
  setScrollToButtom: () => Promise<void>;
1155
1166
  getIntervalMsgTime: (time: string) => string;
1167
+ resetInfo: () => void;
1156
1168
  NAvatar: any;
1157
1169
  NImageGroup: import("vue").DefineComponent<{
1158
1170
  showToolbar: {
@@ -1493,10 +1505,12 @@ declare const _default: import("vue").DefineComponent<{
1493
1505
  state: IState;
1494
1506
  stompClient: import("vue").Ref<ChatSock>;
1495
1507
  setCurrentSessionItem: (item: AnyObject) => void;
1508
+ showEmoji: import("vue").Ref<boolean>;
1496
1509
  handleKeyDown: (event: KeyboardEvent) => void;
1497
1510
  isWrap: (event: KeyboardEvent) => boolean;
1498
1511
  handleInput: () => void;
1499
- onChange: (options: {
1512
+ selectEmoji: (index: string | number) => void;
1513
+ fileChange: (options: {
1500
1514
  file: import("naive-ui").UploadFileInfo;
1501
1515
  fileList: import("naive-ui").UploadFileInfo[];
1502
1516
  }, chatMessageType: import("./constants").MESSAGE_TYPE) => Promise<void>;
@@ -1519,11 +1533,30 @@ declare const _default: import("vue").DefineComponent<{
1519
1533
  alt: string[];
1520
1534
  MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
1521
1535
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1536
+ ChatSearch: import("vue").DefineComponent<{}, {
1537
+ showSearch: import("vue").Ref<boolean>;
1538
+ keyword: import("vue").Ref<any>;
1539
+ userList: import("vue").Ref<any>;
1540
+ state: IState;
1541
+ entrySession: (item: AnyObject) => void;
1542
+ handleSearch: () => Promise<void>;
1543
+ openSession: (userId: string) => Promise<void>;
1544
+ NPopover: any;
1545
+ NButton: any;
1546
+ NAvatar: any;
1547
+ NInput: any;
1548
+ NIcon: any;
1549
+ SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1550
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1522
1551
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("template-click" | "unread-message-update")[], "template-click" | "unread-message-update", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1523
1552
  token: {
1524
1553
  type: StringConstructor;
1525
1554
  required: true;
1526
1555
  };
1556
+ orgId: {
1557
+ type: (NumberConstructor | StringConstructor)[];
1558
+ required: true;
1559
+ };
1527
1560
  userId: {
1528
1561
  type: StringConstructor;
1529
1562
  required: true;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,reactive as t,provide as o,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as u,withCtx as d,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as S,NLayout as v,NLayoutContent as b}from"naive-ui";import g from"./components/SiderList.vue.js";import y from"./components/ChatHeader.vue.js";import k from"./components/ChatMain.vue.js";import j from"./components/ChatFooter.vue.js";import{ChatSock as I}from"./utils/chatSock.js";import{instanceAxios as _}from"./api/index.js";import{useTheme as L}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as U}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as x}from"./constants/index.js";import{InjectionIChatState as M,InjectionIChatStompClient as C,InjectionIChatEmits as N}from"./types/index.js";import"./utils/emoji.js";import{useSession as q}from"./hooks/useSession.js";const T={class:"c-biunique-chat__header"},A={class:"toolbar"};var E=e({__name:"Index",props:{token:{type:String,required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:E,emit:O}){const V=e;_.defaults.baseURL=V.baseURL+"/chat",_.defaults.headers.Authorization="bearer"+V.token;const w=L(),J=s(!1),R=s(),F=t({currentSessionItem:{},id:"",userInfo:{},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1});o(M,F),o(C,R),o(N,O);const{entrySession:H,setSessionList:$}=q(F);function z(){const e={headers:{AccessToken:V.token,UserId:V.userId},heartbeatFn:()=>{try{R.value.send("test")}catch(e){R.value.disconnect(),z()}},connectCb:()=>{console.log("连接成功"),R.value.subscribe("/user/topic/single",(({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:t,sessionVo:o}=s;switch(s.event){case x.MESSAGE:if(s.messageVo.sender===F.userInfo.id)return;t.sender===F.currentSessionItem.receiver&&(F.currentMsg=t,F.isAppendMsg=!0),F.updateSessionItem={receiver:t.sender,lastMessageSendTime:t.sendTime,sortTime:t.sendTime,lastMessage:t.content},F.isUpdateSession=!0;break;case x.NEW_SESSION:F.updateSessionItem=o,F.isUpdateSession=!0}}catch(e){console.log(e)}})),R.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{currentUser:t,sessionVos:o}=s;if(F.userInfo=t,!(null==o?void 0:o.length))return;$(o)}catch(e){console.log(e)}}))},errorCb:(e,s)=>{console.log("断线了,正在重连...")}};R.value=new I("/fdp-chat/websocket",e)}return async function(){z()}(),r((()=>{var e;null==(e=R.value)||e.disconnect()})),E({getUnreadData:function(){return F.sessionList.filter((e=>U(e.unreadNum)&&e.unreadNum>0))},entrySession:H}),(e,s)=>(n(),i("div",{class:"c-biunique-chat",style:a(c(w))},[u(c(f),{abstract:"",namespace:"c-biunique-chat__popover"},{default:d((()=>[J.value?(n(),m(c(S),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",T,[l("div",A,[h(e.$slots,"toolbar")])]),u(c(v),{class:"c-biunique-chat__body","has-sider":""},{default:d((()=>[u(g),u(c(b),{class:"chat-content"},{default:d((()=>[u(y),u(k),u(j)])),_:1}),h(e.$slots,"external")])),_:3})],64))])),_:3})],4))}});export{E as default};
1
+ import{defineComponent as e,ref as s,reactive as t,provide as o,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as u,withCtx as d,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as S,NLayout as v,NLayoutContent as g}from"naive-ui";import b from"./components/SiderList.vue.js";import y from"./components/ChatHeader.vue.js";import I from"./components/ChatMain.vue.js";import j from"./components/ChatFooter.vue.js";import k from"./components/ChatSearch.vue.js";import{ChatSock as _}from"./utils/chatSock.js";import{instanceAxios as L}from"./api/index.js";import{useTheme as U}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as x}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as C}from"./constants/index.js";import{InjectionIChatState as M,InjectionIChatStompClient as N,InjectionIChatEmits as q}from"./types/index.js";import"./utils/emoji.js";import{useSession as T}from"./hooks/useSession.js";const A={class:"c-biunique-chat__header"},E={class:"toolbar"};var O=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:O,emit:V}){const w=e;L.defaults.baseURL=w.baseURL,L.defaults.headers.Authorization="bearer "+w.token;const J=U(),R=s(!1),F=s(),H=t({orgId:w.orgId,currentSessionItem:{},id:"",userInfo:{},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1});o(M,H),o(N,F),o(q,V);const{entrySession:$,setSessionList:z}=T(H);function D(){const e={headers:{AccessToken:w.token,UserId:w.userId},heartbeatFn:()=>{try{F.value.send("test")}catch(e){F.value.disconnect(),D()}},connectCb:()=>{console.log("连接成功"),F.value.subscribe("/user/topic/single",(({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:t,sessionVo:o}=s;switch(s.event){case C.MESSAGE:if(s.messageVo.sender===H.userInfo.id)return;t.sender===H.currentSessionItem.receiver&&(H.currentMsg=t,H.isAppendMsg=!0),H.updateSessionItem={receiver:t.sender,lastMessageSendTime:t.sendTime,sortTime:t.sendTime,lastMessage:t.content},H.isUpdateSession=!0;break;case C.NEW_SESSION:H.updateSessionItem=o,H.isUpdateSession=!0}}catch(e){console.log(e)}})),F.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{currentUser:t,sessionVos:o}=s;if(H.userInfo=t,!(null==o?void 0:o.length))return;z(o)}catch(e){console.log(e)}}))},errorCb:(e,s)=>{console.log("断线了,正在重连...")}};F.value=new _("/fdp-chat/websocket",e)}return async function(){D()}(),r((()=>{var e;null==(e=F.value)||e.disconnect()})),O({getUnreadData:function(){return H.sessionList.filter((e=>x(e.unreadNum)&&e.unreadNum>0))},entrySession:$}),(e,s)=>(n(),i("div",{class:"c-biunique-chat",style:a(c(J))},[u(c(f),{abstract:"",namespace:"c-biunique-chat__popover"},{default:d((()=>[R.value?(n(),m(c(S),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",A,[u(k),l("div",E,[h(e.$slots,"toolbar")])]),u(c(v),{class:"c-biunique-chat__body","has-sider":""},{default:d((()=>[u(b),u(c(g),{class:"chat-content"},{default:d((()=>[u(y),u(I),u(j)])),_:1}),h(e.$slots,"external")])),_:3})],64))])),_:3})],4))}});export{O as default};
@@ -1,6 +1,7 @@
1
1
  import { AnyObject } from '../../../../shared/types';
2
2
  export declare const instanceAxios: import("axios").AxiosInstance;
3
- export declare function accessSessionApi(params: AnyObject): import("axios").AxiosPromise<any>;
3
+ export declare function openSessionApi(params: AnyObject): import("axios").AxiosPromise<any>;
4
4
  export declare function getHistoryRecordApi(params: AnyObject): import("axios").AxiosPromise<any>;
5
5
  export declare function toppingSessionApi(params: AnyObject): import("axios").AxiosPromise<any>;
6
6
  export declare function uploadFileApi(params: FormData): import("axios").AxiosPromise<any>;
7
+ export declare function listUserApi(params: AnyObject): import("axios").AxiosPromise<any>;
@@ -1 +1 @@
1
- import o from"axios";function t(o){const t=[];for(const e in o){const n=o[e];Array.isArray(n)?n.forEach((o=>{t.push(`${encodeURIComponent(e)}=${encodeURIComponent(o)}`)})):t.push(`${encodeURIComponent(e)}=${encodeURIComponent(n)}`)}return t.join("&")}const e=o.create({withCredentials:!0,timeout:5e3});function n(o){return e({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/openSession",data:t(o)})}function r(o){return e({method:"get",url:"/recordList",params:o})}function a(o){return e({method:"post",url:"/toppingSession",data:o})}function s(o){return e({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/uploadFile",data:o})}e.interceptors.response.use((o=>{var t,e;if(null==(t=o.data)?void 0:t.result)return null==(e=o.data)?void 0:e.data;console.log("请求错误")}));export{n as accessSessionApi,r as getHistoryRecordApi,e as instanceAxios,a as toppingSessionApi,s as uploadFileApi};
1
+ import t from"axios";function e(t){const e=[];for(const o in t){const n=t[o];Array.isArray(n)?n.forEach((t=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(t)}`)})):e.push(`${encodeURIComponent(o)}=${encodeURIComponent(n)}`)}return e.join("&")}const o=t.create({withCredentials:!0,timeout:5e3});function n(t){return o({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/chat/openSession",data:e(t)})}function r(t){return o({method:"get",url:"/chat/recordList",params:t})}function a(t){return o({method:"post",url:"/chat/toppingSession",data:t})}function s(t){return o({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/chat/uploadFile",data:t})}function u(t){return o({method:"get",url:"/user/listUser",params:t})}o.interceptors.response.use((t=>{var e,o;if(null==(e=t.data)?void 0:e.result)return null==(o=t.data)?void 0:o.data;console.log("请求错误")}));export{r as getHistoryRecordApi,o as instanceAxios,u as listUserApi,n as openSessionApi,a as toppingSessionApi,s as uploadFileApi};
@@ -7,10 +7,12 @@ declare const _default: import("vue").DefineComponent<{}, {
7
7
  state: import("../types").IState;
8
8
  stompClient: import("vue").Ref<import("../utils/chatSock").ChatSock>;
9
9
  setCurrentSessionItem: (item: AnyObject) => void;
10
+ showEmoji: import("vue").Ref<boolean>;
10
11
  handleKeyDown: (event: KeyboardEvent) => void;
11
12
  isWrap: (event: KeyboardEvent) => boolean;
12
13
  handleInput: () => void;
13
- onChange: (options: {
14
+ selectEmoji: (index: number | string) => void;
15
+ fileChange: (options: {
14
16
  file: UploadFileInfo;
15
17
  fileList: Array<UploadFileInfo>;
16
18
  }, chatMessageType: MESSAGE_TYPE) => Promise<void>;
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as r,withCtx as c,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as E,alt as I}from"../utils/emoji.js";import{MESSAGE_TYPE as w}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],X={class:"btn-box"},z=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var B=t({__name:"ChatFooter",setup(t){const B=e(),R=e(""),{state:U,stompClient:q}=T(),{setCurrentSessionItem:P}=b(U);function Q(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Y()))}function V(){var t,e;R.value=(null==(e=null==(t=B.value)?void 0:t.innerText)?void 0:e.trim())||""}async function W(t,e){console.log(W,t);const{file:n,name:s}=t.file,i=new FormData;i.append("sender",U.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");Z({chatMessageType:e,msg:e===w.FILE?s:a,url:a})}function Y(){if(!(R.value.length>2e3))return R.value?void Z({msg:R.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function Z(t){const{chatMessageType:e=w.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===w.FILE&&(i.fileUrl=s),[w.TEXT,w.BLEND].includes(e)&&(B.value.innerHTML="",R.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");U.currentMsg={content:i,sender:U.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},U.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a}),U.isChangeSession=!0;try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:U.currentSessionItem.receiver})),U.currentMsg={...U.currentMsg,fail:!1}}catch(t){U.currentMsg={...U.currentMsg,fail:!0}}finally{U.currentMsg={...U.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(U).id?"default":"not-allowed"})},[l("div",S,[r(o(v),{placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show"},{trigger:c((()=>[j])),default:c((()=>[l("div",L,[u(' <span>最近使用</span>\r\n\t\t\t\t\t<div class="list-box">\r\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\r\n\t\t\t\t\t\t\t<i>\r\n\t\t\t\t\t\t\t\t<img :src="img" />\r\n\t\t\t\t\t\t\t</i>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t</div> '),F,l("div",K,[(s(!0),i(d,null,f(o(E),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:c((()=>[l("i",{onClick:()=>Z({chatMessageType:o(w).EMOJI,msg:e})},[l("img",{src:t},null,8,H)],8,D)])),default:c((()=>[m(" "+g(o(I)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1}),l("span",{onClick:e[0]||(e[0]=()=>Z({chatMessageType:o(w).EMOJI,msg:0}))},J),r(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[1]||(e[1]=t=>W(t,o(w).IMAGE))},{default:c((()=>[r(o(k),{abstract:""},{default:c((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),r(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[2]||(e[2]=t=>W(t,o(w).FILE))},{default:c((()=>[r(o(k),{abstract:""},{default:c((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:B,class:"input-box",contenteditable:"",onKeydown:Q,onInput:V},null,544),[[h,o(U).id]]),l("div",X,[z,r(o(x),{type:"primary",round:"",disabled:!R.value,onClick:Y},{default:c((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(U).id]])}});export{B as default};
1
+ import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as r,withCtx as c,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as w,alt as E}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],U={class:"btn-box"},X=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var z=t({__name:"ChatFooter",setup(t){const z=e(),B=e(""),{state:R,stompClient:q}=T(),{setCurrentSessionItem:P}=b(R),Q=e(!1);function V(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Z()))}function W(){var t,e;B.value=(null==(e=null==(t=z.value)?void 0:t.innerText)?void 0:e.trim())||""}async function Y(t,e){console.log(Y,t);const{file:n,name:s}=t.file,i=new FormData;i.append("sender",R.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");$({chatMessageType:e,msg:e===I.FILE?s:a,url:a})}function Z(){if(!(B.value.length>2e3))return B.value?void $({msg:B.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function $(t){const{chatMessageType:e=I.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===I.FILE&&(i.fileUrl=s),[I.TEXT,I.BLEND].includes(e)&&(z.value.innerHTML="",B.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");R.currentMsg={content:i,sender:R.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},R.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a}),R.isChangeSession=!0;try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:R.currentSessionItem.receiver})),R.currentMsg={...R.currentMsg,fail:!1}}catch(t){R.currentMsg={...R.currentMsg,fail:!0}}finally{R.currentMsg={...R.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(R).id?"default":"not-allowed"})},[l("div",S,[r(o(v),{show:Q.value,"onUpdate:show":e[0]||(e[0]=t=>Q.value=t),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show"},{trigger:c((()=>[j])),default:c((()=>[l("div",L,[u(' <span>最近使用</span>\r\n\t\t\t\t\t<div class="list-box">\r\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\r\n\t\t\t\t\t\t\t<i>\r\n\t\t\t\t\t\t\t\t<img :src="img" />\r\n\t\t\t\t\t\t\t</i>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t</div> '),F,l("div",K,[(s(!0),i(d,null,f(o(w),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:c((()=>[l("i",{onClick:()=>function(t){Q.value=!1,$({chatMessageType:I.EMOJI,msg:t})}(e)},[l("img",{src:t},null,8,H)],8,D)])),default:c((()=>[m(" "+g(o(E)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),l("span",{onClick:e[1]||(e[1]=()=>$({chatMessageType:o(I).EMOJI,msg:0}))},J),r(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[2]||(e[2]=t=>Y(t,o(I).IMAGE))},{default:c((()=>[r(o(k),{abstract:""},{default:c((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),r(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[3]||(e[3]=t=>Y(t,o(I).FILE))},{default:c((()=>[r(o(k),{abstract:""},{default:c((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:z,class:"input-box",contenteditable:"",onKeydown:V,onInput:W},null,544),[[h,o(R).id]]),l("div",U,[X,r(o(x),{type:"primary",round:"",disabled:!B.value,onClick:Z},{default:c((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(R).id]])}});export{z as default};
@@ -4,15 +4,18 @@ declare const _default: import("vue").DefineComponent<{}, {
4
4
  chatMainRef: import("vue").Ref<HTMLElement | undefined>;
5
5
  state: import("../types").IState;
6
6
  setMsgList: (list?: AnyObject[]) => void;
7
- page: number;
7
+ currentInfo: {
8
+ page: number;
9
+ hasMore: boolean;
10
+ };
8
11
  getHistoryRecord: () => Promise<void>;
9
- accessSession: () => Promise<void>;
10
12
  showMessage: (item: AnyObject) => boolean;
11
13
  showTemplateMsg: (item: AnyObject, type: 'system' | 'template') => boolean | undefined;
12
14
  isTemplate3: (content: AnyObject) => boolean;
13
15
  needShowTime: (item: AnyObject, index: number) => boolean;
14
16
  setScrollToButtom: () => Promise<void>;
15
17
  getIntervalMsgTime: (time: string) => string;
18
+ resetInfo: () => void;
16
19
  NAvatar: any;
17
20
  NImageGroup: import("vue").DefineComponent<{
18
21
  showToolbar: {
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,openBlock as s,createElementBlock as i,createVNode as o,unref as a,withCtx as r,Fragment as l,renderList as m,normalizeClass as c,toDisplayString as u,createCommentVNode as d,createBlock as f}from"vue";import{NImageGroup as p,NAvatar as g,NImage as y}from"naive-ui";import{useInfiniteScroll as v,promiseTimeout as T}from"@vueuse/core";import{isToday as M,format as h,isYesterday as _}from"date-fns";import{getHistoryRecordApi as k}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{isNumber as L}from"lodash-es";import H from"./PersonProfile.vue.js";import A from"./MessageTemplate.vue.js";import{images as j}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";const w={key:0,class:"time"},P={key:2,class:"message-box"},D=["data-time"],x=["innerHTML"],F=["src"],b=["href"];var J=e({__name:"ChatMain",setup(e){const J=t(),{state:K,setMsgList:O}=E();let S=1;async function Y(){try{const e=await k({sessionKey:K.currentSessionItem.sessionKey,page:S});if(!Array.isArray(e))return;if(0===e.length)return console.log("没有更多消息了");O(S>1?[...e,...K.msgList]:e),1===S&&U()}catch(e){console.log(e)}}function z(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==I.TEMPLATE||!!n}function C(e,t){var n,s;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===I.TEMPLATE)return"system"===t?2==(null==(n=null==o?void 0:o.setting)?void 0:n.style.id):2!=(null==(s=null==o?void 0:o.setting)?void 0:s.style.id)}function G(e){var t,n;const{chatMessageType:s,messageTemplate:i}=e;return s===I.TEMPLATE&&3==(null==(n=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:n.id)}function R(e,t){var n;const s=L(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(n=K.msgList[t-1])?void 0:n.sendTime;return s-(0===t?0:L(i)?i:Date.parse(i))>3e5}async function U(){var e,t,n;await T(50);const s=null!=(t=null==(e=J.value)?void 0:e.scrollHeight)?t:0;null==(n=J.value)||n.scrollTo({top:s})}function X(e){const t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return"刚刚";if(n<36e5)return Math.ceil(n/1e3/60)+"分钟前";if(M(t))return"今天 "+h(t,"HH:mm");if(_(t))return"昨天 "+h(t,"HH:mm");{const e=t.getFullYear(),n=(new Date).getFullYear();return h(t,e<n?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}}return v(J,(()=>{S++,Y()}),{distance:10,direction:"top"}),n((()=>K.id),(e=>{e&&(S=1,Y())}),{immediate:!0}),n((()=>K.isAppendMsg),(e=>{e&&(O([...K.msgList,K.currentMsg]),K.isAppendMsg=!1,U())}),{immediate:!0}),(e,t)=>(s(),i("div",{class:"chat-main",ref_key:"chatMainRef",ref:J},[o(a(p),{"show-toolbar-tooltip":""},{default:r((()=>[(s(!0),i(l,null,m(a(K).msgList,((e,t)=>(s(),i(l,{key:t},[z(e)?(s(),i("div",{key:0,class:c(["message-item",{"message-item--mine":e.sender==a(K).userInfo.id}])},[R(e,t)?(s(),i("p",w,u(X(e.sendTime)),1)):d("v-if",!0),C(e,"system")?(s(),f(A,{key:1,data:e},null,8,["data"])):(s(),i("div",P,[o(H,{"user-info":e.sender==a(K).userInfo.id?a(K).userInfo:e},{trigger:r((()=>[o(a(g),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-info"]),e.content?(s(),i("div",{key:0,class:c(["content",{emoji:e.content.chatMessageType===a(I).EMOJI,template:e.content.chatMessageType===a(I).TEMPLATE,"template--3":G(e.content)}]),"data-time":e.__time},[e.content.chatMessageType===a(I).TEXT?(s(),i("pre",{key:0,innerHTML:e.__content},null,8,x)):d("v-if",!0),e.content.chatMessageType===a(I).EMOJI?(s(),i("img",{key:1,src:a(j)[e.__content]},null,8,F)):d("v-if",!0),C(e,"template")?(s(),f(A,{key:2,data:e},null,8,["data"])):d("v-if",!0),e.content.chatMessageType===a(I).IMAGE?(s(),f(a(y),{key:3,width:"240",src:e.__content},null,8,["src"])):d("v-if",!0),e.content.chatMessageType===a(I).FILE?(s(),i("a",{key:4,href:e.content.fileUrl},u(e.__content),9,b)):d("v-if",!0)],10,D)):d("v-if",!0)]))],2)):d("v-if",!0)],64)))),128))])),_:1})],512))}});export{J as default};
1
+ import{defineComponent as e,ref as t,watch as s,openBlock as n,createElementBlock as i,normalizeClass as o,unref as a,createVNode as r,withCtx as l,Fragment as m,renderList as c,toDisplayString as u,createCommentVNode as d,createBlock as f}from"vue";import{NImageGroup as p,NAvatar as g,NImage as y}from"naive-ui";import{isToday as v,format as M,isYesterday as T}from"date-fns";import{getHistoryRecordApi as h}from"../api/index.js";import{useState as _}from"../hooks/useState.js";import{isNumber as k}from"lodash-es";import E from"./PersonProfile.vue.js";import L from"./MessageTemplate.vue.js";import{images as H}from"../utils/emoji.js";import{MESSAGE_TYPE as j}from"../constants/index.js";import{useScrollLoading as A}from"../hooks/useScrollLoading.js";const I={key:0,class:"time"},w={key:2,class:"message-box"},P=["data-time"],b=["innerHTML"],D=["src"],x=["href"];var F=e({__name:"ChatMain",setup(e){const F=t(),{state:O,setMsgList:S}=_(),J={page:0,hasMore:!0};async function K(){try{if(!J.hasMore)return;J.page++;const e=await h({sessionKey:O.currentSessionItem.sessionKey,page:J.page});if(!Array.isArray(e)||0===e.length)return J.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");S(J.page>1?[...e,...O.msgList]:e)}catch(e){console.log(e)}}function Y(e){const{chatMessageType:t,messageTemplate:s}=e.content;return t!==j.TEMPLATE||!!s}function z(e,t){var s,n;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===j.TEMPLATE)return"system"===t?2==(null==(s=null==o?void 0:o.setting)?void 0:s.style.id):2!=(null==(n=null==o?void 0:o.setting)?void 0:n.style.id)}function C(e){var t,s;const{chatMessageType:n,messageTemplate:i}=e;return n===j.TEMPLATE&&3==(null==(s=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:s.id)}function G(e,t){var s;const n=k(e.sendTime)?e.sendTime:Date.parse(e.sendTime),i=null==(s=O.msgList[t-1])?void 0:s.sendTime;return n-(0===t?0:k(i)?i:Date.parse(i))>3e5}function R(e){const t=new Date(e),s=Date.now()-t.getTime();if(s<6e4)return"刚刚";if(s<36e5)return Math.ceil(s/1e3/60)+"分钟前";if(v(t))return"今天 "+M(t,"HH:mm");if(T(t))return"昨天 "+M(t,"HH:mm");{const e=t.getFullYear(),s=(new Date).getFullYear();return M(t,e<s?"yyyy年M月d日 HH:mm":"M月d日 HH:mm")}}return A(F,(()=>{K()}),"top"),s((()=>O.id),(e=>{e&&(Object.assign(J,{page:0,hasMore:!0}),K())}),{immediate:!0}),s((()=>O.isAppendMsg),(e=>{e&&(S([...O.msgList,O.currentMsg]),O.isAppendMsg=!1,async function(){var e,t,s;const n=null!=(t=null==(e=F.value)?void 0:e.scrollHeight)?t:0;null==(s=F.value)||s.scrollTo({top:n,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(n(),i("div",{class:o(["chat-main",{"home-bg":!a(O).id}]),ref_key:"chatMainRef",ref:F},[r(a(p),{"show-toolbar-tooltip":""},{default:l((()=>[(n(!0),i(m,null,c(a(O).msgList,((e,t)=>(n(),i(m,{key:t},[Y(e)?(n(),i("div",{key:0,class:o(["message-item",{"message-item--mine":e.sender==a(O).userInfo.id}])},[G(e,t)?(n(),i("p",I,u(R(e.sendTime)),1)):d("v-if",!0),z(e,"system")?(n(),f(L,{key:1,data:e},null,8,["data"])):(n(),i("div",w,[r(E,{"user-info":e.sender==a(O).userInfo.id?a(O).userInfo:e},{trigger:l((()=>[r(a(g),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-info"]),e.content?(n(),i("div",{key:0,class:o(["content",{emoji:e.content.chatMessageType===a(j).EMOJI,template:e.content.chatMessageType===a(j).TEMPLATE,"template--3":C(e.content)}]),"data-time":e.__time},[e.content.chatMessageType===a(j).TEXT?(n(),i("pre",{key:0,innerHTML:e.__content},null,8,b)):d("v-if",!0),e.content.chatMessageType===a(j).EMOJI?(n(),i("img",{key:1,src:a(H)[e.__content]},null,8,D)):d("v-if",!0),z(e,"template")?(n(),f(L,{key:2,data:e},null,8,["data"])):d("v-if",!0),e.content.chatMessageType===a(j).IMAGE?(n(),f(a(y),{key:3,width:"240",src:e.__content},null,8,["src"])):d("v-if",!0),e.content.chatMessageType===a(j).FILE?(n(),i("a",{key:4,href:e.content.fileUrl},u(e.__content),9,x)):d("v-if",!0)],10,P)):d("v-if",!0)]))],2)):d("v-if",!0)],64)))),128))])),_:1})],2))}});export{F as default};
@@ -0,0 +1,17 @@
1
+ import { AnyObject } from '../../../../shared/types';
2
+ declare const _default: import("vue").DefineComponent<{}, {
3
+ showSearch: import("vue").Ref<boolean>;
4
+ keyword: import("vue").Ref<any>;
5
+ userList: import("vue").Ref<any>;
6
+ state: import("../types").IState;
7
+ entrySession: (item: AnyObject) => void;
8
+ handleSearch: () => Promise<void>;
9
+ openSession: (userId: string) => Promise<void>;
10
+ NPopover: any;
11
+ NButton: any;
12
+ NAvatar: any;
13
+ NInput: any;
14
+ NIcon: any;
15
+ SearchOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
16
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
17
+ export default _default;
@@ -0,0 +1 @@
1
+ import e from"./ChatSearch.vue2.js";import r from"../../../../_virtual/_plugin-vue_export-helper.js";var a=r(e,[["__file","ChatSearch.vue"]]);export{a as default};
@@ -0,0 +1 @@
1
+ import{defineComponent as e,ref as o,openBlock as a,createBlock as s,unref as n,withCtx as r,createVNode as l,createTextVNode as t,createElementVNode as i,withKeys as c,withModifiers as u,createElementBlock as p,Fragment as d,renderList as v,toDisplayString as f}from"vue";import{NPopover as m,NButton as h,NIcon as w,NInput as y,NAvatar as g}from"naive-ui";import{SearchOutline as k}from"@vicons/ionicons5";import{useState as S}from"../hooks/useState.js";import{useSession as _}from"../hooks/useSession.js";import{listUserApi as I,openSessionApi as j}from"../api/index.js";import{isArray as x}from"lodash-es";const C={class:"popover-search"},b={class:"user-list-wrapper"},z=["onClick"],K={class:"user-info"},U=i("span",null,"职务",-1),E=i("span",null,"部门",-1);var G=e({__name:"ChatSearch",setup(e){const G=o(!1),L=o(),N=o(),{state:T}=S(),{entrySession:q}=_(T);async function A(){const e=await I({orgId:T.orgId,keyword:L.value});x(e)&&(N.value=e)}return(e,o)=>(a(),s(n(m),{show:G.value,"onUpdate:show":o[1]||(o[1]=e=>G.value=e),placement:"top",trigger:"click","show-arrow":!1,overlap:""},{trigger:r((()=>[l(n(h),{color:"#d8dce34f",class:"search-trigger-btn"},{icon:r((()=>[l(n(w),{component:n(k),color:"#ffffff80"},null,8,["component"])])),default:r((()=>[t(" 搜索联系人 ")])),_:1})])),default:r((()=>[i("div",C,[l(n(y),{placeholder:"",size:"small",clearable:"",autofocus:"","passively-activated":"",delay:0,onKeydown:c(u(A,["prevent"]),["enter"]),value:L.value,"onUpdate:value":o[0]||(o[0]=e=>L.value=e)},{prefix:r((()=>[l(n(w),{component:n(k)},null,8,["component"])])),_:1},8,["onKeydown","value"]),i("div",b,[(a(!0),p(d,null,v(N.value,(e=>(a(),p("div",{class:"user-item",key:e.id,onClick:()=>async function(e){G.value=!1;const o=await j({chatType:"SINGLE",receiver:e,sender:T.userInfo.id});q(o)}(e.id)},[l(n(g),{round:"",size:32,src:e.avatar},null,8,["src"]),i("div",K,[i("span",null,f(e.name),1),U,E])],8,z)))),128))])])])),_:1},8,["show"]))}});export{G as default};
@@ -0,0 +1,2 @@
1
+ import { Ref } from 'vue';
2
+ export declare function useScrollLoading(el: Ref<HTMLElement | undefined | null>, callback: () => void, direction?: 'top' | 'bottom' | undefined): void;
@@ -0,0 +1 @@
1
+ import{onMounted as e}from"vue";import{useThrottleFn as t}from"@vueuse/core";const o=t((({target:e},t,o)=>{const{clientHeight:r,scrollTop:l,scrollHeight:i}=e;if("top"===o){if(0===l)return;r-l>=i-5&&t()}else r+l>=i-10&&t()}),500);function r(t,r,l="bottom"){e((()=>{t.value&&t.value.addEventListener("scroll",(e=>o(e,r,l)))}))}export{r as useScrollLoading};
@@ -1 +1 @@
1
- import{computed as s}from"vue";import{transformLastMessage as e}from"../utils/index.js";function t(t){function n(s){Object.assign(t.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),t.id!==t.currentSessionItem.id&&(t.id=t.currentSessionItem.id)}return{entrySession:function(s){s.unreadNum=0,n(s),t.isChangeSession=!0},setCurrentSessionItem:n,unreadTotal:s((()=>t.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){t.sessionList=s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:t?e(t):""}}))}}}export{t as useSession};
1
+ import{computed as s}from"vue";import{transformLastMessage as e}from"../utils/index.js";function t(t){function n(s){Object.assign(t.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),t.id!==t.currentSessionItem.id&&(t.msgList=[],t.id=t.currentSessionItem.id)}return{entrySession:function(s){s.unreadNum=0,n(s),t.isChangeSession=!0},setCurrentSessionItem:n,unreadTotal:s((()=>t.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){t.sessionList=s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:t?e(t):""}}))}}}export{t as useSession};
@@ -1 +1 @@
1
- import{inject as t}from"vue";import{formatTime as e,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as s,InjectionIChatStompClient as i,InjectionIChatEmits as m}from"../types/index.js";import{MESSAGE_TYPE as o}from"../constants/index.js";function r(){const r=t(s),c=t(i),T=t(m);return{state:r,setMsgList:function(t=[]){r.msgList=t.map((t=>{var s,i,m;return Object.assign(t,{__time:e(t.sendTime).msgTime,__content:(m=t.content.chatMessageType,[o.TEXT,o.TEXT].includes(m)?n(null==(s=t.content)?void 0:s.msg):null==(i=t.content)?void 0:i.msg)}),t})).sort(((t,e)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime()))},stompClient:c,emit:T}}export{r as useState};
1
+ import{inject as t}from"vue";import{formatTime as e,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as s,InjectionIChatStompClient as i,InjectionIChatEmits as m}from"../types/index.js";import{MESSAGE_TYPE as o}from"../constants/index.js";function r(){const r=t(s),c=t(i),T=t(m);return{state:r,setMsgList:function(t=[]){r.msgList=t.map((t=>{var s,i,m;return Object.assign(t,{__time:e(t.sendTime).msgTime,__content:(m=t.content.chatMessageType,[o.TEXT,o.TEXT].includes(m)?n(null==(s=t.content)?void 0:s.msg):null==(i=t.content)?void 0:i.msg)}),t})).sort(((t,e)=>new Date(e.sendTime).getTime()-new Date(t.sendTime).getTime()))},stompClient:c,emit:T}}export{r as useState};
@@ -2,6 +2,7 @@ import { InjectionKey, Ref } from 'vue';
2
2
  import { AnyObject } from '../../../../shared/types';
3
3
  import { ChatSock } from '../utils/chatSock';
4
4
  export declare type IState = {
5
+ orgId: number | string;
5
6
  currentSessionItem: AnyObject;
6
7
  id: string;
7
8
  userInfo: AnyObject;