cnhis-design-vue 3.2.7-beta.16 → 3.2.7-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +87 -87
  2. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  3. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  5. package/es/components/field-set/src/FieldColor.vue.d.ts +2 -2
  6. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  7. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  8. package/es/components/field-set/src/components/Row.vue.d.ts +1 -1
  9. package/es/components/field-set/src/components/edit-dialog.vue.d.ts +1 -1
  10. package/es/components/form-config/index.d.ts +3 -0
  11. package/es/components/form-config/src/FormConfig.vue.d.ts +3 -0
  12. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -0
  13. package/es/components/form-render/src/components/renderer/formItem.js +1 -1
  14. package/es/components/form-render/src/components/tooltipMessage.vue2.js +1 -1
  15. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  16. package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
  17. package/es/components/iho-chat/index.d.ts +33 -6
  18. package/es/components/iho-chat/src/Index.vue.d.ts +33 -6
  19. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +1 -1
  20. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  21. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +5 -2
  22. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  23. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  24. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +14 -2
  25. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  26. package/es/components/iho-chat/src/components/Video.vue.d.ts +14 -2
  27. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  28. package/es/components/iho-chat/src/hooks/useState.js +1 -1
  29. package/es/components/iho-chat/src/hooks/useVideo.d.ts +11 -0
  30. package/es/components/iho-chat/src/hooks/useVideo.js +1 -1
  31. package/es/components/iho-chat/src/utils/index.js +1 -1
  32. package/es/components/iho-chat/style/index.css +1 -1
  33. package/es/components/index.css +1 -1
  34. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  35. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  36. package/es/components/shortcut-setter/index.d.ts +1 -0
  37. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -0
  38. package/es/env.d.ts +25 -25
  39. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  40. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  41. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  42. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  43. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  44. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  45. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  46. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  47. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  48. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  49. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  50. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  51. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  52. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  53. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  54. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  55. package/es/shared/assets/img/failure.png.js +1 -1
  56. package/es/shared/assets/img/no-permission.png.js +1 -1
  57. package/es/shared/assets/img/nodata.png.js +1 -1
  58. package/es/shared/assets/img/notfound.png.js +1 -1
  59. package/es/shared/assets/img/qr.png.js +1 -1
  60. package/es/shared/assets/img/success.png.js +1 -1
  61. package/es/shared/assets/img/table_style_2.png.js +1 -1
  62. package/es/shared/assets/img/video.png.js +1 -1
  63. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  64. package/es/shared/assets/img/xb_big.png.js +1 -1
  65. package/es/shared/assets/img/xb_small.png.js +1 -1
  66. package/es/shared/package.json.js +1 -1
  67. package/package.json +2 -2
  68. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  69. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  70. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  71. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  72. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  73. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  74. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -652,12 +652,14 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
652
652
  setScrollToButtom: () => Promise<void>;
653
653
  resetInfo: () => void;
654
654
  setReferenceMsg: (msgItem: import("../../shared/types").AnyObject) => void;
655
+ handleSelect: (key: string, msgItem: import("../../shared/types").AnyObject) => void;
655
656
  NAvatar: any;
656
657
  NImageGroup: any;
657
658
  NImage: any;
658
659
  NIcon: any;
659
660
  NButtonGroup: any;
660
661
  NButton: any;
662
+ NFlex: any;
661
663
  PersonProfile: import("vue").DefineComponent<{
662
664
  userId: {
663
665
  type: StringConstructor;
@@ -838,18 +840,18 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
838
840
  }, {
839
841
  show: boolean;
840
842
  }>;
841
- downloadFile: typeof import("./src/utils").downloadFile;
842
843
  simplifyMessage: typeof import("./src/utils").simplifyMessage;
843
844
  isAudioOrVideoMessage: typeof import("./src/utils").isAudioOrVideoMessage;
844
845
  getAVTime: typeof import("./src/utils").getAVTime;
845
846
  MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
846
847
  ChatbubbleEllipsesOutline: 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<{}>>, {}>;
848
+ EllipsisHorizontal: 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<{}>>, {}>;
847
849
  CallOutline: 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<{}>>, {}>;
848
850
  VideocamOutline: 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<{}>>, {}>;
851
+ DocumentSharp: 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<{}>>, {}>;
849
852
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
850
853
  ChatFooter: import("vue").DefineComponent<{}, {
851
854
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
852
- content: import("vue").Ref<string>;
853
855
  state: import("./src/types").IState;
854
856
  sendMessage: (message: {
855
857
  chatType?: string | undefined;
@@ -858,6 +860,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
858
860
  }) => Promise<void>;
859
861
  isGroupChat: import("vue").ComputedRef<boolean>;
860
862
  showEmoji: import("vue").Ref<boolean>;
863
+ content: import("vue").Ref<string>;
861
864
  chatAddProps: import("vue").ComputedRef<{
862
865
  options: import("../../shared/types").AnyObject[];
863
866
  defaultValue: import("../../shared/types").AnyObject[];
@@ -1141,6 +1144,20 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1141
1144
  timer: any;
1142
1145
  seconds: number;
1143
1146
  };
1147
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1148
+ handleError: import("../../shared/types").AnyFn;
1149
+ handleRemoteUserEnter: import("../../shared/types").AnyFn;
1150
+ handleRemoteAudioAvailable: import("../../shared/types").AnyFn;
1151
+ handleRemoteUserExit: import("../../shared/types").AnyFn;
1152
+ handleRemoteVideoAvailable: import("../../shared/types").AnyFn;
1153
+ }) => void;
1154
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1155
+ handleError: import("../../shared/types").AnyFn;
1156
+ handleRemoteUserEnter: import("../../shared/types").AnyFn;
1157
+ handleRemoteAudioAvailable: import("../../shared/types").AnyFn;
1158
+ handleRemoteUserExit: import("../../shared/types").AnyFn;
1159
+ handleRemoteVideoAvailable: import("../../shared/types").AnyFn;
1160
+ }) => void;
1144
1161
  videoRef: import("vue").Ref<any>;
1145
1162
  selfVideoRef: import("vue").Ref<any>;
1146
1163
  isConnect: import("vue").Ref<boolean>;
@@ -1157,8 +1174,6 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1157
1174
  handleEnter: () => Promise<void>;
1158
1175
  handleFinish: () => void;
1159
1176
  handleExit: () => Promise<void>;
1160
- installEventHandlers: () => void;
1161
- uninstallEventHandlers: () => void;
1162
1177
  handleRemoteVideoAvailable: (event: any) => Promise<void>;
1163
1178
  handleRemoteAudioAvailable: (event: any) => void;
1164
1179
  handleRemoteUserEnter: () => void;
@@ -1195,6 +1210,20 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1195
1210
  timing: import("vue").Ref<string>;
1196
1211
  toggleVideo: () => Promise<void>;
1197
1212
  videocamOpen: import("vue").Ref<boolean>;
1213
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1214
+ handleError: import("../../shared/types").AnyFn;
1215
+ handleRemoteUserEnter: import("../../shared/types").AnyFn;
1216
+ handleRemoteAudioAvailable: import("../../shared/types").AnyFn;
1217
+ handleRemoteUserExit: import("../../shared/types").AnyFn;
1218
+ handleRemoteVideoAvailable: import("../../shared/types").AnyFn;
1219
+ }) => void;
1220
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1221
+ handleError: import("../../shared/types").AnyFn;
1222
+ handleRemoteUserEnter: import("../../shared/types").AnyFn;
1223
+ handleRemoteAudioAvailable: import("../../shared/types").AnyFn;
1224
+ handleRemoteUserExit: import("../../shared/types").AnyFn;
1225
+ handleRemoteVideoAvailable: import("../../shared/types").AnyFn;
1226
+ }) => void;
1198
1227
  isConnect: import("vue").Ref<boolean>;
1199
1228
  callUser: import("vue").ComputedRef<any>;
1200
1229
  title: import("vue").ComputedRef<string>;
@@ -1202,8 +1231,6 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1202
1231
  handleCall: () => void;
1203
1232
  handleEnter: () => Promise<void>;
1204
1233
  handleExit: () => Promise<void>;
1205
- installEventHandlers: () => void;
1206
- uninstallEventHandlers: () => void;
1207
1234
  handleRemoteVideoAvailable: (event: any) => Promise<void>;
1208
1235
  handleRemoteAudioAvailable: (event: any) => Promise<void>;
1209
1236
  handleRemoteUserEnter: (event: any) => Promise<void>;
