vue-chat-kit 0.3.5 → 0.3.6
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/README.md +169 -119
- package/dist/vue-chat-kit.css +1 -1
- package/dist/vue-chat-kit.es.js +83 -83
- package/dist/vue-chat-kit.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/ChatPanel.vue +7 -1
- package/src/core/adapter-example.js +189 -0
package/dist/vue-chat-kit.es.js
CHANGED
|
@@ -168,8 +168,8 @@ class Wt {
|
|
|
168
168
|
fetch(Z, ve),
|
|
169
169
|
this.timeoutPromise(this.timeout)
|
|
170
170
|
]);
|
|
171
|
-
if (this.responseInterceptors.forEach((
|
|
172
|
-
U =
|
|
171
|
+
if (this.responseInterceptors.forEach((ce) => {
|
|
172
|
+
U = ce(U);
|
|
173
173
|
}), !U.ok)
|
|
174
174
|
throw new Je(
|
|
175
175
|
`HTTP ${U.status}: ${U.statusText}`,
|
|
@@ -354,7 +354,7 @@ function Lt(x, t) {
|
|
|
354
354
|
email: x.user.email || "",
|
|
355
355
|
phone: x.user.phone || "",
|
|
356
356
|
bio: x.user.bio || ""
|
|
357
|
-
}), Z = _(!1), X = _([]), ve = _([]), V = _([]), U = _(""), A = _(""), f = _(""),
|
|
357
|
+
}), Z = _(!1), X = _([]), ve = _([]), V = _([]), U = _(""), A = _(""), f = _(""), ce = _(null), Ae = _(!1), he = _(""), C = _([]), ge = _(!1), Ce = _([]), Ve = _(!1), xe = we(() => {
|
|
358
358
|
let i = ve.value;
|
|
359
359
|
if (A.value) {
|
|
360
360
|
const d = A.value.toLowerCase();
|
|
@@ -424,7 +424,7 @@ function Lt(x, t) {
|
|
|
424
424
|
return ["xls", "xlsx"].includes(d) ? "excel" : ["pdf"].includes(d) ? "pdf" : ["doc", "docx"].includes(d) ? "docx" : "default";
|
|
425
425
|
}, Y = () => {
|
|
426
426
|
Oe(() => {
|
|
427
|
-
|
|
427
|
+
ce.value && (ce.value.scrollTop = ce.value.scrollHeight);
|
|
428
428
|
});
|
|
429
429
|
}, I = async () => {
|
|
430
430
|
try {
|
|
@@ -598,7 +598,7 @@ function Lt(x, t) {
|
|
|
598
598
|
}
|
|
599
599
|
I(), t && typeof t == "function" && t(g);
|
|
600
600
|
}
|
|
601
|
-
},
|
|
601
|
+
}, de = () => {
|
|
602
602
|
const i = `${x.api.websocketUrl}?userId=${$}`;
|
|
603
603
|
v = new Dt($, {
|
|
604
604
|
wsUrl: i,
|
|
@@ -648,7 +648,7 @@ function Lt(x, t) {
|
|
|
648
648
|
} catch (i) {
|
|
649
649
|
console.warn("[VueChatKit] 加载头像失败", i);
|
|
650
650
|
}
|
|
651
|
-
},
|
|
651
|
+
}, le = (i) => {
|
|
652
652
|
ee.value = i;
|
|
653
653
|
}, K = async () => {
|
|
654
654
|
Z.value = !0;
|
|
@@ -663,7 +663,7 @@ function Lt(x, t) {
|
|
|
663
663
|
} finally {
|
|
664
664
|
Z.value = !1;
|
|
665
665
|
}
|
|
666
|
-
},
|
|
666
|
+
}, oe = async (i) => {
|
|
667
667
|
try {
|
|
668
668
|
return (await n.updateUserInfo($, i)).code === 200 ? (H.value = {
|
|
669
669
|
...H.value,
|
|
@@ -688,7 +688,7 @@ function Lt(x, t) {
|
|
|
688
688
|
currentSelectName: U,
|
|
689
689
|
searchText: A,
|
|
690
690
|
inputText: f,
|
|
691
|
-
messagesContainer:
|
|
691
|
+
messagesContainer: ce,
|
|
692
692
|
filteredUsers: xe,
|
|
693
693
|
filteredAvailableUsers: Fe,
|
|
694
694
|
currentUser: Re,
|
|
@@ -710,16 +710,16 @@ function Lt(x, t) {
|
|
|
710
710
|
sendMessage: P,
|
|
711
711
|
sendFile: L,
|
|
712
712
|
sendFilesAndText: q,
|
|
713
|
-
initWebSocket:
|
|
713
|
+
initWebSocket: de,
|
|
714
714
|
closeWebSocket: pe,
|
|
715
715
|
reset: ze,
|
|
716
716
|
openAddFriendDialog: B,
|
|
717
717
|
addFriend: ne,
|
|
718
718
|
loadFriendApplyList: D,
|
|
719
719
|
agreeFriend: W,
|
|
720
|
-
updateMyAvatar:
|
|
720
|
+
updateMyAvatar: le,
|
|
721
721
|
getUserInfo: K,
|
|
722
|
-
updateUserInfo:
|
|
722
|
+
updateUserInfo: oe
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
725
|
const gt = (x, t) => {
|
|
@@ -766,7 +766,7 @@ const gt = (x, t) => {
|
|
|
766
766
|
y: 0,
|
|
767
767
|
size: 150,
|
|
768
768
|
minSize: v.minSize
|
|
769
|
-
}),
|
|
769
|
+
}), ce = we(() => ({
|
|
770
770
|
width: `${A.value.displayWidth}px`,
|
|
771
771
|
height: `${A.value.displayHeight}px`,
|
|
772
772
|
maxWidth: "none",
|
|
@@ -799,8 +799,8 @@ const gt = (x, t) => {
|
|
|
799
799
|
}, Ce = () => {
|
|
800
800
|
const w = U.value, z = V.value;
|
|
801
801
|
if (!w || !z) return;
|
|
802
|
-
const Y = w.getContext("2d"), { naturalWidth: I, naturalHeight: R, displayWidth: M, displayHeight: E, offsetX: N, offsetY: P } = A.value, L = I / M, q = R / E, te = (f.value.x - N) * L, se = (f.value.y - P) * q,
|
|
803
|
-
Y.clearRect(0, 0, w.width, w.height), Y.drawImage(z, te, se,
|
|
802
|
+
const Y = w.getContext("2d"), { naturalWidth: I, naturalHeight: R, displayWidth: M, displayHeight: E, offsetX: N, offsetY: P } = A.value, L = I / M, q = R / E, te = (f.value.x - N) * L, se = (f.value.y - P) * q, de = f.value.size * L, pe = f.value.size / v.aspectRatio * q;
|
|
803
|
+
Y.clearRect(0, 0, w.width, w.height), Y.drawImage(z, te, se, de, pe, 0, 0, w.width, w.height);
|
|
804
804
|
}, Ve = (w) => {
|
|
805
805
|
w.preventDefault();
|
|
806
806
|
const z = w.clientX || w.touches[0].clientX, Y = w.clientY || w.touches[0].clientY;
|
|
@@ -811,7 +811,7 @@ const gt = (x, t) => {
|
|
|
811
811
|
boxY: f.value.y
|
|
812
812
|
};
|
|
813
813
|
const I = (M) => {
|
|
814
|
-
const E = M.clientX || M.touches[0].clientX, N = M.clientY || M.touches[0].clientY, P = E - he.startX, L = N - he.startY, { offsetX: q, offsetY: te, displayWidth: se, displayHeight:
|
|
814
|
+
const E = M.clientX || M.touches[0].clientX, N = M.clientY || M.touches[0].clientY, P = E - he.startX, L = N - he.startY, { offsetX: q, offsetY: te, displayWidth: se, displayHeight: de } = A.value, pe = f.value.size / v.aspectRatio, B = Math.max(q, Math.min(q + se - f.value.size, he.boxX + P)), ae = Math.max(te, Math.min(te + de - pe, he.boxY + L));
|
|
815
815
|
f.value.x = B, f.value.y = ae, Ce();
|
|
816
816
|
}, R = () => {
|
|
817
817
|
he = null, document.removeEventListener("mousemove", I), document.removeEventListener("mouseup", R), document.removeEventListener("touchmove", I), document.removeEventListener("touchend", R);
|
|
@@ -829,18 +829,18 @@ const gt = (x, t) => {
|
|
|
829
829
|
boxSize: f.value.size
|
|
830
830
|
};
|
|
831
831
|
const R = (E) => {
|
|
832
|
-
const N = E.clientX || E.touches[0].clientX, P = E.clientY || E.touches[0].clientY, L = N - C.startX, q = P - C.startY, { offsetX: te, offsetY: se, displayWidth:
|
|
832
|
+
const N = E.clientX || E.touches[0].clientX, P = E.clientY || E.touches[0].clientY, L = N - C.startX, q = P - C.startY, { offsetX: te, offsetY: se, displayWidth: de, displayHeight: pe } = A.value;
|
|
833
833
|
let B = C.boxSize, ae = C.boxX, ne = C.boxY;
|
|
834
834
|
const D = C.boxSize / v.aspectRatio;
|
|
835
835
|
switch (w) {
|
|
836
836
|
case "se":
|
|
837
|
-
B = Math.max(f.value.minSize, Math.min(
|
|
837
|
+
B = Math.max(f.value.minSize, Math.min(de - (C.boxX - te), pe - (C.boxY - se), C.boxSize + Math.max(L, q)));
|
|
838
838
|
break;
|
|
839
839
|
case "nw":
|
|
840
840
|
B = Math.max(f.value.minSize, Math.min(C.boxX - te + C.boxSize, C.boxY - se + D, C.boxSize - Math.max(L, q))), ae = C.boxX + (C.boxSize - B), ne = C.boxY + (D - B / v.aspectRatio);
|
|
841
841
|
break;
|
|
842
842
|
case "ne":
|
|
843
|
-
B = Math.max(f.value.minSize, Math.min(te +
|
|
843
|
+
B = Math.max(f.value.minSize, Math.min(te + de - C.boxX, C.boxY - se + D, C.boxSize + Math.max(L, -q))), ne = C.boxY + (D - B / v.aspectRatio);
|
|
844
844
|
break;
|
|
845
845
|
case "sw":
|
|
846
846
|
B = Math.max(f.value.minSize, Math.min(C.boxX - te + C.boxSize, se + pe - C.boxY, C.boxSize + Math.max(-L, q))), ae = C.boxX + (C.boxSize - B);
|
|
@@ -855,7 +855,7 @@ const gt = (x, t) => {
|
|
|
855
855
|
B = Math.max(f.value.minSize, Math.min(C.boxX - te + C.boxSize, C.boxSize - L)), ae = C.boxX + (C.boxSize - B);
|
|
856
856
|
break;
|
|
857
857
|
case "e":
|
|
858
|
-
B = Math.max(f.value.minSize, Math.min(te +
|
|
858
|
+
B = Math.max(f.value.minSize, Math.min(te + de - C.boxX, C.boxSize + L));
|
|
859
859
|
break;
|
|
860
860
|
}
|
|
861
861
|
f.value.size = B, f.value.x = ae, f.value.y = ne, Ce();
|
|
@@ -866,8 +866,8 @@ const gt = (x, t) => {
|
|
|
866
866
|
}, Se = () => {
|
|
867
867
|
const w = document.createElement("canvas"), z = V.value;
|
|
868
868
|
if (!z) return null;
|
|
869
|
-
const { naturalWidth: Y, naturalHeight: I, displayWidth: R, displayHeight: M, offsetX: E, offsetY: N } = A.value, P = Y / R, L = I / M, q = (f.value.x - E) * P, te = (f.value.y - N) * L, se = f.value.size * P,
|
|
870
|
-
return w.width = v.outputSize, w.height = v.outputSize / v.aspectRatio, w.getContext("2d").drawImage(z, q, te, se,
|
|
869
|
+
const { naturalWidth: Y, naturalHeight: I, displayWidth: R, displayHeight: M, offsetX: E, offsetY: N } = A.value, P = Y / R, L = I / M, q = (f.value.x - E) * P, te = (f.value.y - N) * L, se = f.value.size * P, de = f.value.size / v.aspectRatio * L;
|
|
870
|
+
return w.width = v.outputSize, w.height = v.outputSize / v.aspectRatio, w.getContext("2d").drawImage(z, q, te, se, de, 0, 0, w.width, w.height), new Promise((B) => {
|
|
871
871
|
w.toBlob(
|
|
872
872
|
(ae) => {
|
|
873
873
|
B(new File([ae], "avatar.jpg", { type: v.outputType }));
|
|
@@ -879,8 +879,8 @@ const gt = (x, t) => {
|
|
|
879
879
|
}, Fe = () => {
|
|
880
880
|
const w = document.createElement("canvas"), z = V.value;
|
|
881
881
|
if (!z) return null;
|
|
882
|
-
const { naturalWidth: Y, naturalHeight: I, displayWidth: R, displayHeight: M, offsetX: E, offsetY: N } = A.value, P = Y / R, L = I / M, q = (f.value.x - E) * P, te = (f.value.y - N) * L, se = f.value.size * P,
|
|
883
|
-
return w.width = v.outputSize, w.height = v.outputSize / v.aspectRatio, w.getContext("2d").drawImage(z, q, te, se,
|
|
882
|
+
const { naturalWidth: Y, naturalHeight: I, displayWidth: R, displayHeight: M, offsetX: E, offsetY: N } = A.value, P = Y / R, L = I / M, q = (f.value.x - E) * P, te = (f.value.y - N) * L, se = f.value.size * P, de = f.value.size / v.aspectRatio * L;
|
|
883
|
+
return w.width = v.outputSize, w.height = v.outputSize / v.aspectRatio, w.getContext("2d").drawImage(z, q, te, se, de, 0, 0, w.width, w.height), w.toDataURL(v.outputType, v.outputQuality);
|
|
884
884
|
}, Re = async () => {
|
|
885
885
|
if (H.value) {
|
|
886
886
|
X.value = !0;
|
|
@@ -957,7 +957,7 @@ const gt = (x, t) => {
|
|
|
957
957
|
ref_key: "imageRef",
|
|
958
958
|
ref: V,
|
|
959
959
|
onLoad: ge,
|
|
960
|
-
style: Xe(
|
|
960
|
+
style: Xe(ce.value)
|
|
961
961
|
}, null, 44, Yt),
|
|
962
962
|
e("div", {
|
|
963
963
|
class: "crop-box",
|
|
@@ -1070,7 +1070,7 @@ const gt = (x, t) => {
|
|
|
1070
1070
|
inputText: U,
|
|
1071
1071
|
messagesContainer: A,
|
|
1072
1072
|
filteredUsers: f,
|
|
1073
|
-
filteredAvailableUsers:
|
|
1073
|
+
filteredAvailableUsers: ce,
|
|
1074
1074
|
currentUser: Ae,
|
|
1075
1075
|
currentMessages: he,
|
|
1076
1076
|
addFriendDialogVisible: C,
|
|
@@ -1097,7 +1097,7 @@ const gt = (x, t) => {
|
|
|
1097
1097
|
loadFriendApplyList: q,
|
|
1098
1098
|
agreeFriend: te,
|
|
1099
1099
|
updateMyAvatar: se,
|
|
1100
|
-
getUserInfo:
|
|
1100
|
+
getUserInfo: de,
|
|
1101
1101
|
updateUserInfo: pe
|
|
1102
1102
|
} = Lt(n.config, (h) => {
|
|
1103
1103
|
v("message", h);
|
|
@@ -1105,7 +1105,7 @@ const gt = (x, t) => {
|
|
|
1105
1105
|
var r;
|
|
1106
1106
|
const h = [{ id: "chat", icon: Ye, badge: 0 }];
|
|
1107
1107
|
return n.config.modules.friends && h.push({ id: "friends", icon: Qe, badge: 0 }), n.config.modules.apply && h.push({ id: "apply", icon: Ut, badge: ((r = xe.value) == null ? void 0 : r.length) || 0 }), h;
|
|
1108
|
-
}), ae = _("chat"), ne = _(null), D = _(null), W = _(null), ie = _(!1),
|
|
1108
|
+
}), ae = _("chat"), ne = _(null), D = _(null), W = _(null), ie = _(!1), le = _(!1), K = _({ nickname: "", email: "", phone: "", bio: "" }), oe = _(!1), ze = _(!1), i = _(!1), d = _(!1), g = _(null), F = _(""), _e = _(null), j = _([]), O = _({ visible: !1, x: 0, y: 0, chat: null }), Ue = (h, r) => {
|
|
1109
1109
|
h.preventDefault(), h.stopPropagation(), O.value = { visible: !0, x: h.clientX, y: h.clientY, chat: r };
|
|
1110
1110
|
}, Le = () => {
|
|
1111
1111
|
O.value.visible = !1;
|
|
@@ -1238,26 +1238,26 @@ const gt = (x, t) => {
|
|
|
1238
1238
|
email: H.value.email || "",
|
|
1239
1239
|
phone: H.value.phone || "",
|
|
1240
1240
|
bio: H.value.bio || ""
|
|
1241
|
-
},
|
|
1241
|
+
}, le.value = !0;
|
|
1242
1242
|
}, vt = () => {
|
|
1243
|
-
|
|
1243
|
+
le.value = !1, K.value = { nickname: "", email: "", phone: "", bio: "" };
|
|
1244
1244
|
}, pt = async () => {
|
|
1245
|
-
|
|
1245
|
+
oe.value = !0;
|
|
1246
1246
|
try {
|
|
1247
|
-
await pe(K.value) ? (Q.success("保存成功"),
|
|
1247
|
+
await pe(K.value) ? (Q.success("保存成功"), le.value = !1) : Q.error("保存失败");
|
|
1248
1248
|
} catch (h) {
|
|
1249
1249
|
console.error(h), Q.error("保存失败");
|
|
1250
1250
|
} finally {
|
|
1251
|
-
|
|
1251
|
+
oe.value = !1;
|
|
1252
1252
|
}
|
|
1253
1253
|
};
|
|
1254
1254
|
return _t(async () => {
|
|
1255
|
-
await Promise.all([We(), q()
|
|
1255
|
+
await Promise.all([We(), q()]), M(), f.value.length > 0 && Te(f.value[0]), v("init"), document.addEventListener("click", Le);
|
|
1256
1256
|
}), bt(() => {
|
|
1257
1257
|
N(), E(), document.removeEventListener("click", Le);
|
|
1258
1258
|
}), (h, r) => {
|
|
1259
1259
|
var ke, He, Ee;
|
|
1260
|
-
const u = be("el-icon"), s = be("el-input"), b = be("el-empty"), T = be("el-button"),
|
|
1260
|
+
const u = be("el-icon"), s = be("el-input"), b = be("el-empty"), T = be("el-button"), re = be("el-dialog");
|
|
1261
1261
|
return a(), p("div", jt, [
|
|
1262
1262
|
e("div", Ot, [
|
|
1263
1263
|
e("div", {
|
|
@@ -1694,7 +1694,7 @@ const gt = (x, t) => {
|
|
|
1694
1694
|
])
|
|
1695
1695
|
])
|
|
1696
1696
|
])) : S("", !0),
|
|
1697
|
-
m(
|
|
1697
|
+
m(re, {
|
|
1698
1698
|
modelValue: c(C),
|
|
1699
1699
|
"onUpdate:modelValue": r[6] || (r[6] = (o) => Ie(C) ? C.value = o : null),
|
|
1700
1700
|
title: "添加好友",
|
|
@@ -1715,10 +1715,10 @@ const gt = (x, t) => {
|
|
|
1715
1715
|
c(Ve) ? (a(), G(b, {
|
|
1716
1716
|
key: 0,
|
|
1717
1717
|
description: "加载中..."
|
|
1718
|
-
})) : c(
|
|
1718
|
+
})) : c(ce).length === 0 ? (a(), G(b, {
|
|
1719
1719
|
key: 1,
|
|
1720
1720
|
description: "暂无用户"
|
|
1721
|
-
})) : (a(!0), p(me, { key: 2 }, fe(c(
|
|
1721
|
+
})) : (a(!0), p(me, { key: 2 }, fe(c(ce), (o) => (a(), p("div", {
|
|
1722
1722
|
key: o.username,
|
|
1723
1723
|
class: "add-friend-user-item"
|
|
1724
1724
|
}, [
|
|
@@ -1745,7 +1745,7 @@ const gt = (x, t) => {
|
|
|
1745
1745
|
]),
|
|
1746
1746
|
_: 1
|
|
1747
1747
|
}, 8, ["modelValue"]),
|
|
1748
|
-
m(
|
|
1748
|
+
m(re, {
|
|
1749
1749
|
modelValue: ze.value,
|
|
1750
1750
|
"onUpdate:modelValue": r[11] || (r[11] = (o) => ze.value = o),
|
|
1751
1751
|
title: "个人设置",
|
|
@@ -1803,7 +1803,7 @@ const gt = (x, t) => {
|
|
|
1803
1803
|
}),
|
|
1804
1804
|
r[23] || (r[23] = ue(" 个人信息 ", -1))
|
|
1805
1805
|
]),
|
|
1806
|
-
|
|
1806
|
+
le.value ? S("", !0) : (a(), G(T, {
|
|
1807
1807
|
key: 0,
|
|
1808
1808
|
type: "primary",
|
|
1809
1809
|
size: "small",
|
|
@@ -1819,7 +1819,7 @@ const gt = (x, t) => {
|
|
|
1819
1819
|
e("div", Fa, [
|
|
1820
1820
|
e("div", Ia, [
|
|
1821
1821
|
r[25] || (r[25] = e("label", { class: "chat-settings-form-label" }, "昵称", -1)),
|
|
1822
|
-
|
|
1822
|
+
le.value ? (a(), G(s, {
|
|
1823
1823
|
key: 0,
|
|
1824
1824
|
modelValue: K.value.nickname,
|
|
1825
1825
|
"onUpdate:modelValue": r[7] || (r[7] = (o) => K.value.nickname = o),
|
|
@@ -1829,7 +1829,7 @@ const gt = (x, t) => {
|
|
|
1829
1829
|
]),
|
|
1830
1830
|
e("div", Ma, [
|
|
1831
1831
|
r[26] || (r[26] = e("label", { class: "chat-settings-form-label" }, "邮箱", -1)),
|
|
1832
|
-
|
|
1832
|
+
le.value ? (a(), G(s, {
|
|
1833
1833
|
key: 0,
|
|
1834
1834
|
modelValue: K.value.email,
|
|
1835
1835
|
"onUpdate:modelValue": r[8] || (r[8] = (o) => K.value.email = o),
|
|
@@ -1839,7 +1839,7 @@ const gt = (x, t) => {
|
|
|
1839
1839
|
]),
|
|
1840
1840
|
e("div", Ta, [
|
|
1841
1841
|
r[27] || (r[27] = e("label", { class: "chat-settings-form-label" }, "手机号", -1)),
|
|
1842
|
-
|
|
1842
|
+
le.value ? (a(), G(s, {
|
|
1843
1843
|
key: 0,
|
|
1844
1844
|
modelValue: K.value.phone,
|
|
1845
1845
|
"onUpdate:modelValue": r[9] || (r[9] = (o) => K.value.phone = o),
|
|
@@ -1849,7 +1849,7 @@ const gt = (x, t) => {
|
|
|
1849
1849
|
]),
|
|
1850
1850
|
e("div", Da, [
|
|
1851
1851
|
r[28] || (r[28] = e("label", { class: "chat-settings-form-label" }, "个人简介", -1)),
|
|
1852
|
-
|
|
1852
|
+
le.value ? (a(), G(s, {
|
|
1853
1853
|
key: 0,
|
|
1854
1854
|
modelValue: K.value.bio,
|
|
1855
1855
|
"onUpdate:modelValue": r[10] || (r[10] = (o) => K.value.bio = o),
|
|
@@ -1859,7 +1859,7 @@ const gt = (x, t) => {
|
|
|
1859
1859
|
size: "large"
|
|
1860
1860
|
}, null, 8, ["modelValue"])) : (a(), p("div", Wa, y(c(H).bio || "这个人很懒,什么都没写~"), 1))
|
|
1861
1861
|
]),
|
|
1862
|
-
|
|
1862
|
+
le.value ? (a(), p("div", Ha, [
|
|
1863
1863
|
m(T, {
|
|
1864
1864
|
size: "default",
|
|
1865
1865
|
onClick: vt
|
|
@@ -1872,7 +1872,7 @@ const gt = (x, t) => {
|
|
|
1872
1872
|
m(T, {
|
|
1873
1873
|
type: "primary",
|
|
1874
1874
|
size: "default",
|
|
1875
|
-
loading:
|
|
1875
|
+
loading: oe.value,
|
|
1876
1876
|
onClick: pt
|
|
1877
1877
|
}, {
|
|
1878
1878
|
default: k(() => [...r[30] || (r[30] = [
|
|
@@ -1906,7 +1906,7 @@ const gt = (x, t) => {
|
|
|
1906
1906
|
]);
|
|
1907
1907
|
};
|
|
1908
1908
|
}
|
|
1909
|
-
}, Ya = /* @__PURE__ */ gt(Xa, [["__scopeId", "data-v-
|
|
1909
|
+
}, Ya = /* @__PURE__ */ gt(Xa, [["__scopeId", "data-v-c08932e1"]]), qa = { class: "chat-container" }, Ba = { class: "sidebar-nav" }, Ka = ["src"], Na = ["onClick"], Pa = {
|
|
1910
1910
|
key: 0,
|
|
1911
1911
|
class: "nav-badge"
|
|
1912
1912
|
}, ja = { class: "content-panel" }, Oa = { class: "search-bar" }, Ga = { class: "content-scroll" }, Ja = { key: 0 }, Qa = ["onClick", "onContextmenu"], Za = { class: "friend-avatar-wrapper" }, en = ["src", "alt"], tn = {
|
|
@@ -1982,7 +1982,7 @@ const gt = (x, t) => {
|
|
|
1982
1982
|
searchText: U,
|
|
1983
1983
|
inputText: A,
|
|
1984
1984
|
messagesContainer: f,
|
|
1985
|
-
filteredUsers:
|
|
1985
|
+
filteredUsers: ce,
|
|
1986
1986
|
filteredAvailableUsers: Ae,
|
|
1987
1987
|
currentUser: he,
|
|
1988
1988
|
currentMessages: C,
|
|
@@ -2009,20 +2009,20 @@ const gt = (x, t) => {
|
|
|
2009
2009
|
addFriend: q,
|
|
2010
2010
|
loadFriendApplyList: te,
|
|
2011
2011
|
agreeFriend: se,
|
|
2012
|
-
updateMyAvatar:
|
|
2012
|
+
updateMyAvatar: de,
|
|
2013
2013
|
getUserInfo: pe,
|
|
2014
2014
|
updateUserInfo: B
|
|
2015
2015
|
} = Lt(n.config), ae = we(() => {
|
|
2016
2016
|
var s;
|
|
2017
2017
|
const u = [{ id: "chat", icon: Ye, badge: 0 }];
|
|
2018
2018
|
return n.config.modules.friends && u.push({ id: "friends", icon: Qe, badge: 0 }), n.config.modules.apply && u.push({ id: "apply", icon: Ut, badge: ((s = Se.value) == null ? void 0 : s.length) || 0 }), u;
|
|
2019
|
-
}), ne = _("chat"), D = _(null), W = _(null), ie = _(null),
|
|
2019
|
+
}), ne = _("chat"), D = _(null), W = _(null), ie = _(null), le = _(!1), K = _(!1), oe = _({ nickname: "", email: "", phone: "", bio: "" }), ze = _(!1), i = _(!1), d = _(!1), g = _(!1), F = _(null), _e = _(""), j = _(null), O = _([]), Ue = _({ visible: !1, x: 0, y: 0, chat: null }), Le = () => {
|
|
2020
2020
|
Ue.value.visible = !1;
|
|
2021
2021
|
}, et = async () => {
|
|
2022
2022
|
if (!Ue.value.chat) return;
|
|
2023
2023
|
await z(Ue.value.chat.id, 0) && D.value === Ue.value.chat.id && (D.value = null, W.value = null), Le();
|
|
2024
2024
|
}, Te = (u) => {
|
|
2025
|
-
D.value = u.id, W.value = u, ie.value = null,
|
|
2025
|
+
D.value = u.id, W.value = u, ie.value = null, le.value = !1, Y({
|
|
2026
2026
|
id: u.id,
|
|
2027
2027
|
name: u.name,
|
|
2028
2028
|
avatar: u.avatar,
|
|
@@ -2034,7 +2034,7 @@ const gt = (x, t) => {
|
|
|
2034
2034
|
if (!ie.value) return;
|
|
2035
2035
|
if (await z(ie.value.id)) {
|
|
2036
2036
|
ne.value = "chat", await Oe();
|
|
2037
|
-
const s =
|
|
2037
|
+
const s = ce.value.find((b) => b.id === ie.value.id);
|
|
2038
2038
|
s && Te(s), ie.value = null;
|
|
2039
2039
|
}
|
|
2040
2040
|
}, at = () => {
|
|
@@ -2085,21 +2085,21 @@ const gt = (x, t) => {
|
|
|
2085
2085
|
if (s) {
|
|
2086
2086
|
for (const T of s)
|
|
2087
2087
|
if (T.kind === "file") {
|
|
2088
|
-
const
|
|
2089
|
-
if (
|
|
2090
|
-
if (
|
|
2091
|
-
Q.warning(`文件 ${
|
|
2088
|
+
const re = T.getAsFile();
|
|
2089
|
+
if (re) {
|
|
2090
|
+
if (re.size > 50 * 1024 * 1024) {
|
|
2091
|
+
Q.warning(`文件 ${re.name} 超过50MB,已跳过`);
|
|
2092
2092
|
continue;
|
|
2093
2093
|
}
|
|
2094
|
-
const ke = URL.createObjectURL(
|
|
2094
|
+
const ke = URL.createObjectURL(re);
|
|
2095
2095
|
O.value.push({
|
|
2096
2096
|
id: Date.now() + Math.random(),
|
|
2097
|
-
file:
|
|
2098
|
-
name:
|
|
2099
|
-
size:
|
|
2100
|
-
type:
|
|
2097
|
+
file: re,
|
|
2098
|
+
name: re.name,
|
|
2099
|
+
size: re.size,
|
|
2100
|
+
type: re.type,
|
|
2101
2101
|
previewUrl: ke,
|
|
2102
|
-
isImage:
|
|
2102
|
+
isImage: re.type.startsWith("image/")
|
|
2103
2103
|
});
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
@@ -2132,7 +2132,7 @@ const gt = (x, t) => {
|
|
|
2132
2132
|
g.value = !0;
|
|
2133
2133
|
try {
|
|
2134
2134
|
const { ChatApi: s } = await Promise.resolve().then(() => Mt), T = await new s(n.config).uploadAvatar(u, ee);
|
|
2135
|
-
T.code === 200 ? (Q.success("头像上传成功"),
|
|
2135
|
+
T.code === 200 ? (Q.success("头像上传成功"), de(T.data), Ge()) : Q.error(T.msg || "头像上传失败");
|
|
2136
2136
|
} catch (s) {
|
|
2137
2137
|
console.error(s), Q.error("头像上传失败");
|
|
2138
2138
|
} finally {
|
|
@@ -2142,34 +2142,34 @@ const gt = (x, t) => {
|
|
|
2142
2142
|
}, Ge = () => {
|
|
2143
2143
|
_e.value = "", d.value = !1, F.value && (F.value.value = "");
|
|
2144
2144
|
}, ut = () => {
|
|
2145
|
-
|
|
2145
|
+
oe.value = {
|
|
2146
2146
|
nickname: Z.value.nickname || "",
|
|
2147
2147
|
email: Z.value.email || "",
|
|
2148
2148
|
phone: Z.value.phone || "",
|
|
2149
2149
|
bio: Z.value.bio || ""
|
|
2150
2150
|
}, K.value = !0;
|
|
2151
2151
|
}, vt = () => {
|
|
2152
|
-
K.value = !1,
|
|
2152
|
+
K.value = !1, oe.value = { nickname: "", email: "", phone: "", bio: "" };
|
|
2153
2153
|
}, pt = async () => {
|
|
2154
2154
|
ze.value = !0;
|
|
2155
2155
|
try {
|
|
2156
|
-
await B(
|
|
2156
|
+
await B(oe.value) ? (Q.success("保存成功"), K.value = !1) : Q.error("保存失败");
|
|
2157
2157
|
} catch (u) {
|
|
2158
2158
|
console.error(u), Q.error("保存失败");
|
|
2159
2159
|
} finally {
|
|
2160
2160
|
ze.value = !1;
|
|
2161
2161
|
}
|
|
2162
2162
|
}, h = () => {
|
|
2163
|
-
P(), N(),
|
|
2163
|
+
P(), N(), le.value = !1, i.value = !1, Ge(), K.value = !1, v("close");
|
|
2164
2164
|
}, r = async () => {
|
|
2165
|
-
await Promise.all([Me(), te(), pe()]), E(),
|
|
2165
|
+
await Promise.all([Me(), te(), pe()]), E(), ce.value.length > 0 && Te(ce.value[0]), v("open");
|
|
2166
2166
|
};
|
|
2167
2167
|
return _t(() => {
|
|
2168
2168
|
document.addEventListener("click", Le);
|
|
2169
2169
|
}), bt(() => {
|
|
2170
2170
|
document.removeEventListener("click", Le), N();
|
|
2171
2171
|
}), (u, s) => {
|
|
2172
|
-
const b = be("el-icon"), T = be("el-input"),
|
|
2172
|
+
const b = be("el-icon"), T = be("el-input"), re = be("el-empty"), ke = be("el-button"), He = be("el-dialog");
|
|
2173
2173
|
return a(), G(He, {
|
|
2174
2174
|
modelValue: $.value,
|
|
2175
2175
|
"onUpdate:modelValue": s[13] || (s[13] = (Ee) => $.value = Ee),
|
|
@@ -2237,7 +2237,7 @@ const gt = (x, t) => {
|
|
|
2237
2237
|
]),
|
|
2238
2238
|
e("div", Ga, [
|
|
2239
2239
|
ne.value === "chat" ? (a(), p("div", Ja, [
|
|
2240
|
-
(a(!0), p(me, null, fe(c(
|
|
2240
|
+
(a(!0), p(me, null, fe(c(ce), (l) => (a(), p("div", {
|
|
2241
2241
|
key: l.id,
|
|
2242
2242
|
class: J([
|
|
2243
2243
|
"chat-item",
|
|
@@ -2310,10 +2310,10 @@ const gt = (x, t) => {
|
|
|
2310
2310
|
], 8, pn))), 128))
|
|
2311
2311
|
])) : S("", !0),
|
|
2312
2312
|
ne.value === "apply" && x.config.modules.apply ? (a(), p("div", yn, [
|
|
2313
|
-
c(Fe) ? (a(), G(
|
|
2313
|
+
c(Fe) ? (a(), G(re, {
|
|
2314
2314
|
key: 0,
|
|
2315
2315
|
description: "加载中..."
|
|
2316
|
-
})) : c(Se).length === 0 ? (a(), G(
|
|
2316
|
+
})) : c(Se).length === 0 ? (a(), G(re, {
|
|
2317
2317
|
key: 1,
|
|
2318
2318
|
description: "暂无好友申请"
|
|
2319
2319
|
})) : (a(!0), p(me, { key: 2 }, fe(c(Se), (l) => (a(), p("div", {
|
|
@@ -2400,7 +2400,7 @@ const gt = (x, t) => {
|
|
|
2400
2400
|
}),
|
|
2401
2401
|
m(b, {
|
|
2402
2402
|
class: "action-icon",
|
|
2403
|
-
onClick: s[3] || (s[3] = (l) =>
|
|
2403
|
+
onClick: s[3] || (s[3] = (l) => le.value = !le.value)
|
|
2404
2404
|
}, {
|
|
2405
2405
|
default: k(() => [
|
|
2406
2406
|
m(c(zt))
|
|
@@ -2601,7 +2601,7 @@ const gt = (x, t) => {
|
|
|
2601
2601
|
e("div", li, y(ne.value === "apply" ? "在左侧选择好友申请" : "在左侧选择好友开始聊天"), 1)
|
|
2602
2602
|
]))
|
|
2603
2603
|
]),
|
|
2604
|
-
|
|
2604
|
+
le.value ? (a(), p("div", oi, [
|
|
2605
2605
|
s[22] || (s[22] = e("div", { class: "detail-header" }, "聊天详情", -1)),
|
|
2606
2606
|
e("div", ri, [
|
|
2607
2607
|
e("div", ci, [
|
|
@@ -2638,10 +2638,10 @@ const gt = (x, t) => {
|
|
|
2638
2638
|
])
|
|
2639
2639
|
]),
|
|
2640
2640
|
e("div", mi, [
|
|
2641
|
-
c(xe) ? (a(), G(
|
|
2641
|
+
c(xe) ? (a(), G(re, {
|
|
2642
2642
|
key: 0,
|
|
2643
2643
|
description: "加载中..."
|
|
2644
|
-
})) : c(Ae).length === 0 ? (a(), G(
|
|
2644
|
+
})) : c(Ae).length === 0 ? (a(), G(re, {
|
|
2645
2645
|
key: 1,
|
|
2646
2646
|
description: "暂无用户"
|
|
2647
2647
|
})) : (a(!0), p(me, { key: 2 }, fe(c(Ae), (l) => (a(), p("div", {
|
|
@@ -2747,8 +2747,8 @@ const gt = (x, t) => {
|
|
|
2747
2747
|
s[26] || (s[26] = e("label", { class: "settings-form-label" }, "昵称", -1)),
|
|
2748
2748
|
K.value ? (a(), G(T, {
|
|
2749
2749
|
key: 0,
|
|
2750
|
-
modelValue:
|
|
2751
|
-
"onUpdate:modelValue": s[7] || (s[7] = (l) =>
|
|
2750
|
+
modelValue: oe.value.nickname,
|
|
2751
|
+
"onUpdate:modelValue": s[7] || (s[7] = (l) => oe.value.nickname = l),
|
|
2752
2752
|
placeholder: "请输入昵称",
|
|
2753
2753
|
size: "large"
|
|
2754
2754
|
}, null, 8, ["modelValue"])) : (a(), p("div", Vi, y(c(Z).nickname || "未设置"), 1))
|
|
@@ -2757,8 +2757,8 @@ const gt = (x, t) => {
|
|
|
2757
2757
|
s[27] || (s[27] = e("label", { class: "settings-form-label" }, "邮箱", -1)),
|
|
2758
2758
|
K.value ? (a(), G(T, {
|
|
2759
2759
|
key: 0,
|
|
2760
|
-
modelValue:
|
|
2761
|
-
"onUpdate:modelValue": s[8] || (s[8] = (l) =>
|
|
2760
|
+
modelValue: oe.value.email,
|
|
2761
|
+
"onUpdate:modelValue": s[8] || (s[8] = (l) => oe.value.email = l),
|
|
2762
2762
|
placeholder: "请输入邮箱",
|
|
2763
2763
|
size: "large"
|
|
2764
2764
|
}, null, 8, ["modelValue"])) : (a(), p("div", Ii, y(c(Z).email || "未设置"), 1))
|
|
@@ -2767,8 +2767,8 @@ const gt = (x, t) => {
|
|
|
2767
2767
|
s[28] || (s[28] = e("label", { class: "settings-form-label" }, "手机号", -1)),
|
|
2768
2768
|
K.value ? (a(), G(T, {
|
|
2769
2769
|
key: 0,
|
|
2770
|
-
modelValue:
|
|
2771
|
-
"onUpdate:modelValue": s[9] || (s[9] = (l) =>
|
|
2770
|
+
modelValue: oe.value.phone,
|
|
2771
|
+
"onUpdate:modelValue": s[9] || (s[9] = (l) => oe.value.phone = l),
|
|
2772
2772
|
placeholder: "请输入手机号",
|
|
2773
2773
|
size: "large"
|
|
2774
2774
|
}, null, 8, ["modelValue"])) : (a(), p("div", Mi, y(c(Z).phone || "未设置"), 1))
|
|
@@ -2777,8 +2777,8 @@ const gt = (x, t) => {
|
|
|
2777
2777
|
s[29] || (s[29] = e("label", { class: "settings-form-label" }, "个人简介", -1)),
|
|
2778
2778
|
K.value ? (a(), G(T, {
|
|
2779
2779
|
key: 0,
|
|
2780
|
-
modelValue:
|
|
2781
|
-
"onUpdate:modelValue": s[10] || (s[10] = (l) =>
|
|
2780
|
+
modelValue: oe.value.bio,
|
|
2781
|
+
"onUpdate:modelValue": s[10] || (s[10] = (l) => oe.value.bio = l),
|
|
2782
2782
|
type: "textarea",
|
|
2783
2783
|
rows: 4,
|
|
2784
2784
|
placeholder: "介绍一下自己吧...",
|