yx-web-sdk 0.0.27 → 0.0.28

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.
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../index.vue_vue_type_style_index_0_lang-BHF09625.mjs";
1
+ import { _ as _sfc_main } from "../index.vue_vue_type_style_index_0_lang-CQtS2mCm.mjs";
2
2
  export {
3
3
  _sfc_main as ChatContent,
4
4
  _sfc_main as default
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../index.vue_vue_type_style_index_0_lang-Bv3It4GH.mjs";
1
+ import { _ as _sfc_main } from "../index.vue_vue_type_style_index_0_lang-CvNvjkKX.mjs";
2
2
  export {
3
3
  _sfc_main as ChatPage,
4
4
  _sfc_main as default
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../index.vue_vue_type_script_setup_true_lang-DWgq-XoC.mjs";
1
+ import { _ as _sfc_main } from "../index.vue_vue_type_script_setup_true_lang-CvCfYqe9.mjs";
2
2
  export {
3
3
  _sfc_main as ChatRoom,
4
4
  _sfc_main as default
@@ -2,7 +2,7 @@ import { defineComponent, computed, ref, onMounted, onUnmounted, openBlock, crea
2
2
  import { useRouter } from "vue-router";
3
3
  import { Spin, Result, Button, Empty, message } from "ant-design-vue";
4
4
  import { s as setGlobalRequest, c as useImSdkStore, a as useServerStore, u as useChannelStore, b as useUserStore, d as useGlobalStore } from "../index.vue_vue_type_style_index_0_lang-Bb0HV9Zp.mjs";
5
- import { _ as _sfc_main$1 } from "../index.vue_vue_type_style_index_0_lang-Bv3It4GH.mjs";
5
+ import { _ as _sfc_main$1 } from "../index.vue_vue_type_style_index_0_lang-CvNvjkKX.mjs";
6
6
  import { S as ServerChannelSidebar } from "../index-BvfJ77uD.mjs";
7
7
  import { M as MembersSidebar } from "../index-DwPi-usb.mjs";
8
8
  import { _ as _export_sfc } from "../_plugin-vue_export-helper-1tPrXgE0.mjs";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, computed, watch, openBlock, createBlock, createElementBlock } from "vue";
2
- import { _ as _sfc_main$1 } from "./index.vue_vue_type_style_index_0_lang-BHF09625.mjs";
2
+ import { _ as _sfc_main$1 } from "./index.vue_vue_type_style_index_0_lang-CQtS2mCm.mjs";
3
3
  import { u as useChannelStore, a as useServerStore, b as useUserStore } from "./index.vue_vue_type_style_index_0_lang-Bb0HV9Zp.mjs";
4
4
  const _hoisted_1 = { key: 1 };
5
5
  const HISTORY_LIMIT = 100;
@@ -1,4 +1,4 @@
1
- import { createVNode, ref, computed, watch, nextTick, defineComponent, openBlock, createElementBlock, createElementVNode, normalizeStyle, unref, normalizeClass, createBlock, createCommentVNode, Fragment, renderList, toDisplayString, withCtx } from "vue";
1
+ import { createVNode, ref, computed, watch, nextTick, defineComponent, openBlock, createElementBlock, createElementVNode, normalizeStyle, unref, normalizeClass, createBlock, createCommentVNode, Fragment, renderList, toDisplayString, withModifiers, withCtx } from "vue";
2
2
  import { useRouter } from "vue-router";
3
3
  import { Input, Image, Popover, Button, Upload, message } from "ant-design-vue";
4
4
  import { A as AitPersonPopover } from "./index-BhLJLbtt.mjs";
@@ -472,11 +472,10 @@ const _hoisted_15 = {
472
472
  class: "chatroomInputAttachmentWrapperImg"
473
473
  };
474
474
  const _hoisted_16 = { class: "chatroomInputAttachmentWrapperImgMask" };
475
- const _hoisted_17 = { class: "chatroomInputWrapper" };
476
- const _hoisted_18 = { class: "chatroomInputLeft" };
477
- const _hoisted_19 = { style: { "width": "400px" } };
478
- const _hoisted_20 = ["onClick"];
479
- const _hoisted_21 = { class: "chatroomController" };
475
+ const _hoisted_17 = { class: "chatroomInputLeft" };
476
+ const _hoisted_18 = { style: { "width": "400px" } };
477
+ const _hoisted_19 = ["onClick"];
478
+ const _hoisted_20 = { class: "chatroomController" };
480
479
  const MAX_IMG_SIZE = 10;
481
480
  const _sfc_main = /* @__PURE__ */ defineComponent({
482
481
  ...{
@@ -808,6 +807,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
808
807
  attachmentUploading.value = false;
809
808
  }
810
809
  };
810
+ const handleDrop = async (e) => {
811
+ var _a;
812
+ e.preventDefault();
813
+ if (props.sendDisabled || attachmentUploading.value) return;
814
+ const dataTransfer = e.dataTransfer;
815
+ console.log("dataTransfer", dataTransfer);
816
+ if (!dataTransfer || !dataTransfer.files.length) return;
817
+ let imageFile = null;
818
+ for (let i = 0; i < dataTransfer.files.length; i++) {
819
+ if (dataTransfer.files[i].type.startsWith("image/")) {
820
+ imageFile = dataTransfer.files[i];
821
+ break;
822
+ }
823
+ }
824
+ if (!imageFile) {
825
+ message.error("仅支持拖入图片文件");
826
+ return;
827
+ }
828
+ const existingFile = (_a = attachment.value) == null ? void 0 : _a.__file;
829
+ if (existingFile && existingFile.size === imageFile.size && existingFile.type === imageFile.type) {
830
+ return;
831
+ }
832
+ if (!isLt(imageFile.size, MAX_IMG_SIZE)) {
833
+ message.error(`图片大小最大支持${MAX_IMG_SIZE}MB`);
834
+ return;
835
+ }
836
+ attachmentUploading.value = true;
837
+ try {
838
+ const uploadResult = await channelStore.uploadImage({
839
+ file: imageFile,
840
+ onUploadStart: () => {
841
+ attachmentUploading.value = true;
842
+ },
843
+ onUploadDone: () => {
844
+ attachmentUploading.value = false;
845
+ }
846
+ });
847
+ uploadResult.__file = imageFile;
848
+ attachment.value = uploadResult;
849
+ } catch (error) {
850
+ console.error("拖拽上传图片失败:", error);
851
+ message.error("拖拽上传图片失败");
852
+ attachmentUploading.value = false;
853
+ }
854
+ };
811
855
  const uploadImgHandler = async (file) => {
812
856
  if (!file.type.startsWith("image/")) {
813
857
  message.error("请上传图片");
@@ -1014,7 +1058,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1014
1058
  __props.msgs.length ? (openBlock(), createElementBlock("div", _hoisted_2, [
1015
1059
  __props.isNoMore ? (openBlock(), createElementBlock("div", _hoisted_3, "没有更多消息了~")) : loadingMore.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
1016
1060
  createVNode(unref(LoadingOutlined)),
1017
- _cache[1] || (_cache[1] = createElementVNode("span", { style: { "margin-left": "10px" } }, "正在加载,请稍候", -1))
1061
+ _cache[2] || (_cache[2] = createElementVNode("span", { style: { "margin-left": "10px" } }, "正在加载,请稍候", -1))
1018
1062
  ])) : createCommentVNode("", true)
1019
1063
  ])) : createCommentVNode("", true),
1020
1064
  __props.msgs.length ? (openBlock(), createElementBlock("div", _hoisted_5, [
@@ -1038,7 +1082,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1038
1082
  class: "emptyChatroomContent",
1039
1083
  style: normalizeStyle({ height: ((_c = curChannel.value) == null ? void 0 : _c.ext) ? "calc(100% - 48px)" : "100%" })
1040
1084
  }, [
1041
- _cache[2] || (_cache[2] = createElementVNode("div", null, "欢迎来到", -1)),
1085
+ _cache[3] || (_cache[3] = createElementVNode("div", null, "欢迎来到", -1)),
1042
1086
  createElementVNode("h1", null, "#" + toDisplayString(__props.channelName), 1)
1043
1087
  ], 4))
1044
1088
  ], 38),
@@ -1090,17 +1134,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1090
1134
  }, null, 8, ["src"])