@@ -657,12 +657,14 @@ declare const _default: import("vue").DefineComponent<{
657
657
  setScrollToButtom: () => Promise<void>;
658
658
  resetInfo: () => void;
659
659
  setReferenceMsg: (msgItem: AnyObject) => void;
660
+ handleSelect: (key: string, msgItem: AnyObject) => void;
660
661
  NAvatar: any;
661
662
  NImageGroup: any;
662
663
  NImage: any;
663
664
  NIcon: any;
664
665
  NButtonGroup: any;
665
666
  NButton: any;
667
+ NFlex: any;
666
668
  PersonProfile: import("vue").DefineComponent<{
667
669
  userId: {
668
670
  type: StringConstructor;
@@ -843,18 +845,18 @@ declare const _default: import("vue").DefineComponent<{
843
845
  }, {
844
846
  show: boolean;
845
847
  }>;
846
- downloadFile: typeof import("./utils").downloadFile;
847
848
  simplifyMessage: typeof import("./utils").simplifyMessage;
848
849
  isAudioOrVideoMessage: typeof isAudioOrVideoMessage;
849
850
  getAVTime: typeof import("./utils").getAVTime;
850
851
  MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
851
852
  ChatbubbleEllipsesOutline: 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<{}>>, {}>;
853
+ EllipsisHorizontal: 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<{}>>, {}>;
852
854
  CallOutline: 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<{}>>, {}>;
853
855
  VideocamOutline: 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<{}>>, {}>;
856
+ DocumentSharp: 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<{}>>, {}>;
854
857
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
855
858
  ChatFooter: import("vue").DefineComponent<{}, {
856
859
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
857
- content: import("vue").Ref<string>;
858
860
  state: IState;
859
861
  sendMessage: (message: {
860
862
  chatType?: string | undefined;
@@ -863,6 +865,7 @@ declare const _default: import("vue").DefineComponent<{
863
865
  }) => Promise<void>;
864
866
  isGroupChat: import("vue").ComputedRef<boolean>;
865
867
  showEmoji: import("vue").Ref<boolean>;
868
+ content: import("vue").Ref<string>;
866
869
  chatAddProps: import("vue").ComputedRef<{
867
870
  options: AnyObject[];
868
871
  defaultValue: AnyObject[];
@@ -1146,6 +1149,20 @@ declare const _default: import("vue").DefineComponent<{
1146
1149
  timer: any;
1147
1150
  seconds: number;
1148
1151
  };
1152
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1153
+ handleError: import("../../../shared/types").AnyFn;
1154
+ handleRemoteUserEnter: import("../../../shared/types").AnyFn;
1155
+ handleRemoteAudioAvailable: import("../../../shared/types").AnyFn;
1156
+ handleRemoteUserExit: import("../../../shared/types").AnyFn;
1157
+ handleRemoteVideoAvailable: import("../../../shared/types").AnyFn;
1158
+ }) => void;
1159
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1160
+ handleError: import("../../../shared/types").AnyFn;
1161
+ handleRemoteUserEnter: import("../../../shared/types").AnyFn;
1162
+ handleRemoteAudioAvailable: import("../../../shared/types").AnyFn;
1163
+ handleRemoteUserExit: import("../../../shared/types").AnyFn;
1164
+ handleRemoteVideoAvailable: import("../../../shared/types").AnyFn;
1165
+ }) => void;
1149
1166
  videoRef: import("vue").Ref<any>;
1150
1167
  selfVideoRef: import("vue").Ref<any>;
1151
1168
  isConnect: import("vue").Ref<boolean>;
@@ -1162,8 +1179,6 @@ declare const _default: import("vue").DefineComponent<{
1162
1179
  handleEnter: () => Promise<void>;
1163
1180
  handleFinish: () => void;
1164
1181
  handleExit: () => Promise<void>;
1165
- installEventHandlers: () => void;
1166
- uninstallEventHandlers: () => void;
1167
1182
  handleRemoteVideoAvailable: (event: any) => Promise<void>;
1168
1183
  handleRemoteAudioAvailable: (event: any) => void;
1169
1184
  handleRemoteUserEnter: () => void;
@@ -1200,6 +1215,20 @@ declare const _default: import("vue").DefineComponent<{
1200
1215
  timing: import("vue").Ref<string>;
1201
1216
  toggleVideo: () => Promise<void>;
1202
1217
  videocamOpen: import("vue").Ref<boolean>;
1218
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1219
+ handleError: import("../../../shared/types").AnyFn;
1220
+ handleRemoteUserEnter: import("../../../shared/types").AnyFn;
1221
+ handleRemoteAudioAvailable: import("../../../shared/types").AnyFn;
1222
+ handleRemoteUserExit: import("../../../shared/types").AnyFn;
1223
+ handleRemoteVideoAvailable: import("../../../shared/types").AnyFn;
1224
+ }) => void;
1225
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
1226
+ handleError: import("../../../shared/types").AnyFn;
1227
+ handleRemoteUserEnter: import("../../../shared/types").AnyFn;
1228
+ handleRemoteAudioAvailable: import("../../../shared/types").AnyFn;
1229
+ handleRemoteUserExit: import("../../../shared/types").AnyFn;
1230
+ handleRemoteVideoAvailable: import("../../../shared/types").AnyFn;
1231
+ }) => void;
1203
1232
  isConnect: import("vue").Ref<boolean>;
1204
1233
  callUser: import("vue").ComputedRef<any>;
1205
1234
  title: import("vue").ComputedRef<string>;
