cnhis-design-vue 3.3.3-release.9 → 3.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/big-table/src/hooks/useBatchEditing.js +25 -24
- package/es/components/button-print/index.d.ts +98 -8
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +98 -8
- package/es/components/button-print/src/ButtonPrint.vue2.js +12 -1
- package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +11 -2
- package/es/components/button-print/src/components/IdentityVerification.vue2.js +3 -2
- package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +44 -6
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +194 -41
- package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +29 -2
- package/es/components/button-print/src/components/OldPrintComponent.vue2.js +34 -5
- package/es/components/button-print/src/utils/print.d.ts +7 -5
- package/es/components/button-print/src/utils/print.js +183 -7
- package/es/components/button-print/style/index.css +1 -1
- package/es/components/calendar/src/Calendar.vue2.js +15 -5
- package/es/components/callback/src/components/render/popupMaps.d.ts +5 -0
- package/es/components/card-render/src/components/index.d.ts +23 -23
- package/es/components/classification/index.d.ts +258 -5
- package/es/components/classification/src/components/search-filter/index.vue.d.ts +258 -5
- package/es/components/classification/src/components/set-classification/index.vue.d.ts +258 -5
- package/es/components/classification/src/index.vue.d.ts +258 -5
- package/es/components/fabric-chart/src/components/PopupMenu.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +6 -2
- package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +3 -2
- package/es/components/fabric-chart/src/hooks/temperature/useOther.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +58 -15
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +4 -3
- package/es/components/field-editor/index.d.ts +5 -0
- package/es/components/field-editor/src/FieldEditor.vue.d.ts +5 -0
- package/es/components/field-set/src/FieldColor.vue.d.ts +4 -1
- package/es/components/field-set/src/FieldFilter.vue.d.ts +4 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +4 -1
- package/es/components/field-set/src/components/table-row.vue.d.ts +2 -1
- package/es/components/field-set/src/components/table-row.vue2.js +21 -6
- package/es/components/field-set/src/constants/index.js +4 -4
- package/es/components/field-set/src/types/index.d.ts +2 -1
- package/es/components/form-config/index.d.ts +63 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +63 -0
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +5 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +50 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue2.js +4 -4
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +5 -0
- package/es/components/form-config/src/constants/index.d.ts +31 -1
- package/es/components/form-config/src/constants/index.js +150 -1
- package/es/components/form-config/src/hooks/useConfigurationField.d.ts +2 -2
- package/es/components/form-config/src/hooks/useConfigurationField.js +53 -6
- package/es/components/form-config/src/hooks/useLocale.d.ts +6 -0
- package/es/components/form-config/src/hooks/useLocale.js +34 -0
- package/es/components/form-config/src/types/index.d.ts +12 -0
- package/es/components/form-render/index.d.ts +5 -0
- package/es/components/form-render/src/FormRender.vue.d.ts +5 -0
- package/es/components/form-render/src/FormRender.vue2.js +1 -0
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +5 -0
- package/es/components/form-render/src/components/renderer/date.d.ts +3 -1
- package/es/components/form-render/src/components/renderer/date.js +12 -10
- package/es/components/form-render/src/components/renderer/formItem.d.ts +2 -0
- package/es/components/form-render/src/components/renderer/formItem.js +10 -3
- package/es/components/form-render/src/components/renderer/levelSearchCascader/index.js +4 -2
- package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +1 -0
- package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +1 -0
- package/es/components/form-render/src/components/renderer/radio_checkbox.js +9 -3
- package/es/components/form-render/src/constants/index.d.ts +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +5 -2
- package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +2 -0
- package/es/components/form-render/src/hooks/useFieldNormalize.js +15 -0
- package/es/components/form-render/src/hooks/useNuiThemeOverrides.d.ts +1 -2
- package/es/components/form-render/src/types/index.d.ts +1 -0
- package/es/components/form-render/style/index.css +1 -1
- package/es/components/iho-chat/index.d.ts +897 -97
- package/es/components/iho-chat/src/Index.vue.d.ts +897 -97
- package/es/components/iho-chat/src/Index.vue2.js +14 -6
- package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +24 -1
- package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +179 -6
- package/es/components/iho-chat/src/components/ChatFile.vue2.js +48 -28
- package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +61 -5
- package/es/components/iho-chat/src/components/ChatFooter.vue2.js +106 -44
- package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +327 -13
- package/es/components/iho-chat/src/components/ChatHeader.vue2.js +18 -17
- package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +232 -17
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +299 -272
- package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +49 -3
- package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +24 -1
- package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +48 -2
- package/es/components/iho-chat/src/components/ContextMenu.js +33 -18
- package/es/components/iho-chat/src/components/ImageLightbox.vue.d.ts +104 -0
- package/es/components/iho-chat/src/components/ImageLightbox.vue.js +6 -0
- package/es/components/iho-chat/src/components/ImageLightbox.vue2.js +307 -0
- package/es/components/iho-chat/src/components/MessageEvent.vue.d.ts +24 -1
- package/es/components/iho-chat/src/components/MessageMergeForward.vue.d.ts +51 -4
- package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +77 -31
- package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +223 -98
- package/es/components/iho-chat/src/components/PersonProfile.vue.d.ts +24 -1
- package/es/components/iho-chat/src/components/SelectLabel.vue.d.ts +1 -1
- package/es/components/iho-chat/src/components/SiderList.vue.d.ts +24 -1
- package/es/components/iho-chat/src/components/Video.vue.d.ts +44 -26
- package/es/components/iho-chat/src/components/Video.vue2.js +56 -49
- package/es/components/iho-chat/src/hooks/useData.d.ts +51 -4
- package/es/components/iho-chat/src/hooks/useVideo.d.ts +83 -16
- package/es/components/iho-chat/src/hooks/useVideo.js +439 -43
- package/es/components/iho-chat/src/types/index.d.ts +37 -1
- package/es/components/iho-chat/src/utils/emoji.d.ts +1 -1
- package/es/components/iho-chat/src/utils/emoji.js +1 -1
- package/es/components/iho-chat/src/utils/index.d.ts +2 -0
- package/es/components/iho-chat/src/utils/index.js +14 -1
- package/es/components/iho-chat/style/index.css +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useAutoFocus.js +0 -22
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +36 -4
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/index.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +2 -0
- package/es/components/index.js +2 -1
- package/es/components/info-header/index.d.ts +24 -17
- package/es/components/info-header/src/InfoHeader.vue.d.ts +24 -17
- package/es/components/info-header/src/InfoHeader.vue2.js +2 -2
- package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +1 -0
- package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue2.js +56 -22
- package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +4 -2
- package/es/components/info-header/src/components/infoDescription/DescriptionList.vue2.js +1 -1
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +15 -17
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +5 -0
- package/es/components/info-header/src/constants/index.d.ts +1 -1
- package/es/components/info-header/src/hooks/useThemeOverrides.d.ts +1 -2
- package/es/components/keyboard/index.d.ts +9 -0
- package/es/components/keyboard/src/Keyboard.vue.d.ts +9 -0
- package/es/components/keyboard/src/Keyboard.vue2.js +33 -9
- package/es/components/keyboard/src/components/NumberPanel.vue.d.ts +4 -0
- package/es/components/keyboard/src/components/NumberPanel.vue2.js +50 -17
- package/es/components/keyboard/src/types.d.ts +17 -0
- package/es/components/keyboard/src/types.js +1 -0
- package/es/components/scale-view/index.d.ts +13 -0
- package/es/components/scale-view/src/ScaleView.vue.d.ts +13 -0
- package/es/components/scale-view/src/hooks/scaleview-computed.js +2 -1
- package/es/components/scale-view/src/hooks/scaleview-props.d.ts +4 -0
- package/es/components/scale-view/src/hooks/scaleview-props.js +4 -0
- package/es/components/search-cascader/src/utils/index.d.ts +1 -1
- package/es/components/select-person/src/SelectPerson.vue2.js +8 -1
- package/es/components/shortcut-provider/src/hooks/useShortcuts.js +1 -1
- package/es/components/shortcut-provider/src/types/index.d.ts +1 -0
- package/es/components/shortcut-provider/src/utils/index.d.ts +1 -1
- package/es/components/shortcut-provider/src/utils/index.js +3 -1
- package/es/components/shortcut-setter/index.d.ts +5 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +5 -0
- package/es/components/table-filter/index.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +246 -1
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue2.js +8 -2
- package/es/components/table-filter/src/components/classify-filter/components/Base/DateOption.vue.d.ts +104 -0
- package/es/components/table-filter/src/components/classify-filter/components/Base/DateOption.vue.js +6 -0
- package/es/components/table-filter/src/components/classify-filter/components/Base/DateOption.vue2.js +250 -0
- package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +116 -0
- package/es/components/table-filter/src/components/classify-filter/components/Date.vue2.js +43 -4
- package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +117 -1
- package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue2.js +45 -8
- package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +233 -1
- package/es/components/table-filter/src/components/classify-filter/helpers/options.d.ts +5 -1
- package/es/components/table-filter/src/components/classify-filter/helpers/options.js +74 -2
- package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +258 -5
- package/es/components/table-filter/src/components/classify-filter/index.vue2.js +15 -6
- package/es/components/table-filter/src/components/render-widget/components/DateInner.vue.d.ts +1 -1
- package/es/components/table-filter/src/components/render-widget/components/DateOut.vue.d.ts +1 -1
- package/es/components/table-filter/src/components/render-widget/components/DateQuickBtn/index.vue2.js +1 -1
- package/es/components/table-filter/src/components/render-widget/components/DateRangeInner.vue.d.ts +1 -1
- package/es/components/table-filter/src/components/render-widget/components/index.d.ts +3 -3
- package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +32 -4
- package/es/components/table-filter/src/components/render-widget/helpers/presetValToTimestamp.d.ts +1 -0
- package/es/components/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +38 -2
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +3 -3
- package/es/components/table-filter/src/hooks/useAdvanced.js +5 -4
- package/es/components/table-filter/src/tool/baseOptions.js +8 -1
- package/es/components/table-filter/src/types/enums.d.ts +5 -0
- package/es/components/table-filter/src/types/enums.js +6 -1
- package/es/components/time-picker/index.d.ts +36 -4
- package/es/components/time-picker/src/TimePicker.vue.d.ts +36 -4
- package/es/components/time-picker/src/TimePicker.vue2.js +98 -13
- package/es/components/vertify/index.d.ts +1 -0
- package/es/components/vertify/index.js +1 -0
- package/es/components/vertify/src/components/IdentityVerification.vue.d.ts +89 -0
- package/es/components/vertify/src/components/IdentityVerification.vue.js +6 -0
- package/es/components/vertify/src/components/IdentityVerification.vue2.js +256 -0
- package/es/components/vertify/src/utils/dialog.d.ts +7 -0
- package/es/components/vertify/src/utils/dialog.js +73 -0
- package/es/components/vertify/src/utils/index.d.ts +11 -0
- package/es/components/vertify/src/utils/index.js +24 -0
- package/es/components/vod-chunk-upload/index.d.ts +13 -0
- package/es/components/vod-chunk-upload/src/chunk-upload-new.vue.d.ts +19 -2
- package/es/components/vod-chunk-upload/src/chunk-upload-new.vue2.js +104 -75
- package/es/components/vod-chunk-upload/src/hooks/upload-computed.d.ts +1 -0
- package/es/components/vod-chunk-upload/src/hooks/upload-computed.js +20 -3
- package/es/components/vod-chunk-upload/src/hooks/upload-data.d.ts +4 -0
- package/es/components/vod-chunk-upload/src/hooks/upload-data.js +6 -2
- package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +13 -0
- package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue2.js +6 -1
- package/es/components/vod-chunk-upload/style/index.css +1 -1
- package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
- package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
- package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
- package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
- package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
- package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
- package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
- package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
- package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
- package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
- package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/components/InputNumberSlash/InputNumberSlash.js +1 -1
- package/es/shared/hooks/useDateTime.d.ts +1 -1
- package/es/shared/hooks/useDateTime.js +1 -1
- package/es/shared/hooks/useLevelSearchCascader.js +3 -3
- package/es/shared/package.json.js +2 -2
- package/es/shared/utils/fabricjs/index.js +1 -1
- package/package.json +5 -5
- package/es/components/audio-sdk/src/utils/recorder/fft.d.ts +0 -4
- package/es/components/audio-sdk/src/utils/recorder/mp3-engine.d.ts +0 -4
- package/es/components/audio-sdk/src/utils/recorder/mp3.d.ts +0 -4
- package/es/components/audio-sdk/src/utils/recorder/recorder.d.ts +0 -4
- package/es/components/audio-sdk/src/utils/recorder/wave.d.ts +0 -4
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- package/es/shared/utils/fabricjs/index.d.ts +0 -6823
- package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1,14 +1,14 @@
|
|
1
|
-
import { ref, computed, onBeforeUnmount } from 'vue';
|
1
|
+
import { ref, computed, onBeforeUnmount, nextTick } from 'vue';
|
2
2
|
import { useData } from './useData.js';
|
3
3
|
import 'stompjs';
|
4
4
|
import 'sockjs-client/dist/sockjs.min.js';
|
5
5
|
import { MESSAGE_TYPE } from '../constants/index.js';
|
6
6
|
import '../api/index.js';
|
7
|
-
import { formatSeconds } from '../utils/index.js';
|
7
|
+
import { formatSeconds, $message } from '../utils/index.js';
|
8
8
|
import 'lodash-es';
|
9
9
|
import TRTC from 'trtc-sdk-v5';
|
10
10
|
|
11
|
-
function useVideo() {
|
11
|
+
function useVideo(config = {}) {
|
12
12
|
const time = {
|
13
13
|
timer: null,
|
14
14
|
seconds: 0
|
@@ -21,6 +21,11 @@ function useVideo() {
|
|
21
21
|
const timing = ref("");
|
22
22
|
const voiceClose = ref(false);
|
23
23
|
const videocamClose = ref(false);
|
24
|
+
const isConnect = ref(false);
|
25
|
+
const remoteUsers = ref([]);
|
26
|
+
const videoRefs = ref(/* @__PURE__ */ new Map());
|
27
|
+
const retryTimers = ref(/* @__PURE__ */ new Map());
|
28
|
+
const retryCount = ref(/* @__PURE__ */ new Map());
|
24
29
|
const isAudio = computed(() => state.currentAVMsg.chatMessageType === MESSAGE_TYPE.AUDIO);
|
25
30
|
const isCall = computed(() => state.currentAVMsg.callMode === "call");
|
26
31
|
const messageTypeText = computed(() => isAudio.value ? function() {
|
@@ -39,6 +44,7 @@ function useVideo() {
|
|
39
44
|
}
|
40
45
|
}());
|
41
46
|
const trtc = TRTC.create();
|
47
|
+
const MAIN_STREAM_TYPE = TRTC.TYPE.STREAM_TYPE_MAIN;
|
42
48
|
function startTimer() {
|
43
49
|
resetTimer();
|
44
50
|
time.timer = setInterval(() => {
|
@@ -52,50 +58,419 @@ function useVideo() {
|
|
52
58
|
time.timer = null;
|
53
59
|
time.seconds = 0;
|
54
60
|
}
|
55
|
-
async function
|
56
|
-
|
57
|
-
|
61
|
+
async function checkTRTCSupport() {
|
62
|
+
try {
|
63
|
+
const checkResult = await TRTC.isSupported();
|
64
|
+
if (!checkResult.result) {
|
65
|
+
$message.error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u89C6\u9891\u901A\u8BDD\uFF0C\u8BF7\u4F7F\u7528\u6700\u65B0\u7248Chrome\u6D4F\u89C8\u5668");
|
66
|
+
return false;
|
67
|
+
}
|
68
|
+
if (!checkResult.detail.isH264EncodeSupported) {
|
69
|
+
$message.error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u89C6\u9891\u7F16\u7801");
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
if (!checkResult.detail.isH264DecodeSupported) {
|
73
|
+
$message.error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u89C6\u9891\u89E3\u7801");
|
74
|
+
return false;
|
75
|
+
}
|
76
|
+
return true;
|
77
|
+
} catch (error) {
|
78
|
+
console.error("Error checking TRTC support:", error);
|
79
|
+
$message.error("\u68C0\u67E5\u6D4F\u89C8\u5668\u652F\u6301\u65F6\u51FA\u9519");
|
80
|
+
return false;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
function findUser(userId) {
|
84
|
+
return remoteUsers.value.find((user) => user.id === userId);
|
85
|
+
}
|
86
|
+
function findUserIndex(userId) {
|
87
|
+
return remoteUsers.value.findIndex((user) => user.id === userId);
|
88
|
+
}
|
89
|
+
function addOrUpdateUser(userId, updates) {
|
90
|
+
const userIndex = findUserIndex(userId);
|
91
|
+
if (userIndex !== -1) {
|
92
|
+
const oldUser = {
|
93
|
+
...remoteUsers.value[userIndex]
|
94
|
+
};
|
95
|
+
Object.assign(remoteUsers.value[userIndex], updates);
|
96
|
+
console.log(`Updated user ${userId}:`, {
|
97
|
+
old: oldUser,
|
98
|
+
new: remoteUsers.value[userIndex]
|
99
|
+
});
|
100
|
+
} else {
|
101
|
+
const newUser = {
|
102
|
+
id: userId,
|
103
|
+
name: updates.name || userId,
|
104
|
+
hasVideo: updates.hasVideo || false,
|
105
|
+
hasAudio: updates.hasAudio || false
|
106
|
+
};
|
107
|
+
remoteUsers.value.push(newUser);
|
108
|
+
console.log(`Added new user ${userId}:`, newUser);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
function removeUser(userId) {
|
112
|
+
console.log("Removing user:", userId);
|
113
|
+
const userIndex = findUserIndex(userId);
|
114
|
+
if (userIndex !== -1) {
|
115
|
+
remoteUsers.value.splice(userIndex, 1);
|
116
|
+
}
|
117
|
+
videoRefs.value.delete(userId);
|
118
|
+
clearRetryTimer(userId);
|
119
|
+
stopRemoteVideo(userId).catch((error) => {
|
120
|
+
console.warn("Error stopping remote video during user removal:", error);
|
58
121
|
});
|
59
|
-
|
122
|
+
console.log("User removed and cleaned up:", userId);
|
60
123
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
124
|
+
function clearRetryTimer(userId) {
|
125
|
+
const timer = retryTimers.value.get(userId);
|
126
|
+
if (timer) {
|
127
|
+
clearTimeout(timer);
|
128
|
+
retryTimers.value.delete(userId);
|
129
|
+
}
|
130
|
+
retryCount.value.delete(userId);
|
131
|
+
}
|
132
|
+
async function tryRenderRemoteVideo(userId) {
|
133
|
+
var _a, _b;
|
134
|
+
const videoElement = videoRefs.value.get(userId);
|
135
|
+
const user = findUser(userId);
|
136
|
+
console.log("tryRenderRemoteVideo called for user:", userId);
|
137
|
+
console.log("User data:", user);
|
138
|
+
console.log("Is connected:", isConnect.value);
|
139
|
+
if (!videoElement) {
|
140
|
+
console.log("Video element not found for user:", userId, "Available refs:", Array.from(videoRefs.value.keys()));
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
if (!isConnect.value) {
|
144
|
+
console.log("Not connected, skipping video render for user:", userId);
|
145
|
+
return;
|
146
|
+
}
|
147
|
+
if (!(user == null ? void 0 : user.hasVideo)) {
|
148
|
+
console.log("User has no video stream:", userId, "User hasVideo:", user == null ? void 0 : user.hasVideo);
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
try {
|
152
|
+
const existingVideo = videoElement.querySelector("video");
|
153
|
+
if (existingVideo) {
|
154
|
+
console.log("Video already playing for user:", userId);
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
await trtc.startRemoteVideo({
|
158
|
+
userId,
|
159
|
+
streamType: MAIN_STREAM_TYPE,
|
160
|
+
view: videoElement
|
161
|
+
});
|
162
|
+
console.log("Successfully rendered video for user:", userId);
|
163
|
+
clearRetryTimer(userId);
|
164
|
+
} catch (error) {
|
165
|
+
console.warn("Failed to render video for user:", userId, error);
|
166
|
+
if (error.code === "INVALID_OPERATION" && (((_a = error.message) == null ? void 0 : _a.includes("does not publishing stream")) || ((_b = error.message) == null ? void 0 : _b.includes("not exist"))) || error.code === "OPERATION_ABORT") {
|
167
|
+
console.log("User no longer exists or not publishing, removing from retry:", userId);
|
168
|
+
clearRetryTimer(userId);
|
169
|
+
addOrUpdateUser(userId, {
|
170
|
+
hasVideo: false
|
171
|
+
});
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
async function stopRemoteVideo(userId) {
|
176
|
+
var _a;
|
177
|
+
try {
|
178
|
+
await trtc.stopRemoteVideo({
|
179
|
+
userId,
|
180
|
+
streamType: MAIN_STREAM_TYPE
|
181
|
+
});
|
182
|
+
console.log("Stopped remote video for user:", userId);
|
183
|
+
} catch (error) {
|
184
|
+
if (error.code === "INVALID_OPERATION" && ((_a = error.message) == null ? void 0 : _a.includes("does not exist"))) {
|
185
|
+
console.log("User already exited, no need to stop video:", userId);
|
186
|
+
} else {
|
187
|
+
console.warn("Error stopping remote video for user:", userId, error);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
function isUserValid(userId) {
|
192
|
+
const user = findUser(userId);
|
193
|
+
return user !== void 0;
|
194
|
+
}
|
195
|
+
function cleanupInvalidUsers() {
|
196
|
+
const validUserIds = remoteUsers.value.map((user) => user.id);
|
197
|
+
const retryUserIds = Array.from(retryTimers.value.keys());
|
198
|
+
retryUserIds.forEach((userId) => {
|
199
|
+
if (!validUserIds.includes(userId)) {
|
200
|
+
console.log("Cleaning up retry timer for invalid user:", userId);
|
201
|
+
clearRetryTimer(userId);
|
202
|
+
}
|
64
203
|
});
|
65
|
-
|
66
|
-
|
67
|
-
function
|
68
|
-
|
69
|
-
handleRemoteUserEnter,
|
70
|
-
handleRemoteAudioAvailable,
|
71
|
-
handleRemoteUserExit,
|
72
|
-
handleRemoteVideoAvailable
|
73
|
-
}) {
|
74
|
-
trtc.on(TRTC.EVENT.ERROR, handleError);
|
75
|
-
trtc.on(TRTC.EVENT.REMOTE_USER_ENTER, handleRemoteUserEnter);
|
76
|
-
trtc.on(TRTC.EVENT.REMOTE_AUDIO_AVAILABLE, handleRemoteAudioAvailable);
|
77
|
-
trtc.on(TRTC.EVENT.REMOTE_USER_EXIT, handleRemoteUserExit);
|
78
|
-
if (isAudio.value)
|
204
|
+
}
|
205
|
+
let userConnectionCheckInterval = null;
|
206
|
+
function startUserConnectionMonitoring() {
|
207
|
+
if (userConnectionCheckInterval)
|
79
208
|
return;
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
209
|
+
console.log("Starting user connection monitoring...");
|
210
|
+
userConnectionCheckInterval = setInterval(() => {
|
211
|
+
if (!isConnect.value) {
|
212
|
+
stopUserConnectionMonitoring();
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
remoteUsers.value.forEach((user) => {
|
216
|
+
if (!user.hasVideo && !user.hasAudio) {
|
217
|
+
console.log(`User ${user.id} has no streams for extended period, checking...`);
|
218
|
+
}
|
219
|
+
});
|
220
|
+
}, 1e4);
|
221
|
+
}
|
222
|
+
function stopUserConnectionMonitoring() {
|
223
|
+
if (userConnectionCheckInterval) {
|
224
|
+
clearInterval(userConnectionCheckInterval);
|
225
|
+
userConnectionCheckInterval = null;
|
226
|
+
console.log("Stopped user connection monitoring");
|
227
|
+
}
|
228
|
+
}
|
229
|
+
function checkAndRenderAllVideos() {
|
230
|
+
console.log("Checking and rendering all videos...");
|
231
|
+
cleanupInvalidUsers();
|
232
|
+
const currentUsers = remoteUsers.value.filter((user) => user.hasVideo);
|
233
|
+
console.log("Current users with video:", currentUsers.map((u) => u.id));
|
234
|
+
currentUsers.forEach((user) => {
|
235
|
+
const videoElement = videoRefs.value.get(user.id);
|
236
|
+
if (videoElement) {
|
237
|
+
const hasExistingVideo = videoElement.querySelector("video");
|
238
|
+
if (user.hasVideo && !hasExistingVideo) {
|
239
|
+
console.log(`Attempting to render video for user: ${user.id}`);
|
240
|
+
tryRenderRemoteVideo(user.id);
|
241
|
+
}
|
242
|
+
} else {
|
243
|
+
console.log(`No video element found for user: ${user.id}`);
|
244
|
+
}
|
245
|
+
});
|
246
|
+
}
|
247
|
+
async function forceRenderAllVideos() {
|
248
|
+
var _a;
|
249
|
+
console.log("Force rendering all available videos...");
|
250
|
+
const usersWithVideo = remoteUsers.value.filter((user) => user.hasVideo);
|
251
|
+
console.log("Users with video to force render:", usersWithVideo.map((u) => u.id));
|
252
|
+
for (const user of usersWithVideo) {
|
253
|
+
const videoElement = videoRefs.value.get(user.id);
|
254
|
+
if (videoElement && user.hasVideo) {
|
255
|
+
try {
|
256
|
+
const existingVideo = videoElement.querySelector("video");
|
257
|
+
if (existingVideo) {
|
258
|
+
existingVideo.remove();
|
259
|
+
}
|
260
|
+
await trtc.startRemoteVideo({
|
261
|
+
userId: user.id,
|
262
|
+
streamType: MAIN_STREAM_TYPE,
|
263
|
+
view: videoElement
|
264
|
+
});
|
265
|
+
console.log(`Force rendered video for user: ${user.id}`);
|
266
|
+
} catch (error) {
|
267
|
+
console.error(`Failed to force render video for user ${user.id}:`, error);
|
268
|
+
if (error.code === "INVALID_OPERATION" && ((_a = error.message) == null ? void 0 : _a.includes("does not publishing stream"))) {
|
269
|
+
console.log("User not publishing stream, updating status:", user.id);
|
270
|
+
addOrUpdateUser(user.id, {
|
271
|
+
hasVideo: false
|
272
|
+
});
|
273
|
+
}
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|
277
|
+
}
|
278
|
+
function cleanupAllResources() {
|
279
|
+
retryTimers.value.forEach((timer) => clearTimeout(timer));
|
280
|
+
retryTimers.value.clear();
|
281
|
+
retryCount.value.clear();
|
282
|
+
videoRefs.value.clear();
|
283
|
+
remoteUsers.value = [];
|
284
|
+
isConnect.value = false;
|
285
|
+
resetTimer();
|
286
|
+
stopUserConnectionMonitoring();
|
287
|
+
}
|
288
|
+
async function toggleAudio() {
|
289
|
+
try {
|
290
|
+
await trtc.updateLocalAudio({
|
291
|
+
mute: !voiceClose.value
|
292
|
+
});
|
293
|
+
voiceClose.value = !voiceClose.value;
|
294
|
+
} catch (error) {
|
295
|
+
console.error("Error toggling audio:", error);
|
296
|
+
$message.error("\u5207\u6362\u97F3\u9891\u5931\u8D25");
|
297
|
+
}
|
298
|
+
}
|
299
|
+
async function toggleVideo() {
|
300
|
+
try {
|
301
|
+
await trtc.updateLocalVideo({
|
302
|
+
mute: !videocamClose.value
|
303
|
+
});
|
304
|
+
videocamClose.value = !videocamClose.value;
|
305
|
+
} catch (error) {
|
306
|
+
console.error("Error toggling video:", error);
|
307
|
+
$message.error("\u5207\u6362\u89C6\u9891\u5931\u8D25");
|
308
|
+
}
|
309
|
+
}
|
310
|
+
async function enterRoom() {
|
311
|
+
if (isConnect.value) {
|
312
|
+
console.log("Already connected");
|
313
|
+
return true;
|
314
|
+
}
|
315
|
+
const isSupported = await checkTRTCSupport();
|
316
|
+
if (!isSupported) {
|
317
|
+
return false;
|
318
|
+
}
|
319
|
+
try {
|
320
|
+
console.log("Entering TRTC room...");
|
321
|
+
await trtc.enterRoom({
|
322
|
+
strRoomId: state.currentAVMsg.strRoomId,
|
323
|
+
sdkAppId: parseInt(state.userInfo.sdkAppID),
|
324
|
+
userId: state.userInfo.id,
|
325
|
+
userSig: state.userInfo.userSig,
|
326
|
+
proxy: trtcProxy.value
|
327
|
+
});
|
328
|
+
isConnect.value = true;
|
329
|
+
console.log("Successfully entered TRTC room");
|
330
|
+
startUserConnectionMonitoring();
|
331
|
+
return true;
|
332
|
+
} catch (error) {
|
333
|
+
console.error("Failed to enter TRTC room:", error);
|
334
|
+
$message.error(`\u8FDB\u5165\u623F\u95F4\u5931\u8D25: ${error.message || "\u672A\u77E5\u9519\u8BEF"}`);
|
335
|
+
isConnect.value = false;
|
336
|
+
return false;
|
337
|
+
}
|
338
|
+
}
|
339
|
+
async function exitRoom() {
|
340
|
+
try {
|
341
|
+
console.log("Exiting TRTC room...");
|
342
|
+
const stopPromises = [];
|
343
|
+
stopPromises.push(trtc.stopLocalAudio().catch((error) => {
|
344
|
+
console.warn("Error stopping local audio:", error);
|
345
|
+
}));
|
346
|
+
if (!isAudio.value) {
|
347
|
+
stopPromises.push(trtc.stopLocalVideo().catch((error) => {
|
348
|
+
console.warn("Error stopping local video:", error);
|
349
|
+
}));
|
350
|
+
}
|
351
|
+
await trtc.exitRoom().catch((error) => {
|
352
|
+
console.warn("Error exiting room:", error);
|
353
|
+
});
|
354
|
+
cleanupAllResources();
|
355
|
+
console.log("Successfully exited TRTC room");
|
356
|
+
} catch (error) {
|
357
|
+
console.error("Error during exit:", error);
|
358
|
+
}
|
359
|
+
}
|
360
|
+
async function startLocalMedia(selfVideoRef) {
|
361
|
+
try {
|
362
|
+
await trtc.startLocalAudio({
|
363
|
+
mute: voiceClose.value
|
364
|
+
});
|
365
|
+
} catch (error) {
|
366
|
+
console.error("Error starting local audio:", error);
|
367
|
+
voiceClose.value = true;
|
368
|
+
}
|
369
|
+
if (!isAudio.value && selfVideoRef) {
|
370
|
+
try {
|
371
|
+
await trtc.startLocalVideo({
|
372
|
+
view: selfVideoRef,
|
373
|
+
mute: videocamClose.value
|
374
|
+
});
|
375
|
+
} catch (error) {
|
376
|
+
console.error("Error starting local video:", error);
|
377
|
+
videocamClose.value = true;
|
378
|
+
}
|
379
|
+
}
|
380
|
+
}
|
381
|
+
function handleError(error) {
|
382
|
+
console.error("TRTC error occurred:", error);
|
383
|
+
if (error.code) {
|
384
|
+
switch (error.code) {
|
385
|
+
case -3301:
|
386
|
+
$message.error("\u8FDB\u5165\u623F\u95F4\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5");
|
387
|
+
break;
|
388
|
+
case -3302:
|
389
|
+
$message.warning("\u7F51\u7EDC\u8FDE\u63A5\u65AD\u5F00\uFF0C\u6B63\u5728\u5C1D\u8BD5\u91CD\u8FDE...");
|
390
|
+
break;
|
391
|
+
case TRTC.ERROR_CODE.DEVICE_ERROR:
|
392
|
+
$message.warning("\u83B7\u53D6\u8BBE\u5907\u6216\u8005\u91C7\u96C6\u97F3\u89C6\u9891\u51FA\u73B0\u5F02\u5E38");
|
393
|
+
break;
|
394
|
+
default:
|
395
|
+
$message.error(`\u901A\u8BDD\u51FA\u73B0\u9519\u8BEF: ${error.message || "\u672A\u77E5\u9519\u8BEF"}`);
|
396
|
+
}
|
397
|
+
} else {
|
398
|
+
$message.error("\u901A\u8BDD\u51FA\u73B0\u672A\u77E5\u9519\u8BEF");
|
399
|
+
}
|
400
|
+
}
|
401
|
+
function installEventHandlers(handlers) {
|
402
|
+
console.log("Installing TRTC event handlers...");
|
403
|
+
const wrappedHandlers = {
|
404
|
+
handleError: (error) => {
|
405
|
+
console.log("TRTC EVENT: ERROR", error);
|
406
|
+
handleError(error);
|
407
|
+
},
|
408
|
+
handleRemoteUserEnter: (event) => {
|
409
|
+
console.log("TRTC EVENT: REMOTE_USER_ENTER", event);
|
410
|
+
handlers.handleRemoteUserEnter(event);
|
411
|
+
},
|
412
|
+
handleRemoteAudioAvailable: (event) => {
|
413
|
+
console.log("TRTC EVENT: REMOTE_AUDIO_AVAILABLE", event);
|
414
|
+
handlers.handleRemoteAudioAvailable(event);
|
415
|
+
},
|
416
|
+
handleRemoteUserExit: (event) => {
|
417
|
+
console.log("TRTC EVENT: REMOTE_USER_EXIT", event);
|
418
|
+
handlers.handleRemoteUserExit(event);
|
419
|
+
},
|
420
|
+
handleRemoteVideoAvailable: (event) => {
|
421
|
+
console.log("TRTC EVENT: REMOTE_VIDEO_AVAILABLE", event);
|
422
|
+
handlers.handleRemoteVideoAvailable(event);
|
423
|
+
},
|
424
|
+
handleRemoteVideoUnavailable: (event) => {
|
425
|
+
console.log("TRTC EVENT: REMOTE_VIDEO_UNAVAILABLE", event);
|
426
|
+
if (handlers.handleRemoteVideoUnavailable) {
|
427
|
+
handlers.handleRemoteVideoUnavailable(event);
|
428
|
+
}
|
429
|
+
}
|
430
|
+
};
|
431
|
+
trtc.on(TRTC.EVENT.ERROR, wrappedHandlers.handleError);
|
432
|
+
trtc.on(TRTC.EVENT.REMOTE_USER_ENTER, wrappedHandlers.handleRemoteUserEnter);
|
433
|
+
trtc.on(TRTC.EVENT.REMOTE_AUDIO_AVAILABLE, wrappedHandlers.handleRemoteAudioAvailable);
|
434
|
+
trtc.on(TRTC.EVENT.REMOTE_USER_EXIT, wrappedHandlers.handleRemoteUserExit);
|
435
|
+
if (!isAudio.value) {
|
436
|
+
trtc.on(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, wrappedHandlers.handleRemoteVideoAvailable);
|
437
|
+
trtc.on(TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE, wrappedHandlers.handleRemoteVideoUnavailable);
|
438
|
+
console.log("REMOTE_VIDEO_UNAVAILABLE event listener added");
|
439
|
+
}
|
440
|
+
}
|
441
|
+
function uninstallEventHandlers(handlers) {
|
89
442
|
trtc.off(TRTC.EVENT.ERROR, handleError);
|
90
|
-
trtc.off(TRTC.EVENT.REMOTE_USER_ENTER, handleRemoteUserEnter);
|
91
|
-
trtc.off(TRTC.EVENT.REMOTE_AUDIO_AVAILABLE, handleRemoteAudioAvailable);
|
92
|
-
trtc.off(TRTC.EVENT.REMOTE_USER_EXIT, handleRemoteUserExit);
|
93
|
-
if (isAudio.value)
|
94
|
-
|
95
|
-
|
443
|
+
trtc.off(TRTC.EVENT.REMOTE_USER_ENTER, handlers.handleRemoteUserEnter);
|
444
|
+
trtc.off(TRTC.EVENT.REMOTE_AUDIO_AVAILABLE, handlers.handleRemoteAudioAvailable);
|
445
|
+
trtc.off(TRTC.EVENT.REMOTE_USER_EXIT, handlers.handleRemoteUserExit);
|
446
|
+
if (!isAudio.value) {
|
447
|
+
trtc.off(TRTC.EVENT.REMOTE_VIDEO_AVAILABLE, handlers.handleRemoteVideoAvailable);
|
448
|
+
trtc.off(TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE, handlers.handleRemoteVideoUnavailable || handlers.handleRemoteVideoAvailable);
|
449
|
+
}
|
450
|
+
}
|
451
|
+
function setVideoRef(userId, el) {
|
452
|
+
if (el) {
|
453
|
+
videoRefs.value.set(userId, el);
|
454
|
+
if (isConnect.value) {
|
455
|
+
const user = findUser(userId);
|
456
|
+
console.log("User found:", user);
|
457
|
+
if (user == null ? void 0 : user.hasVideo) {
|
458
|
+
console.log("User has video, attempting to render");
|
459
|
+
nextTick(() => {
|
460
|
+
tryRenderRemoteVideo(userId);
|
461
|
+
});
|
462
|
+
} else {
|
463
|
+
console.log("User has no video stream yet, will render when available");
|
464
|
+
}
|
465
|
+
}
|
466
|
+
} else {
|
467
|
+
videoRefs.value.delete(userId);
|
468
|
+
clearRetryTimer(userId);
|
469
|
+
console.log("Video ref removed for user:", userId);
|
470
|
+
}
|
96
471
|
}
|
97
472
|
onBeforeUnmount(() => {
|
98
|
-
|
473
|
+
cleanupAllResources();
|
99
474
|
});
|
100
475
|
return {
|
101
476
|
state,
|
@@ -105,16 +480,37 @@ function useVideo() {
|
|
105
480
|
timing,
|
106
481
|
voiceClose,
|
107
482
|
videocamClose,
|
483
|
+
isConnect,
|
108
484
|
isAudio,
|
109
485
|
isCall,
|
486
|
+
messageTypeText,
|
487
|
+
time,
|
488
|
+
remoteUsers,
|
489
|
+
videoRefs,
|
110
490
|
startTimer,
|
111
491
|
resetTimer,
|
112
492
|
toggleAudio,
|
113
493
|
toggleVideo,
|
114
|
-
|
115
|
-
|
494
|
+
enterRoom,
|
495
|
+
exitRoom,
|
496
|
+
startLocalMedia,
|
497
|
+
checkTRTCSupport,
|
498
|
+
findUser,
|
499
|
+
addOrUpdateUser,
|
500
|
+
removeUser,
|
501
|
+
tryRenderRemoteVideo,
|
502
|
+
stopRemoteVideo,
|
503
|
+
setVideoRef,
|
116
504
|
installEventHandlers,
|
117
|
-
uninstallEventHandlers
|
505
|
+
uninstallEventHandlers,
|
506
|
+
cleanupAllResources,
|
507
|
+
checkAndRenderAllVideos,
|
508
|
+
forceRenderAllVideos,
|
509
|
+
cleanupInvalidUsers,
|
510
|
+
isUserValid,
|
511
|
+
startUserConnectionMonitoring,
|
512
|
+
stopUserConnectionMonitoring,
|
513
|
+
MAIN_STREAM_TYPE
|
118
514
|
};
|
119
515
|
}
|
120
516
|
|
@@ -1,11 +1,36 @@
|
|
1
1
|
import { AnyObject } from '../../../../shared/types';
|
2
2
|
import { UploadFileInfo } from 'naive-ui';
|
3
|
+
type ItemContent = {
|
4
|
+
chatMessageType: string;
|
5
|
+
msg: string;
|
6
|
+
referenceContent?: any;
|
7
|
+
forwardMessageList?: AnyObject[];
|
8
|
+
messageTemplate?: any;
|
9
|
+
messageTemplateData?: any;
|
10
|
+
fileUrl?: string;
|
11
|
+
avStatus?: string;
|
12
|
+
[key: string]: any;
|
13
|
+
};
|
14
|
+
export type MsgListItem = {
|
15
|
+
id: string;
|
16
|
+
sessionKey: string;
|
17
|
+
content: ItemContent;
|
18
|
+
senderName: string;
|
19
|
+
sendTime: string;
|
20
|
+
sender: string;
|
21
|
+
status: string;
|
22
|
+
senderAvatar: string;
|
23
|
+
__content: string;
|
24
|
+
__time?: string;
|
25
|
+
__sendTime?: string;
|
26
|
+
[key: string]: any;
|
27
|
+
};
|
3
28
|
export type IState = {
|
4
29
|
orgId: number | string;
|
5
30
|
currentSessionItem: AnyObject;
|
6
31
|
id: string;
|
7
32
|
userInfo: AnyObject;
|
8
|
-
msgList:
|
33
|
+
msgList: MsgListItem[];
|
9
34
|
currentMsg: AnyObject;
|
10
35
|
isAppendMsg: boolean;
|
11
36
|
sessionList: AnyObject[];
|
@@ -45,4 +70,15 @@ export type ProxyServer = Partial<{
|
|
45
70
|
turnServer: Array<TurnServer>;
|
46
71
|
iceTransportPolicy: 'all' | 'relay';
|
47
72
|
}>;
|
73
|
+
export type ImageItem = {
|
74
|
+
id: string;
|
75
|
+
fileUrl: string;
|
76
|
+
senderName: string;
|
77
|
+
fileSize: string;
|
78
|
+
sendTime: string;
|
79
|
+
fileName: string;
|
80
|
+
width?: number;
|
81
|
+
height?: number;
|
82
|
+
[key: string]: any;
|
83
|
+
};
|
48
84
|
export {};
|
@@ -5,7 +5,7 @@ const emojis = {
|
|
5
5
|
findEmoji(name) {
|
6
6
|
var _a, _b;
|
7
7
|
if (!isNaN(+name)) {
|
8
|
-
return (_a = this.default[name]) == null ? void 0 : _a[1];
|
8
|
+
return (_a = this.default[+name]) == null ? void 0 : _a[1];
|
9
9
|
}
|
10
10
|
return (_b = this.default.find(([emojiName]) => emojiName === name)) == null ? void 0 : _b[1];
|
11
11
|
}
|
@@ -21,3 +21,5 @@ export declare function getFileType(msg: string): string;
|
|
21
21
|
export declare function getDetail(item: AnyObject, isShowSize?: boolean): string;
|
22
22
|
export declare function showAudioAndVideoRecord(chatMessageType: string): "语音通话" | "视频通话";
|
23
23
|
export declare function formatJsonstr(obj: AnyObject | string, type: string): any;
|
24
|
+
export declare function removeImgBySrc(htmlString: string, targetSrc: string): string;
|
25
|
+
export declare function ensureLeadingSlashIfRelative(str?: string): string;
|
@@ -301,5 +301,18 @@ function formatJsonstr(obj, type) {
|
|
301
301
|
return obj;
|
302
302
|
}
|
303
303
|
}
|
304
|
+
function removeImgBySrc(htmlString, targetSrc) {
|
305
|
+
const regex = new RegExp(`<img[^>]*src=['"]${escapeRegExp(targetSrc)}['"][^>]*/?>`, "gi");
|
306
|
+
return htmlString.replace(regex, "");
|
307
|
+
}
|
308
|
+
function escapeRegExp(str) {
|
309
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
310
|
+
}
|
311
|
+
function ensureLeadingSlashIfRelative(str = "") {
|
312
|
+
if (!/^[a-z]+:\/\//i.test(str) && !str.startsWith("/")) {
|
313
|
+
return "/" + str;
|
314
|
+
}
|
315
|
+
return str;
|
316
|
+
}
|
304
317
|
|
305
|
-
export { $message, base64ToFile, downloadFile, formatJsonstr, formatSeconds, formatTime, getAVTime, getDetail, getFileType, getForwardTitle, getRoleName, isAudioOrVideoMessage, isDoctorRole, isGroup, listSort, showAudioAndVideoRecord, simplifyMessage, transformMessage };
|
318
|
+
export { $message, base64ToFile, downloadFile, ensureLeadingSlashIfRelative, formatJsonstr, formatSeconds, formatTime, getAVTime, getDetail, getFileType, getForwardTitle, getRoleName, isAudioOrVideoMessage, isDoctorRole, isGroup, listSort, removeImgBySrc, showAudioAndVideoRecord, simplifyMessage, transformMessage };
|