1091
1135
  ])) : createCommentVNode("", true)
1092
1136
  ])) : createCommentVNode("", true),
1093
- createElementVNode("div", _hoisted_17, [
1094
- createElementVNode("div", _hoisted_18, [
1137
+ createElementVNode("div", {
1138
+ class: "chatroomInputWrapper",
1139
+ onDragover: _cache[1] || (_cache[1] = withModifiers(() => {
1140
+ }, ["prevent"])),
1141
+ onDrop: withModifiers(handleDrop, ["prevent"])
1142
+ }, [
1143
+ createElementVNode("div", _hoisted_17, [
1095
1144
  createVNode(unref(Popover), { placement: "topLeft" }, {
1096
1145
  content: withCtx(() => [
1097
- createElementVNode("div", _hoisted_19, [
1146
+ createElementVNode("div", _hoisted_18, [
1098
1147
  (openBlock(), createElementBlock(Fragment, null, renderList(emjjData, (value, i) => {
1099
1148
  return createElementVNode("span", {
1100
1149
  key: i,
1101
1150
  style: { "font-size": "16px", "cursor": "pointer" },
1102
1151
  onClick: ($event) => insertEmj(i)
1103
- }, toDisplayString(value), 9, _hoisted_20);
1152
+ }, toDisplayString(value), 9, _hoisted_19);
1104
1153
  }), 64))
1105
1154
  ])
1106
1155
  ]),
@@ -1110,7 +1159,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1110
1159
  type: "text",
1111
1160
  disabled: __props.sendDisabled
1112
1161
  }, {
1113
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
1162
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
1114
1163
  createElementVNode("svg", {
1115
1164
  width: "21",
1116
1165
  height: "21",
@@ -1145,7 +1194,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1145
1194
  onBlur: handleInputBlur,
1146
1195
  onPaste: handlePaste
1147
1196
  }, null, 8, ["value", "placeholder", "disabled", "onKeydown", "onClick"]),
1148
- createElementVNode("div", _hoisted_21, [
1197
+ createElementVNode("div", _hoisted_20, [
1149
1198
  createVNode(unref(Upload), {
1150
1199
  "before-upload": uploadImgHandler,
1151
1200
  "show-upload-list": false,
@@ -1160,7 +1209,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1160
1209
  loading: attachmentUploading.value,
1161
1210
  disabled: __props.sendDisabled || attachmentUploading.value
1162
1211
  }, {
1163
- icon: withCtx(() => [..._cache[4] || (_cache[4] = [
1212
+ icon: withCtx(() => [..._cache[5] || (_cache[5] = [
1164
1213
  createElementVNode("svg", {
1165
1214
  width: "21",
1166
1215
  height: "18",
@@ -1185,14 +1234,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1185
1234
  ]),
1186
1235
  _: 1
1187
1236
  }, 8, ["accept", "disabled"]),
1188
- _cache[6] || (_cache[6] = createElementVNode("span", { class: "lineSeparator" }, null, -1)),
1237
+ _cache[7] || (_cache[7] = createElementVNode("span", { class: "lineSeparator" }, null, -1)),
1189
1238
  createVNode(unref(Button), {
1190
1239
  class: "chatroomButtonArrowUp",
1191
1240
  type: "text",
1192
1241
  disabled: __props.sendDisabled,
1193
1242
  onClick: handleSendText
1194
1243
  }, {
1195
- icon: withCtx(() => [..._cache[5] || (_cache[5] = [
1244
+ icon: withCtx(() => [..._cache[6] || (_cache[6] = [
1196
1245
  createElementVNode("svg", {
1197
1246
  width: "36",
1198
1247
  height: "36",
@@ -1215,7 +1264,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1215
1264
  _: 1
1216
1265
  }, 8, ["disabled"])
1217
1266
  ])
1218
- ])
1267
+ ], 32)
1219
1268
  ])
1220
1269
  ]),
1221
1270
  createVNode(AitPersonPopover, {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, h, watch, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, createVNode } from "vue";
2
2
  import { List, Typography } from "ant-design-vue";
3
- import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_setup_true_lang-DWgq-XoC.mjs";
3
+ import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_setup_true_lang-CvCfYqe9.mjs";
4
4
  import { a as useServerStore, u as useChannelStore } from "./index.vue_vue_type_style_index_0_lang-Bb0HV9Zp.mjs";
5
5
  import "./index-L_drmZir.mjs";
6
6
  import { useLocalStorage } from "@vueuse/core";
@@ -38867,7 +38867,7 @@ const _hoisted_17$2 = {
38867
38867
  const _hoisted_18$2 = { class: "chatCardQuoteMsgName" };
38868
38868
  const _hoisted_19$2 = ["innerHTML"];
38869
38869
  const _hoisted_20$2 = { class: "ant-image-mask-info" };
38870
- const _hoisted_21$2 = { class: "chatCardStatus" };
38870
+ const _hoisted_21$1 = { class: "chatCardStatus" };
38871
38871
  const MAX_IMG_PREVIEW_SIZE = 2 * 1024 * 1024;
38872
38872
  const REVOCATION_INTERVAL = 120 * 1e3;
38873
38873
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
@@ -39324,7 +39324,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
39324
39324
  ])
39325
39325
  ])) : createCommentVNode("", true)
39326
39326
  ]),
39327
- createElementVNode("div", _hoisted_21$2, [
39327
+ createElementVNode("div", _hoisted_21$1, [
39328
39328
  __props.msg.deliveryStatus === "failed" ? (openBlock(), createBlock(unref(Button), {
39329
39329
  key: 0,
39330
39330
  type: "text",
@@ -40041,11 +40041,10 @@ const _hoisted_15$2 = {
40041
40041
  class: "chatroomInputAttachmentWrapperImg"
40042
40042
  };
40043
40043
  const _hoisted_16$1 = { class: "chatroomInputAttachmentWrapperImgMask" };
40044
- const _hoisted_17$1 = { class: "chatroomInputWrapper" };
40045
- const _hoisted_18$1 = { class: "chatroomInputLeft" };
40046
- const _hoisted_19$1 = { style: { "width": "400px" } };
40047
- const _hoisted_20$1 = ["onClick"];
40048
- const _hoisted_21$1 = { class: "chatroomController" };
40044
+ const _hoisted_17$1 = { class: "chatroomInputLeft" };
40045
+ const _hoisted_18$1 = { style: { "width": "400px" } };
40046
+ const _hoisted_19$1 = ["onClick"];
40047
+ const _hoisted_20$1 = { class: "chatroomController" };
40049
40048
  const MAX_IMG_SIZE = 10;
40050
40049
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40051
40050
  ...{
@@ -40377,6 +40376,51 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40377
40376
  attachmentUploading.value = false;
40378
40377
  }
40379
40378
  };
40379
+ const handleDrop = async (e) => {
40380
+ var _a;
40381
+ e.preventDefault();
40382
+ if (props.sendDisabled || attachmentUploading.value) return;
40383
+ const dataTransfer = e.dataTransfer;
40384
+ console.log("dataTransfer", dataTransfer);
40385
+ if (!dataTransfer || !dataTransfer.files.length) return;
40386
+ let imageFile = null;
40387
+ for (let i = 0; i < dataTransfer.files.length; i++) {
40388
+ if (dataTransfer.files[i].type.startsWith("image/")) {
40389
+ imageFile = dataTransfer.files[i];
40390
+ break;
40391
+ }
40392
+ }
40393
+ if (!imageFile) {
40394
+ message.error("仅支持拖入图片文件");
40395
+ return;
40396
+ }
40397
+ const existingFile = (_a = attachment.value) == null ? void 0 : _a.__file;
40398
+ if (existingFile && existingFile.size === imageFile.size && existingFile.type === imageFile.type) {
40399
+ return;
40400
+ }
40401
+ if (!isLt(imageFile.size, MAX_IMG_SIZE)) {
40402
+ message.error(`图片大小最大支持${MAX_IMG_SIZE}MB`);
40403
+ return;
40404
+ }
40405
+ attachmentUploading.value = true;
40406
+ try {
40407
+ const uploadResult = await channelStore.uploadImage({
40408
+ file: imageFile,
40409
+ onUploadStart: () => {
40410
+ attachmentUploading.value = true;
40411
+ },
40412
+ onUploadDone: () => {
40413
+ attachmentUploading.value = false;
40414
+ }
40415
+ });
40416
+ uploadResult.__file = imageFile;
40417
+ attachment.value = uploadResult;
40418
+ } catch (error) {
40419
+ console.error("拖拽上传图片失败:", error);
40420
+ message.error("拖拽上传图片失败");
40421
+ attachmentUploading.value = false;
40422
+ }
40423
+ };
40380
40424
  const uploadImgHandler = async (file) => {
40381
40425
  if (!file.type.startsWith("image/")) {
40382
40426
  message.error("请上传图片");
@@ -40583,7 +40627,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40583
40627
  __props.msgs.length ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
40584
40628
  __props.isNoMore ? (openBlock(), createElementBlock("div", _hoisted_3$4, "没有更多消息了~")) : loadingMore.value ? (openBlock(), createElementBlock("div", _hoisted_4$4, [
40585
40629
  createVNode(unref(LoadingOutlined)),
40586
- _cache[1] || (_cache[1] = createElementVNode("span", { style: { "margin-left": "10px" } }, "正在加载,请稍候", -1))
40630
+ _cache[2] || (_cache[2] = createElementVNode("span", { style: { "margin-left": "10px" } }, "正在加载,请稍候", -1))
40587
40631
  ])) : createCommentVNode("", true)
40588
40632
  ])) : createCommentVNode("", true),
40589
40633
  __props.msgs.length ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
@@ -40607,7 +40651,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40607
40651
  class: "emptyChatroomContent",
40608
40652
  style: normalizeStyle({ height: ((_c = curChannel.value) == null ? void 0 : _c.ext) ? "calc(100% - 48px)" : "100%" })
40609
40653
  }, [
40610
- _cache[2] || (_cache[2] = createElementVNode("div", null, "欢迎来到", -1)),
40654
+ _cache[3] || (_cache[3] = createElementVNode("div", null, "欢迎来到", -1)),
40611
40655
  createElementVNode("h1", null, "#" + toDisplayString(__props.channelName), 1)
40612
40656
  ], 4))
40613
40657
  ], 38),
@@ -40659,17 +40703,22 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40659
40703
  }, null, 8, ["src"])
40660
40704
  ])) : createCommentVNode("", true)
40661
40705
  ])) : createCommentVNode("", true),
40662
- createElementVNode("div", _hoisted_17$1, [
40663
- createElementVNode("div", _hoisted_18$1, [
40706
+ createElementVNode("div", {
40707
+ class: "chatroomInputWrapper",
40708
+ onDragover: _cache[1] || (_cache[1] = withModifiers(() => {
40709
+ }, ["prevent"])),
40710
+ onDrop: withModifiers(handleDrop, ["prevent"])
40711
+ }, [
40712
+ createElementVNode("div", _hoisted_17$1, [
40664
40713
  createVNode(unref(Popover), { placement: "topLeft" }, {
40665
40714
  content: withCtx(() => [
40666
- createElementVNode("div", _hoisted_19$1, [
40715
+ createElementVNode("div", _hoisted_18$1, [
40667
40716
  (openBlock(), createElementBlock(Fragment, null, renderList(emjjData, (value, i) => {
40668
40717
  return createElementVNode("span", {
40669
40718
  key: i,
40670
40719
  style: { "font-size": "16px", "cursor": "pointer" },
40671
40720
  onClick: ($event) => insertEmj(i)
40672
- }, toDisplayString(value), 9, _hoisted_20$1);
40721
+ }, toDisplayString(value), 9, _hoisted_19$1);
40673
40722
  }), 64))
40674
40723
  ])
40675
40724
  ]),
@@ -40679,7 +40728,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40679
40728
  type: "text",
40680
40729
  disabled: __props.sendDisabled
40681
40730
  }, {
40682
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
40731
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
40683
40732
  createElementVNode("svg", {
40684
40733
  width: "21",
40685
40734
  height: "21",
@@ -40714,7 +40763,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40714
40763
  onBlur: handleInputBlur,
40715
40764
  onPaste: handlePaste
40716
40765
  }, null, 8, ["value", "placeholder", "disabled", "onKeydown", "onClick"]),
40717
- createElementVNode("div", _hoisted_21$1, [
40766
+ createElementVNode("div", _hoisted_20$1, [
40718
40767
  createVNode(unref(Upload), {
40719
40768
  "before-upload": uploadImgHandler,
40720
40769
  "show-upload-list": false,
@@ -40729,7 +40778,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40729
40778
  loading: attachmentUploading.value,
40730
40779
  disabled: __props.sendDisabled || attachmentUploading.value
40731
40780
  }, {
40732
- icon: withCtx(() => [..._cache[4] || (_cache[4] = [
40781
+ icon: withCtx(() => [..._cache[5] || (_cache[5] = [
40733
40782
  createElementVNode("svg", {
40734
40783
  width: "21",
40735
40784
  height: "18",
@@ -40754,14 +40803,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40754
40803
  ]),
40755
40804
  _: 1
40756
40805
  }, 8, ["accept", "disabled"]),
40757
- _cache[6] || (_cache[6] = createElementVNode("span", { class: "lineSeparator" }, null, -1)),
40806
+ _cache[7] || (_cache[7] = createElementVNode("span", { class: "lineSeparator" }, null, -1)),
40758
40807
  createVNode(unref(Button), {
40759
40808
  class: "chatroomButtonArrowUp",
40760
40809
  type: "text",
40761
40810
  disabled: __props.sendDisabled,
40762
40811
  onClick: handleSendText
40763
40812
  }, {
40764
- icon: withCtx(() => [..._cache[5] || (_cache[5] = [
40813
+ icon: withCtx(() => [..._cache[6] || (_cache[6] = [
40765
40814
  createElementVNode("svg", {
40766
40815
  width: "36",
40767
40816
  height: "36",
@@ -40784,7 +40833,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40784
40833
  _: 1
40785
40834
  }, 8, ["disabled"])
40786
40835
  ])
40787
- ])
40836
+ ], 32)
40788
40837
  ])
40789
40838
  ]),
40790
40839
  createVNode(AitPersonPopover, {
@@ -38864,7 +38864,7 @@
38864
38864
  const _hoisted_18$2 = { class: "chatCardQuoteMsgName" };
38865
38865
  const _hoisted_19$2 = ["innerHTML"];
38866
38866
  const _hoisted_20$2 = { class: "ant-image-mask-info" };
38867
- const _hoisted_21$2 = { class: "chatCardStatus" };
38867
+ const _hoisted_21$1 = { class: "chatCardStatus" };
38868
38868
  const MAX_IMG_PREVIEW_SIZE = 2 * 1024 * 1024;
38869
38869
  const REVOCATION_INTERVAL = 120 * 1e3;
38870
38870
  const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
@@ -39321,7 +39321,7 @@
39321
39321
  ])
39322
39322
  ])) : vue.createCommentVNode("", true)
39323
39323
  ]),
39324
- vue.createElementVNode("div", _hoisted_21$2, [
39324
+ vue.createElementVNode("div", _hoisted_21$1, [
39325
39325
  __props.msg.deliveryStatus === "failed" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Button), {
39326
39326
  key: 0,
39327
39327
  type: "text",
@@ -40038,11 +40038,10 @@
40038
40038
  class: "chatroomInputAttachmentWrapperImg"
40039
40039
  };
40040
40040
  const _hoisted_16$1 = { class: "chatroomInputAttachmentWrapperImgMask" };
40041
- const _hoisted_17$1 = { class: "chatroomInputWrapper" };
40042
- const _hoisted_18$1 = { class: "chatroomInputLeft" };
40043
- const _hoisted_19$1 = { style: { "width": "400px" } };
40044
- const _hoisted_20$1 = ["onClick"];
40045
- const _hoisted_21$1 = { class: "chatroomController" };
40041
+ const _hoisted_17$1 = { class: "chatroomInputLeft" };
40042
+ const _hoisted_18$1 = { style: { "width": "400px" } };
40043
+ const _hoisted_19$1 = ["onClick"];
40044
+ const _hoisted_20$1 = { class: "chatroomController" };
40046
40045
  const MAX_IMG_SIZE = 10;
40047
40046
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
40048
40047
  ...{
@@ -40374,6 +40373,51 @@
40374
40373
  attachmentUploading.value = false;
40375
40374
  }
40376
40375
  };
40376
+ const handleDrop = async (e) => {
40377
+ var _a;
40378
+ e.preventDefault();
40379
+ if (props.sendDisabled || attachmentUploading.value) return;
40380
+ const dataTransfer = e.dataTransfer;
40381
+ console.log("dataTransfer", dataTransfer);
40382
+ if (!dataTransfer || !dataTransfer.files.length) return;
40383
+ let imageFile = null;
40384
+ for (let i = 0; i < dataTransfer.files.length; i++) {
40385
+ if (dataTransfer.files[i].type.startsWith("image/")) {
40386
+ imageFile = dataTransfer.files[i];
40387
+ break;
40388
+ }
40389
+ }
40390
+ if (!imageFile) {
40391
+ antDesignVue.message.error("仅支持拖入图片文件");
40392
+ return;
40393
+ }
40394
+ const existingFile = (_a = attachment.value) == null ? void 0 : _a.__file;
40395
+ if (existingFile && existingFile.size === imageFile.size && existingFile.type === imageFile.type) {
40396
+ return;
40397
+ }
40398
+ if (!isLt(imageFile.size, MAX_IMG_SIZE)) {
40399
+ antDesignVue.message.error(`图片大小最大支持${MAX_IMG_SIZE}MB`);
40400
+ return;
40401
+ }
40402
+ attachmentUploading.value = true;
40403
+ try {
40404
+ const uploadResult = await channelStore.uploadImage({
40405
+ file: imageFile,
40406
+ onUploadStart: () => {
40407
+ attachmentUploading.value = true;
40408
+ },
40409
+ onUploadDone: () => {
40410
+ attachmentUploading.value = false;
40411
+ }
40412
+ });
40413
+ uploadResult.__file = imageFile;
40414
+ attachment.value = uploadResult;
40415
+ } catch (error) {
40416
+ console.error("拖拽上传图片失败:", error);
40417
+ antDesignVue.message.error("拖拽上传图片失败");
40418
+ attachmentUploading.value = false;
40419
+ }
40420
+ };
40377
40421
  const uploadImgHandler = async (file) => {
40378
40422
  if (!file.type.startsWith("image/")) {
40379
40423
  antDesignVue.message.error("请上传图片");
@@ -40580,7 +40624,7 @@
40580
40624
  __props.msgs.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$4, [
40581
40625
  __props.isNoMore ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, "没有更多消息了~")) : loadingMore.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
40582
40626
  vue.createVNode(vue.unref(LoadingOutlined)),
40583
- _cache[1] || (_cache[1] = vue.createElementVNode("span", { style: { "margin-left": "10px" } }, "正在加载,请稍候", -1))
40627
+ _cache[2] || (_cache[2] = vue.createElementVNode("span", { style: { "margin-left": "10px" } }, "正在加载,请稍候", -1))
40584
40628
  ])) : vue.createCommentVNode("", true)
40585
40629
  ])) : vue.createCommentVNode("", true),
40586
40630
  __props.msgs.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$4, [
@@ -40604,7 +40648,7 @@
40604
40648
  class: "emptyChatroomContent",
40605
40649
  style: vue.normalizeStyle({ height: ((_c = curChannel.value) == null ? void 0 : _c.ext) ? "calc(100% - 48px)" : "100%" })
40606
40650
  }, [
40607
- _cache[2] || (_cache[2] = vue.createElementVNode("div", null, "欢迎来到", -1)),
40651
+ _cache[3] || (_cache[3] = vue.createElementVNode("div", null, "欢迎来到", -1)),
40608
40652
  vue.createElementVNode("h1", null, "#" + vue.toDisplayString(__props.channelName), 1)
40609
40653
  ], 4))
40610
40654
  ], 38),
@@ -40656,17 +40700,22 @@
40656
40700
  }, null, 8, ["src"])
40657
40701
  ])) : vue.createCommentVNode("", true)
40658
40702
  ])) : vue.createCommentVNode("", true),
40659
- vue.createElementVNode("div", _hoisted_17$1, [
40660
- vue.createElementVNode("div", _hoisted_18$1, [
40703
+ vue.createElementVNode("div", {
40704
+ class: "chatroomInputWrapper",
40705
+ onDragover: _cache[1] || (_cache[1] = vue.withModifiers(() => {
40706
+ }, ["prevent"])),
40707
+ onDrop: vue.withModifiers(handleDrop, ["prevent"])
40708
+ }, [
40709
+ vue.createElementVNode("div", _hoisted_17$1, [
40661
40710
  vue.createVNode(vue.unref(antDesignVue.Popover), { placement: "topLeft" }, {
40662
40711
  content: vue.withCtx(() => [
40663
- vue.createElementVNode("div", _hoisted_19$1, [
40712
+ vue.createElementVNode("div", _hoisted_18$1, [
40664
40713
  (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(emjjData, (value, i) => {
40665
40714
  return vue.createElementVNode("span", {
40666
40715
  key: i,
40667
40716
  style: { "font-size": "16px", "cursor": "pointer" },
40668
40717
  onClick: ($event) => insertEmj(i)
40669
- }, vue.toDisplayString(value), 9, _hoisted_20$1);
40718
+ }, vue.toDisplayString(value), 9, _hoisted_19$1);
40670
40719
  }), 64))
40671
40720
  ])
40672
40721
  ]),
@@ -40676,7 +40725,7 @@
40676
40725
  type: "text",
40677
40726
  disabled: __props.sendDisabled
40678
40727
  }, {
40679
- default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
40728
+ default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
40680
40729
  vue.createElementVNode("svg", {
40681
40730
  width: "21",
40682
40731
  height: "21",
@@ -40711,7 +40760,7 @@
40711
40760
  onBlur: handleInputBlur,
40712
40761
  onPaste: handlePaste
40713
40762
  }, null, 8, ["value", "placeholder", "disabled", "onKeydown", "onClick"]),
40714
- vue.createElementVNode("div", _hoisted_21$1, [
40763
+ vue.createElementVNode("div", _hoisted_20$1, [
40715
40764
  vue.createVNode(vue.unref(antDesignVue.Upload), {
40716
40765
  "before-upload": uploadImgHandler,
40717
40766
  "show-upload-list": false,
@@ -40726,7 +40775,7 @@
40726
40775
  loading: attachmentUploading.value,
40727
40776
  disabled: __props.sendDisabled || attachmentUploading.value
40728
40777
  }, {
40729
- icon: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
40778
+ icon: vue.withCtx(() => [..._cache[5] || (_cache[5] = [
40730
40779
  vue.createElementVNode("svg", {
40731
40780
  width: "21",
40732
40781
  height: "18",
@@ -40751,14 +40800,14 @@
40751
40800
  ]),
40752
40801
  _: 1
40753
40802
  }, 8, ["accept", "disabled"]),
40754
- _cache[6] || (_cache[6] = vue.createElementVNode("span", { class: "lineSeparator" }, null, -1)),
40803
+ _cache[7] || (_cache[7] = vue.createElementVNode("span", { class: "lineSeparator" }, null, -1)),
40755
40804
  vue.createVNode(vue.unref(antDesignVue.Button), {
40756
40805
  class: "chatroomButtonArrowUp",
40757
40806
  type: "text",
40758
40807
  disabled: __props.sendDisabled,
40759
40808
  onClick: handleSendText
40760
40809
  }, {
40761
- icon: vue.withCtx(() => [..._cache[5] || (_cache[5] = [
40810
+ icon: vue.withCtx(() => [..._cache[6] || (_cache[6] = [
40762
40811
  vue.createElementVNode("svg", {
40763
40812
  width: "36",
40764
40813
  height: "36",
@@ -40781,7 +40830,7 @@
40781
40830
  _: 1
40782
40831
  }, 8, ["disabled"])
40783
40832
  ])
40784
- ])
40833
+ ], 32)
40785
40834
  ])
40786
40835
  ]),
40787
40836
  vue.createVNode(AitPersonPopover, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yx-web-sdk",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "private": false,
5
5
  "main": "dist/yx-web-sdk.umd.js",
6
6
  "module": "dist/yx-web-sdk.es.js",