@@ -1207,8 +1236,6 @@ declare const _default: import("vue").DefineComponent<{
1207
1236
  handleCall: () => void;
1208
1237
  handleEnter: () => Promise<void>;
1209
1238
  handleExit: () => Promise<void>;
1210
- installEventHandlers: () => void;
1211
- uninstallEventHandlers: () => void;
1212
1239
  handleRemoteVideoAvailable: (event: any) => Promise<void>;
1213
1240
  handleRemoteAudioAvailable: (event: any) => Promise<void>;
1214
1241
  handleRemoteUserEnter: (event: any) => Promise<void>;
@@ -8,7 +8,6 @@ type FileOptions = {
8
8
  };
9
9
  declare const _default: import("vue").DefineComponent<{}, {
10
10
  inputRef: import("vue").Ref<HTMLDivElement | undefined>;
11
- content: import("vue").Ref<string>;
12
11
  state: import("../types").IState;
13
12
  sendMessage: (message: {
14
13
  chatType?: string | undefined;
@@ -17,6 +16,7 @@ declare const _default: import("vue").DefineComponent<{}, {
17
16
  }) => Promise<void>;
18
17
  isGroupChat: import("vue").ComputedRef<boolean>;
19
18
  showEmoji: import("vue").Ref<boolean>;
19
+ content: import("vue").Ref<string>;
20
20
  chatAddProps: import("vue").ComputedRef<{
21
21
  options: AnyObject[];
22
22
  defaultValue: AnyObject[];
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as o,withDirectives as i,openBlock as s,createElementBlock as r,normalizeStyle as a,unref as c,createElementVNode as l,toDisplayString as u,createVNode as d,createCommentVNode as f,withCtx as m,Fragment as p,renderList as g,createBlock as y,createTextVNode as h,mergeProps as v,vShow as M}from"vue";import{NIcon as k,NPopover as C,NButton as _,NTooltip as x,NUpload as I,NUploadTrigger as b}from"naive-ui";import w from"./ChatAdd.vue.js";import{useState as T}from"../hooks/useState.js";import{useSession as z}from"../hooks/useSession.js";import{MESSAGE_TYPE as E,AV_STATUS as j}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as R}from"../utils/index.js";import{emojis as q}from"../utils/emoji.js";import{uploadFileApi as L}from"../api/index.js";import{CloseCircleOutline as D,CallOutline as O,VideocamOutline as V}from"@vicons/ionicons5";import{xor as A,cloneDeep as F}from"lodash-es";import{uuidGenerator as K}from"../../../../shared/utils/index.js";const U={key:0,class:"reference-content-box"},S={class:"reference-content"},G=["innerHTML"],H={class:"tool-box"},N=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),J={class:"emoji-box"},X=l("span",null,"默认表情",-1),B={class:"list-box"},P=["src"],Q=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),W=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Y=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),Z={class:"btn-box"},$=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var ee=e({__name:"ChatFooter",setup(e){const ee=t(),te=t(""),{state:ne,sendMessage:oe}=T(),{isGroupChat:ie}=z(ne),se=t(!1),re=n((()=>({options:ne.currentGroupUser,defaultValue:[ne.userInfo]})));function ae(e,t=[]){const n=K(),o=[],i=t.length>0;ne.showVideo||ne.showMultipleVideo||(i?(o.push(...A(t,[ne.userInfo.id])),Object.assign(ne.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ne.showMultipleVideo=!0):oe({content:{chatMessageType:e,msg:"",avStatus:j.IN_CALL}}))}function ce(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),de()))}function le(){var e,t;te.value=(null==(t=null==(e=ee.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ue(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ne.userInfo.id),i.append("file",n);const s=await L(i);if(!s)return console.log("上传失败");fe({chatMessageType:t,msg:t===E.FILE?o:s,url:s})}function de(){if(!(te.value.length>2e3))return te.value?void fe({msg:te.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function fe(e){const{chatMessageType:t=E.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===E.FILE&&(i.fileUrl=o),[E.TEXT,E.BLEND].includes(t)&&(ee.value.innerHTML="",te.value=""),ne.currentReferenceMsg&&(i.referenceContent=F(ne.currentReferenceMsg),ne.currentReferenceMsg=null),oe({content:i})}return o((()=>ne.currentReferenceMsg),(e=>{var t;e&&(null==(t=ee.value)||t.focus())})),(e,t)=>i((s(),r("section",{class:"chat-footer",style:a({cursor:c(ne).id?"default":"not-allowed"})},[c(ne).currentReferenceMsg?(s(),r("div",U,[l("div",S,[l("span",null,u(c(ne).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:c(R)(c(ne).currentReferenceMsg.content)},null,8,G)]),d(c(k),{component:c(D),onClick:t[0]||(t[0]=()=>c(ne).currentReferenceMsg=null)},null,8,["component"])])):f("v-if",!0),l("div",H,[d(c(C),{show:se.value,"onUpdate:show":t[1]||(t[1]=e=>se.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:m((()=>[d(c(_),{quaternary:"",size:"tiny"},{icon:m((()=>[N])),_:1})])),default:m((()=>[l("div",J,[f(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),X,l("div",B,[(s(!0),r(p,null,g(c(q).default,(([e,t])=>(s(),y(c(x),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:m((()=>[d(c(_),{quaternary:"",size:"tiny",onClick:()=>function(e){se.value=!1,fe({chatMessageType:E.EMOJI,msg:e})}(e)},{icon:m((()=>[l("img",{src:t},null,8,P)])),_:2},1032,["onClick"])])),default:m((()=>[h(" "+u(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),d(c(_),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>fe({chatMessageType:c(E).EMOJI,msg:0}))},{icon:m((()=>[Q])),_:1}),d(c(I),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ue(e,c(E).IMAGE))},{default:m((()=>[d(c(b),{abstract:""},{default:m((({handleClick:e})=>[d(c(_),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[W])),_:2},1032,["onClick"])])),_:1})])),_:1}),d(c(I),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ue(e,c(E).FILE))},{default:m((()=>[d(c(b),{abstract:""},{default:m((({handleClick:e})=>[d(c(_),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[Y])),_:2},1032,["onClick"])])),_:1})])),_:1}),c(ie)?(s(),r(p,{key:0},[d(w,v(c(re),{onComfirm:t[5]||(t[5]=e=>ae(c(E).AUDIO,e))}),{trigger:m((()=>[d(c(_),{quaternary:"",size:"tiny"},{icon:m((()=>[d(c(k),{size:"18",component:c(O)},null,8,["component"])])),_:1})])),_:1},16),d(w,v(c(re),{onComfirm:t[6]||(t[6]=e=>ae(c(E).VIDEO,e))}),{trigger:m((()=>[d(c(_),{quaternary:"",size:"tiny"},{icon:m((()=>[d(c(k),{size:"20",component:c(V)},null,8,["component"])])),_:1})])),_:1},16)],64)):(s(),r(p,{key:1},[d(c(_),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ae(c(E).AUDIO))},{icon:m((()=>[d(c(k),{size:"18",component:c(O)},null,8,["component"])])),_:1}),d(c(_),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ae(c(E).VIDEO))},{icon:m((()=>[d(c(k),{size:"20",component:c(V)},null,8,["component"])])),_:1})],64))]),i(l("div",{ref_key:"inputRef",ref:ee,class:"input-box",contenteditable:"",onKeydown:ce,onInput:le},null,544),[[M,c(ne).id]]),l("div",Z,[$,d(c(_),{type:"primary",round:"",disabled:!te.value,onClick:de},{default:m((()=>[h("发送")])),_:1},8,["disabled"])])],4)),[[M,c(ne).id]])}});export{ee as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as o,withDirectives as i,openBlock as s,createElementBlock as r,normalizeStyle as c,unref as a,createElementVNode as l,toDisplayString as u,createVNode as m,createCommentVNode as d,withCtx as f,Fragment as p,renderList as g,createBlock as h,createTextVNode as y,mergeProps as v,vShow as M}from"vue";import{NIcon as k,NPopover as C,NButton as _,NTooltip as I,NUpload as x,NUploadTrigger as T}from"naive-ui";import b from"./ChatAdd.vue.js";import{useState as E}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as z,AV_STATUS as L}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as j}from"../utils/index.js";import{emojis as R}from"../utils/emoji.js";import{uploadFileApi as q}from"../api/index.js";import{CloseCircleOutline as O,CallOutline as D,VideocamOutline as A}from"@vicons/ionicons5";import{xor as V,cloneDeep as K}from"lodash-es";import{uuidGenerator as F}from"../../../../shared/utils/index.js";const H={key:0,class:"reference-content-box"},U={class:"reference-content"},G=["innerHTML"],J={class:"tool-box"},N=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),S={class:"emoji-box"},X=l("span",null,"默认表情",-1),B={class:"list-box"},$=["src"],P=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),W=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),Y={class:"btn-box"},Z=l("span",{class:"tip"},"Enter 发送, Ctrl + Enter 换行",-1);var ee=e({__name:"ChatFooter",setup(e){const ee=t(),{state:te,sendMessage:ne}=E(),{isGroupChat:oe}=w(te),ie=t(!1),se=t(""),re=n((()=>({options:te.currentGroupUser,defaultValue:[te.userInfo]})));function ce(e,t=[]){const n=F(),o=[],i=t.length>0;te.showVideo||te.showMultipleVideo||(i?(o.push(...V(t,[te.userInfo.id])),Object.assign(te.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),te.showMultipleVideo=!0):ne({content:{chatMessageType:e,msg:"",avStatus:L.IN_CALL}}))}function ae(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(),me()))}function le(){var e;se.value=(null==(e=ee.value)?void 0:e.innerHTML)||""}async function ue(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",te.userInfo.id),i.append("file",n);const s=await q(i);if(!s)return console.log("上传失败");de({chatMessageType:t,msg:t===z.FILE?o:s,url:s})}function me(){const{innerHTML:e="",innerText:t=""}=ee.value||{};if(se.value.trim().length>2e3)return void console.log("请控制在2000字以内");if(!se.value)return console.log("请输入内容");const n=e.split(t).find((e=>!!e));let o=z.TEXT,i="";if(n){if(t.replace(/\n$/,"")||(e.match(/<img[^>]*>/gi)||[]).length>1)o=z.BLEND,i=e;else if(e.includes(z.EMOJI)){o=z.EMOJI;const t=e.match(/data-msg\s*=\s*"([^"]*)"/);t&&(i=t[1])}else{o=z.IMAGE;const t=e.match(/src\s*=\s*"([^"]*)"/);t&&(i=t[1])}}else i=t.trim();i&&de({msg:i,chatMessageType:o,origin:"btn"})}async function de(e){const{chatMessageType:t=z.TEXT,msg:n,url:o,origin:i=""}=e,s={msg:n,chatMessageType:t};t===z.FILE&&(s.fileUrl=o),"btn"===i&&(ee.value.innerHTML="",se.value=""),te.currentReferenceMsg&&(t===z.TEXT&&(s.referenceContent=K(te.currentReferenceMsg)),te.currentReferenceMsg=null),ne({content:s})}return o((()=>te.currentReferenceMsg),(e=>{var t;e&&(null==(t=ee.value)||t.focus())})),(e,t)=>i((s(),r("section",{class:"chat-footer",style:c({cursor:a(te).id?"default":"not-allowed"})},[a(te).currentReferenceMsg?(s(),r("div",H,[l("div",U,[l("span",null,u(a(te).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(j)(a(te).currentReferenceMsg.content)},null,8,G)]),m(a(k),{component:a(O),onClick:t[0]||(t[0]=()=>a(te).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",J,[m(a(C),{show:ie.value,"onUpdate:show":t[1]||(t[1]=e=>ie.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[m(a(_),{quaternary:"",size:"tiny"},{icon:f((()=>[N])),_:1})])),default:f((()=>[l("div",S,[d(' <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> '),X,l("div",B,[(s(!0),r(p,null,g(a(R).default,(([e,t])=>(s(),h(a(I),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[m(a(_),{quaternary:"",size:"tiny",onClick:()=>function(e){ie.value=!1,de({chatMessageType:z.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,$)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),m(a(_),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>de({chatMessageType:a(z).EMOJI,msg:0}))},{icon:f((()=>[P])),_:1}),m(a(x),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ue(e,a(z).IMAGE))},{default:f((()=>[m(a(T),{abstract:""},{default:f((({handleClick:e})=>[m(a(_),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),m(a(x),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ue(e,a(z).FILE))},{default:f((()=>[m(a(T),{abstract:""},{default:f((({handleClick:e})=>[m(a(_),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[W])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(oe)?(s(),r(p,{key:0},[m(b,v(a(re),{onComfirm:t[5]||(t[5]=e=>ce(a(z).AUDIO,e))}),{trigger:f((()=>[m(a(_),{quaternary:"",size:"tiny"},{icon:f((()=>[m(a(k),{size:"18",component:a(D)},null,8,["component"])])),_:1})])),_:1},16),m(b,v(a(re),{onComfirm:t[6]||(t[6]=e=>ce(a(z).VIDEO,e))}),{trigger:f((()=>[m(a(_),{quaternary:"",size:"tiny"},{icon:f((()=>[m(a(k),{size:"20",component:a(A)},null,8,["component"])])),_:1})])),_:1},16)],64)):(s(),r(p,{key:1},[m(a(_),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ce(a(z).AUDIO))},{icon:f((()=>[m(a(k),{size:"18",component:a(D)},null,8,["component"])])),_:1}),m(a(_),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ce(a(z).VIDEO))},{icon:f((()=>[m(a(k),{size:"20",component:a(A)},null,8,["component"])])),_:1})],64))]),i(l("div",{ref_key:"inputRef",ref:ee,class:"input-box",contenteditable:"",onKeydown:ae,onInput:le},null,544),[[M,a(te).id]]),l("div",Y,[Z,m(a(_),{type:"primary",round:"",disabled:!se.value,onClick:me},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[M,a(te).id]])}});export{ee as default};
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'vue';
2
2
  import { AnyObject } from '../../../../shared/types';
3
- import { downloadFile, simplifyMessage, isAudioOrVideoMessage, getAVTime } from '../utils';
3
+ import { simplifyMessage, isAudioOrVideoMessage, getAVTime } from '../utils';
4
4
  import { MESSAGE_TYPE } from '../constants';
5
5
  declare const _default: import("vue").DefineComponent<{}, {
6
6
  chatMainRef: import("vue").Ref<HTMLElement | undefined>;
@@ -31,12 +31,14 @@ declare const _default: import("vue").DefineComponent<{}, {
31
31
  setScrollToButtom: () => Promise<void>;
32
32
  resetInfo: () => void;
33
33
  setReferenceMsg: (msgItem: AnyObject) => void;
34
+ handleSelect: (key: string, msgItem: AnyObject) => void;
34
35
  NAvatar: any;
35
36
  NImageGroup: any;
36
37
  NImage: any;
37
38
  NIcon: any;
38
39
  NButtonGroup: any;
39
40
  NButton: any;
41
+ NFlex: any;
40
42
  PersonProfile: import("vue").DefineComponent<{
41
43
  userId: {
42
44
  type: StringConstructor;
@@ -217,13 +219,14 @@ declare const _default: import("vue").DefineComponent<{}, {
217
219
  }, {
218
220
  show: boolean;
219
221
  }>;
220
- downloadFile: typeof downloadFile;
221
222
  simplifyMessage: typeof simplifyMessage;
222
223
  isAudioOrVideoMessage: typeof isAudioOrVideoMessage;
223
224
  getAVTime: typeof getAVTime;
224
225
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
225
226
  ChatbubbleEllipsesOutline: 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<{}>>, {}>;
227
+ EllipsisHorizontal: 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<{}>>, {}>;
226
228
  CallOutline: 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<{}>>, {}>;
227
229
  VideocamOutline: 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<{}>>, {}>;
230
+ DocumentSharp: 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<{}>>, {}>;
228
231
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
229
232
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as m,Fragment as u,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as v,createElementVNode as y,withModifiers as g}from"vue";import{NImageGroup as T,NAvatar as h,NImage as M,NIcon as k,NButtonGroup as _,NButton as I}from"naive-ui";import{format as S}from"date-fns";import{getHistoryRecordApi as x,readMessageApi as j}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as L}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as C,simplifyMessage as b,getAVTime as w,downloadFile as H}from"../utils/index.js";import{first as z,last as D}from"lodash-es";import O from"./PersonProfile.vue.js";import P from"./MessageTemplate.vue.js";import{emojis as N}from"../utils/emoji.js";import U from"./ContextMenu.js";import{useScrollLoading as q}from"../hooks/useScrollLoading.js";import{CallOutline as R,VideocamOutline as G,ChatbubbleEllipsesOutline as J}from"@vicons/ionicons5";const K={key:0,class:"time"},F={key:2,class:"message-box"},X={key:0,class:"content-box"},B={class:"name-box"},Q=["data-time"],V=["onContextmenu"],W={key:0,class:"reference-content"},Y=["innerHTML"],Z=["innerHTML"],$=["src"],ee={style:{"margin-left":"8px"}},te=["href","onClick"];var ne=e({__name:"ChatMain",setup(e){const ne=t(),{state:se,setMsgList:oe}=E(),{setCurrentSessionItem:ie,isGroupChat:ae}=L(se),re=t(),ce=t(!1),le=t({left:0,top:0}),me=t(),ue={page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")},pe=n((()=>({"--c-tip-top":ae.value?"1px":"-20px","--c-tip-gap":ae.value?"10px":"0px"})));async function de(){try{if(!ue.hasMore)return;ue.page++;const e=await x({sessionKey:se.currentSessionItem.sessionKey,page:ue.page,lastSendTime:ue.lastSendTime});if(!Array.isArray(e)||0===e.length)return ue.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=z(e).id;ue.lastSendTime=D(e).sendTime,oe(ue.page>1?[...e,...se.msgList]:e),1===ue.page&&se.currentSessionItem.unreadNum&&(await j({chatType:se.currentSessionItem.chatType,messageIdSet:[t],receiver:se.userInfo.id,sender:se.currentSessionItem.receiver}),ie({unreadNum:0}))}catch(e){console.log(e)}}function fe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function ve(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 ye(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 ge(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=se.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}return q(ne,(()=>{de()}),"top",(()=>{ce.value=!1})),s((()=>se.id),(e=>{e&&(Object.assign(ue,{page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")}),de())}),{immediate:!0}),s((()=>se.isAppendMsg),(e=>{e&&(oe([...se.msgList,se.currentMsg]),se.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ne.value)?void 0:e.scrollHeight)?t:0;null==(n=ne.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(se).id}]),ref_key:"chatMainRef",ref:ne,style:c(r(pe))},[l(r(T),{"show-toolbar-tooltip":""},{default:m((()=>[(o(!0),i(u,null,p(r(se).msgList,((e,t)=>(o(),i(u,{key:e.id},[fe(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(se).userInfo.id}])},[ge(e,t)?(o(),i("p",K,d(e.__sendTime),1)):f("v-if",!0),ve(e,"system")?(o(),v(P,{key:1,data:e},null,8,["data"])):(o(),i("div",F,[l(O,{"user-id":e.sender},{trigger:m((()=>[l(r(h),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",X,[y("div",B,[y("span",{class:"name","data-time":e.__time},d(r(ae)?e.senderName:""),9,Q)]),y("div",{class:a(["content",{emoji:e.content.chatMessageType===r(A).EMOJI,template:e.content.chatMessageType===r(A).TEMPLATE,"template--3":ye(e.content),"audio-video":r(C)(e.content)}]),onContextmenu:g((t=>async function(e,t){}(0,e.id)),["prevent"])},[e.content.chatMessageType===r(A).TEXT?(o(),i(u,{key:0},[e.content.referenceContent?(o(),i("div",W,[y("span",null,d(e.content.referenceContent.senderName)+":",1),y("pre",{innerHTML:r(b)(e.content.referenceContent.content)},null,8,Y)])):f("v-if",!0),y("pre",{innerHTML:e.__content},null,8,Z)],64)):f("v-if",!0),e.content.chatMessageType===r(A).EMOJI?(o(),i("img",{key:1,src:r(N).findEmoji(e.__content)},null,8,$)):f("v-if",!0),ve(e,"template")?(o(),v(P,{key:2,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===r(A).IMAGE?(o(),v(r(M),{key:3,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),r(C)(e.content)?(o(),i(u,{key:4},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(A).AUDIO}),component:e.content.chatMessageType===r(A).AUDIO?r(R):r(G)},null,8,["class","component"]),y("span",ee,d(r(w)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===r(A).FILE?(o(),i("a",{key:5,href:e.content.fileUrl,onClick:g((()=>r(H)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,te)):f("v-if",!0),l(r(_),{class:"quick-menu"},{default:m((()=>[f(' <n-button quaternary size="tiny">\n\t\t\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\n\t\t\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t\t\t</n-button> '),l(r(I),{quaternary:"",size:"tiny",onClick:()=>{return t=e,se.currentReferenceMsg=t,void Object.assign(se.currentReferenceMsg,{chatType:se.currentSessionItem.chatType,receiver:se.currentSessionItem.receiver,receiverAvatar:se.currentSessionItem.avatar,receiverName:se.currentSessionItem.name});var t}},{icon:m((()=>[l(r(k),{size:"17",component:r(J)},null,8,["component"])])),_:2},1032,["onClick"]),f(' <n-button quaternary size="tiny">\n\t\t\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\n\t\t\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t\t\t</n-button> ')])),_:2},1024)],42,V)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(r(U),{ref_key:"contextmenuRef",ref:re,show:ce.value,"onUpdate:show":t[0]||(t[0]=e=>ce.value=e),position:le.value,"msg-id":me.value},null,8,["show","position","msg-id"])],6))}});export{ne as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as v,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as _,NIcon as k,NFlex as x,NButtonGroup as I,NButton as S}from"naive-ui";import{format as L}from"date-fns";import{getHistoryRecordApi as j,readMessageApi as E}from"../api/index.js";import{useState as w}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import{MESSAGE_TYPE as b}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as z,getAVTime as H}from"../utils/index.js";import{first as D,last as R}from"lodash-es";import N from"./PersonProfile.vue.js";import O from"./MessageTemplate.vue.js";import{emojis as P}from"../utils/emoji.js";import q from"./ContextMenu.js";import{useScrollLoading as B}from"../hooks/useScrollLoading.js";import{CallOutline as U,VideocamOutline as F,DocumentSharp as G,ChatbubbleEllipsesOutline as J,EllipsisHorizontal as K}from"@vicons/ionicons5";const X={key:0,class:"time"},Y={key:2,class:"message-box"},$={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W=["onContextmenu"],Z={key:0,class:"reference-content"},ee=["innerHTML"],te=["innerHTML"],ne=["src"],se={style:{"margin-left":"8px"}},oe={class:"size"};var ie=e({__name:"ChatMain",setup(e){const ie=t(),{state:ae,setMsgList:re}=w(),{setCurrentSessionItem:ce,isGroupChat:le}=C(ae),ue=t(),me=t(!1),pe=t({left:0,top:0}),de=t(),fe={page:0,hasMore:!0,lastSendTime:L(new Date,"yyyy-MM-dd HH:mm:ss")},ve=n((()=>({"--c-tip-top":le.value?"1px":"-20px","--c-tip-gap":le.value?"10px":"0px"})));async function ge(){try{if(!fe.hasMore)return;fe.page++;const e=await j({sessionKey:ae.currentSessionItem.sessionKey,page:fe.page,lastSendTime:fe.lastSendTime});if(!Array.isArray(e)||0===e.length)return fe.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=D(e).id;fe.lastSendTime=R(e).sendTime,re(fe.page>1?[...e,...ae.msgList]:e),1===fe.page&&ae.currentSessionItem.unreadNum&&(await E({chatType:ae.currentSessionItem.chatType,messageIdSet:[t],receiver:ae.userInfo.id,sender:ae.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}async function ye(e,t){de.value=t,async function(e){var t,n,s,o,i,a;me.value=!0,await h();const{clientX:r,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=ie.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=ue.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(a=null==(i=ie.value)?void 0:i.scrollTop)?a:0,v=5,g={};r<=m+l/2?g.left=r-m+v+"px":g.right=m+l-r-v+"px";c-p<d/2?g.top=f+v+"px":p+u-c<=d/2?g.bottom=Math.abs(f)+v+"px":g.top=f+c-p-d/2+"px";pe.value=g}(e)}function he(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==b.TEMPLATE||!!n}function Te(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===b.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function Me(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===b.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function _e(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ae.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function ke(e){ae.currentReferenceMsg=e,Object.assign(ae.currentReferenceMsg,{chatType:ae.currentSessionItem.chatType,receiver:ae.currentSessionItem.receiver,receiverAvatar:ae.currentSessionItem.avatar,receiverName:ae.currentSessionItem.name})}function xe(e,t){"reply"===e&&ke(t)}return B(ie,(()=>{ge()}),"top",(()=>{me.value=!1})),s((()=>ae.id),(e=>{e&&(ae.currentReferenceMsg=null,Object.assign(fe,{page:0,hasMore:!0,lastSendTime:L(new Date,"yyyy-MM-dd HH:mm:ss")}),ge())}),{immediate:!0}),s((()=>ae.isAppendMsg),(e=>{e&&(re([...ae.msgList,ae.currentMsg]),ae.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ie.value)?void 0:e.scrollHeight)?t:0;null==(n=ie.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(ae).id}]),ref_key:"chatMainRef",ref:ie,style:c(r(ve))},[l(r(T),{"show-toolbar-tooltip":""},{default:u((()=>[(o(!0),i(m,null,p(r(ae).msgList,((e,t)=>(o(),i(m,{key:e.id},[he(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ae).userInfo.id}])},[_e(e,t)?(o(),i("p",X,d(e.__sendTime),1)):f("v-if",!0),Te(e,"system")?(o(),v(O,{key:1,data:e},null,8,["data"])):(o(),i("div",Y,[l(N,{"user-id":e.sender},{trigger:u((()=>[l(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",$,[g("div",Q,[g("span",{class:"name","data-time":e.__time},d(r(le)?e.senderName:""),9,V)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(b).EMOJI,template:e.content.chatMessageType===r(b).TEMPLATE,"template--3":Me(e.content),"audio-video":r(A)(e.content),file:e.content.chatMessageType===r(b).FILE}]),onContextmenu:y((t=>ye(t,e.id)),["prevent"])},[e.content.chatMessageType===r(b).TEXT?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",Z,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(z)(e.content.referenceContent.content)},null,8,ee)])):f("v-if",!0),g("pre",null,d(e.__content),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).BLEND?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,te)):f("v-if",!0),e.content.chatMessageType===r(b).EMOJI?(o(),i("img",{key:2,src:r(P).findEmoji(e.__content)},null,8,ne)):f("v-if",!0),Te(e,"template")?(o(),v(O,{key:3,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===r(b).IMAGE?(o(),v(r(_),{key:4,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),r(A)(e.content)?(o(),i(m,{key:5},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(b).AUDIO}),component:e.content.chatMessageType===r(b).AUDIO?r(U):r(F)},null,8,["class","component"]),g("span",se,d(r(H)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).FILE?(o(),v(r(x),{key:6},{default:u((()=>[l(r(k),{class:"icon-file",size:"40",component:r(G)},null,8,["component"]),l(r(x),{vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[g("span",null,d(e.__content),1),g("span",oe,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(r(I),{class:"quick-menu"},{default:u((()=>[r(A)(e.content)?f("v-if",!0):(o(),i(m,{key:0},[f(' <n-button quaternary size="tiny">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(r(S),{quaternary:"",size:"tiny",onClick:()=>ke(e)},{icon:u((()=>[l(r(k),{size:"17",component:r(J)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(r(S),{quaternary:"",size:"tiny",onClick:t=>ye(t,e.id)},{icon:u((()=>[l(r(k),{size:"14",component:r(K)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,W)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(r(q),{ref_key:"contextmenuRef",ref:ue,show:me.value,"onUpdate:show":t[0]||(t[0]=e=>me.value=e),position:pe.value,"msg-id":de.value,onSelect:xe},null,8,["show","position","msg-id"])],6))}});export{ie as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as o,withDirectives as n,createVNode as s,vShow as i,isVNode as l}from"vue";import{NButtonGroup as r,NButton as a,NIcon as p}from"naive-ui";import{CopyOutline as u,OpenOutline as c,ChatbubbleEllipsesOutline as d,ReorderFourOutline as m,ReturnDownBack as y,DownloadOutline as f}from"@vicons/ionicons5";import{onClickOutside as h}from"@vueuse/core";import{useState as v}from"../hooks/useState.js";import{isAudioOrVideoMessage as w}from"../utils/index.js";import"lodash-es";import{MESSAGE_TYPE as b}from"../constants/index.js";import"../api/index.js";import"trtc-sdk-v5";import{isSameMonth as k}from"date-fns";var g=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},position:{type:Object},msgId:{type:String}},emits:["update:show","select"],setup(e,{attrs:g,slots:j,emit:E}){const{state:T,setMsgList:I}=v(),L=[{icon:u,label:"复制",key:"copy"},{icon:c,label:"转发",key:"relay"},{icon:d,label:"回复",key:"reply"},{icon:m,label:"多选",key:"multiSelect"},{icon:y,label:"撤回",key:"withdraw"},{icon:f,label:"下载",key:"download"}],M=t(null),x=o((()=>T.msgList.find((({id:t})=>t===e.msgId)))),O=o((()=>{if(!e.msgId)return[];if(!(null==x?void 0:x.value))return[];const{content:t={},sendTime:o,sender:n}=x.value,{chatMessageType:s}=t,i=[];return(n!==T.userInfo.id&&k(new Date(o),new Date)||s===b.TEMPLATE)&&i.push("withdraw"),[b.TEXT,b.EMOJI,b.BLEND].includes(s)?i.push("download"):w(t)?i.push("copy","relay","download"):s===b.FILE?i.push("copy"):[b.FORWARD,b.TEMPLATE].includes(s)&&i.push("copy","download"),i.length?L.filter((e=>!i.includes(e.key))):L}));return h(M,(e=>{E("update:show",!1)})),()=>{let t;return e.msgId&&O.value?n(s("div",{class:"contextmenu-wrapper",ref:M,style:e.position},[s(r,{vertical:!0},(o=t=O.value.map((e=>s(a,{onClick:()=>{return t=e.key,E("update:show",!1),x.value,void E("select",t);var t},quaternary:!0},{default:()=>e.label,icon:()=>s(p,{component:e.icon},null)}))),"function"==typeof o||"[object Object]"===Object.prototype.toString.call(o)&&!l(o)?t:{default:()=>[t]}))]),[[i,e.show]]):null;var o}}});export{g as default};
1
+ import{defineComponent as e,ref as t,computed as o,withDirectives as s,createVNode as i,vShow as n,isVNode as r}from"vue";import{NButtonGroup as a,NButton as l,NIcon as p}from"naive-ui";import{CopyOutline as c,ChatbubbleEllipsesOutline as d,DownloadOutline as u}from"@vicons/ionicons5";import{onClickOutside as m}from"@vueuse/core";import{useState as f}from"../hooks/useState.js";import{isAudioOrVideoMessage as g,downloadFile as y}from"../utils/index.js";import"lodash-es";import{MESSAGE_TYPE as w}from"../constants/index.js";import"../api/index.js";import"trtc-sdk-v5";import{isSameMonth as h}from"date-fns";import{emojis as v}from"../utils/emoji.js";var E=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},position:{type:Object},msgId:{type:String}},emits:["update:show","select"],setup(e,{attrs:E,slots:b,emit:T}){const{state:I,setMsgList:j}=f(),M=[{icon:c,label:"复制",key:"copy"},{icon:d,label:"回复",key:"reply"},{icon:u,label:"下载",key:"download"}],x=t(null),k=o((()=>I.msgList.find((({id:t})=>t===e.msgId)))),O=o((()=>{if(!e.msgId)return[];if(!(null==k?void 0:k.value))return[];const{content:t={},sendTime:o,sender:s}=k.value,{chatMessageType:i}=t,n=[];return(s!==I.userInfo.id&&h(new Date(o),new Date)||i===w.TEMPLATE)&&n.push("withdraw"),[w.TEXT,w.EMOJI,w.BLEND].includes(i)?n.push("download"):g(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?M.filter((e=>!n.includes(e.key))):M}));return m(x,(e=>{T("update:show",!1)})),()=>{let t;return e.msgId&&O.value?s(i("div",{class:"contextmenu-wrapper",ref:x,style:e.position},[i(a,{vertical:!0},(o=t=O.value.map((e=>i(l,{onClick:()=>async function(e){T("update:show",!1);const{content:t={},sendTime:o,sender:s}=k.value||{},{chatMessageType:i}=t;switch(e){case"copy":if(!t.msg)return console.log("复制内容为空!");if(!navigator||!("clipboard"in navigator))return console.log("当前浏览器版本不支持复制!");try{if(i===w.TEXT)await navigator.clipboard.writeText(t.msg);else{let e;if([w.EMOJI,w.IMAGE].includes(i)){const o=i===w.EMOJI?v.findEmoji(t.msg):t.msg;e=`<img data-msg=${t.msg} data-type=${i} ${i===w.EMOJI?'style="width: 24px;"':""} src=${o} />`}else e=t.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 y(t.fileUrl,t.msg)}T("select",e,k.value)}(e.key),quaternary:!0},{default:()=>e.label,icon:()=>i(p,{component:e.icon},null)}))),"function"==typeof o||"[object Object]"===Object.prototype.toString.call(o)&&!r(o)?t:{default:()=>[t]}))]),[[n,e.show]]):null;var o}}});export{E as default};
@@ -23,6 +23,20 @@ declare const _default: import("vue").DefineComponent<{}, {
23
23
  timing: import("vue").Ref<string>;
24
24
  toggleVideo: () => Promise<void>;
25
25
  videocamOpen: import("vue").Ref<boolean>;
26
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
27
+ handleError: import("../../../../shared/types").AnyFn;
28
+ handleRemoteUserEnter: import("../../../../shared/types").AnyFn;
29
+ handleRemoteAudioAvailable: import("../../../../shared/types").AnyFn;
30
+ handleRemoteUserExit: import("../../../../shared/types").AnyFn;
31
+ handleRemoteVideoAvailable: import("../../../../shared/types").AnyFn;
32
+ }) => void;
33
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
34
+ handleError: import("../../../../shared/types").AnyFn;
35
+ handleRemoteUserEnter: import("../../../../shared/types").AnyFn;
36
+ handleRemoteAudioAvailable: import("../../../../shared/types").AnyFn;
37
+ handleRemoteUserExit: import("../../../../shared/types").AnyFn;
38
+ handleRemoteVideoAvailable: import("../../../../shared/types").AnyFn;
39
+ }) => void;
26
40
  isConnect: import("vue").Ref<boolean>;
27
41
  callUser: import("vue").ComputedRef<any>;
28
42
  title: import("vue").ComputedRef<string>;
@@ -30,8 +44,6 @@ declare const _default: import("vue").DefineComponent<{}, {
30
44
  handleCall: () => void;
31
45
  handleEnter: () => Promise<void>;
32
46
  handleExit: () => Promise<void>;
33
- installEventHandlers: () => void;
34
- uninstallEventHandlers: () => void;
35
47
  handleRemoteVideoAvailable: (event: any) => Promise<void>;
36
48
  handleRemoteAudioAvailable: (event: any) => Promise<void>;
37
49
  handleRemoteUserEnter: (event: any) => Promise<void>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as n,openBlock as t,createElementBlock as s,createElementVNode as i,withDirectives as c,toDisplayString as l,unref as a,vShow as r,createVNode as u,withCtx as d,Fragment as p,renderList as m,createCommentVNode as f,createTextVNode as v,nextTick as E}from"vue";import{NButton as g,NIcon as _}from"naive-ui";import V from"./ChatAdd.vue.js";import{Close as I,Mic as T,MicOff as A,Videocam as h,VideocamOff as R,Call as M,PersonAdd as k}from"@vicons/ionicons5";import{xorBy as y}from"lodash-es";import"date-fns";import{CHAT_TYPE as w,SUBSCRIBE_MESSAGE_TYPE as b}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import{getUserDetailApi as O}from"../api/index.js";import{useVideo as N}from"../hooks/useVideo.js";import x from"trtc-sdk-v5";const C={class:"video-wrapper video-wrapper--multiple"},L={class:"video-header"},S={key:0,class:"video-main"},U={class:"video-main__left"},j=["data-name"],D={class:"video-bottom"},$={class:"btn-group"},z={class:"btn"},B=i("span",{class:"text"},"静音",-1),H={class:"btn"},P=i("span",{class:"text"},"摄像头",-1),X=i("span",{class:"text"},"结束会诊",-1),Y={class:"btn"},q=i("span",{class:"text"},"添加参会人",-1),G={class:"video-main__right"},F=["id","data-name"],J={class:"user"},K={class:"name"},Q={key:0,class:"tip"},W={key:0,class:"calling-box"},Z={class:"btn-box"},ee={key:1,class:"opt-btn"},oe={class:"btn"},ne=i("span",null,"拒接",-1),te={class:"btn"},se=i("span",null,"接听",-1);var ie=e({__name:"MultipleVideo",setup(e){const ie=o(),ce=o([]),{state:le,sendMessage:ae,trtc:re,voiceOpen:ue,isAudio:de,isCall:pe,startTimer:me,resetTimer:fe,toggleAudio:ve,messageTypeText:Ee,timing:ge,toggleVideo:_e,videocamOpen:Ve}=N(),Ie=o(!1),Te=n((()=>pe.value?le.userInfo.name:le.currentAVMsg.sendName)),Ae=n((()=>{if(!Ie.value)return"";const e=pe.value?`(${ce.value.length+1}/${le.currentAVMsg.checkedIds.length+1})`:"";return`${Te.value}发起的${Ee.value}会诊${e} ${ge.value}`}));function he(e){console.log("checkedIds :>> ",e),le.currentAVMsg.checkedIds.push(...e),Re()}function Re(){var e;(null==(e=le.currentAVMsg.checkedIds)?void 0:e.length)&&le.currentAVMsg.checkedIds.forEach((e=>{ae({chatType:w.SINGLE,content:{msg:le.currentAVMsg.chatMessageType+","+le.currentAVMsg.strRoomId,chatMessageType:b.AV_STATUS},receiver:e})})),Ie.value||Me()}async function Me(){const e=await x.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(le.showMultipleVideo=!1);try{if(await re.enterRoom({strRoomId:le.currentAVMsg.strRoomId,sdkAppId:parseInt(le.userInfo.sdkAppID),userId:le.userInfo.id,userSig:le.userInfo.userSig}),Ie.value=!0,me(),function(){if(re.on(x.EVENT.ERROR,xe),re.on(x.EVENT.REMOTE_USER_ENTER,be),re.on(x.EVENT.REMOTE_AUDIO_AVAILABLE,we),re.on(x.EVENT.REMOTE_USER_EXIT,Ne),de.value)return;re.on(x.EVENT.REMOTE_VIDEO_AVAILABLE,ye)}(),await re.startLocalAudio(),de.value)return;await re.startLocalVideo({view:ie.value})}catch(e){console.log("error :>> ",e),le.showMultipleVideo=!1}}async function ke(){try{if(le.showMultipleVideo=!1,function(){if(re.off(x.EVENT.ERROR,xe),re.off(x.EVENT.REMOTE_USER_ENTER,be),re.off(x.EVENT.REMOTE_AUDIO_AVAILABLE,we),re.off(x.EVENT.REMOTE_USER_EXIT,Ne),de.value)return;re.off(x.EVENT.REMOTE_VIDEO_AVAILABLE,ye)}(),await re.exitRoom(),await re.stopLocalAudio(),de.value)return;await re.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ye(e){const{userId:o,streamType:n}=e;try{n===x.TYPE.STREAM_TYPE_MAIN&&(await E(),await re.startRemoteVideo({userId:o,streamType:n,view:o}))}catch(e){console.log("error :>> ",e)}}async function we(e){var o;const{userId:n}=e;if(n&&!(null==(o=ce.value.map((e=>e.id)))?void 0:o.includes(n))){const e=await Oe(n);ce.value.push({id:n,name:e})}}async function be(e){const{userId:o}=e,n=await Oe(o);ce.value.push({id:o,name:n}),me()}async function Oe(e){const o=await O({userId:e});return(null==o?void 0:o.name)||""}function Ne(e){console.log("event :>> 退房",e);const{userId:o}=e;ce.value=y(ce.value,[{id:o,name:""}],"id")}function xe(e){console.log("error :>> ",e),le.showMultipleVideo=!1}return(e,o)=>(t(),s("div",C,[i("div",L,[c(i("span",{class:"title"},l(a(Ae)),513),[[r,Ie.value]]),u(a(g),{quaternary:"",circle:"",color:"#ffffffcc",onClick:ke},{icon:d((()=>[u(a(_),{component:a(I)},null,8,["component"])])),_:1})]),Ie.value?(t(),s("div",S,[i("div",U,[i("div",{ref_key:"selfVideoRef",ref:ie,class:"video-view","data-name":a(le).userInfo.name},null,8,j),i("div",D,[i("div",$,[i("div",z,[u(a(g),{text:"",color:a(ue)?"#fff":"#000",onClick:a(ve)},{icon:d((()=>[u(a(_),{component:a(ue)?a(T):a(A)},null,8,["component"])])),_:1},8,["color","onClick"]),B]),i("div",H,[u(a(g),{text:"",color:a(Ve)?"#fff":"#000",disabled:a(de),onClick:a(_e)},{icon:d((()=>[u(a(_),{component:a(Ve)?a(h):a(R)},null,8,["component"])])),_:1},8,["color","disabled","onClick"]),P]),i("div",{class:"btn",onClick:ke},[u(a(g),{circle:"",color:"#f17568",class:"btn--rotate"},{icon:d((()=>[u(a(_),{component:a(M)},null,8,["component"])])),_:1}),X]),u(V,{onComfirm:he},{trigger:d((()=>[i("div",Y,[u(a(g),{text:"",color:"#fff"},{icon:d((()=>[u(a(_),{component:a(k)},null,8,["component"])])),_:1}),q])])),_:1})])])]),i("div",G,[(t(!0),s(p,null,m(ce.value,(e=>(t(),s("div",{key:e.id,id:e.id,class:"video-view","data-name":e.name},null,8,F)))),128))])])):(t(),s(p,{key:1},[i("div",J,[i("span",K,l(a(Te))+"发起的"+l(a(Ee))+"会议",1),a(pe)?f("v-if",!0):(t(),s("span",Q,"邀请你加入"+l(a(Ee))+"会议",1))]),a(pe)?(t(),s("div",W,[u(V,{onComfirm:he},{trigger:d((()=>[u(a(g),{size:"large",circle:"",color:"#000"},{icon:d((()=>[u(a(_),{component:a(k)},null,8,["component"])])),_:1})])),_:1}),i("p",null,"已邀请共"+l(a(le).currentAVMsg.checkedIds.length)+"人",1),u(a(g),{size:"large",strong:"",round:"",type:"primary",onClick:Re},{default:d((()=>[v("开始会诊")])),_:1}),i("div",Z,[u(a(g),{color:"#000",round:""},{icon:d((()=>[u(a(_),{component:a(T)},null,8,["component"])])),_:1}),u(a(g),{color:"#000",round:""},{icon:d((()=>[u(a(_),{component:a(h)},null,8,["component"])])),_:1})])])):(t(),s("div",ee,[i("div",oe,[u(a(g),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>a(le).showMultipleVideo=!1)},{icon:d((()=>[u(a(_),{size:"30",component:a(M)},null,8,["component"])])),_:1}),ne]),i("div",te,[u(a(g),{circle:"",color:"#2ac98b",onClick:Me},{icon:d((()=>[u(a(_),{size:"30",component:a(M)},null,8,["component"])])),_:1}),se])]))],64))]))}});export{ie as default};
1
+ import{defineComponent as e,ref as o,computed as n,onBeforeUnmount as t,openBlock as s,createElementBlock as l,createElementVNode as i,withDirectives as a,toDisplayString as c,unref as r,vShow as d,createVNode as u,withCtx as m,Fragment as p,renderList as v,createCommentVNode as f,createTextVNode as g,nextTick as h}from"vue";import{NButton as k,NIcon as A}from"naive-ui";import I from"./ChatAdd.vue.js";import{Close as y,Mic as V,MicOff as w,Videocam as _,VideocamOff as b,Call as M,PersonAdd as R}from"@vicons/ionicons5";import{xorBy as x}from"lodash-es";import"date-fns";import{CHAT_TYPE as E,SUBSCRIBE_MESSAGE_TYPE as T}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import{getUserDetailApi as C}from"../api/index.js";import{useVideo as S}from"../hooks/useVideo.js";import j from"trtc-sdk-v5";const $={class:"video-wrapper video-wrapper--multiple"},L={class:"video-header"},U={key:0,class:"video-main"},z={class:"video-main__left"},H=["data-name"],N={class:"video-bottom"},D={class:"btn-group"},O={class:"btn"},P=i("span",{class:"text"},"静音",-1),Y={class:"btn"},q=i("span",{class:"text"},"摄像头",-1),G=i("span",{class:"text"},"结束会诊",-1),B={class:"btn"},F=i("span",{class:"text"},"添加参会人",-1),J={class:"video-main__right"},K=["id","data-name"],Q={class:"user"},W={class:"name"},X={key:0,class:"tip"},Z={key:0,class:"calling-box"},ee={class:"btn-box"},oe={key:1,class:"opt-btn"},ne={class:"btn"},te=i("span",null,"拒接",-1),se={class:"btn"},le=i("span",null,"接听",-1);var ie=e({__name:"MultipleVideo",setup(e){const ie=o(),ae=o([]),{state:ce,sendMessage:re,trtc:de,voiceOpen:ue,isAudio:me,isCall:pe,startTimer:ve,resetTimer:fe,toggleAudio:ge,messageTypeText:he,timing:ke,toggleVideo:Ae,videocamOpen:Ie,installEventHandlers:ye,uninstallEventHandlers:Ve}=S(),we=o(!1),_e=n((()=>pe.value?ce.userInfo.name:ce.currentAVMsg.sendName)),be=n((()=>{if(!we.value)return"";const e=pe.value?`(${ae.value.length+1}/${ce.currentAVMsg.checkedIds.length+1})`:"";return`${_e.value}发起的${he.value}会诊${e} ${ke.value}`}));function Me(e){console.log("checkedIds :>> ",e),ce.currentAVMsg.checkedIds.push(...e),Re()}function Re(){var e;(null==(e=ce.currentAVMsg.checkedIds)?void 0:e.length)&&ce.currentAVMsg.checkedIds.forEach((e=>{re({chatType:E.SINGLE,content:{msg:ce.currentAVMsg.chatMessageType+","+ce.currentAVMsg.strRoomId,chatMessageType:T.AV_STATUS},receiver:e})})),we.value||xe()}async function xe(){const e=await j.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(ce.showMultipleVideo=!1);try{if(await de.enterRoom({strRoomId:ce.currentAVMsg.strRoomId,sdkAppId:parseInt(ce.userInfo.sdkAppID),userId:ce.userInfo.id,userSig:ce.userInfo.userSig}),we.value=!0,ve(),ye({handleError:Le,handleRemoteUserEnter:Se,handleRemoteAudioAvailable:Ce,handleRemoteUserExit:$e,handleRemoteVideoAvailable:Te}),await de.startLocalAudio(),me.value)return;await de.startLocalVideo({view:ie.value})}catch(e){console.log("error :>> ",e),ce.showMultipleVideo=!1}}async function Ee(){try{if(ce.showMultipleVideo=!1,Ve({handleError:Le,handleRemoteUserEnter:Se,handleRemoteAudioAvailable:Ce,handleRemoteUserExit:$e,handleRemoteVideoAvailable:Te}),await de.exitRoom(),await de.stopLocalAudio(),me.value)return;await de.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function Te(e){const{userId:o,streamType:n}=e;try{n===j.TYPE.STREAM_TYPE_MAIN&&(await h(),await de.startRemoteVideo({userId:o,streamType:n,view:o}))}catch(e){console.log("error :>> ",e)}}async function Ce(e){var o;const{userId:n}=e;if(n&&!(null==(o=ae.value.map((e=>e.id)))?void 0:o.includes(n))){const e=await je(n);ae.value.push({id:n,name:e})}}async function Se(e){const{userId:o}=e,n=await je(o);ae.value.push({id:o,name:n}),ve()}async function je(e){const o=await C({userId:e});return(null==o?void 0:o.name)||""}function $e(e){console.log("event :>> 退房",e);const{userId:o}=e;ae.value=x(ae.value,[{id:o,name:""}],"id")}function Le(e){console.log("error :>> ",e),ce.showMultipleVideo=!1}return t((()=>{Ee()})),(e,o)=>(s(),l("div",$,[i("div",L,[a(i("span",{class:"title"},c(r(be)),513),[[d,we.value]]),u(r(k),{quaternary:"",circle:"",color:"#ffffffcc",onClick:Ee},{icon:m((()=>[u(r(A),{component:r(y)},null,8,["component"])])),_:1})]),we.value?(s(),l("div",U,[i("div",z,[i("div",{ref_key:"selfVideoRef",ref:ie,class:"video-view","data-name":r(ce).userInfo.name},null,8,H),i("div",N,[i("div",D,[i("div",O,[u(r(k),{text:"",color:r(ue)?"#fff":"#000",onClick:r(ge)},{icon:m((()=>[u(r(A),{component:r(ue)?r(V):r(w)},null,8,["component"])])),_:1},8,["color","onClick"]),P]),i("div",Y,[u(r(k),{text:"",color:r(Ie)?"#fff":"#000",disabled:r(me),onClick:r(Ae)},{icon:m((()=>[u(r(A),{component:r(Ie)?r(_):r(b)},null,8,["component"])])),_:1},8,["color","disabled","onClick"]),q]),i("div",{class:"btn",onClick:Ee},[u(r(k),{circle:"",color:"#f17568",class:"btn--rotate"},{icon:m((()=>[u(r(A),{component:r(M)},null,8,["component"])])),_:1}),G]),u(I,{onComfirm:Me},{trigger:m((()=>[i("div",B,[u(r(k),{text:"",color:"#fff"},{icon:m((()=>[u(r(A),{component:r(R)},null,8,["component"])])),_:1}),F])])),_:1})])])]),i("div",J,[(s(!0),l(p,null,v(ae.value,(e=>(s(),l("div",{key:e.id,id:e.id,class:"video-view","data-name":e.name},null,8,K)))),128))])])):(s(),l(p,{key:1},[i("div",Q,[i("span",W,c(r(_e))+"发起的"+c(r(he))+"会议",1),r(pe)?f("v-if",!0):(s(),l("span",X,"邀请你加入"+c(r(he))+"会议",1))]),r(pe)?(s(),l("div",Z,[u(I,{onComfirm:Me},{trigger:m((()=>[u(r(k),{size:"large",circle:"",color:"#000"},{icon:m((()=>[u(r(A),{component:r(R)},null,8,["component"])])),_:1})])),_:1}),i("p",null,"已邀请共"+c(r(ce).currentAVMsg.checkedIds.length)+"人",1),u(r(k),{size:"large",strong:"",round:"",type:"primary",onClick:Re},{default:m((()=>[g("开始会诊")])),_:1}),i("div",ee,[u(r(k),{color:"#000",round:""},{icon:m((()=>[u(r(A),{component:r(V)},null,8,["component"])])),_:1}),u(r(k),{color:"#000",round:""},{icon:m((()=>[u(r(A),{component:r(_)},null,8,["component"])])),_:1})])])):(s(),l("div",oe,[i("div",ne,[u(r(k),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>r(ce).showMultipleVideo=!1)},{icon:m((()=>[u(r(A),{size:"30",component:r(M)},null,8,["component"])])),_:1}),te]),i("div",se,[u(r(k),{circle:"",color:"#2ac98b",onClick:xe},{icon:m((()=>[u(r(A),{size:"30",component:r(M)},null,8,["component"])])),_:1}),le])]))],64))]))}});export{ie as default};
@@ -20,6 +20,20 @@ declare const _default: import("vue").DefineComponent<{}, {
20
20
  timer: any;
21
21
  seconds: number;
22
22
  };
23
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
24
+ handleError: import("../../../../shared/types").AnyFn;
25
+ handleRemoteUserEnter: import("../../../../shared/types").AnyFn;
26
+ handleRemoteAudioAvailable: import("../../../../shared/types").AnyFn;
27
+ handleRemoteUserExit: import("../../../../shared/types").AnyFn;
28
+ handleRemoteVideoAvailable: import("../../../../shared/types").AnyFn;
29
+ }) => void;
30
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: {
31
+ handleError: import("../../../../shared/types").AnyFn;
32
+ handleRemoteUserEnter: import("../../../../shared/types").AnyFn;
33
+ handleRemoteAudioAvailable: import("../../../../shared/types").AnyFn;
34
+ handleRemoteUserExit: import("../../../../shared/types").AnyFn;
35
+ handleRemoteVideoAvailable: import("../../../../shared/types").AnyFn;
36
+ }) => void;
23
37
  videoRef: import("vue").Ref<any>;
24
38
  selfVideoRef: import("vue").Ref<any>;
25
39
  isConnect: import("vue").Ref<boolean>;
@@ -36,8 +50,6 @@ declare const _default: import("vue").DefineComponent<{}, {
36
50
  handleEnter: () => Promise<void>;
37
51
  handleFinish: () => void;
38
52
  handleExit: () => Promise<void>;
39
- installEventHandlers: () => void;
40
- uninstallEventHandlers: () => void;
41
53
  handleRemoteVideoAvailable: (event: any) => Promise<void>;
42
54
  handleRemoteAudioAvailable: (event: any) => void;
43
55
  handleRemoteUserEnter: () => void;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as n,watch as s,openBlock as t,createElementBlock as r,withDirectives as a,createElementVNode as i,vShow as c,createVNode as l,unref as u,toDisplayString as d,Fragment as v,normalizeClass as E,withCtx as m}from"vue";import{NAvatar as f,NButton as p,NIcon as I}from"naive-ui";import{Mic as T,MicOffCircle as V,Call as A}from"@vicons/ionicons5";import"lodash-es";import"date-fns";import{AV_STATUS as R,CHAT_TYPE as g}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import{avFinishApi as _}from"../api/index.js";import{useVideo as M}from"../hooks/useVideo.js";import y from"trtc-sdk-v5";const N={class:"video-wrapper"},S={class:"user"},w={class:"name"},O={class:"tip"},k={class:"opt-btn"},L={class:"btn"},h=i("span",null,"静音",-1),D=i("span",null,"拒接",-1),C={class:"btn"},b=i("span",null,"挂断",-1),x=i("span",null,"接听",-1);var U=e({__name:"Video",setup(e){const{sendMessage:U,state:j,trtc:z,timing:H,voiceOpen:B,isAudio:F,isCall:X,startTimer:G,resetTimer:J,toggleAudio:P,messageTypeText:$,time:q}=M(),K=o(),Q=o(),W=o(!1);let Y=null;const Z=n((()=>{var e,o,n;return X.value?{avatar:j.currentSessionItem.avatar,name:j.currentSessionItem.name,userId:j.currentSessionItem.receiver}:{avatar:null==(e=j.currentAVMsg.currentMsg)?void 0:e.senderAvatar,name:null==(o=j.currentAVMsg.currentMsg)?void 0:o.senderName,userId:null==(n=j.currentAVMsg.currentMsg)?void 0:n.sender}})),ee=n((()=>W.value?F.value?H.value:"":X.value?"正在呼叫...":`邀请你${$.value}问诊...`)),oe=n((()=>{var e,o;return null==(o=null==(e=j.currentAVMsg.currentMsg)?void 0:e.content)?void 0:o.avStatus}));async function ne(e=R.FINISHED){U({chatType:g.SINGLE,content:{msg:e===R.FINISHED?""+q.seconds:"s",chatMessageType:j.currentAVMsg.chatMessageType,avStatus:e},receiver:Z.value.userId}),await _({recordId:j.currentAVMsg.currentMsg.id,status:e,duration:e===R.FINISHED?q.seconds:0})}async function se(){const e=await y.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(j.showVideo=!1);try{if(await z.enterRoom({strRoomId:j.currentAVMsg.strRoomId,sdkAppId:parseInt(j.userInfo.sdkAppID),userId:j.userInfo.id,userSig:j.userInfo.userSig}),X.value||(W.value=!0,G()),function(){if(z.on(y.EVENT.ERROR,ue),z.on(y.EVENT.REMOTE_USER_ENTER,ce),z.on(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.on(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.on(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.startLocalAudio(),F.value)return;await z.startLocalVideo({view:Q.value})}catch(e){console.log("error :>> ",e),j.showVideo=!1}}function te(){X.value&&!W.value?ne(R.CANCELED):ne()}async function re(){try{if(j.showVideo=!1,function(){if(z.off(y.EVENT.ERROR,ue),z.off(y.EVENT.REMOTE_USER_ENTER,ce),z.off(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.off(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.off(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.exitRoom(),await z.stopLocalAudio(),F.value)return;await z.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ae(e){const{userId:o,streamType:n}=e;try{await z.startRemoteVideo({userId:o,streamType:n,view:K.value})}catch(e){console.log("error :>> ",e)}}function ie(e){}function ce(){W.value=!0,G()}function le(e){console.log("event :>> 对方已挂断",e),re()}function ue(e){console.log("error :>> ",e),j.showVideo=!1}return s((()=>oe.value),(e=>{j.showVideo&&(e===R.IN_CALL?async function(){X.value?se():(Y&&clearTimeout(Y),Y=setTimeout((async()=>{W.value||ne(R.NO_RESPONSE)}),6e4))}():re())}),{immediate:!0}),(e,o)=>(t(),r("div",N,[a(i("div",{class:"video-box",ref_key:"videoRef",ref:K},null,512),[[c,W.value]]),a(i("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:Q},null,512),[[c,W.value]]),a(i("div",S,[l(u(f),{size:58,round:"",src:u(Z).avatar},null,8,["src"]),i("span",w,d(u(Z).name),1),i("span",O,d(u(ee)),1)],512),[[c,u(F)||!W.value]]),i("div",k,[i("div",L,[u(X)&&!W.value||W.value?(t(),r(v,{key:0},[l(u(p),{circle:"",onClick:u(P),class:E({bordered:u(B)})},{icon:m((()=>[l(u(I),{size:"30",color:u(B)?"#fff":"#626262",component:u(B)?u(T):u(V)},null,8,["color","component"])])),_:1},8,["onClick","class"]),h],64)):(t(),r(v,{key:1},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>ne(u(R).REJECTED))},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),D],64))]),i("div",C,[u(X)&&!W.value||W.value?(t(),r(v,{key:0},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:te},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),b],64)):(t(),r(v,{key:1},[l(u(p),{circle:"",color:"#2ac98b",onClick:se},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),x],64))])])]))}});export{U as default};
1
+ import{defineComponent as e,ref as o,computed as n,watch as t,onBeforeUnmount as s,openBlock as r,createElementBlock as a,withDirectives as l,createElementVNode as i,vShow as c,createVNode as u,unref as d,toDisplayString as v,Fragment as m,normalizeClass as p,withCtx as f}from"vue";import{NAvatar as g,NButton as I,NIcon as h}from"naive-ui";import{Mic as A,MicOffCircle as y,Call as E}from"@vicons/ionicons5";import"lodash-es";import"date-fns";import{AV_STATUS as V,CHAT_TYPE as R}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import{avFinishApi as w}from"../api/index.js";import{useVideo as k}from"../hooks/useVideo.js";import S from"trtc-sdk-v5";const M={class:"video-wrapper"},b={class:"user"},T={class:"name"},C={class:"tip"},_={class:"opt-btn"},x={class:"btn"},N=i("span",null,"静音",-1),L=i("span",null,"拒接",-1),D={class:"btn"},H=i("span",null,"挂断",-1),j=i("span",null,"接听",-1);var z=e({__name:"Video",setup(e){const{sendMessage:z,state:U,trtc:F,timing:O,voiceOpen:G,isAudio:J,isCall:P,startTimer:$,resetTimer:q,toggleAudio:B,messageTypeText:K,time:Q,installEventHandlers:W,uninstallEventHandlers:X}=k(),Y=o(),Z=o(),ee=o(!1);let oe=null;const ne=n((()=>{var e,o,n;return P.value?{avatar:U.currentSessionItem.avatar,name:U.currentSessionItem.name,userId:U.currentSessionItem.receiver}:{avatar:null==(e=U.currentAVMsg.currentMsg)?void 0:e.senderAvatar,name:null==(o=U.currentAVMsg.currentMsg)?void 0:o.senderName,userId:null==(n=U.currentAVMsg.currentMsg)?void 0:n.sender}})),te=n((()=>ee.value?J.value?O.value:"":P.value?"正在呼叫...":`邀请你${K.value}问诊...`)),se=n((()=>{var e,o;return null==(o=null==(e=U.currentAVMsg.currentMsg)?void 0:e.content)?void 0:o.avStatus}));async function re(e=V.FINISHED){z({chatType:R.SINGLE,content:{msg:e===V.FINISHED?""+Q.seconds:"s",chatMessageType:U.currentAVMsg.chatMessageType,avStatus:e},receiver:ne.value.userId}),await w({recordId:U.currentAVMsg.currentMsg.id,status:e,duration:e===V.FINISHED?Q.seconds:0})}async function ae(){const e=await S.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(U.showVideo=!1);try{if(await F.enterRoom({strRoomId:U.currentAVMsg.strRoomId,sdkAppId:parseInt(U.userInfo.sdkAppID),userId:U.userInfo.id,userSig:U.userInfo.userSig}),P.value||(ee.value=!0,$()),W({handleError:me,handleRemoteUserEnter:de,handleRemoteAudioAvailable:ue,handleRemoteUserExit:ve,handleRemoteVideoAvailable:ce}),await F.startLocalAudio(),J.value)return;await F.startLocalVideo({view:Z.value})}catch(e){console.log("error :>> ",e),U.showVideo=!1}}function le(){P.value&&!ee.value?re(V.CANCELED):re()}async function ie(){try{if(U.showVideo=!1,X({handleError:me,handleRemoteUserEnter:de,handleRemoteAudioAvailable:ue,handleRemoteUserExit:ve,handleRemoteVideoAvailable:ce}),await F.exitRoom(),await F.stopLocalAudio(),J.value)return;await F.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ce(e){const{userId:o,streamType:n}=e;try{await F.startRemoteVideo({userId:o,streamType:n,view:Y.value})}catch(e){console.log("error :>> ",e)}}function ue(e){}function de(){ee.value=!0,$()}function ve(e){console.log("event :>> 对方已挂断",e),ie()}function me(e){console.log("error :>> ",e),U.showVideo=!1}return t((()=>se.value),(e=>{U.showVideo&&(e===V.IN_CALL?async function(){P.value?ae():(oe&&clearTimeout(oe),oe=setTimeout((async()=>{ee.value||re(V.NO_RESPONSE)}),6e4))}():ie())}),{immediate:!0}),s((()=>{ie()})),(e,o)=>(r(),a("div",M,[l(i("div",{class:"video-box",ref_key:"videoRef",ref:Y},null,512),[[c,ee.value]]),l(i("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:Z},null,512),[[c,ee.value]]),l(i("div",b,[u(d(g),{size:58,round:"",src:d(ne).avatar},null,8,["src"]),i("span",T,v(d(ne).name),1),i("span",C,v(d(te)),1)],512),[[c,d(J)||!ee.value]]),i("div",_,[i("div",x,[d(P)&&!ee.value||ee.value?(r(),a(m,{key:0},[u(d(I),{circle:"",onClick:d(B),class:p({bordered:d(G)})},{icon:f((()=>[u(d(h),{size:"30",color:d(G)?"#fff":"#626262",component:d(G)?d(A):d(y)},null,8,["color","component"])])),_:1},8,["onClick","class"]),N],64)):(r(),a(m,{key:1},[u(d(I),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>re(d(V).REJECTED))},{icon:f((()=>[u(d(h),{size:"30",component:d(E)},null,8,["component"])])),_:1}),L],64))]),i("div",D,[d(P)&&!ee.value||ee.value?(r(),a(m,{key:0},[u(d(I),{circle:"",color:"#f17568",class:"btn--rotate",onClick:le},{icon:f((()=>[u(d(h),{size:"30",component:d(E)},null,8,["component"])])),_:1}),H],64)):(r(),a(m,{key:1},[u(d(I),{circle:"",color:"#2ac98b",onClick:ae},{icon:f((()=>[u(d(h),{size:"30",component:d(E)},null,8,["component"])])),_:1}),j],64))])])]))}});export{z as default};
@@ -1 +1 @@
1
- import{inject as e}from"vue";import{cloneDeep as t}from"lodash-es";import{formatTime as s,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as i,InjectionIChatStompClient as m,InjectionIChatEmits as o}from"../types/index.js";import{MESSAGE_TYPE as r}from"../constants/index.js";import{useIntervalFn as c}from"@vueuse/core";function a(){const a=e(i),T=e(m),d=e(o),{pause:u,resume:g,isActive:p}=c((()=>{const e=t(a.msgList);e.some((e=>{const{sendTime:t}=e;return!(Date.now()-new Date(t).getTime()>=36e5)&&(e.__sendTime=s(t).recordTime,!0)})),a.msgList=e,l()||u()}),6e4,{immediate:!1});function l(){return!!a.msgList.length&&a.msgList.some((e=>Date.now()-new Date(e.sendTime).getTime()<36e5))}return{state:a,setMsgList:function(e=[]){u(),a.msgList=e.map((e=>{var t,i,m;return Object.assign(e,{__time:s(e.sendTime).msgTime,__content:(m=e.content.chatMessageType,[r.TEXT,r.TEXT].includes(m)?n(null==(t=e.content)?void 0:t.msg):null==(i=e.content)?void 0:i.msg),__sendTime:s(e.sendTime).recordTime}),e})).sort(((e,t)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime())),l()&&g()},stompClient:T,emit:d,sendMessage:async function(e){try{T.value.send("/app/chat/send",{},JSON.stringify({chatType:a.currentSessionItem.chatType,receiver:a.currentSessionItem.receiver,...e}))}catch(e){console.log("error :>> ",e)}}}}export{a as useState};
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:l}=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,f()||u()}),6e4,{immediate:!1});function f(){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,o;Object.assign(e,{__time:s(e.sendTime).msgTime,__content:(o=e.content.chatMessageType,[c.TEXT,c.TEXT].includes(o)?n(null==(t=e.content)?void 0:t.msg):null==(m=e.content)?void 0:m.msg),__sendTime:s(e.sendTime).recordTime}),e.content.chatMessageType!==c.FILE||e.__size||i(e.content.fileUrl).then((t=>{e.__size=t}))})),f()&&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){console.log("error :>> ",e)}}}}export{T as useState};
@@ -1,4 +1,12 @@
1
1
  import TRTC from 'trtc-sdk-v5';
2
+ import { AnyFn } from '../../../../shared/types';
3
+ type EventHandlers = {
4
+ handleError: AnyFn;
5
+ handleRemoteUserEnter: AnyFn;
6
+ handleRemoteAudioAvailable: AnyFn;
7
+ handleRemoteUserExit: AnyFn;
8
+ handleRemoteVideoAvailable: AnyFn;
9
+ };
2
10
  export declare function useVideo(): {
3
11
  state: import("../types").IState;
4
12
  sendMessage: (message: {
@@ -21,4 +29,7 @@ export declare function useVideo(): {
21
29
  timer: any;
22
30
  seconds: number;
23
31
  };
32
+ installEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: EventHandlers) => void;
33
+ uninstallEventHandlers: ({ handleError, handleRemoteUserEnter, handleRemoteAudioAvailable, handleRemoteUserExit, handleRemoteVideoAvailable }: EventHandlers) => void;
24
34
  };
35
+ export {};
@@ -1 +1 @@
1
- import{ref as e,computed as t,onBeforeUnmount as s}from"vue";import{useState as a}from"./useState.js";import{MESSAGE_TYPE as i}from"../constants/index.js";import o from"trtc-sdk-v5";import{formatSeconds as n}from"../utils/index.js";function r(){const r={timer:null,seconds:0},{state:u,sendMessage:l}=a(),c=e(""),m=e(!0),d=e(!0),v=t((()=>u.currentAVMsg.chatMessageType===i.AUDIO)),p=t((()=>"call"===u.currentAVMsg.callMode)),g=t((()=>v.value?"语音":"视频")),f=o.create();function A(){c.value="00:00:00",r.timer&&clearInterval(r.timer),r.timer=null,r.seconds=0}return s((()=>{A()})),{state:u,sendMessage:l,trtc:f,timing:c,voiceOpen:m,videocamOpen:d,isAudio:v,isCall:p,startTimer:function(){A(),r.timer=setInterval((()=>{r.seconds++,c.value=n(r.seconds)}),1e3)},resetTimer:A,toggleAudio:async function(){await f.updateLocalAudio({mute:!m.value}),m.value=!m.value},toggleVideo:async function(){await f.updateLocalVideo({mute:!d.value}),d.value=!d.value},messageTypeText:g,time:r}}export{r as useVideo};
1
+ import{ref as e,computed as t,onBeforeUnmount as E}from"vue";import{useState as a}from"./useState.js";import{MESSAGE_TYPE as n}from"../constants/index.js";import o from"trtc-sdk-v5";import{formatSeconds as l}from"../utils/index.js";function i(){const i={timer:null,seconds:0},{state:r,sendMessage:s}=a(),u=e(""),d=e(!0),m=e(!0),c=t((()=>r.currentAVMsg.chatMessageType===n.AUDIO)),R=t((()=>"call"===r.currentAVMsg.callMode)),T=t((()=>c.value?"语音":"视频")),A=o.create();function v(){u.value="00:00:00",i.timer&&clearInterval(i.timer),i.timer=null,i.seconds=0}return E((()=>{v()})),{state:r,sendMessage:s,trtc:A,timing:u,voiceOpen:d,videocamOpen:m,isAudio:c,isCall:R,startTimer:function(){v(),i.timer=setInterval((()=>{i.seconds++,u.value=l(i.seconds)}),1e3)},resetTimer:v,toggleAudio:async function(){await A.updateLocalAudio({mute:!d.value}),d.value=!d.value},toggleVideo:async function(){await A.updateLocalVideo({mute:!m.value}),m.value=!m.value},messageTypeText:T,time:i,installEventHandlers:function({handleError:e,handleRemoteUserEnter:t,handleRemoteAudioAvailable:E,handleRemoteUserExit:a,handleRemoteVideoAvailable:n}){A.on(o.EVENT.ERROR,e),A.on(o.EVENT.REMOTE_USER_ENTER,t),A.on(o.EVENT.REMOTE_AUDIO_AVAILABLE,E),A.on(o.EVENT.REMOTE_USER_EXIT,a),c.value||A.on(o.EVENT.REMOTE_VIDEO_AVAILABLE,n)},uninstallEventHandlers:function({handleError:e,handleRemoteUserEnter:t,handleRemoteAudioAvailable:E,handleRemoteUserExit:a,handleRemoteVideoAvailable:n}){A.off(o.EVENT.ERROR,e),A.off(o.EVENT.REMOTE_USER_ENTER,t),A.off(o.EVENT.REMOTE_AUDIO_AVAILABLE,E),A.off(o.EVENT.REMOTE_USER_EXIT,a),c.value||A.off(o.EVENT.REMOTE_VIDEO_AVAILABLE,n)}}}export{i as useVideo};