vue-chat-kit 0.3.2 → 0.3.5
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/dist/vue-chat-kit.css +1 -1
- package/dist/vue-chat-kit.es.js +1524 -1389
- package/dist/vue-chat-kit.umd.js +1 -1
- package/package.json +2 -2
- package/src/components/AvatarCrop.vue +475 -170
package/dist/vue-chat-kit.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { ChatDotRound as
|
|
3
|
-
import
|
|
4
|
-
import { ElMessage as
|
|
5
|
-
class
|
|
6
|
-
constructor(t,
|
|
7
|
-
this.userId = t, this.wsUrl =
|
|
1
|
+
import { ref as _, computed as we, nextTick as Oe, watch as Et, resolveComponent as be, openBlock as a, createBlock as G, withCtx as k, createElementVNode as e, createElementBlock as p, normalizeStyle as Xe, Fragment as me, renderList as fe, withModifiers as Be, normalizeClass as J, createVNode as m, createTextVNode as ue, onMounted as _t, onUnmounted as bt, unref as c, resolveDynamicComponent as kt, toDisplayString as y, createCommentVNode as S, isRef as Ie, withDirectives as wt, withKeys as Ct, vModelText as xt } from "vue";
|
|
2
|
+
import { ChatDotRound as Ye, UserFilled as Qe, Bell as Ut, Setting as $t, Search as qe, Plus as St, MoreFilled as zt, Document as At, Download as Vt, Folder as Ze, Picture as Ft, ChatLineRound as It, Camera as Rt } from "@element-plus/icons-vue";
|
|
3
|
+
import ft from "dayjs";
|
|
4
|
+
import { ElMessage as Q } from "element-plus";
|
|
5
|
+
class Dt {
|
|
6
|
+
constructor(t, n = {}) {
|
|
7
|
+
this.userId = t, this.wsUrl = n.wsUrl || "", this.socket = null, this.reconnectAttempts = 0, this.maxReconnectAttempts = n.maxReconnectAttempts || 5, this.reconnectDelay = n.reconnectDelay || 3e3, this.handlers = {
|
|
8
8
|
message: [],
|
|
9
9
|
open: [],
|
|
10
10
|
close: [],
|
|
@@ -22,10 +22,10 @@ class Et {
|
|
|
22
22
|
console.log("[VueChatKit] WebSocket 连接成功"), this.isConnecting = !1, this.reconnectAttempts = 0, this.emit("open");
|
|
23
23
|
}, this.socket.onmessage = (t) => {
|
|
24
24
|
try {
|
|
25
|
-
const
|
|
26
|
-
this.emit("message",
|
|
27
|
-
} catch (
|
|
28
|
-
console.error("[VueChatKit] WebSocket 消息解析失败",
|
|
25
|
+
const n = t.data;
|
|
26
|
+
this.emit("message", n);
|
|
27
|
+
} catch (n) {
|
|
28
|
+
console.error("[VueChatKit] WebSocket 消息解析失败", n);
|
|
29
29
|
}
|
|
30
30
|
}, this.socket.onclose = (t) => {
|
|
31
31
|
console.log("[VueChatKit] WebSocket 连接关闭", t.code), this.isConnecting = !1, this.emit("close", t), !this.manualClose && t.code !== 1e3 && this.reconnect();
|
|
@@ -40,40 +40,40 @@ class Et {
|
|
|
40
40
|
/**
|
|
41
41
|
* 发送消息
|
|
42
42
|
*/
|
|
43
|
-
send(t,
|
|
43
|
+
send(t, n, v = "text", $ = "", ee = "", H = 0) {
|
|
44
44
|
if (this.isConnected()) {
|
|
45
|
-
const
|
|
45
|
+
const Z = JSON.stringify({
|
|
46
46
|
to: t,
|
|
47
|
-
msg:
|
|
48
|
-
type:
|
|
49
|
-
fileUrl:
|
|
50
|
-
fileName:
|
|
51
|
-
fileSize:
|
|
47
|
+
msg: n,
|
|
48
|
+
type: v,
|
|
49
|
+
fileUrl: $,
|
|
50
|
+
fileName: ee,
|
|
51
|
+
fileSize: H
|
|
52
52
|
});
|
|
53
|
-
return this.socket.send(
|
|
53
|
+
return this.socket.send(Z), !0;
|
|
54
54
|
}
|
|
55
55
|
return console.warn("[VueChatKit] WebSocket 连接未建立,无法发送消息"), !1;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* 注册事件监听
|
|
59
59
|
*/
|
|
60
|
-
on(t,
|
|
61
|
-
this.handlers[t] && this.handlers[t].push(
|
|
60
|
+
on(t, n) {
|
|
61
|
+
this.handlers[t] && this.handlers[t].push(n);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* 移除事件监听
|
|
65
65
|
*/
|
|
66
|
-
off(t,
|
|
66
|
+
off(t, n) {
|
|
67
67
|
if (this.handlers[t]) {
|
|
68
|
-
const
|
|
69
|
-
|
|
68
|
+
const v = this.handlers[t].indexOf(n);
|
|
69
|
+
v > -1 && this.handlers[t].splice(v, 1);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* 触发事件
|
|
74
74
|
*/
|
|
75
|
-
emit(t, ...
|
|
76
|
-
this.handlers[t] && this.handlers[t].forEach((
|
|
75
|
+
emit(t, ...n) {
|
|
76
|
+
this.handlers[t] && this.handlers[t].forEach((v) => v(...n));
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* 重连
|
|
@@ -99,20 +99,20 @@ class Et {
|
|
|
99
99
|
return this.socket && this.socket.readyState === WebSocket.OPEN;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
class
|
|
103
|
-
constructor(t,
|
|
104
|
-
super(t), this.name = "RequestError", this.status =
|
|
102
|
+
class Je extends Error {
|
|
103
|
+
constructor(t, n, v, $) {
|
|
104
|
+
super(t), this.name = "RequestError", this.status = n || 0, this.code = v || 0, this.data = $;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class Wt {
|
|
108
108
|
constructor(t = {}) {
|
|
109
|
-
this.baseUrl = t.baseUrl || "", this.timeout = t.timeout || 1e4, this.headers = t.headers || {}, this.requestInterceptors = [], this.responseInterceptors = [], t.requestInterceptors && Array.isArray(t.requestInterceptors) && t.requestInterceptors.forEach((
|
|
110
|
-
this.requestInterceptors.push(
|
|
111
|
-
}), this.addRequestInterceptor((
|
|
109
|
+
this.baseUrl = t.baseUrl || "", this.timeout = t.timeout || 1e4, this.headers = t.headers || {}, this.requestInterceptors = [], this.responseInterceptors = [], t.requestInterceptors && Array.isArray(t.requestInterceptors) && t.requestInterceptors.forEach((n) => {
|
|
110
|
+
this.requestInterceptors.push(n);
|
|
111
|
+
}), this.addRequestInterceptor((n) => (n.body instanceof FormData || (n.headers = {
|
|
112
112
|
"Content-Type": "application/json",
|
|
113
|
-
...
|
|
114
|
-
}),
|
|
115
|
-
this.responseInterceptors.push(
|
|
113
|
+
...n.headers
|
|
114
|
+
}), n)), t.responseInterceptors && Array.isArray(t.responseInterceptors) && t.responseInterceptors.forEach((n) => {
|
|
115
|
+
this.responseInterceptors.push(n);
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -131,79 +131,79 @@ class qt {
|
|
|
131
131
|
* 超时控制
|
|
132
132
|
*/
|
|
133
133
|
timeoutPromise(t) {
|
|
134
|
-
return new Promise((
|
|
134
|
+
return new Promise((n, v) => {
|
|
135
135
|
setTimeout(() => {
|
|
136
|
-
|
|
136
|
+
v(new Je("请求超时", 408, 408));
|
|
137
137
|
}, t);
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* 核心请求方法
|
|
142
142
|
*/
|
|
143
|
-
async request(t,
|
|
144
|
-
const { method:
|
|
145
|
-
let
|
|
146
|
-
method:
|
|
147
|
-
headers: { ...this.headers,
|
|
148
|
-
body:
|
|
149
|
-
params:
|
|
143
|
+
async request(t, n = {}) {
|
|
144
|
+
const { method: v = "GET", headers: $ = {}, body: ee, params: H } = n;
|
|
145
|
+
let Z = t.startsWith("http") ? t : `${this.baseUrl}${t}`, X = {
|
|
146
|
+
method: v,
|
|
147
|
+
headers: { ...this.headers, ...$ },
|
|
148
|
+
body: ee,
|
|
149
|
+
params: H
|
|
150
150
|
};
|
|
151
|
-
this.requestInterceptors.forEach((
|
|
152
|
-
|
|
151
|
+
this.requestInterceptors.forEach((V) => {
|
|
152
|
+
X = V(X);
|
|
153
153
|
});
|
|
154
|
-
const
|
|
155
|
-
method:
|
|
156
|
-
headers:
|
|
154
|
+
const ve = {
|
|
155
|
+
method: X.method,
|
|
156
|
+
headers: X.headers,
|
|
157
157
|
credentials: "include"
|
|
158
158
|
};
|
|
159
|
-
if (
|
|
160
|
-
const
|
|
161
|
-
for (const
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
159
|
+
if (X.body && v !== "GET" && (X.body instanceof FormData ? ve.body = X.body : typeof X.body == "object" ? ve.body = JSON.stringify(X.body) : ve.body = X.body), X.params) {
|
|
160
|
+
const V = new URLSearchParams();
|
|
161
|
+
for (const A in X.params)
|
|
162
|
+
X.params[A] !== void 0 && X.params[A] !== null && X.params[A] !== "" && V.append(A, X.params[A]);
|
|
163
|
+
const U = V.toString();
|
|
164
|
+
U && (Z += (Z.includes("?") ? "&" : "?") + U);
|
|
165
165
|
}
|
|
166
166
|
try {
|
|
167
|
-
let
|
|
168
|
-
fetch(
|
|
167
|
+
let U = await Promise.race([
|
|
168
|
+
fetch(Z, ve),
|
|
169
169
|
this.timeoutPromise(this.timeout)
|
|
170
170
|
]);
|
|
171
|
-
if (this.responseInterceptors.forEach((
|
|
172
|
-
|
|
173
|
-
}), !
|
|
174
|
-
throw new
|
|
175
|
-
`HTTP ${
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
if (this.responseInterceptors.forEach((de) => {
|
|
172
|
+
U = de(U);
|
|
173
|
+
}), !U.ok)
|
|
174
|
+
throw new Je(
|
|
175
|
+
`HTTP ${U.status}: ${U.statusText}`,
|
|
176
|
+
U.status,
|
|
177
|
+
U.status
|
|
178
178
|
);
|
|
179
|
-
const
|
|
180
|
-
let
|
|
181
|
-
return
|
|
182
|
-
} catch (
|
|
183
|
-
throw
|
|
184
|
-
|
|
179
|
+
const A = U.headers.get("content-type");
|
|
180
|
+
let f;
|
|
181
|
+
return A && A.includes("application/json") ? f = await U.json() : f = await U.text(), f;
|
|
182
|
+
} catch (V) {
|
|
183
|
+
throw V instanceof Je ? V : new Je(
|
|
184
|
+
V instanceof Error ? V.message : "网络错误",
|
|
185
185
|
0,
|
|
186
186
|
0
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
// 便捷方法
|
|
191
|
-
get(t,
|
|
192
|
-
return this.request(t, { ...
|
|
191
|
+
get(t, n, v) {
|
|
192
|
+
return this.request(t, { ...v, method: "GET", params: n });
|
|
193
193
|
}
|
|
194
|
-
post(t,
|
|
195
|
-
return this.request(t, { ...
|
|
194
|
+
post(t, n, v) {
|
|
195
|
+
return this.request(t, { ...v, method: "POST", body: n });
|
|
196
196
|
}
|
|
197
|
-
put(t,
|
|
198
|
-
return this.request(t, { ...
|
|
197
|
+
put(t, n, v) {
|
|
198
|
+
return this.request(t, { ...v, method: "PUT", body: n });
|
|
199
199
|
}
|
|
200
|
-
delete(t,
|
|
201
|
-
return this.request(t, { ...
|
|
200
|
+
delete(t, n) {
|
|
201
|
+
return this.request(t, { ...n, method: "DELETE" });
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
class
|
|
205
|
-
constructor(t,
|
|
206
|
-
this.config = t, this.endpoints = t.api.endpoints, this.customAdapter = t.api.adapter,
|
|
204
|
+
class ht {
|
|
205
|
+
constructor(t, n = null) {
|
|
206
|
+
this.config = t, this.endpoints = t.api.endpoints, this.customAdapter = t.api.adapter, n ? this.http = n : this.http = new Wt({
|
|
207
207
|
baseUrl: t.api.baseUrl,
|
|
208
208
|
headers: t.headers,
|
|
209
209
|
requestInterceptors: t.requestInterceptors,
|
|
@@ -213,8 +213,8 @@ class ft {
|
|
|
213
213
|
/**
|
|
214
214
|
* 使用自定义适配器或默认实现
|
|
215
215
|
*/
|
|
216
|
-
async _call(t, ...
|
|
217
|
-
return this.customAdapter && typeof this.customAdapter[t] == "function" ? this.customAdapter[t](...
|
|
216
|
+
async _call(t, ...n) {
|
|
217
|
+
return this.customAdapter && typeof this.customAdapter[t] == "function" ? this.customAdapter[t](...n) : this[`_${t}`](...n);
|
|
218
218
|
}
|
|
219
219
|
// ========== 好友相关 ==========
|
|
220
220
|
/**
|
|
@@ -238,11 +238,11 @@ class ft {
|
|
|
238
238
|
/**
|
|
239
239
|
* 添加好友
|
|
240
240
|
*/
|
|
241
|
-
async addFriend(t,
|
|
242
|
-
return this._call("addFriend", t,
|
|
241
|
+
async addFriend(t, n) {
|
|
242
|
+
return this._call("addFriend", t, n);
|
|
243
243
|
}
|
|
244
|
-
async _addFriend(t,
|
|
245
|
-
return this.http.post(this.endpoints.addFriend, { currentUser: t, friendUser:
|
|
244
|
+
async _addFriend(t, n) {
|
|
245
|
+
return this.http.post(this.endpoints.addFriend, { currentUser: t, friendUser: n });
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* 获取好友申请列表
|
|
@@ -256,39 +256,39 @@ class ft {
|
|
|
256
256
|
/**
|
|
257
257
|
* 同意好友申请
|
|
258
258
|
*/
|
|
259
|
-
async agreeFriend(t,
|
|
260
|
-
return this._call("agreeFriend", t,
|
|
259
|
+
async agreeFriend(t, n) {
|
|
260
|
+
return this._call("agreeFriend", t, n);
|
|
261
261
|
}
|
|
262
|
-
async _agreeFriend(t,
|
|
263
|
-
return this.http.post(this.endpoints.agreeFriend, { applyUser: t, friendUser:
|
|
262
|
+
async _agreeFriend(t, n) {
|
|
263
|
+
return this.http.post(this.endpoints.agreeFriend, { applyUser: t, friendUser: n });
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
266
|
* 设置好友聊天状态
|
|
267
267
|
*/
|
|
268
|
-
async setChatStatus(t,
|
|
269
|
-
return this._call("setChatStatus", t,
|
|
268
|
+
async setChatStatus(t, n, v = 1) {
|
|
269
|
+
return this._call("setChatStatus", t, n, v);
|
|
270
270
|
}
|
|
271
|
-
async _setChatStatus(t,
|
|
272
|
-
return this.http.post(this.endpoints.setChatStatus, null, { params: { currentUser: t, friendUser:
|
|
271
|
+
async _setChatStatus(t, n, v) {
|
|
272
|
+
return this.http.post(this.endpoints.setChatStatus, null, { params: { currentUser: t, friendUser: n, status: v } });
|
|
273
273
|
}
|
|
274
274
|
// ========== 消息相关 ==========
|
|
275
275
|
/**
|
|
276
276
|
* 获取聊天历史
|
|
277
277
|
*/
|
|
278
|
-
async getHistory(t,
|
|
279
|
-
return this._call("getHistory", t,
|
|
278
|
+
async getHistory(t, n) {
|
|
279
|
+
return this._call("getHistory", t, n);
|
|
280
280
|
}
|
|
281
|
-
async _getHistory(t,
|
|
282
|
-
return this.http.get(this.endpoints.getHistory, { fromUser: t, toUser:
|
|
281
|
+
async _getHistory(t, n) {
|
|
282
|
+
return this.http.get(this.endpoints.getHistory, { fromUser: t, toUser: n });
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* 标记消息已读
|
|
286
286
|
*/
|
|
287
|
-
async setRead(t,
|
|
288
|
-
return this._call("setRead", t,
|
|
287
|
+
async setRead(t, n) {
|
|
288
|
+
return this._call("setRead", t, n);
|
|
289
289
|
}
|
|
290
|
-
async _setRead(t,
|
|
291
|
-
return this.http.post(this.endpoints.setRead, { currentUser: t, friendUser:
|
|
290
|
+
async _setRead(t, n) {
|
|
291
|
+
return this.http.post(this.endpoints.setRead, { currentUser: t, friendUser: n });
|
|
292
292
|
}
|
|
293
293
|
// ========== 文件相关 ==========
|
|
294
294
|
/**
|
|
@@ -298,8 +298,8 @@ class ft {
|
|
|
298
298
|
return this._call("uploadFile", t);
|
|
299
299
|
}
|
|
300
300
|
async _uploadFile(t) {
|
|
301
|
-
const
|
|
302
|
-
return
|
|
301
|
+
const n = new FormData();
|
|
302
|
+
return n.append("file", t), this.http.post(this.endpoints.uploadFile, n);
|
|
303
303
|
}
|
|
304
304
|
// ========== 用户相关 ==========
|
|
305
305
|
/**
|
|
@@ -314,11 +314,11 @@ class ft {
|
|
|
314
314
|
/**
|
|
315
315
|
* 更新用户信息
|
|
316
316
|
*/
|
|
317
|
-
async updateUserInfo(t,
|
|
318
|
-
return this._call("updateUserInfo", t,
|
|
317
|
+
async updateUserInfo(t, n) {
|
|
318
|
+
return this._call("updateUserInfo", t, n);
|
|
319
319
|
}
|
|
320
|
-
async _updateUserInfo(t,
|
|
321
|
-
return this.http.put(this.endpoints.updateUserInfo, { username: t, ...
|
|
320
|
+
async _updateUserInfo(t, n) {
|
|
321
|
+
return this.http.put(this.endpoints.updateUserInfo, { username: t, ...n });
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
324
|
* 获取用户头像
|
|
@@ -332,209 +332,209 @@ class ft {
|
|
|
332
332
|
/**
|
|
333
333
|
* 上传头像
|
|
334
334
|
*/
|
|
335
|
-
async uploadAvatar(t,
|
|
336
|
-
return this._call("uploadAvatar", t,
|
|
335
|
+
async uploadAvatar(t, n) {
|
|
336
|
+
return this._call("uploadAvatar", t, n);
|
|
337
337
|
}
|
|
338
|
-
async _uploadAvatar(t,
|
|
339
|
-
const
|
|
340
|
-
return
|
|
338
|
+
async _uploadAvatar(t, n) {
|
|
339
|
+
const v = new FormData();
|
|
340
|
+
return v.append("file", t), v.append("username", n), this.http.post(this.endpoints.uploadAvatar, v);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
const
|
|
343
|
+
const Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
344
344
|
__proto__: null,
|
|
345
|
-
ChatApi:
|
|
346
|
-
default:
|
|
345
|
+
ChatApi: ht,
|
|
346
|
+
default: ht
|
|
347
347
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
348
|
-
function
|
|
349
|
-
const
|
|
350
|
-
let
|
|
351
|
-
const
|
|
352
|
-
username:
|
|
353
|
-
nickname:
|
|
354
|
-
email:
|
|
355
|
-
phone:
|
|
356
|
-
bio:
|
|
357
|
-
}),
|
|
358
|
-
let
|
|
359
|
-
if (
|
|
360
|
-
const d =
|
|
361
|
-
|
|
348
|
+
function Lt(x, t) {
|
|
349
|
+
const n = new ht(x);
|
|
350
|
+
let v = null;
|
|
351
|
+
const $ = x.user.username, ee = _(x.user.avatar || `https://api.dicebear.com/7.x/avataaars/svg?seed=${$}`), H = _({
|
|
352
|
+
username: $,
|
|
353
|
+
nickname: x.user.nickname || "",
|
|
354
|
+
email: x.user.email || "",
|
|
355
|
+
phone: x.user.phone || "",
|
|
356
|
+
bio: x.user.bio || ""
|
|
357
|
+
}), Z = _(!1), X = _([]), ve = _([]), V = _([]), U = _(""), A = _(""), f = _(""), de = _(null), Ae = _(!1), he = _(""), C = _([]), ge = _(!1), Ce = _([]), Ve = _(!1), xe = we(() => {
|
|
358
|
+
let i = ve.value;
|
|
359
|
+
if (A.value) {
|
|
360
|
+
const d = A.value.toLowerCase();
|
|
361
|
+
i = i.filter(
|
|
362
362
|
(g) => {
|
|
363
|
-
var
|
|
364
|
-
return (
|
|
363
|
+
var F;
|
|
364
|
+
return (F = g.username) == null ? void 0 : F.toLowerCase().includes(d);
|
|
365
365
|
}
|
|
366
366
|
);
|
|
367
367
|
}
|
|
368
|
-
return
|
|
368
|
+
return i.map((d) => ({
|
|
369
369
|
id: d.username,
|
|
370
370
|
name: d.username,
|
|
371
|
-
avatar: d.avatar ||
|
|
371
|
+
avatar: d.avatar || ee.value,
|
|
372
372
|
online: d.online,
|
|
373
373
|
lastMsg: d.lastMsg || "暂无消息",
|
|
374
374
|
lastTime: d.lastTime,
|
|
375
375
|
unread: d.unReadNum || 0
|
|
376
376
|
}));
|
|
377
|
-
}),
|
|
378
|
-
let
|
|
379
|
-
if (
|
|
380
|
-
const d =
|
|
381
|
-
|
|
377
|
+
}), Se = we(() => {
|
|
378
|
+
let i = X.value;
|
|
379
|
+
if (A.value) {
|
|
380
|
+
const d = A.value.toLowerCase();
|
|
381
|
+
i = i.filter(
|
|
382
382
|
(g) => {
|
|
383
|
-
var
|
|
384
|
-
return (
|
|
383
|
+
var F;
|
|
384
|
+
return (F = g.username) == null ? void 0 : F.toLowerCase().includes(d);
|
|
385
385
|
}
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
|
-
return
|
|
388
|
+
return i.map((d) => ({
|
|
389
389
|
id: d.username,
|
|
390
390
|
name: d.username,
|
|
391
|
-
avatar: d.avatar ||
|
|
391
|
+
avatar: d.avatar || ee.value,
|
|
392
392
|
online: d.online,
|
|
393
393
|
isChatting: d.isChatting
|
|
394
394
|
}));
|
|
395
|
-
}),
|
|
396
|
-
(
|
|
395
|
+
}), Fe = we(() => he.value ? C.value.filter(
|
|
396
|
+
(i) => {
|
|
397
397
|
var d;
|
|
398
|
-
return (d =
|
|
398
|
+
return (d = i.username) == null ? void 0 : d.toLowerCase().includes(he.value.toLowerCase());
|
|
399
399
|
}
|
|
400
|
-
) :
|
|
401
|
-
const d =
|
|
400
|
+
) : C.value), Re = we(() => xe.value.find((i) => i.id === U.value) || null), De = we(() => V.value.map((i) => {
|
|
401
|
+
const d = i.type === "file" || i.fileUrl || i.fileName, g = i.fileName || i.msgContent;
|
|
402
402
|
return {
|
|
403
|
-
text:
|
|
404
|
-
isSelf:
|
|
405
|
-
time:
|
|
406
|
-
sendUsername:
|
|
403
|
+
text: i.msgContent,
|
|
404
|
+
isSelf: i.sendUsername === $,
|
|
405
|
+
time: i.createTime,
|
|
406
|
+
sendUsername: i.sendUsername,
|
|
407
407
|
type: d ? "file" : "text",
|
|
408
|
-
fileType:
|
|
409
|
-
fileUrl:
|
|
408
|
+
fileType: w(g) ? "image" : z(g),
|
|
409
|
+
fileUrl: i.fileUrl || "",
|
|
410
410
|
fileName: g,
|
|
411
|
-
fileSize:
|
|
411
|
+
fileSize: i.fileSize || 0
|
|
412
412
|
};
|
|
413
|
-
})),
|
|
414
|
-
if (!
|
|
415
|
-
const d =
|
|
413
|
+
})), We = (i) => ft(i).format("HH:mm"), Me = (i) => {
|
|
414
|
+
if (!i) return "";
|
|
415
|
+
const d = ft(), g = ft(i);
|
|
416
416
|
return d.isSame(g, "day") ? g.format("HH:mm") : d.diff(g, "day") === 1 ? "昨天" : d.diff(g, "day") < 7 ? ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][g.day()] : g.format("MM/DD");
|
|
417
|
-
},
|
|
418
|
-
if (!
|
|
419
|
-
const d = ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"], g =
|
|
417
|
+
}, w = (i) => {
|
|
418
|
+
if (!i) return !1;
|
|
419
|
+
const d = ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"], g = i.split(".").pop().toLowerCase();
|
|
420
420
|
return d.includes(g);
|
|
421
|
-
},
|
|
422
|
-
if (!
|
|
423
|
-
const d =
|
|
421
|
+
}, z = (i) => {
|
|
422
|
+
if (!i) return "default";
|
|
423
|
+
const d = i.split(".").pop().toLowerCase();
|
|
424
424
|
return ["xls", "xlsx"].includes(d) ? "excel" : ["pdf"].includes(d) ? "pdf" : ["doc", "docx"].includes(d) ? "docx" : "default";
|
|
425
|
-
},
|
|
426
|
-
|
|
427
|
-
|
|
425
|
+
}, Y = () => {
|
|
426
|
+
Oe(() => {
|
|
427
|
+
de.value && (de.value.scrollTop = de.value.scrollHeight);
|
|
428
428
|
});
|
|
429
|
-
},
|
|
429
|
+
}, I = async () => {
|
|
430
430
|
try {
|
|
431
|
-
const d = (await
|
|
432
|
-
|
|
433
|
-
for (const g of
|
|
431
|
+
const d = (await n.getFriends($)).data || [];
|
|
432
|
+
X.value = d, ve.value = d.filter((g) => g.isChatting === 1);
|
|
433
|
+
for (const g of ve.value)
|
|
434
434
|
try {
|
|
435
|
-
const
|
|
436
|
-
g.unReadNum =
|
|
437
|
-
(
|
|
435
|
+
const _e = (await n.getHistory($, g.username)).data || [];
|
|
436
|
+
g.unReadNum = _e.filter(
|
|
437
|
+
(j) => j.isRead === 0 && j.sendUsername === g.username
|
|
438
438
|
).length;
|
|
439
439
|
} catch {
|
|
440
440
|
g.unReadNum = 0;
|
|
441
441
|
}
|
|
442
|
-
} catch (
|
|
443
|
-
console.error("[VueChatKit] 获取好友列表失败",
|
|
442
|
+
} catch (i) {
|
|
443
|
+
console.error("[VueChatKit] 获取好友列表失败", i);
|
|
444
444
|
}
|
|
445
|
-
},
|
|
445
|
+
}, R = async (i) => {
|
|
446
446
|
try {
|
|
447
|
-
const d = await
|
|
448
|
-
|
|
447
|
+
const d = await n.getHistory($, i);
|
|
448
|
+
V.value = d.data || [], Y();
|
|
449
449
|
} catch (d) {
|
|
450
450
|
console.error("[VueChatKit] 获取聊天历史失败", d);
|
|
451
451
|
}
|
|
452
|
-
},
|
|
452
|
+
}, M = async (i) => {
|
|
453
453
|
try {
|
|
454
|
-
await
|
|
454
|
+
await n.setRead($, i), I();
|
|
455
455
|
} catch (d) {
|
|
456
456
|
console.error("[VueChatKit] 标记已读失败", d);
|
|
457
457
|
}
|
|
458
|
-
},
|
|
459
|
-
|
|
460
|
-
},
|
|
458
|
+
}, E = async (i) => {
|
|
459
|
+
U.value = i.id, await R(i.id), await M(i.id), Y();
|
|
460
|
+
}, N = async (i, d = 1) => {
|
|
461
461
|
try {
|
|
462
|
-
return await
|
|
462
|
+
return await n.setChatStatus($, i, d), await I(), !0;
|
|
463
463
|
} catch (g) {
|
|
464
464
|
return console.error("[VueChatKit] 设置聊天状态失败", g), !1;
|
|
465
465
|
}
|
|
466
|
-
},
|
|
467
|
-
if (!
|
|
468
|
-
if (
|
|
466
|
+
}, P = () => {
|
|
467
|
+
if (!f.value.trim() || !U.value || !v) return;
|
|
468
|
+
if (v.send(U.value, f.value.trim(), "text")) {
|
|
469
469
|
const d = {
|
|
470
|
-
msgContent:
|
|
471
|
-
sendUsername:
|
|
472
|
-
receiveUsername:
|
|
470
|
+
msgContent: f.value.trim(),
|
|
471
|
+
sendUsername: $,
|
|
472
|
+
receiveUsername: U.value,
|
|
473
473
|
createTime: /* @__PURE__ */ new Date(),
|
|
474
474
|
isRead: 0,
|
|
475
475
|
type: "text"
|
|
476
476
|
};
|
|
477
|
-
|
|
478
|
-
|
|
477
|
+
V.value.push(d), f.value = "", Y(), setTimeout(() => {
|
|
478
|
+
R(U.value), I();
|
|
479
479
|
}, 300);
|
|
480
480
|
}
|
|
481
|
-
},
|
|
482
|
-
if (!
|
|
481
|
+
}, L = async (i) => {
|
|
482
|
+
if (!U.value || !v) return !1;
|
|
483
483
|
try {
|
|
484
|
-
const d = await
|
|
484
|
+
const d = await n.uploadFile(i);
|
|
485
485
|
if (d.code === 200 && d.data) {
|
|
486
|
-
const { fileUrl: g, fileName:
|
|
487
|
-
if (
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
const { fileUrl: g, fileName: F } = d.data;
|
|
487
|
+
if (v.send(
|
|
488
|
+
U.value,
|
|
489
|
+
F,
|
|
490
490
|
"file",
|
|
491
491
|
g,
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
F,
|
|
493
|
+
i.size
|
|
494
494
|
)) {
|
|
495
|
-
const
|
|
496
|
-
msgContent:
|
|
497
|
-
sendUsername:
|
|
498
|
-
receiveUsername:
|
|
495
|
+
const j = {
|
|
496
|
+
msgContent: F,
|
|
497
|
+
sendUsername: $,
|
|
498
|
+
receiveUsername: U.value,
|
|
499
499
|
createTime: /* @__PURE__ */ new Date(),
|
|
500
500
|
isRead: 0,
|
|
501
501
|
type: "file",
|
|
502
502
|
fileUrl: g,
|
|
503
|
-
fileName:
|
|
504
|
-
fileSize:
|
|
503
|
+
fileName: F,
|
|
504
|
+
fileSize: i.size
|
|
505
505
|
};
|
|
506
|
-
return
|
|
506
|
+
return V.value.push(j), Y(), !0;
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
return !1;
|
|
510
510
|
} catch (d) {
|
|
511
511
|
return console.error("[VueChatKit] 发送文件失败", d), !1;
|
|
512
512
|
}
|
|
513
|
-
},
|
|
514
|
-
if (!(!
|
|
515
|
-
if (d && d.trim() &&
|
|
516
|
-
const
|
|
513
|
+
}, q = async (i, d) => {
|
|
514
|
+
if (!(!U.value || !v)) {
|
|
515
|
+
if (d && d.trim() && v.send(U.value, d.trim(), "text")) {
|
|
516
|
+
const F = {
|
|
517
517
|
msgContent: d.trim(),
|
|
518
|
-
sendUsername:
|
|
519
|
-
receiveUsername:
|
|
518
|
+
sendUsername: $,
|
|
519
|
+
receiveUsername: U.value,
|
|
520
520
|
createTime: /* @__PURE__ */ new Date(),
|
|
521
521
|
isRead: 0,
|
|
522
522
|
type: "text"
|
|
523
523
|
};
|
|
524
|
-
|
|
524
|
+
V.value.push(F);
|
|
525
525
|
}
|
|
526
|
-
for (const g of
|
|
527
|
-
const
|
|
528
|
-
await
|
|
526
|
+
for (const g of i) {
|
|
527
|
+
const F = g.file || g;
|
|
528
|
+
await L(F);
|
|
529
529
|
}
|
|
530
530
|
setTimeout(() => {
|
|
531
|
-
|
|
531
|
+
R(U.value), I();
|
|
532
532
|
}, 300);
|
|
533
533
|
}
|
|
534
|
-
},
|
|
534
|
+
}, te = (i) => {
|
|
535
535
|
try {
|
|
536
536
|
try {
|
|
537
|
-
const g = JSON.parse(
|
|
537
|
+
const g = JSON.parse(i);
|
|
538
538
|
if (g.to || g.msg)
|
|
539
539
|
return {
|
|
540
540
|
to: g.to,
|
|
@@ -546,7 +546,7 @@ function Tt(w, t) {
|
|
|
546
546
|
};
|
|
547
547
|
} catch {
|
|
548
548
|
}
|
|
549
|
-
const d =
|
|
549
|
+
const d = i.match(/^\[(.+?)\]:(.+)$/);
|
|
550
550
|
if (d)
|
|
551
551
|
return {
|
|
552
552
|
username: d[1],
|
|
@@ -557,32 +557,32 @@ function Tt(w, t) {
|
|
|
557
557
|
console.error("[VueChatKit] 解析消息失败", d);
|
|
558
558
|
}
|
|
559
559
|
return null;
|
|
560
|
-
},
|
|
561
|
-
if (
|
|
562
|
-
const g = /【状态变更】(.+?) 已(上线|下线)/,
|
|
563
|
-
if (
|
|
564
|
-
const
|
|
565
|
-
|
|
560
|
+
}, se = (i) => {
|
|
561
|
+
if (i.includes("【状态变更】")) {
|
|
562
|
+
const g = /【状态变更】(.+?) 已(上线|下线)/, F = i.match(g);
|
|
563
|
+
if (F) {
|
|
564
|
+
const _e = F[1], j = F[2] === "上线", O = X.value.find((Ue) => Ue.username === _e);
|
|
565
|
+
O && (O.online = j);
|
|
566
566
|
}
|
|
567
567
|
return;
|
|
568
568
|
}
|
|
569
|
-
const d =
|
|
569
|
+
const d = te(i);
|
|
570
570
|
if (d) {
|
|
571
571
|
const g = {
|
|
572
572
|
content: d.content,
|
|
573
|
-
username: d.username ||
|
|
573
|
+
username: d.username || U.value,
|
|
574
574
|
type: d.type || "text",
|
|
575
575
|
fileUrl: d.fileUrl || "",
|
|
576
576
|
fileName: d.fileName || "",
|
|
577
577
|
fileSize: d.fileSize || 0,
|
|
578
578
|
timestamp: /* @__PURE__ */ new Date()
|
|
579
579
|
};
|
|
580
|
-
if (
|
|
580
|
+
if (U.value) {
|
|
581
581
|
try {
|
|
582
|
-
let
|
|
582
|
+
let F = {
|
|
583
583
|
msgContent: d.content,
|
|
584
584
|
sendUsername: g.username,
|
|
585
|
-
receiveUsername:
|
|
585
|
+
receiveUsername: $,
|
|
586
586
|
createTime: /* @__PURE__ */ new Date(),
|
|
587
587
|
isRead: 0,
|
|
588
588
|
type: d.type || "text",
|
|
@@ -590,427 +590,562 @@ function Tt(w, t) {
|
|
|
590
590
|
fileName: d.fileName || "",
|
|
591
591
|
fileSize: d.fileSize || 0
|
|
592
592
|
};
|
|
593
|
-
|
|
594
|
-
} catch (
|
|
595
|
-
console.error("[VueChatKit] 添加临时消息失败",
|
|
593
|
+
V.value.push(F), Y();
|
|
594
|
+
} catch (F) {
|
|
595
|
+
console.error("[VueChatKit] 添加临时消息失败", F);
|
|
596
596
|
}
|
|
597
|
-
|
|
597
|
+
R(U.value);
|
|
598
598
|
}
|
|
599
|
-
|
|
599
|
+
I(), t && typeof t == "function" && t(g);
|
|
600
600
|
}
|
|
601
|
-
},
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
wsUrl:
|
|
605
|
-
maxReconnectAttempts:
|
|
606
|
-
reconnectDelay:
|
|
607
|
-
}),
|
|
608
|
-
},
|
|
609
|
-
|
|
610
|
-
},
|
|
611
|
-
|
|
612
|
-
},
|
|
613
|
-
|
|
601
|
+
}, le = () => {
|
|
602
|
+
const i = `${x.api.websocketUrl}?userId=${$}`;
|
|
603
|
+
v = new Dt($, {
|
|
604
|
+
wsUrl: i,
|
|
605
|
+
maxReconnectAttempts: x.websocket.maxReconnectAttempts,
|
|
606
|
+
reconnectDelay: x.websocket.reconnectDelay
|
|
607
|
+
}), v.on("message", se), v.connect();
|
|
608
|
+
}, pe = () => {
|
|
609
|
+
v && (v.close(), v = null);
|
|
610
|
+
}, B = async () => {
|
|
611
|
+
Ae.value = !0, he.value = "", await ae();
|
|
612
|
+
}, ae = async () => {
|
|
613
|
+
ge.value = !0;
|
|
614
614
|
try {
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
} catch (
|
|
618
|
-
console.error("[VueChatKit] 获取可用用户失败",
|
|
615
|
+
const i = await n.getAvailableUsers($);
|
|
616
|
+
C.value = (i == null ? void 0 : i.data) || [];
|
|
617
|
+
} catch (i) {
|
|
618
|
+
console.error("[VueChatKit] 获取可用用户失败", i);
|
|
619
619
|
} finally {
|
|
620
|
-
|
|
620
|
+
ge.value = !1;
|
|
621
621
|
}
|
|
622
|
-
},
|
|
622
|
+
}, ne = async (i) => {
|
|
623
623
|
try {
|
|
624
|
-
await
|
|
624
|
+
await n.addFriend($, i.username), await I(), Ae.value = !1;
|
|
625
625
|
} catch (d) {
|
|
626
626
|
console.error("[VueChatKit] 添加好友失败", d);
|
|
627
627
|
}
|
|
628
|
-
},
|
|
629
|
-
|
|
628
|
+
}, D = async () => {
|
|
629
|
+
Ve.value = !0;
|
|
630
630
|
try {
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
} catch (
|
|
634
|
-
console.error("[VueChatKit] 获取好友申请列表失败",
|
|
631
|
+
const i = await n.getApplyList($);
|
|
632
|
+
Ce.value = i.data || [];
|
|
633
|
+
} catch (i) {
|
|
634
|
+
console.error("[VueChatKit] 获取好友申请列表失败", i);
|
|
635
635
|
} finally {
|
|
636
|
-
|
|
636
|
+
Ve.value = !1;
|
|
637
637
|
}
|
|
638
|
-
},
|
|
638
|
+
}, W = async (i) => {
|
|
639
639
|
try {
|
|
640
|
-
await
|
|
640
|
+
await n.agreeFriend(i, $), await D(), await I();
|
|
641
641
|
} catch (d) {
|
|
642
642
|
console.error("[VueChatKit] 同意好友申请失败", d);
|
|
643
643
|
}
|
|
644
|
-
},
|
|
644
|
+
}, ie = async () => {
|
|
645
645
|
try {
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
} catch (
|
|
649
|
-
console.warn("[VueChatKit] 加载头像失败",
|
|
646
|
+
const i = await n.getUserAvatar($);
|
|
647
|
+
i.code === 200 && i.data && (ee.value = i.data);
|
|
648
|
+
} catch (i) {
|
|
649
|
+
console.warn("[VueChatKit] 加载头像失败", i);
|
|
650
650
|
}
|
|
651
|
-
},
|
|
652
|
-
|
|
653
|
-
},
|
|
654
|
-
|
|
651
|
+
}, oe = (i) => {
|
|
652
|
+
ee.value = i;
|
|
653
|
+
}, K = async () => {
|
|
654
|
+
Z.value = !0;
|
|
655
655
|
try {
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
...
|
|
659
|
-
...
|
|
656
|
+
const i = await n.getUserInfo($);
|
|
657
|
+
i.code === 200 && i.data && (H.value = {
|
|
658
|
+
...H.value,
|
|
659
|
+
...i.data
|
|
660
660
|
});
|
|
661
|
-
} catch (
|
|
662
|
-
console.error("[VueChatKit] 获取用户信息失败",
|
|
661
|
+
} catch (i) {
|
|
662
|
+
console.error("[VueChatKit] 获取用户信息失败", i);
|
|
663
663
|
} finally {
|
|
664
|
-
|
|
664
|
+
Z.value = !1;
|
|
665
665
|
}
|
|
666
|
-
},
|
|
666
|
+
}, re = async (i) => {
|
|
667
667
|
try {
|
|
668
|
-
return (await
|
|
669
|
-
...
|
|
670
|
-
...
|
|
668
|
+
return (await n.updateUserInfo($, i)).code === 200 ? (H.value = {
|
|
669
|
+
...H.value,
|
|
670
|
+
...i
|
|
671
671
|
}, !0) : !1;
|
|
672
672
|
} catch (d) {
|
|
673
673
|
return console.error("[VueChatKit] 更新用户信息失败", d), !1;
|
|
674
674
|
}
|
|
675
|
-
},
|
|
676
|
-
|
|
675
|
+
}, ze = () => {
|
|
676
|
+
U.value = "", V.value = [], f.value = "", A.value = "";
|
|
677
677
|
};
|
|
678
|
-
return
|
|
678
|
+
return ie(), {
|
|
679
679
|
// 状态
|
|
680
|
-
myUsername:
|
|
681
|
-
myAvatar:
|
|
682
|
-
userInfo:
|
|
683
|
-
loadingUserInfo:
|
|
684
|
-
friendList:
|
|
685
|
-
chatList:
|
|
686
|
-
filteredFriendList:
|
|
687
|
-
chatMsgList:
|
|
688
|
-
currentSelectName:
|
|
689
|
-
searchText:
|
|
690
|
-
inputText:
|
|
691
|
-
messagesContainer:
|
|
692
|
-
filteredUsers:
|
|
693
|
-
filteredAvailableUsers:
|
|
694
|
-
currentUser:
|
|
695
|
-
currentMessages:
|
|
696
|
-
addFriendDialogVisible:
|
|
697
|
-
addFriendSearchText:
|
|
698
|
-
availableUsers:
|
|
699
|
-
loadingAvailableUsers:
|
|
700
|
-
friendApplyList:
|
|
701
|
-
loadingFriendApply:
|
|
680
|
+
myUsername: $,
|
|
681
|
+
myAvatar: ee,
|
|
682
|
+
userInfo: H,
|
|
683
|
+
loadingUserInfo: Z,
|
|
684
|
+
friendList: X,
|
|
685
|
+
chatList: ve,
|
|
686
|
+
filteredFriendList: Se,
|
|
687
|
+
chatMsgList: V,
|
|
688
|
+
currentSelectName: U,
|
|
689
|
+
searchText: A,
|
|
690
|
+
inputText: f,
|
|
691
|
+
messagesContainer: de,
|
|
692
|
+
filteredUsers: xe,
|
|
693
|
+
filteredAvailableUsers: Fe,
|
|
694
|
+
currentUser: Re,
|
|
695
|
+
currentMessages: De,
|
|
696
|
+
addFriendDialogVisible: Ae,
|
|
697
|
+
addFriendSearchText: he,
|
|
698
|
+
availableUsers: C,
|
|
699
|
+
loadingAvailableUsers: ge,
|
|
700
|
+
friendApplyList: Ce,
|
|
701
|
+
loadingFriendApply: Ve,
|
|
702
702
|
// 方法
|
|
703
|
-
formatTime:
|
|
704
|
-
formatLastTime:
|
|
705
|
-
scrollToBottom:
|
|
706
|
-
getFriendList:
|
|
707
|
-
getChatHistory:
|
|
708
|
-
setFriendToChatStatus:
|
|
709
|
-
selectUser:
|
|
710
|
-
sendMessage:
|
|
711
|
-
sendFile:
|
|
712
|
-
sendFilesAndText:
|
|
713
|
-
initWebSocket:
|
|
714
|
-
closeWebSocket:
|
|
715
|
-
reset:
|
|
716
|
-
openAddFriendDialog:
|
|
717
|
-
addFriend:
|
|
718
|
-
loadFriendApplyList:
|
|
719
|
-
agreeFriend:
|
|
720
|
-
updateMyAvatar:
|
|
721
|
-
getUserInfo:
|
|
722
|
-
updateUserInfo:
|
|
703
|
+
formatTime: We,
|
|
704
|
+
formatLastTime: Me,
|
|
705
|
+
scrollToBottom: Y,
|
|
706
|
+
getFriendList: I,
|
|
707
|
+
getChatHistory: R,
|
|
708
|
+
setFriendToChatStatus: N,
|
|
709
|
+
selectUser: E,
|
|
710
|
+
sendMessage: P,
|
|
711
|
+
sendFile: L,
|
|
712
|
+
sendFilesAndText: q,
|
|
713
|
+
initWebSocket: le,
|
|
714
|
+
closeWebSocket: pe,
|
|
715
|
+
reset: ze,
|
|
716
|
+
openAddFriendDialog: B,
|
|
717
|
+
addFriend: ne,
|
|
718
|
+
loadFriendApplyList: D,
|
|
719
|
+
agreeFriend: W,
|
|
720
|
+
updateMyAvatar: oe,
|
|
721
|
+
getUserInfo: K,
|
|
722
|
+
updateUserInfo: re
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
|
-
const
|
|
726
|
-
const
|
|
727
|
-
for (const [
|
|
728
|
-
|
|
729
|
-
return
|
|
730
|
-
},
|
|
725
|
+
const gt = (x, t) => {
|
|
726
|
+
const n = x.__vccOpts || x;
|
|
727
|
+
for (const [v, $] of t)
|
|
728
|
+
n[v] = $;
|
|
729
|
+
return n;
|
|
730
|
+
}, Ht = { class: "avatar-crop-container" }, Xt = {
|
|
731
731
|
key: 0,
|
|
732
|
-
class: "crop-
|
|
733
|
-
},
|
|
732
|
+
class: "crop-wrapper"
|
|
733
|
+
}, Yt = ["src"], qt = ["onMousedown", "onTouchstart"], Bt = { class: "preview-wrapper" }, Kt = ["width", "height"], Nt = { class: "dialog-footer" }, Pt = {
|
|
734
734
|
__name: "AvatarCrop",
|
|
735
735
|
props: {
|
|
736
|
-
modelValue:
|
|
737
|
-
src: { type: String, default: "" }
|
|
736
|
+
modelValue: Boolean,
|
|
737
|
+
src: { type: String, default: "" },
|
|
738
|
+
dialogWidth: { type: String, default: "520px" },
|
|
739
|
+
cropAreaHeight: { type: String, default: "288px" },
|
|
740
|
+
previewSize: { type: Number, default: 96 },
|
|
741
|
+
outputSize: { type: Number, default: 400 },
|
|
742
|
+
outputType: { type: String, default: "image/jpeg" },
|
|
743
|
+
outputQuality: { type: Number, default: 0.9 },
|
|
744
|
+
appendToBody: { type: Boolean, default: !0 },
|
|
745
|
+
aspectRatio: { type: Number, default: 1 },
|
|
746
|
+
minSize: { type: Number, default: 50 }
|
|
738
747
|
},
|
|
739
|
-
emits: ["update:modelValue", "confirm"],
|
|
740
|
-
setup(
|
|
741
|
-
const
|
|
742
|
-
get: () =>
|
|
743
|
-
set: (
|
|
744
|
-
}),
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
748
|
+
emits: ["update:modelValue", "confirm", "cancel", "closed"],
|
|
749
|
+
setup(x, { expose: t, emit: n }) {
|
|
750
|
+
const v = x, $ = n, ee = we({
|
|
751
|
+
get: () => v.modelValue,
|
|
752
|
+
set: (w) => $("update:modelValue", w)
|
|
753
|
+
}), H = we({
|
|
754
|
+
get: () => v.src,
|
|
755
|
+
set: (w) => {
|
|
756
|
+
}
|
|
757
|
+
}), Z = ["nw", "n", "ne", "e", "se", "s", "sw", "w"], X = _(!1), ve = _(null), V = _(null), U = _(null), A = _({
|
|
758
|
+
naturalWidth: 0,
|
|
759
|
+
naturalHeight: 0,
|
|
760
|
+
displayWidth: 0,
|
|
761
|
+
displayHeight: 0,
|
|
762
|
+
offsetX: 0,
|
|
763
|
+
offsetY: 0
|
|
764
|
+
}), f = _({
|
|
765
|
+
x: 0,
|
|
766
|
+
y: 0,
|
|
767
|
+
size: 150,
|
|
768
|
+
minSize: v.minSize
|
|
769
|
+
}), de = we(() => ({
|
|
770
|
+
width: `${A.value.displayWidth}px`,
|
|
771
|
+
height: `${A.value.displayHeight}px`,
|
|
772
|
+
maxWidth: "none",
|
|
773
|
+
maxHeight: "none",
|
|
774
|
+
display: "block"
|
|
775
|
+
})), Ae = we(() => ({
|
|
776
|
+
left: `${f.value.x}px`,
|
|
777
|
+
top: `${f.value.y}px`,
|
|
778
|
+
width: `${f.value.size}px`,
|
|
779
|
+
height: `${f.value.size / v.aspectRatio}px`
|
|
780
|
+
}));
|
|
781
|
+
let he = null, C = null;
|
|
782
|
+
const ge = () => {
|
|
783
|
+
Oe(() => {
|
|
784
|
+
const w = V.value, z = ve.value;
|
|
785
|
+
if (!w || !z) return;
|
|
786
|
+
const Y = z.clientWidth, I = z.clientHeight, R = w.naturalWidth / w.naturalHeight, M = Y / I;
|
|
787
|
+
let E, N, P, L;
|
|
788
|
+
R > M ? (E = Y, N = Y / R, P = 0, L = (I - N) / 2) : (N = I, E = I * R, P = (Y - E) / 2, L = 0), A.value = {
|
|
789
|
+
naturalWidth: w.naturalWidth,
|
|
790
|
+
naturalHeight: w.naturalHeight,
|
|
791
|
+
displayWidth: E,
|
|
792
|
+
displayHeight: N,
|
|
793
|
+
offsetX: P,
|
|
794
|
+
offsetY: L
|
|
795
|
+
};
|
|
796
|
+
const q = Math.min(E, N) * 0.6;
|
|
797
|
+
f.value.size = q, f.value.x = P + (E - q) / 2, f.value.y = L + (N - q / v.aspectRatio) / 2, Ce();
|
|
757
798
|
});
|
|
758
|
-
},
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
799
|
+
}, Ce = () => {
|
|
800
|
+
const w = U.value, z = V.value;
|
|
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, le = 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, le, pe, 0, 0, w.width, w.height);
|
|
804
|
+
}, Ve = (w) => {
|
|
805
|
+
w.preventDefault();
|
|
806
|
+
const z = w.clientX || w.touches[0].clientX, Y = w.clientY || w.touches[0].clientY;
|
|
807
|
+
he = {
|
|
808
|
+
startX: z,
|
|
809
|
+
startY: Y,
|
|
810
|
+
boxX: f.value.x,
|
|
811
|
+
boxY: f.value.y
|
|
812
|
+
};
|
|
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: le } = 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 + le - pe, he.boxY + L));
|
|
815
|
+
f.value.x = B, f.value.y = ae, Ce();
|
|
816
|
+
}, R = () => {
|
|
817
|
+
he = null, document.removeEventListener("mousemove", I), document.removeEventListener("mouseup", R), document.removeEventListener("touchmove", I), document.removeEventListener("touchend", R);
|
|
818
|
+
};
|
|
819
|
+
document.addEventListener("mousemove", I), document.addEventListener("mouseup", R), document.addEventListener("touchmove", I, { passive: !1 }), document.addEventListener("touchend", R);
|
|
820
|
+
}, xe = (w, z) => {
|
|
821
|
+
z.preventDefault();
|
|
822
|
+
const Y = z.clientX || z.touches[0].clientX, I = z.clientY || z.touches[0].clientY;
|
|
823
|
+
C = {
|
|
824
|
+
handle: w,
|
|
825
|
+
startX: Y,
|
|
826
|
+
startY: I,
|
|
827
|
+
boxX: f.value.x,
|
|
828
|
+
boxY: f.value.y,
|
|
829
|
+
boxSize: f.value.size
|
|
830
|
+
};
|
|
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: le, displayHeight: pe } = A.value;
|
|
833
|
+
let B = C.boxSize, ae = C.boxX, ne = C.boxY;
|
|
834
|
+
const D = C.boxSize / v.aspectRatio;
|
|
835
|
+
switch (w) {
|
|
836
|
+
case "se":
|
|
837
|
+
B = Math.max(f.value.minSize, Math.min(le - (C.boxX - te), pe - (C.boxY - se), C.boxSize + Math.max(L, q)));
|
|
838
|
+
break;
|
|
839
|
+
case "nw":
|
|
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
|
+
break;
|
|
842
|
+
case "ne":
|
|
843
|
+
B = Math.max(f.value.minSize, Math.min(te + le - C.boxX, C.boxY - se + D, C.boxSize + Math.max(L, -q))), ne = C.boxY + (D - B / v.aspectRatio);
|
|
844
|
+
break;
|
|
845
|
+
case "sw":
|
|
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);
|
|
847
|
+
break;
|
|
848
|
+
case "n":
|
|
849
|
+
B = Math.max(f.value.minSize, Math.min(C.boxY - se + D, C.boxSize - q)), ne = C.boxY + (D - B / v.aspectRatio);
|
|
850
|
+
break;
|
|
851
|
+
case "s":
|
|
852
|
+
B = Math.max(f.value.minSize, Math.min(se + pe - C.boxY, C.boxSize + q));
|
|
853
|
+
break;
|
|
854
|
+
case "w":
|
|
855
|
+
B = Math.max(f.value.minSize, Math.min(C.boxX - te + C.boxSize, C.boxSize - L)), ae = C.boxX + (C.boxSize - B);
|
|
856
|
+
break;
|
|
857
|
+
case "e":
|
|
858
|
+
B = Math.max(f.value.minSize, Math.min(te + le - C.boxX, C.boxSize + L));
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
861
|
+
f.value.size = B, f.value.x = ae, f.value.y = ne, Ce();
|
|
862
|
+
}, M = () => {
|
|
863
|
+
C = null, document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", M), document.removeEventListener("touchmove", R), document.removeEventListener("touchend", M);
|
|
768
864
|
};
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
865
|
+
document.addEventListener("mousemove", R), document.addEventListener("mouseup", M), document.addEventListener("touchmove", R, { passive: !1 }), document.addEventListener("touchend", M);
|
|
866
|
+
}, Se = () => {
|
|
867
|
+
const w = document.createElement("canvas"), z = V.value;
|
|
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, le = 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, le, 0, 0, w.width, w.height), new Promise((B) => {
|
|
871
|
+
w.toBlob(
|
|
872
|
+
(ae) => {
|
|
873
|
+
B(new File([ae], "avatar.jpg", { type: v.outputType }));
|
|
874
|
+
},
|
|
875
|
+
v.outputType,
|
|
876
|
+
v.outputQuality
|
|
877
|
+
);
|
|
878
|
+
});
|
|
879
|
+
}, Fe = () => {
|
|
880
|
+
const w = document.createElement("canvas"), z = V.value;
|
|
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, le = 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, le, 0, 0, w.width, w.height), w.toDataURL(v.outputType, v.outputQuality);
|
|
884
|
+
}, Re = async () => {
|
|
885
|
+
if (H.value) {
|
|
886
|
+
X.value = !0;
|
|
887
|
+
try {
|
|
888
|
+
const w = await Se(), z = Fe();
|
|
889
|
+
w && $("confirm", { file: w, dataUrl: z });
|
|
890
|
+
} catch (w) {
|
|
891
|
+
console.error(w), Q.error("生成图片失败");
|
|
892
|
+
} finally {
|
|
893
|
+
X.value = !1;
|
|
894
|
+
}
|
|
790
895
|
}
|
|
791
|
-
},
|
|
792
|
-
|
|
896
|
+
}, De = () => {
|
|
897
|
+
$("cancel"), ee.value = !1;
|
|
898
|
+
}, We = () => {
|
|
899
|
+
Me(), $("closed");
|
|
900
|
+
}, Me = () => {
|
|
901
|
+
f.value = { x: 0, y: 0, size: 150, minSize: v.minSize };
|
|
793
902
|
};
|
|
794
|
-
return (
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
903
|
+
return Et(
|
|
904
|
+
() => v.src,
|
|
905
|
+
(w) => {
|
|
906
|
+
w && Oe(() => {
|
|
907
|
+
V.value && V.value.complete && ge();
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
), t({
|
|
911
|
+
getCroppedImage: Se,
|
|
912
|
+
getCroppedImageDataUrl: Fe,
|
|
913
|
+
reset: Me
|
|
914
|
+
}), (w, z) => {
|
|
915
|
+
const Y = be("el-empty"), I = be("el-button"), R = be("el-dialog");
|
|
916
|
+
return a(), G(R, {
|
|
917
|
+
modelValue: ee.value,
|
|
918
|
+
"onUpdate:modelValue": z[0] || (z[0] = (M) => ee.value = M),
|
|
919
|
+
title: "调整头像",
|
|
920
|
+
width: x.dialogWidth,
|
|
801
921
|
"close-on-click-modal": !1,
|
|
802
|
-
|
|
922
|
+
"append-to-body": x.appendToBody,
|
|
923
|
+
onClosed: We
|
|
803
924
|
}, {
|
|
804
|
-
footer:
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
925
|
+
footer: k(() => [
|
|
926
|
+
e("div", Nt, [
|
|
927
|
+
m(I, { onClick: De }, {
|
|
928
|
+
default: k(() => [...z[2] || (z[2] = [
|
|
929
|
+
ue("取消", -1)
|
|
930
|
+
])]),
|
|
931
|
+
_: 1
|
|
932
|
+
}),
|
|
933
|
+
m(I, {
|
|
934
|
+
type: "primary",
|
|
935
|
+
loading: X.value,
|
|
936
|
+
disabled: !H.value,
|
|
937
|
+
onClick: Re
|
|
938
|
+
}, {
|
|
939
|
+
default: k(() => [...z[3] || (z[3] = [
|
|
940
|
+
ue(" 确认 ", -1)
|
|
941
|
+
])]),
|
|
942
|
+
_: 1
|
|
943
|
+
}, 8, ["loading", "disabled"])
|
|
944
|
+
])
|
|
822
945
|
]),
|
|
823
|
-
default:
|
|
824
|
-
e("div",
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
946
|
+
default: k(() => [
|
|
947
|
+
e("div", Ht, [
|
|
948
|
+
H.value ? (a(), p("div", Xt, [
|
|
949
|
+
e("div", {
|
|
950
|
+
ref_key: "cropAreaRef",
|
|
951
|
+
ref: ve,
|
|
952
|
+
class: "crop-area",
|
|
953
|
+
style: Xe({ height: x.cropAreaHeight })
|
|
954
|
+
}, [
|
|
955
|
+
e("img", {
|
|
956
|
+
src: H.value,
|
|
957
|
+
ref_key: "imageRef",
|
|
958
|
+
ref: V,
|
|
959
|
+
onLoad: ge,
|
|
960
|
+
style: Xe(de.value)
|
|
961
|
+
}, null, 44, Yt),
|
|
962
|
+
e("div", {
|
|
963
|
+
class: "crop-box",
|
|
964
|
+
style: Xe(Ae.value),
|
|
965
|
+
onMousedown: Ve,
|
|
966
|
+
onTouchstart: Ve
|
|
967
|
+
}, [
|
|
968
|
+
(a(), p(me, null, fe(Z, (M) => e("div", {
|
|
969
|
+
key: M,
|
|
970
|
+
class: J(["crop-handle", M]),
|
|
971
|
+
onMousedown: Be((E) => xe(M, E), ["stop"]),
|
|
972
|
+
onTouchstart: Be((E) => xe(M, E), ["stop"])
|
|
973
|
+
}, null, 42, qt)), 64))
|
|
974
|
+
], 36)
|
|
975
|
+
], 4),
|
|
976
|
+
e("div", Bt, [
|
|
977
|
+
z[1] || (z[1] = e("div", { class: "preview-label" }, "预览", -1)),
|
|
978
|
+
e("div", {
|
|
979
|
+
class: "preview-box",
|
|
980
|
+
style: Xe({ width: x.previewSize + "px", height: x.previewSize + "px" })
|
|
981
|
+
}, [
|
|
982
|
+
e("canvas", {
|
|
983
|
+
ref_key: "previewCanvasRef",
|
|
984
|
+
ref: U,
|
|
985
|
+
width: x.previewSize,
|
|
986
|
+
height: x.previewSize,
|
|
987
|
+
class: "preview-canvas"
|
|
988
|
+
}, null, 8, Kt)
|
|
989
|
+
], 4)
|
|
990
|
+
])
|
|
991
|
+
])) : (a(), G(Y, {
|
|
992
|
+
key: 1,
|
|
993
|
+
description: "请上传图片"
|
|
994
|
+
}))
|
|
860
995
|
])
|
|
861
996
|
]),
|
|
862
997
|
_: 1
|
|
863
|
-
}, 8, ["modelValue"]);
|
|
998
|
+
}, 8, ["modelValue", "width", "append-to-body"]);
|
|
864
999
|
};
|
|
865
1000
|
}
|
|
866
|
-
},
|
|
1001
|
+
}, yt = /* @__PURE__ */ gt(Pt, [["__scopeId", "data-v-594eeaf3"]]), jt = { class: "chat-panel" }, Ot = { class: "chat-sidebar" }, Gt = ["src"], Jt = ["onClick"], Qt = {
|
|
867
1002
|
key: 0,
|
|
868
1003
|
class: "sidebar-nav-badge"
|
|
869
|
-
},
|
|
1004
|
+
}, Zt = { class: "chat-content-panel" }, es = { class: "chat-search-bar" }, ts = { class: "chat-content-scroll" }, ss = { key: 0 }, as = ["onClick", "onContextmenu"], ns = { class: "chat-list-avatar-wrapper" }, is = ["src", "alt"], ls = {
|
|
870
1005
|
key: 0,
|
|
871
1006
|
class: "chat-list-online-indicator"
|
|
872
|
-
},
|
|
1007
|
+
}, os = { class: "chat-list-info" }, rs = { class: "chat-list-header" }, cs = { class: "chat-list-name" }, ds = { class: "chat-list-time" }, us = { class: "chat-list-preview" }, vs = { class: "chat-list-last-msg" }, ps = {
|
|
873
1008
|
key: 0,
|
|
874
1009
|
class: "chat-list-unread"
|
|
875
|
-
},
|
|
1010
|
+
}, ms = { key: 1 }, fs = { class: "add-friend-section" }, hs = { class: "add-friend-icon" }, gs = ["onClick"], ys = { class: "chat-list-avatar-wrapper" }, _s = ["src", "alt"], bs = { class: "chat-list-info" }, ks = { class: "chat-list-name" }, ws = { key: 2 }, Cs = { class: "friend-request-info" }, xs = ["src", "alt"], Us = { class: "friend-request-details" }, $s = { class: "friend-request-username" }, Ss = { class: "chat-main-area" }, zs = {
|
|
876
1011
|
key: 0,
|
|
877
1012
|
class: "friend-profile-area"
|
|
878
|
-
}, As = ["src", "alt"],
|
|
1013
|
+
}, As = ["src", "alt"], Vs = { class: "profile-name" }, Fs = { class: "profile-status" }, Is = {
|
|
879
1014
|
key: 1,
|
|
880
1015
|
class: "chat-window-area"
|
|
881
|
-
},
|
|
1016
|
+
}, Rs = { class: "chat-window-header" }, Ms = { class: "chat-window-title" }, Ls = { class: "chat-window-name" }, Ts = { class: "chat-window-actions" }, Es = { class: "message-avatar" }, Ds = ["src"], Ws = {
|
|
882
1017
|
key: 0,
|
|
883
1018
|
class: "message-sender-name"
|
|
884
|
-
},
|
|
1019
|
+
}, Hs = { class: "message-bubble-wrapper" }, Xs = ["onClick"], Ys = ["src", "alt"], qs = {
|
|
885
1020
|
key: 0,
|
|
886
1021
|
class: "message-image-size"
|
|
887
|
-
},
|
|
1022
|
+
}, Bs = ["onClick"], Ks = { class: "message-file-content" }, Ns = { class: "message-file-icon" }, Ps = { class: "message-file-info" }, js = { class: "message-file-name" }, Os = { class: "message-file-meta" }, Gs = { key: 0 }, Js = { class: "chat-input-area" }, Qs = {
|
|
888
1023
|
key: 0,
|
|
889
1024
|
class: "pending-files-area"
|
|
890
|
-
},
|
|
1025
|
+
}, Zs = {
|
|
891
1026
|
key: 0,
|
|
892
1027
|
class: "pending-image-wrapper"
|
|
893
|
-
},
|
|
1028
|
+
}, ea = ["src", "alt"], ta = ["onClick"], sa = {
|
|
894
1029
|
key: 1,
|
|
895
1030
|
class: "pending-file-wrapper"
|
|
896
|
-
},
|
|
1031
|
+
}, aa = { class: "pending-file-name" }, na = ["onClick"], ia = {
|
|
897
1032
|
key: 1,
|
|
898
1033
|
class: "input-toolbar"
|
|
899
|
-
}, la = { class: "input-textarea-wrapper" },
|
|
1034
|
+
}, la = { class: "input-textarea-wrapper" }, oa = ["onKeydown"], ra = { class: "input-send-wrapper" }, ca = {
|
|
900
1035
|
key: 2,
|
|
901
1036
|
class: "chat-empty-state"
|
|
902
|
-
},
|
|
1037
|
+
}, da = { class: "empty-state-text" }, ua = {
|
|
903
1038
|
key: 0,
|
|
904
1039
|
class: "chat-detail-panel"
|
|
905
|
-
},
|
|
1040
|
+
}, va = { class: "chat-detail-content" }, pa = { class: "chat-detail-profile" }, ma = ["src", "alt"], fa = { class: "chat-detail-name" }, ha = { class: "add-friend-search-wrapper" }, ga = { class: "add-friend-users-list" }, ya = { class: "add-friend-user-info" }, _a = ["src", "alt"], ba = { class: "add-friend-user-name" }, ka = { class: "chat-settings-container" }, wa = { class: "chat-settings-avatar-section" }, Ca = { class: "chat-settings-avatar-wrapper" }, xa = ["src"], Ua = { class: "chat-settings-user-display" }, $a = { class: "chat-settings-nickname" }, Sa = { class: "chat-settings-username" }, za = { class: "chat-settings-form-section" }, Aa = { class: "chat-settings-form-header" }, Va = { class: "chat-settings-form-title" }, Fa = { class: "chat-settings-form" }, Ia = { class: "chat-settings-form-item" }, Ra = {
|
|
906
1041
|
key: 1,
|
|
907
1042
|
class: "chat-settings-form-value"
|
|
908
|
-
},
|
|
1043
|
+
}, Ma = { class: "chat-settings-form-item" }, La = {
|
|
909
1044
|
key: 1,
|
|
910
1045
|
class: "chat-settings-form-value"
|
|
911
|
-
}, Ta = { class: "chat-settings-form-item" },
|
|
1046
|
+
}, Ta = { class: "chat-settings-form-item" }, Ea = {
|
|
912
1047
|
key: 1,
|
|
913
1048
|
class: "chat-settings-form-value"
|
|
914
|
-
}, Da = { class: "chat-settings-form-item" },
|
|
1049
|
+
}, Da = { class: "chat-settings-form-item" }, Wa = {
|
|
915
1050
|
key: 1,
|
|
916
1051
|
class: "chat-settings-form-value bio-value"
|
|
917
|
-
},
|
|
1052
|
+
}, Ha = {
|
|
918
1053
|
key: 0,
|
|
919
1054
|
class: "chat-settings-form-actions"
|
|
920
|
-
},
|
|
1055
|
+
}, Xa = {
|
|
921
1056
|
__name: "ChatPanel",
|
|
922
1057
|
props: {
|
|
923
1058
|
config: { type: Object, required: !0 }
|
|
924
1059
|
},
|
|
925
1060
|
emits: ["message", "send", "error", "init"],
|
|
926
|
-
setup(
|
|
927
|
-
const
|
|
928
|
-
myUsername:
|
|
929
|
-
myAvatar:
|
|
930
|
-
userInfo:
|
|
931
|
-
loadingUserInfo:
|
|
932
|
-
friendList:
|
|
933
|
-
filteredFriendList:
|
|
934
|
-
searchText:
|
|
935
|
-
inputText:
|
|
936
|
-
messagesContainer:
|
|
937
|
-
filteredUsers:
|
|
938
|
-
filteredAvailableUsers:
|
|
939
|
-
currentUser:
|
|
940
|
-
currentMessages:
|
|
941
|
-
addFriendDialogVisible:
|
|
942
|
-
addFriendSearchText:
|
|
943
|
-
availableUsers:
|
|
944
|
-
loadingAvailableUsers:
|
|
945
|
-
friendApplyList:
|
|
946
|
-
loadingFriendApply:
|
|
947
|
-
formatTime:
|
|
948
|
-
formatLastTime:
|
|
949
|
-
scrollToBottom:
|
|
950
|
-
getFriendList:
|
|
951
|
-
getChatHistory:
|
|
952
|
-
setFriendToChatStatus:
|
|
953
|
-
selectUser:
|
|
954
|
-
sendMessage:
|
|
955
|
-
sendFile:
|
|
956
|
-
sendFilesAndText:
|
|
957
|
-
initWebSocket:
|
|
958
|
-
closeWebSocket:
|
|
959
|
-
reset:
|
|
960
|
-
openAddFriendDialog:
|
|
961
|
-
addFriend:
|
|
962
|
-
loadFriendApplyList:
|
|
963
|
-
agreeFriend:
|
|
964
|
-
updateMyAvatar:
|
|
965
|
-
getUserInfo:
|
|
966
|
-
updateUserInfo:
|
|
967
|
-
} =
|
|
968
|
-
|
|
969
|
-
}),
|
|
1061
|
+
setup(x, { emit: t }) {
|
|
1062
|
+
const n = x, v = t, {
|
|
1063
|
+
myUsername: $,
|
|
1064
|
+
myAvatar: ee,
|
|
1065
|
+
userInfo: H,
|
|
1066
|
+
loadingUserInfo: Z,
|
|
1067
|
+
friendList: X,
|
|
1068
|
+
filteredFriendList: ve,
|
|
1069
|
+
searchText: V,
|
|
1070
|
+
inputText: U,
|
|
1071
|
+
messagesContainer: A,
|
|
1072
|
+
filteredUsers: f,
|
|
1073
|
+
filteredAvailableUsers: de,
|
|
1074
|
+
currentUser: Ae,
|
|
1075
|
+
currentMessages: he,
|
|
1076
|
+
addFriendDialogVisible: C,
|
|
1077
|
+
addFriendSearchText: ge,
|
|
1078
|
+
availableUsers: Ce,
|
|
1079
|
+
loadingAvailableUsers: Ve,
|
|
1080
|
+
friendApplyList: xe,
|
|
1081
|
+
loadingFriendApply: Se,
|
|
1082
|
+
formatTime: Fe,
|
|
1083
|
+
formatLastTime: Re,
|
|
1084
|
+
scrollToBottom: De,
|
|
1085
|
+
getFriendList: We,
|
|
1086
|
+
getChatHistory: Me,
|
|
1087
|
+
setFriendToChatStatus: w,
|
|
1088
|
+
selectUser: z,
|
|
1089
|
+
sendMessage: Y,
|
|
1090
|
+
sendFile: I,
|
|
1091
|
+
sendFilesAndText: R,
|
|
1092
|
+
initWebSocket: M,
|
|
1093
|
+
closeWebSocket: E,
|
|
1094
|
+
reset: N,
|
|
1095
|
+
openAddFriendDialog: P,
|
|
1096
|
+
addFriend: L,
|
|
1097
|
+
loadFriendApplyList: q,
|
|
1098
|
+
agreeFriend: te,
|
|
1099
|
+
updateMyAvatar: se,
|
|
1100
|
+
getUserInfo: le,
|
|
1101
|
+
updateUserInfo: pe
|
|
1102
|
+
} = Lt(n.config, (h) => {
|
|
1103
|
+
v("message", h);
|
|
1104
|
+
}), B = we(() => {
|
|
970
1105
|
var r;
|
|
971
|
-
const
|
|
972
|
-
return
|
|
973
|
-
}),
|
|
974
|
-
|
|
975
|
-
},
|
|
976
|
-
|
|
977
|
-
},
|
|
978
|
-
if (!
|
|
979
|
-
await
|
|
980
|
-
},
|
|
981
|
-
|
|
982
|
-
id:
|
|
983
|
-
name:
|
|
984
|
-
avatar:
|
|
985
|
-
online:
|
|
1106
|
+
const h = [{ id: "chat", icon: Ye, badge: 0 }];
|
|
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), oe = _(!1), K = _({ nickname: "", email: "", phone: "", bio: "" }), re = _(!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
|
+
h.preventDefault(), h.stopPropagation(), O.value = { visible: !0, x: h.clientX, y: h.clientY, chat: r };
|
|
1110
|
+
}, Le = () => {
|
|
1111
|
+
O.value.visible = !1;
|
|
1112
|
+
}, et = async () => {
|
|
1113
|
+
if (!O.value.chat) return;
|
|
1114
|
+
await w(O.value.chat.id, 0) && ne.value === O.value.chat.id && (ne.value = null, D.value = null), Le();
|
|
1115
|
+
}, Te = (h) => {
|
|
1116
|
+
ne.value = h.id, D.value = h, W.value = null, ie.value = !1, z({
|
|
1117
|
+
id: h.id,
|
|
1118
|
+
name: h.name,
|
|
1119
|
+
avatar: h.avatar,
|
|
1120
|
+
online: h.online
|
|
986
1121
|
});
|
|
987
|
-
},
|
|
988
|
-
|
|
989
|
-
},
|
|
990
|
-
if (!
|
|
991
|
-
if (await
|
|
992
|
-
|
|
993
|
-
const r =
|
|
994
|
-
r &&
|
|
1122
|
+
}, tt = (h) => {
|
|
1123
|
+
W.value = h, ne.value = null, D.value = null;
|
|
1124
|
+
}, st = async () => {
|
|
1125
|
+
if (!W.value) return;
|
|
1126
|
+
if (await w(W.value.id)) {
|
|
1127
|
+
ae.value = "chat", await Oe();
|
|
1128
|
+
const r = f.value.find((u) => u.id === W.value.id);
|
|
1129
|
+
r && Te(r), W.value = null;
|
|
995
1130
|
}
|
|
996
|
-
}, st = () => {
|
|
997
|
-
ge.value = !0;
|
|
998
1131
|
}, at = () => {
|
|
999
|
-
|
|
1000
|
-
(f = g.value) == null || f.click();
|
|
1132
|
+
ze.value = !0;
|
|
1001
1133
|
}, nt = () => {
|
|
1002
|
-
var
|
|
1003
|
-
(
|
|
1004
|
-
},
|
|
1005
|
-
|
|
1134
|
+
var h;
|
|
1135
|
+
(h = g.value) == null || h.click();
|
|
1136
|
+
}, it = () => {
|
|
1137
|
+
var h;
|
|
1138
|
+
(h = _e.value) == null || h.click();
|
|
1139
|
+
}, lt = (h) => {
|
|
1140
|
+
const r = Array.from(h.target.files || []);
|
|
1006
1141
|
if (r.length !== 0) {
|
|
1007
1142
|
for (const u of r) {
|
|
1008
1143
|
if (u.size > 50 * 1024 * 1024) {
|
|
1009
|
-
|
|
1144
|
+
Q.warning(`文件 ${u.name} 超过50MB,已跳过`);
|
|
1010
1145
|
continue;
|
|
1011
1146
|
}
|
|
1012
1147
|
const s = URL.createObjectURL(u);
|
|
1013
|
-
|
|
1148
|
+
j.value.push({
|
|
1014
1149
|
id: Date.now() + Math.random(),
|
|
1015
1150
|
file: u,
|
|
1016
1151
|
name: u.name,
|
|
@@ -1020,206 +1155,206 @@ const ht = (w, t) => {
|
|
|
1020
1155
|
isImage: u.type.startsWith("image/")
|
|
1021
1156
|
});
|
|
1022
1157
|
}
|
|
1023
|
-
|
|
1158
|
+
_e.value && (_e.value.value = "");
|
|
1024
1159
|
}
|
|
1025
|
-
},
|
|
1026
|
-
const r =
|
|
1027
|
-
r.previewUrl && URL.revokeObjectURL(r.previewUrl),
|
|
1028
|
-
},
|
|
1029
|
-
if (
|
|
1030
|
-
const r = 1024, u = ["B", "KB", "MB", "GB"], s = Math.floor(Math.log(
|
|
1031
|
-
return parseFloat((
|
|
1032
|
-
},
|
|
1033
|
-
if (!
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1160
|
+
}, Ke = (h) => {
|
|
1161
|
+
const r = j.value[h];
|
|
1162
|
+
r.previewUrl && URL.revokeObjectURL(r.previewUrl), j.value.splice(h, 1);
|
|
1163
|
+
}, Ne = (h) => {
|
|
1164
|
+
if (h === 0) return "0 B";
|
|
1165
|
+
const r = 1024, u = ["B", "KB", "MB", "GB"], s = Math.floor(Math.log(h) / Math.log(r));
|
|
1166
|
+
return parseFloat((h / Math.pow(r, s)).toFixed(2)) + " " + u[s];
|
|
1167
|
+
}, Pe = async () => {
|
|
1168
|
+
if (!U.value.trim() && j.value.length === 0) return;
|
|
1169
|
+
const h = [...j.value], r = U.value;
|
|
1170
|
+
U.value = "", j.value.forEach((u) => {
|
|
1036
1171
|
u.previewUrl && URL.revokeObjectURL(u.previewUrl);
|
|
1037
|
-
}),
|
|
1038
|
-
},
|
|
1172
|
+
}), j.value = [], await R(h, r), v("send", { text: r, files: h });
|
|
1173
|
+
}, ot = (h) => {
|
|
1039
1174
|
var u;
|
|
1040
|
-
const r = (u =
|
|
1175
|
+
const r = (u = h.clipboardData) == null ? void 0 : u.items;
|
|
1041
1176
|
if (r) {
|
|
1042
1177
|
for (const s of r)
|
|
1043
1178
|
if (s.kind === "file") {
|
|
1044
|
-
const
|
|
1045
|
-
if (
|
|
1046
|
-
if (
|
|
1047
|
-
|
|
1179
|
+
const b = s.getAsFile();
|
|
1180
|
+
if (b) {
|
|
1181
|
+
if (b.size > 50 * 1024 * 1024) {
|
|
1182
|
+
Q.warning(`文件 ${b.name} 超过50MB,已跳过`);
|
|
1048
1183
|
continue;
|
|
1049
1184
|
}
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1185
|
+
const T = URL.createObjectURL(b);
|
|
1186
|
+
j.value.push({
|
|
1052
1187
|
id: Date.now() + Math.random(),
|
|
1053
|
-
file:
|
|
1054
|
-
name:
|
|
1055
|
-
size:
|
|
1056
|
-
type:
|
|
1057
|
-
previewUrl:
|
|
1058
|
-
isImage:
|
|
1188
|
+
file: b,
|
|
1189
|
+
name: b.name,
|
|
1190
|
+
size: b.size,
|
|
1191
|
+
type: b.type,
|
|
1192
|
+
previewUrl: T,
|
|
1193
|
+
isImage: b.type.startsWith("image/")
|
|
1059
1194
|
});
|
|
1060
1195
|
}
|
|
1061
1196
|
}
|
|
1062
1197
|
}
|
|
1063
|
-
},
|
|
1064
|
-
if (!
|
|
1065
|
-
|
|
1198
|
+
}, je = (h) => {
|
|
1199
|
+
if (!h) {
|
|
1200
|
+
Q.warning("文件地址无效");
|
|
1066
1201
|
return;
|
|
1067
1202
|
}
|
|
1068
|
-
window.open(
|
|
1069
|
-
},
|
|
1070
|
-
console.warn("图片加载失败",
|
|
1071
|
-
},
|
|
1072
|
-
const r =
|
|
1203
|
+
window.open(h, "_blank");
|
|
1204
|
+
}, rt = (h) => {
|
|
1205
|
+
console.warn("图片加载失败", h);
|
|
1206
|
+
}, ct = (h) => {
|
|
1207
|
+
const r = h.target.files[0];
|
|
1073
1208
|
if (!r) return;
|
|
1074
1209
|
if (!r.type.startsWith("image/")) {
|
|
1075
|
-
|
|
1210
|
+
Q.error("只能上传图片文件");
|
|
1076
1211
|
return;
|
|
1077
1212
|
}
|
|
1078
1213
|
if (r.size > 5 * 1024 * 1024) {
|
|
1079
|
-
|
|
1214
|
+
Q.error("图片大小不能超过 5MB");
|
|
1080
1215
|
return;
|
|
1081
1216
|
}
|
|
1082
1217
|
const u = new FileReader();
|
|
1083
1218
|
u.onload = (s) => {
|
|
1084
|
-
|
|
1219
|
+
F.value = s.target.result, i.value = !0;
|
|
1085
1220
|
}, u.readAsDataURL(r);
|
|
1086
|
-
},
|
|
1087
|
-
if (
|
|
1221
|
+
}, dt = async ({ file: h }) => {
|
|
1222
|
+
if (h) {
|
|
1088
1223
|
d.value = !0;
|
|
1089
1224
|
try {
|
|
1090
|
-
const { ChatApi: r } = await Promise.resolve().then(() =>
|
|
1091
|
-
s.code === 200 ? (
|
|
1225
|
+
const { ChatApi: r } = await Promise.resolve().then(() => Mt), s = await new r(n.config).uploadAvatar(h, $);
|
|
1226
|
+
s.code === 200 ? (Q.success("头像上传成功"), se(s.data), Ge()) : Q.error(s.msg || "头像上传失败");
|
|
1092
1227
|
} catch (r) {
|
|
1093
|
-
console.error(r),
|
|
1228
|
+
console.error(r), Q.error("头像上传失败");
|
|
1094
1229
|
} finally {
|
|
1095
1230
|
d.value = !1;
|
|
1096
1231
|
}
|
|
1097
1232
|
}
|
|
1098
|
-
},
|
|
1099
|
-
|
|
1100
|
-
}, dt = () => {
|
|
1101
|
-
D.value = {
|
|
1102
|
-
nickname: I.value.nickname || "",
|
|
1103
|
-
email: I.value.email || "",
|
|
1104
|
-
phone: I.value.phone || "",
|
|
1105
|
-
bio: I.value.bio || ""
|
|
1106
|
-
}, j.value = !0;
|
|
1233
|
+
}, Ge = () => {
|
|
1234
|
+
F.value = "", i.value = !1, g.value && (g.value.value = "");
|
|
1107
1235
|
}, ut = () => {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1236
|
+
K.value = {
|
|
1237
|
+
nickname: H.value.nickname || "",
|
|
1238
|
+
email: H.value.email || "",
|
|
1239
|
+
phone: H.value.phone || "",
|
|
1240
|
+
bio: H.value.bio || ""
|
|
1241
|
+
}, oe.value = !0;
|
|
1242
|
+
}, vt = () => {
|
|
1243
|
+
oe.value = !1, K.value = { nickname: "", email: "", phone: "", bio: "" };
|
|
1244
|
+
}, pt = async () => {
|
|
1245
|
+
re.value = !0;
|
|
1111
1246
|
try {
|
|
1112
|
-
await
|
|
1113
|
-
} catch (
|
|
1114
|
-
console.error(
|
|
1247
|
+
await pe(K.value) ? (Q.success("保存成功"), oe.value = !1) : Q.error("保存失败");
|
|
1248
|
+
} catch (h) {
|
|
1249
|
+
console.error(h), Q.error("保存失败");
|
|
1115
1250
|
} finally {
|
|
1116
|
-
|
|
1251
|
+
re.value = !1;
|
|
1117
1252
|
}
|
|
1118
1253
|
};
|
|
1119
1254
|
return _t(async () => {
|
|
1120
|
-
await Promise.all([
|
|
1121
|
-
}),
|
|
1122
|
-
|
|
1123
|
-
}), (
|
|
1124
|
-
var
|
|
1125
|
-
const u =
|
|
1126
|
-
return
|
|
1127
|
-
e("div",
|
|
1255
|
+
await Promise.all([We(), q(), le()]), M(), f.value.length > 0 && Te(f.value[0]), v("init"), document.addEventListener("click", Le);
|
|
1256
|
+
}), bt(() => {
|
|
1257
|
+
N(), E(), document.removeEventListener("click", Le);
|
|
1258
|
+
}), (h, r) => {
|
|
1259
|
+
var ke, He, Ee;
|
|
1260
|
+
const u = be("el-icon"), s = be("el-input"), b = be("el-empty"), T = be("el-button"), ce = be("el-dialog");
|
|
1261
|
+
return a(), p("div", jt, [
|
|
1262
|
+
e("div", Ot, [
|
|
1128
1263
|
e("div", {
|
|
1129
1264
|
class: "sidebar-avatar",
|
|
1130
|
-
onClick:
|
|
1265
|
+
onClick: at
|
|
1131
1266
|
}, [
|
|
1132
1267
|
e("img", {
|
|
1133
|
-
src: c(
|
|
1268
|
+
src: c(ee),
|
|
1134
1269
|
alt: "头像",
|
|
1135
1270
|
class: "sidebar-avatar-img"
|
|
1136
|
-
}, null, 8,
|
|
1271
|
+
}, null, 8, Gt)
|
|
1137
1272
|
]),
|
|
1138
|
-
(
|
|
1273
|
+
(a(!0), p(me, null, fe(B.value, (o) => (a(), p("div", {
|
|
1139
1274
|
key: o.id,
|
|
1140
|
-
class:
|
|
1275
|
+
class: J([
|
|
1141
1276
|
"sidebar-nav-item",
|
|
1142
|
-
|
|
1277
|
+
ae.value === o.id ? "sidebar-nav-item-active" : "sidebar-nav-item-inactive"
|
|
1143
1278
|
]),
|
|
1144
|
-
onClick: (
|
|
1279
|
+
onClick: (ye) => ae.value = o.id
|
|
1145
1280
|
}, [
|
|
1146
|
-
|
|
1147
|
-
default:
|
|
1148
|
-
(
|
|
1281
|
+
m(u, { size: 24 }, {
|
|
1282
|
+
default: k(() => [
|
|
1283
|
+
(a(), G(kt(o.icon)))
|
|
1149
1284
|
]),
|
|
1150
1285
|
_: 2
|
|
1151
1286
|
}, 1024),
|
|
1152
|
-
o.badge ? (
|
|
1153
|
-
], 10,
|
|
1287
|
+
o.badge ? (a(), p("span", Qt, y(o.badge > 99 ? "99+" : o.badge), 1)) : S("", !0)
|
|
1288
|
+
], 10, Jt))), 128)),
|
|
1154
1289
|
r[13] || (r[13] = e("div", { class: "sidebar-spacer" }, null, -1)),
|
|
1155
|
-
|
|
1290
|
+
x.config.modules.settings ? (a(), p("div", {
|
|
1156
1291
|
key: 0,
|
|
1157
1292
|
class: "sidebar-nav-item sidebar-nav-item-inactive",
|
|
1158
|
-
onClick: r[0] || (r[0] = (o) =>
|
|
1293
|
+
onClick: r[0] || (r[0] = (o) => ze.value = !0),
|
|
1159
1294
|
title: "设置"
|
|
1160
1295
|
}, [
|
|
1161
|
-
|
|
1162
|
-
default:
|
|
1163
|
-
|
|
1296
|
+
m(u, { size: 24 }, {
|
|
1297
|
+
default: k(() => [
|
|
1298
|
+
m(c($t))
|
|
1164
1299
|
]),
|
|
1165
1300
|
_: 1
|
|
1166
1301
|
})
|
|
1167
|
-
])) :
|
|
1302
|
+
])) : S("", !0)
|
|
1168
1303
|
]),
|
|
1169
|
-
e("div",
|
|
1170
|
-
e("div",
|
|
1171
|
-
|
|
1172
|
-
modelValue: c(
|
|
1173
|
-
"onUpdate:modelValue": r[1] || (r[1] = (o) =>
|
|
1304
|
+
e("div", Zt, [
|
|
1305
|
+
e("div", es, [
|
|
1306
|
+
m(s, {
|
|
1307
|
+
modelValue: c(V),
|
|
1308
|
+
"onUpdate:modelValue": r[1] || (r[1] = (o) => Ie(V) ? V.value = o : null),
|
|
1174
1309
|
placeholder: "搜索",
|
|
1175
|
-
"prefix-icon": c(
|
|
1310
|
+
"prefix-icon": c(qe),
|
|
1176
1311
|
class: "chat-search-input"
|
|
1177
1312
|
}, null, 8, ["modelValue", "prefix-icon"])
|
|
1178
1313
|
]),
|
|
1179
|
-
e("div",
|
|
1180
|
-
|
|
1181
|
-
(
|
|
1314
|
+
e("div", ts, [
|
|
1315
|
+
ae.value === "chat" ? (a(), p("div", ss, [
|
|
1316
|
+
(a(!0), p(me, null, fe(c(f), (o) => (a(), p("div", {
|
|
1182
1317
|
key: o.id,
|
|
1183
|
-
class:
|
|
1318
|
+
class: J([
|
|
1184
1319
|
"chat-list-item",
|
|
1185
|
-
|
|
1320
|
+
ne.value === o.id ? "chat-list-item-active" : ""
|
|
1186
1321
|
]),
|
|
1187
|
-
onClick: (
|
|
1188
|
-
onContextmenu:
|
|
1322
|
+
onClick: (ye) => Te(o),
|
|
1323
|
+
onContextmenu: Be((ye) => Ue(ye, o), ["prevent", "stop"])
|
|
1189
1324
|
}, [
|
|
1190
|
-
e("div",
|
|
1325
|
+
e("div", ns, [
|
|
1191
1326
|
e("img", {
|
|
1192
1327
|
src: o.avatar,
|
|
1193
1328
|
alt: o.name,
|
|
1194
1329
|
class: "chat-list-avatar"
|
|
1195
|
-
}, null, 8,
|
|
1196
|
-
o.online ? (
|
|
1330
|
+
}, null, 8, is),
|
|
1331
|
+
o.online ? (a(), p("span", ls)) : S("", !0)
|
|
1197
1332
|
]),
|
|
1198
|
-
e("div",
|
|
1199
|
-
e("div",
|
|
1200
|
-
e("span",
|
|
1201
|
-
e("span",
|
|
1333
|
+
e("div", os, [
|
|
1334
|
+
e("div", rs, [
|
|
1335
|
+
e("span", cs, y(o.name), 1),
|
|
1336
|
+
e("span", ds, y(c(Re)(o.lastTime)), 1)
|
|
1202
1337
|
]),
|
|
1203
|
-
e("div",
|
|
1204
|
-
e("span",
|
|
1205
|
-
o.unread > 0 ? (
|
|
1338
|
+
e("div", us, [
|
|
1339
|
+
e("span", vs, y(o.lastMsg), 1),
|
|
1340
|
+
o.unread > 0 ? (a(), p("span", ps, y(o.unread > 99 ? "99+" : o.unread), 1)) : S("", !0)
|
|
1206
1341
|
])
|
|
1207
1342
|
])
|
|
1208
|
-
], 42,
|
|
1209
|
-
])) :
|
|
1210
|
-
|
|
1211
|
-
e("div",
|
|
1343
|
+
], 42, as))), 128))
|
|
1344
|
+
])) : S("", !0),
|
|
1345
|
+
ae.value === "friends" && x.config.modules.friends ? (a(), p("div", ms, [
|
|
1346
|
+
e("div", fs, [
|
|
1212
1347
|
e("div", {
|
|
1213
1348
|
class: "add-friend-btn",
|
|
1214
|
-
onClick: r[2] || (r[2] = (...o) => c(
|
|
1349
|
+
onClick: r[2] || (r[2] = (...o) => c(P) && c(P)(...o))
|
|
1215
1350
|
}, [
|
|
1216
|
-
e("div",
|
|
1217
|
-
|
|
1351
|
+
e("div", hs, [
|
|
1352
|
+
m(u, {
|
|
1218
1353
|
class: "text-white",
|
|
1219
1354
|
size: 20
|
|
1220
1355
|
}, {
|
|
1221
|
-
default:
|
|
1222
|
-
|
|
1356
|
+
default: k(() => [
|
|
1357
|
+
m(c(St))
|
|
1223
1358
|
]),
|
|
1224
1359
|
_: 1
|
|
1225
1360
|
})
|
|
@@ -1227,92 +1362,92 @@ const ht = (w, t) => {
|
|
|
1227
1362
|
r[14] || (r[14] = e("span", { class: "add-friend-text" }, "添加好友", -1))
|
|
1228
1363
|
])
|
|
1229
1364
|
]),
|
|
1230
|
-
(
|
|
1365
|
+
(a(!0), p(me, null, fe(c(ve), (o) => (a(), p("div", {
|
|
1231
1366
|
key: o.id,
|
|
1232
1367
|
class: "chat-list-item",
|
|
1233
|
-
onClick: (
|
|
1368
|
+
onClick: (ye) => tt(o)
|
|
1234
1369
|
}, [
|
|
1235
|
-
e("div",
|
|
1370
|
+
e("div", ys, [
|
|
1236
1371
|
e("img", {
|
|
1237
1372
|
src: o.avatar,
|
|
1238
1373
|
alt: o.name,
|
|
1239
1374
|
class: "chat-list-avatar"
|
|
1240
1375
|
}, null, 8, _s),
|
|
1241
1376
|
e("span", {
|
|
1242
|
-
class:
|
|
1377
|
+
class: J([
|
|
1243
1378
|
"chat-list-online-indicator",
|
|
1244
1379
|
o.online ? "chat-list-online" : "chat-list-offline"
|
|
1245
1380
|
])
|
|
1246
1381
|
}, null, 2)
|
|
1247
1382
|
]),
|
|
1248
|
-
e("div",
|
|
1249
|
-
e("span",
|
|
1383
|
+
e("div", bs, [
|
|
1384
|
+
e("span", ks, y(o.name), 1)
|
|
1250
1385
|
])
|
|
1251
|
-
], 8,
|
|
1252
|
-
])) :
|
|
1253
|
-
|
|
1254
|
-
c(
|
|
1386
|
+
], 8, gs))), 128))
|
|
1387
|
+
])) : S("", !0),
|
|
1388
|
+
ae.value === "apply" && x.config.modules.apply ? (a(), p("div", ws, [
|
|
1389
|
+
c(Se) ? (a(), G(b, {
|
|
1255
1390
|
key: 0,
|
|
1256
1391
|
description: "加载中..."
|
|
1257
|
-
})) : c(
|
|
1392
|
+
})) : c(xe).length === 0 ? (a(), G(b, {
|
|
1258
1393
|
key: 1,
|
|
1259
1394
|
description: "暂无好友申请"
|
|
1260
|
-
})) : (
|
|
1395
|
+
})) : (a(!0), p(me, { key: 2 }, fe(c(xe), (o) => (a(), p("div", {
|
|
1261
1396
|
key: o.applyUser || o.id,
|
|
1262
1397
|
class: "friend-request-item"
|
|
1263
1398
|
}, [
|
|
1264
|
-
e("div",
|
|
1399
|
+
e("div", Cs, [
|
|
1265
1400
|
e("img", {
|
|
1266
1401
|
src: `https://api.dicebear.com/7.x/avataaars/svg?seed=${o.applyUser}`,
|
|
1267
1402
|
alt: o.applyUser,
|
|
1268
1403
|
class: "friend-request-avatar"
|
|
1269
|
-
}, null, 8,
|
|
1404
|
+
}, null, 8, xs),
|
|
1270
1405
|
e("div", Us, [
|
|
1271
|
-
e("div", $s,
|
|
1406
|
+
e("div", $s, y(o.applyUser), 1),
|
|
1272
1407
|
r[15] || (r[15] = e("div", { class: "friend-request-desc" }, "请求添加你为好友", -1))
|
|
1273
1408
|
])
|
|
1274
1409
|
]),
|
|
1275
|
-
|
|
1410
|
+
m(T, {
|
|
1276
1411
|
type: "primary",
|
|
1277
1412
|
size: "small",
|
|
1278
|
-
onClick: (
|
|
1413
|
+
onClick: (ye) => c(te)(o.applyUser)
|
|
1279
1414
|
}, {
|
|
1280
|
-
default:
|
|
1281
|
-
|
|
1415
|
+
default: k(() => [...r[16] || (r[16] = [
|
|
1416
|
+
ue("同意", -1)
|
|
1282
1417
|
])]),
|
|
1283
1418
|
_: 1
|
|
1284
1419
|
}, 8, ["onClick"])
|
|
1285
1420
|
]))), 128))
|
|
1286
|
-
])) :
|
|
1421
|
+
])) : S("", !0)
|
|
1287
1422
|
])
|
|
1288
1423
|
]),
|
|
1289
|
-
e("div",
|
|
1290
|
-
|
|
1424
|
+
e("div", Ss, [
|
|
1425
|
+
W.value && !D.value ? (a(), p("div", zs, [
|
|
1291
1426
|
e("img", {
|
|
1292
|
-
src:
|
|
1293
|
-
alt:
|
|
1427
|
+
src: W.value.avatar,
|
|
1428
|
+
alt: W.value.name,
|
|
1294
1429
|
class: "profile-avatar"
|
|
1295
1430
|
}, null, 8, As),
|
|
1296
|
-
e("div",
|
|
1431
|
+
e("div", Vs, y(W.value.name), 1),
|
|
1297
1432
|
e("div", Fs, [
|
|
1298
1433
|
e("span", {
|
|
1299
|
-
class:
|
|
1434
|
+
class: J([
|
|
1300
1435
|
"profile-status-dot",
|
|
1301
|
-
|
|
1436
|
+
W.value.online ? "profile-status-online" : "profile-status-offline"
|
|
1302
1437
|
])
|
|
1303
1438
|
}, null, 2),
|
|
1304
|
-
e("span", null,
|
|
1439
|
+
e("span", null, y(W.value.online ? "在线" : "离线"), 1)
|
|
1305
1440
|
]),
|
|
1306
|
-
|
|
1441
|
+
m(T, {
|
|
1307
1442
|
type: "primary",
|
|
1308
1443
|
size: "large",
|
|
1309
|
-
onClick:
|
|
1444
|
+
onClick: st,
|
|
1310
1445
|
class: "profile-start-chat-btn"
|
|
1311
1446
|
}, {
|
|
1312
|
-
default:
|
|
1313
|
-
|
|
1314
|
-
default:
|
|
1315
|
-
|
|
1447
|
+
default: k(() => [
|
|
1448
|
+
m(u, null, {
|
|
1449
|
+
default: k(() => [
|
|
1450
|
+
m(c(Ye))
|
|
1316
1451
|
]),
|
|
1317
1452
|
_: 1
|
|
1318
1453
|
}),
|
|
@@ -1320,31 +1455,31 @@ const ht = (w, t) => {
|
|
|
1320
1455
|
]),
|
|
1321
1456
|
_: 1
|
|
1322
1457
|
})
|
|
1323
|
-
])) :
|
|
1324
|
-
|
|
1325
|
-
e("div",
|
|
1326
|
-
e("div",
|
|
1327
|
-
e("span", Ls,
|
|
1458
|
+
])) : S("", !0),
|
|
1459
|
+
D.value ? (a(), p("div", Is, [
|
|
1460
|
+
e("div", Rs, [
|
|
1461
|
+
e("div", Ms, [
|
|
1462
|
+
e("span", Ls, y(D.value.name), 1),
|
|
1328
1463
|
e("span", {
|
|
1329
|
-
class:
|
|
1464
|
+
class: J([
|
|
1330
1465
|
"chat-window-status",
|
|
1331
|
-
|
|
1466
|
+
D.value.online ? "chat-window-status-online" : "chat-window-status-offline"
|
|
1332
1467
|
])
|
|
1333
|
-
},
|
|
1468
|
+
}, y(D.value.online ? "在线" : "离线"), 3)
|
|
1334
1469
|
]),
|
|
1335
1470
|
e("div", Ts, [
|
|
1336
|
-
|
|
1337
|
-
default:
|
|
1338
|
-
|
|
1471
|
+
m(u, { class: "chat-action-icon" }, {
|
|
1472
|
+
default: k(() => [
|
|
1473
|
+
m(c(qe))
|
|
1339
1474
|
]),
|
|
1340
1475
|
_: 1
|
|
1341
1476
|
}),
|
|
1342
|
-
|
|
1477
|
+
m(u, {
|
|
1343
1478
|
class: "chat-action-icon",
|
|
1344
|
-
onClick: r[3] || (r[3] = (o) =>
|
|
1479
|
+
onClick: r[3] || (r[3] = (o) => ie.value = !ie.value)
|
|
1345
1480
|
}, {
|
|
1346
|
-
default:
|
|
1347
|
-
|
|
1481
|
+
default: k(() => [
|
|
1482
|
+
m(c(zt))
|
|
1348
1483
|
]),
|
|
1349
1484
|
_: 1
|
|
1350
1485
|
})
|
|
@@ -1352,256 +1487,256 @@ const ht = (w, t) => {
|
|
|
1352
1487
|
]),
|
|
1353
1488
|
e("div", {
|
|
1354
1489
|
ref_key: "messagesContainer",
|
|
1355
|
-
ref:
|
|
1490
|
+
ref: A,
|
|
1356
1491
|
class: "chat-messages-container"
|
|
1357
1492
|
}, [
|
|
1358
|
-
(
|
|
1359
|
-
key:
|
|
1360
|
-
class:
|
|
1493
|
+
(a(!0), p(me, null, fe(c(he), (o, ye) => (a(), p("div", {
|
|
1494
|
+
key: ye,
|
|
1495
|
+
class: J([
|
|
1361
1496
|
"message-wrapper",
|
|
1362
1497
|
o.isSelf ? "message-self" : "message-other"
|
|
1363
1498
|
])
|
|
1364
1499
|
}, [
|
|
1365
|
-
e("div",
|
|
1500
|
+
e("div", Es, [
|
|
1366
1501
|
e("img", {
|
|
1367
|
-
src: o.isSelf ? c(
|
|
1502
|
+
src: o.isSelf ? c(ee) : D.value.avatar,
|
|
1368
1503
|
class: "message-avatar-img"
|
|
1369
1504
|
}, null, 8, Ds)
|
|
1370
1505
|
]),
|
|
1371
1506
|
e("div", {
|
|
1372
|
-
class:
|
|
1507
|
+
class: J([
|
|
1373
1508
|
"message-content",
|
|
1374
1509
|
o.isSelf ? "message-content-self" : "message-content-other"
|
|
1375
1510
|
])
|
|
1376
1511
|
}, [
|
|
1377
|
-
o.isSelf ?
|
|
1378
|
-
e("div",
|
|
1379
|
-
o.type === "text" ? (
|
|
1512
|
+
o.isSelf ? S("", !0) : (a(), p("div", Ws, y(D.value.name), 1)),
|
|
1513
|
+
e("div", Hs, [
|
|
1514
|
+
o.type === "text" ? (a(), p("div", {
|
|
1380
1515
|
key: 0,
|
|
1381
|
-
class:
|
|
1516
|
+
class: J([
|
|
1382
1517
|
"message-bubble",
|
|
1383
1518
|
o.isSelf ? "message-bubble-self" : "message-bubble-other"
|
|
1384
1519
|
])
|
|
1385
|
-
},
|
|
1520
|
+
}, y(o.text), 3)) : o.type === "file" && o.fileType === "image" ? (a(), p("div", {
|
|
1386
1521
|
key: 1,
|
|
1387
|
-
class:
|
|
1522
|
+
class: J([
|
|
1388
1523
|
"message-bubble",
|
|
1389
1524
|
"message-image-bubble",
|
|
1390
1525
|
o.isSelf ? "message-bubble-self" : "message-bubble-other"
|
|
1391
1526
|
]),
|
|
1392
|
-
onClick: (
|
|
1527
|
+
onClick: (l) => je(o.fileUrl)
|
|
1393
1528
|
}, [
|
|
1394
1529
|
e("img", {
|
|
1395
1530
|
src: o.fileUrl,
|
|
1396
1531
|
alt: o.fileName,
|
|
1397
1532
|
class: "message-image",
|
|
1398
|
-
onError:
|
|
1399
|
-
}, null, 40,
|
|
1400
|
-
o.fileSize ? (
|
|
1401
|
-
], 10,
|
|
1533
|
+
onError: rt
|
|
1534
|
+
}, null, 40, Ys),
|
|
1535
|
+
o.fileSize ? (a(), p("div", qs, y(Ne(o.fileSize)), 1)) : S("", !0)
|
|
1536
|
+
], 10, Xs)) : o.type === "file" ? (a(), p("div", {
|
|
1402
1537
|
key: 2,
|
|
1403
|
-
class:
|
|
1538
|
+
class: J([
|
|
1404
1539
|
"message-bubble",
|
|
1405
1540
|
"message-file-bubble",
|
|
1406
1541
|
o.isSelf ? "message-bubble-self" : "message-bubble-other"
|
|
1407
1542
|
]),
|
|
1408
|
-
onClick: (
|
|
1543
|
+
onClick: (l) => je(o.fileUrl)
|
|
1409
1544
|
}, [
|
|
1410
|
-
e("div",
|
|
1411
|
-
e("div",
|
|
1412
|
-
|
|
1413
|
-
default:
|
|
1414
|
-
|
|
1545
|
+
e("div", Ks, [
|
|
1546
|
+
e("div", Ns, [
|
|
1547
|
+
m(u, { size: 28 }, {
|
|
1548
|
+
default: k(() => [
|
|
1549
|
+
m(c(At))
|
|
1415
1550
|
]),
|
|
1416
1551
|
_: 1
|
|
1417
1552
|
})
|
|
1418
1553
|
]),
|
|
1419
|
-
e("div",
|
|
1420
|
-
e("div", js,
|
|
1421
|
-
e("div",
|
|
1422
|
-
|
|
1423
|
-
default:
|
|
1424
|
-
|
|
1554
|
+
e("div", Ps, [
|
|
1555
|
+
e("div", js, y(o.fileName || o.text), 1),
|
|
1556
|
+
e("div", Os, [
|
|
1557
|
+
m(u, { size: 12 }, {
|
|
1558
|
+
default: k(() => [
|
|
1559
|
+
m(c(Vt))
|
|
1425
1560
|
]),
|
|
1426
1561
|
_: 1
|
|
1427
1562
|
}),
|
|
1428
1563
|
r[18] || (r[18] = e("span", null, "点击下载", -1)),
|
|
1429
|
-
o.fileSize ? (
|
|
1564
|
+
o.fileSize ? (a(), p("span", Gs, "· " + y(Ne(o.fileSize)), 1)) : S("", !0)
|
|
1430
1565
|
])
|
|
1431
1566
|
])
|
|
1432
1567
|
])
|
|
1433
|
-
], 10,
|
|
1568
|
+
], 10, Bs)) : S("", !0),
|
|
1434
1569
|
e("div", {
|
|
1435
|
-
class:
|
|
1570
|
+
class: J([
|
|
1436
1571
|
"message-time",
|
|
1437
1572
|
o.isSelf ? "message-time-right" : "message-time-left"
|
|
1438
1573
|
])
|
|
1439
|
-
},
|
|
1574
|
+
}, y(c(Fe)(o.time)), 3)
|
|
1440
1575
|
])
|
|
1441
1576
|
], 2)
|
|
1442
1577
|
], 2))), 128))
|
|
1443
1578
|
], 512),
|
|
1444
|
-
e("div",
|
|
1445
|
-
|
|
1446
|
-
(
|
|
1579
|
+
e("div", Js, [
|
|
1580
|
+
j.value.length > 0 ? (a(), p("div", Qs, [
|
|
1581
|
+
(a(!0), p(me, null, fe(j.value, (o, ye) => (a(), p("div", {
|
|
1447
1582
|
key: o.id,
|
|
1448
1583
|
class: "pending-file-item"
|
|
1449
1584
|
}, [
|
|
1450
|
-
o.isImage ? (
|
|
1585
|
+
o.isImage ? (a(), p("div", Zs, [
|
|
1451
1586
|
e("img", {
|
|
1452
1587
|
src: o.previewUrl,
|
|
1453
1588
|
alt: o.name,
|
|
1454
1589
|
class: "pending-image"
|
|
1455
|
-
}, null, 8,
|
|
1590
|
+
}, null, 8, ea),
|
|
1456
1591
|
e("button", {
|
|
1457
|
-
onClick: (
|
|
1592
|
+
onClick: (l) => Ke(ye),
|
|
1458
1593
|
class: "pending-file-remove-btn"
|
|
1459
|
-
}, " × ", 8,
|
|
1460
|
-
])) : (
|
|
1461
|
-
|
|
1462
|
-
default:
|
|
1463
|
-
|
|
1594
|
+
}, " × ", 8, ta)
|
|
1595
|
+
])) : (a(), p("div", sa, [
|
|
1596
|
+
m(u, { class: "pending-file-icon" }, {
|
|
1597
|
+
default: k(() => [
|
|
1598
|
+
m(c(Ze))
|
|
1464
1599
|
]),
|
|
1465
1600
|
_: 1
|
|
1466
1601
|
}),
|
|
1467
|
-
e("span",
|
|
1602
|
+
e("span", aa, y(o.name), 1),
|
|
1468
1603
|
e("button", {
|
|
1469
|
-
onClick: (
|
|
1604
|
+
onClick: (l) => Ke(ye),
|
|
1470
1605
|
class: "pending-file-remove-btn"
|
|
1471
|
-
}, " × ", 8,
|
|
1606
|
+
}, " × ", 8, na)
|
|
1472
1607
|
]))
|
|
1473
1608
|
]))), 128))
|
|
1474
|
-
])) :
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
default:
|
|
1478
|
-
|
|
1609
|
+
])) : S("", !0),
|
|
1610
|
+
x.config.modules.fileUpload ? (a(), p("div", ia, [
|
|
1611
|
+
m(u, { class: "input-toolbar-icon" }, {
|
|
1612
|
+
default: k(() => [
|
|
1613
|
+
m(c(Ye))
|
|
1479
1614
|
]),
|
|
1480
1615
|
_: 1
|
|
1481
1616
|
}),
|
|
1482
|
-
|
|
1617
|
+
m(u, {
|
|
1483
1618
|
class: "input-toolbar-icon",
|
|
1484
|
-
onClick:
|
|
1619
|
+
onClick: it
|
|
1485
1620
|
}, {
|
|
1486
|
-
default:
|
|
1487
|
-
|
|
1621
|
+
default: k(() => [
|
|
1622
|
+
m(c(Ze))
|
|
1488
1623
|
]),
|
|
1489
1624
|
_: 1
|
|
1490
1625
|
}),
|
|
1491
|
-
|
|
1492
|
-
default:
|
|
1493
|
-
|
|
1626
|
+
m(u, { class: "input-toolbar-icon" }, {
|
|
1627
|
+
default: k(() => [
|
|
1628
|
+
m(c(Ft))
|
|
1494
1629
|
]),
|
|
1495
1630
|
_: 1
|
|
1496
1631
|
})
|
|
1497
|
-
])) :
|
|
1632
|
+
])) : S("", !0),
|
|
1498
1633
|
e("div", la, [
|
|
1499
|
-
|
|
1500
|
-
"onUpdate:modelValue": r[4] || (r[4] = (o) =>
|
|
1501
|
-
onKeydown:
|
|
1502
|
-
onPaste:
|
|
1634
|
+
wt(e("textarea", {
|
|
1635
|
+
"onUpdate:modelValue": r[4] || (r[4] = (o) => Ie(U) ? U.value = o : null),
|
|
1636
|
+
onKeydown: Ct(Be(Pe, ["prevent"]), ["enter"]),
|
|
1637
|
+
onPaste: ot,
|
|
1503
1638
|
placeholder: "输入消息或粘贴文件...",
|
|
1504
1639
|
class: "message-input-textarea",
|
|
1505
1640
|
rows: "3"
|
|
1506
|
-
}, null, 40,
|
|
1507
|
-
[
|
|
1641
|
+
}, null, 40, oa), [
|
|
1642
|
+
[xt, c(U)]
|
|
1508
1643
|
])
|
|
1509
1644
|
]),
|
|
1510
|
-
e("div",
|
|
1511
|
-
|
|
1645
|
+
e("div", ra, [
|
|
1646
|
+
m(T, {
|
|
1512
1647
|
type: "primary",
|
|
1513
|
-
disabled: !c(
|
|
1514
|
-
onClick:
|
|
1648
|
+
disabled: !c(U).trim() && j.value.length === 0,
|
|
1649
|
+
onClick: Pe,
|
|
1515
1650
|
class: "send-message-btn"
|
|
1516
1651
|
}, {
|
|
1517
|
-
default:
|
|
1518
|
-
|
|
1652
|
+
default: k(() => [...r[19] || (r[19] = [
|
|
1653
|
+
ue(" 发送 ", -1)
|
|
1519
1654
|
])]),
|
|
1520
1655
|
_: 1
|
|
1521
1656
|
}, 8, ["disabled"])
|
|
1522
1657
|
]),
|
|
1523
1658
|
e("input", {
|
|
1524
1659
|
ref_key: "fileInputRef",
|
|
1525
|
-
ref:
|
|
1660
|
+
ref: _e,
|
|
1526
1661
|
type: "file",
|
|
1527
1662
|
multiple: "",
|
|
1528
1663
|
class: "hidden-file-input",
|
|
1529
1664
|
onChange: lt
|
|
1530
1665
|
}, null, 544)
|
|
1531
1666
|
])
|
|
1532
|
-
])) :
|
|
1533
|
-
|
|
1667
|
+
])) : W.value ? S("", !0) : (a(), p("div", ca, [
|
|
1668
|
+
m(u, {
|
|
1534
1669
|
size: 64,
|
|
1535
1670
|
class: "empty-state-icon"
|
|
1536
1671
|
}, {
|
|
1537
|
-
default:
|
|
1538
|
-
|
|
1672
|
+
default: k(() => [
|
|
1673
|
+
m(c(It))
|
|
1539
1674
|
]),
|
|
1540
1675
|
_: 1
|
|
1541
1676
|
}),
|
|
1542
|
-
e("div",
|
|
1677
|
+
e("div", da, y(ae.value === "apply" ? "在左侧选择好友申请" : "在左侧选择好友开始聊天"), 1)
|
|
1543
1678
|
]))
|
|
1544
1679
|
]),
|
|
1545
|
-
|
|
1680
|
+
ie.value ? (a(), p("div", ua, [
|
|
1546
1681
|
r[21] || (r[21] = e("div", { class: "chat-detail-header" }, "聊天详情", -1)),
|
|
1547
|
-
e("div",
|
|
1548
|
-
e("div",
|
|
1682
|
+
e("div", va, [
|
|
1683
|
+
e("div", pa, [
|
|
1549
1684
|
e("img", {
|
|
1550
|
-
src: (
|
|
1551
|
-
alt: (
|
|
1685
|
+
src: (ke = D.value) == null ? void 0 : ke.avatar,
|
|
1686
|
+
alt: (He = D.value) == null ? void 0 : He.name,
|
|
1552
1687
|
class: "chat-detail-avatar"
|
|
1553
|
-
}, null, 8,
|
|
1554
|
-
e("div",
|
|
1688
|
+
}, null, 8, ma),
|
|
1689
|
+
e("div", fa, y((Ee = D.value) == null ? void 0 : Ee.name), 1),
|
|
1555
1690
|
r[20] || (r[20] = e("div", { class: "chat-detail-actions" }, [
|
|
1556
1691
|
e("div", { class: "chat-detail-action-item" }, "查找聊天记录"),
|
|
1557
1692
|
e("div", { class: "chat-detail-action-item" }, "清空聊天记录")
|
|
1558
1693
|
], -1))
|
|
1559
1694
|
])
|
|
1560
1695
|
])
|
|
1561
|
-
])) :
|
|
1562
|
-
|
|
1563
|
-
modelValue: c(
|
|
1564
|
-
"onUpdate:modelValue": r[6] || (r[6] = (o) =>
|
|
1696
|
+
])) : S("", !0),
|
|
1697
|
+
m(ce, {
|
|
1698
|
+
modelValue: c(C),
|
|
1699
|
+
"onUpdate:modelValue": r[6] || (r[6] = (o) => Ie(C) ? C.value = o : null),
|
|
1565
1700
|
title: "添加好友",
|
|
1566
1701
|
width: "500px",
|
|
1567
1702
|
"append-to-body": ""
|
|
1568
1703
|
}, {
|
|
1569
|
-
default:
|
|
1570
|
-
e("div",
|
|
1571
|
-
|
|
1572
|
-
modelValue: c(
|
|
1573
|
-
"onUpdate:modelValue": r[5] || (r[5] = (o) =>
|
|
1704
|
+
default: k(() => [
|
|
1705
|
+
e("div", ha, [
|
|
1706
|
+
m(s, {
|
|
1707
|
+
modelValue: c(ge),
|
|
1708
|
+
"onUpdate:modelValue": r[5] || (r[5] = (o) => Ie(ge) ? ge.value = o : null),
|
|
1574
1709
|
placeholder: "搜索用户",
|
|
1575
|
-
"prefix-icon": c(
|
|
1710
|
+
"prefix-icon": c(qe),
|
|
1576
1711
|
class: "add-friend-search-input"
|
|
1577
1712
|
}, null, 8, ["modelValue", "prefix-icon"])
|
|
1578
1713
|
]),
|
|
1579
|
-
e("div",
|
|
1580
|
-
c(
|
|
1714
|
+
e("div", ga, [
|
|
1715
|
+
c(Ve) ? (a(), G(b, {
|
|
1581
1716
|
key: 0,
|
|
1582
1717
|
description: "加载中..."
|
|
1583
|
-
})) : c(
|
|
1718
|
+
})) : c(de).length === 0 ? (a(), G(b, {
|
|
1584
1719
|
key: 1,
|
|
1585
1720
|
description: "暂无用户"
|
|
1586
|
-
})) : (
|
|
1721
|
+
})) : (a(!0), p(me, { key: 2 }, fe(c(de), (o) => (a(), p("div", {
|
|
1587
1722
|
key: o.username,
|
|
1588
1723
|
class: "add-friend-user-item"
|
|
1589
1724
|
}, [
|
|
1590
|
-
e("div",
|
|
1725
|
+
e("div", ya, [
|
|
1591
1726
|
e("img", {
|
|
1592
1727
|
src: `https://api.dicebear.com/7.x/avataaars/svg?seed=${o.username}`,
|
|
1593
1728
|
alt: o.username,
|
|
1594
1729
|
class: "add-friend-user-avatar"
|
|
1595
1730
|
}, null, 8, _a),
|
|
1596
|
-
e("div",
|
|
1731
|
+
e("div", ba, y(o.username), 1)
|
|
1597
1732
|
]),
|
|
1598
|
-
|
|
1733
|
+
m(T, {
|
|
1599
1734
|
type: "primary",
|
|
1600
1735
|
size: "small",
|
|
1601
|
-
onClick: (
|
|
1736
|
+
onClick: (ye) => c(L)(o)
|
|
1602
1737
|
}, {
|
|
1603
|
-
default:
|
|
1604
|
-
|
|
1738
|
+
default: k(() => [...r[22] || (r[22] = [
|
|
1739
|
+
ue("添加", -1)
|
|
1605
1740
|
])]),
|
|
1606
1741
|
_: 1
|
|
1607
1742
|
}, 8, ["onClick"])
|
|
@@ -1610,73 +1745,73 @@ const ht = (w, t) => {
|
|
|
1610
1745
|
]),
|
|
1611
1746
|
_: 1
|
|
1612
1747
|
}, 8, ["modelValue"]),
|
|
1613
|
-
|
|
1614
|
-
modelValue:
|
|
1615
|
-
"onUpdate:modelValue": r[11] || (r[11] = (o) =>
|
|
1748
|
+
m(ce, {
|
|
1749
|
+
modelValue: ze.value,
|
|
1750
|
+
"onUpdate:modelValue": r[11] || (r[11] = (o) => ze.value = o),
|
|
1616
1751
|
title: "个人设置",
|
|
1617
1752
|
width: "560px",
|
|
1618
1753
|
"close-on-click-modal": !1,
|
|
1619
1754
|
"append-to-body": "",
|
|
1620
1755
|
class: "chat-settings-dialog"
|
|
1621
1756
|
}, {
|
|
1622
|
-
default:
|
|
1623
|
-
e("div",
|
|
1624
|
-
e("div",
|
|
1625
|
-
e("div",
|
|
1757
|
+
default: k(() => [
|
|
1758
|
+
e("div", ka, [
|
|
1759
|
+
e("div", wa, [
|
|
1760
|
+
e("div", Ca, [
|
|
1626
1761
|
e("img", {
|
|
1627
|
-
src: c(
|
|
1762
|
+
src: c(ee),
|
|
1628
1763
|
alt: "头像",
|
|
1629
1764
|
class: "chat-settings-avatar"
|
|
1630
|
-
}, null, 8,
|
|
1631
|
-
|
|
1765
|
+
}, null, 8, xa),
|
|
1766
|
+
x.config.modules.avatarCrop ? (a(), p("div", {
|
|
1632
1767
|
key: 0,
|
|
1633
1768
|
class: "chat-settings-avatar-edit",
|
|
1634
|
-
onClick:
|
|
1769
|
+
onClick: nt
|
|
1635
1770
|
}, [
|
|
1636
|
-
|
|
1771
|
+
m(u, {
|
|
1637
1772
|
size: 18,
|
|
1638
1773
|
class: "chat-settings-avatar-icon"
|
|
1639
1774
|
}, {
|
|
1640
|
-
default:
|
|
1641
|
-
|
|
1775
|
+
default: k(() => [
|
|
1776
|
+
m(c(Rt))
|
|
1642
1777
|
]),
|
|
1643
1778
|
_: 1
|
|
1644
1779
|
})
|
|
1645
|
-
])) :
|
|
1780
|
+
])) : S("", !0),
|
|
1646
1781
|
e("input", {
|
|
1647
1782
|
ref_key: "avatarInputRef",
|
|
1648
1783
|
ref: g,
|
|
1649
1784
|
type: "file",
|
|
1650
1785
|
accept: "image/*",
|
|
1651
1786
|
class: "hidden-avatar-input",
|
|
1652
|
-
onChange:
|
|
1787
|
+
onChange: ct
|
|
1653
1788
|
}, null, 544)
|
|
1654
1789
|
]),
|
|
1655
1790
|
e("div", Ua, [
|
|
1656
|
-
e("div", $a,
|
|
1657
|
-
e("div",
|
|
1791
|
+
e("div", $a, y(c(H).nickname || c($)), 1),
|
|
1792
|
+
e("div", Sa, "@" + y(c($)), 1)
|
|
1658
1793
|
])
|
|
1659
1794
|
]),
|
|
1660
|
-
e("div",
|
|
1795
|
+
e("div", za, [
|
|
1661
1796
|
e("div", Aa, [
|
|
1662
|
-
e("div",
|
|
1663
|
-
|
|
1664
|
-
default:
|
|
1665
|
-
|
|
1797
|
+
e("div", Va, [
|
|
1798
|
+
m(u, null, {
|
|
1799
|
+
default: k(() => [
|
|
1800
|
+
m(c(Qe))
|
|
1666
1801
|
]),
|
|
1667
1802
|
_: 1
|
|
1668
1803
|
}),
|
|
1669
|
-
r[23] || (r[23] =
|
|
1804
|
+
r[23] || (r[23] = ue(" 个人信息 ", -1))
|
|
1670
1805
|
]),
|
|
1671
|
-
|
|
1806
|
+
oe.value ? S("", !0) : (a(), G(T, {
|
|
1672
1807
|
key: 0,
|
|
1673
1808
|
type: "primary",
|
|
1674
1809
|
size: "small",
|
|
1675
|
-
onClick:
|
|
1810
|
+
onClick: ut,
|
|
1676
1811
|
class: "chat-settings-edit-btn"
|
|
1677
1812
|
}, {
|
|
1678
|
-
default:
|
|
1679
|
-
|
|
1813
|
+
default: k(() => [...r[24] || (r[24] = [
|
|
1814
|
+
ue(" 编辑 ", -1)
|
|
1680
1815
|
])]),
|
|
1681
1816
|
_: 1
|
|
1682
1817
|
}))
|
|
@@ -1684,148 +1819,148 @@ const ht = (w, t) => {
|
|
|
1684
1819
|
e("div", Fa, [
|
|
1685
1820
|
e("div", Ia, [
|
|
1686
1821
|
r[25] || (r[25] = e("label", { class: "chat-settings-form-label" }, "昵称", -1)),
|
|
1687
|
-
|
|
1822
|
+
oe.value ? (a(), G(s, {
|
|
1688
1823
|
key: 0,
|
|
1689
|
-
modelValue:
|
|
1690
|
-
"onUpdate:modelValue": r[7] || (r[7] = (o) =>
|
|
1824
|
+
modelValue: K.value.nickname,
|
|
1825
|
+
"onUpdate:modelValue": r[7] || (r[7] = (o) => K.value.nickname = o),
|
|
1691
1826
|
placeholder: "请输入昵称",
|
|
1692
1827
|
size: "large"
|
|
1693
|
-
}, null, 8, ["modelValue"])) : (
|
|
1828
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", Ra, y(c(H).nickname || "未设置"), 1))
|
|
1694
1829
|
]),
|
|
1695
|
-
e("div",
|
|
1830
|
+
e("div", Ma, [
|
|
1696
1831
|
r[26] || (r[26] = e("label", { class: "chat-settings-form-label" }, "邮箱", -1)),
|
|
1697
|
-
|
|
1832
|
+
oe.value ? (a(), G(s, {
|
|
1698
1833
|
key: 0,
|
|
1699
|
-
modelValue:
|
|
1700
|
-
"onUpdate:modelValue": r[8] || (r[8] = (o) =>
|
|
1834
|
+
modelValue: K.value.email,
|
|
1835
|
+
"onUpdate:modelValue": r[8] || (r[8] = (o) => K.value.email = o),
|
|
1701
1836
|
placeholder: "请输入邮箱",
|
|
1702
1837
|
size: "large"
|
|
1703
|
-
}, null, 8, ["modelValue"])) : (
|
|
1838
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", La, y(c(H).email || "未设置"), 1))
|
|
1704
1839
|
]),
|
|
1705
1840
|
e("div", Ta, [
|
|
1706
1841
|
r[27] || (r[27] = e("label", { class: "chat-settings-form-label" }, "手机号", -1)),
|
|
1707
|
-
|
|
1842
|
+
oe.value ? (a(), G(s, {
|
|
1708
1843
|
key: 0,
|
|
1709
|
-
modelValue:
|
|
1710
|
-
"onUpdate:modelValue": r[9] || (r[9] = (o) =>
|
|
1844
|
+
modelValue: K.value.phone,
|
|
1845
|
+
"onUpdate:modelValue": r[9] || (r[9] = (o) => K.value.phone = o),
|
|
1711
1846
|
placeholder: "请输入手机号",
|
|
1712
1847
|
size: "large"
|
|
1713
|
-
}, null, 8, ["modelValue"])) : (
|
|
1848
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", Ea, y(c(H).phone || "未设置"), 1))
|
|
1714
1849
|
]),
|
|
1715
1850
|
e("div", Da, [
|
|
1716
1851
|
r[28] || (r[28] = e("label", { class: "chat-settings-form-label" }, "个人简介", -1)),
|
|
1717
|
-
|
|
1852
|
+
oe.value ? (a(), G(s, {
|
|
1718
1853
|
key: 0,
|
|
1719
|
-
modelValue:
|
|
1720
|
-
"onUpdate:modelValue": r[10] || (r[10] = (o) =>
|
|
1854
|
+
modelValue: K.value.bio,
|
|
1855
|
+
"onUpdate:modelValue": r[10] || (r[10] = (o) => K.value.bio = o),
|
|
1721
1856
|
type: "textarea",
|
|
1722
1857
|
rows: 4,
|
|
1723
1858
|
placeholder: "介绍一下自己吧...",
|
|
1724
1859
|
size: "large"
|
|
1725
|
-
}, null, 8, ["modelValue"])) : (
|
|
1860
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", Wa, y(c(H).bio || "这个人很懒,什么都没写~"), 1))
|
|
1726
1861
|
]),
|
|
1727
|
-
|
|
1728
|
-
|
|
1862
|
+
oe.value ? (a(), p("div", Ha, [
|
|
1863
|
+
m(T, {
|
|
1729
1864
|
size: "default",
|
|
1730
|
-
onClick:
|
|
1865
|
+
onClick: vt
|
|
1731
1866
|
}, {
|
|
1732
|
-
default:
|
|
1733
|
-
|
|
1867
|
+
default: k(() => [...r[29] || (r[29] = [
|
|
1868
|
+
ue("取消", -1)
|
|
1734
1869
|
])]),
|
|
1735
1870
|
_: 1
|
|
1736
1871
|
}),
|
|
1737
|
-
|
|
1872
|
+
m(T, {
|
|
1738
1873
|
type: "primary",
|
|
1739
1874
|
size: "default",
|
|
1740
|
-
loading:
|
|
1741
|
-
onClick:
|
|
1875
|
+
loading: re.value,
|
|
1876
|
+
onClick: pt
|
|
1742
1877
|
}, {
|
|
1743
|
-
default:
|
|
1744
|
-
|
|
1878
|
+
default: k(() => [...r[30] || (r[30] = [
|
|
1879
|
+
ue("保存更改", -1)
|
|
1745
1880
|
])]),
|
|
1746
1881
|
_: 1
|
|
1747
1882
|
}, 8, ["loading"])
|
|
1748
|
-
])) :
|
|
1883
|
+
])) : S("", !0)
|
|
1749
1884
|
])
|
|
1750
1885
|
])
|
|
1751
1886
|
])
|
|
1752
1887
|
]),
|
|
1753
1888
|
_: 1
|
|
1754
1889
|
}, 8, ["modelValue"]),
|
|
1755
|
-
|
|
1756
|
-
modelValue:
|
|
1757
|
-
"onUpdate:modelValue": r[12] || (r[12] = (o) =>
|
|
1758
|
-
src:
|
|
1759
|
-
onConfirm:
|
|
1890
|
+
m(yt, {
|
|
1891
|
+
modelValue: i.value,
|
|
1892
|
+
"onUpdate:modelValue": r[12] || (r[12] = (o) => i.value = o),
|
|
1893
|
+
src: F.value,
|
|
1894
|
+
onConfirm: dt
|
|
1760
1895
|
}, null, 8, ["modelValue", "src"]),
|
|
1761
|
-
|
|
1896
|
+
O.value.visible ? (a(), p("div", {
|
|
1762
1897
|
key: 1,
|
|
1763
1898
|
class: "chat-context-menu",
|
|
1764
|
-
style:
|
|
1899
|
+
style: Xe({ left: O.value.x + "px", top: O.value.y + "px" })
|
|
1765
1900
|
}, [
|
|
1766
1901
|
e("div", {
|
|
1767
1902
|
class: "chat-context-menu-item",
|
|
1768
|
-
onClick:
|
|
1903
|
+
onClick: et
|
|
1769
1904
|
}, "删除聊天")
|
|
1770
|
-
], 4)) :
|
|
1905
|
+
], 4)) : S("", !0)
|
|
1771
1906
|
]);
|
|
1772
1907
|
};
|
|
1773
1908
|
}
|
|
1774
|
-
},
|
|
1909
|
+
}, Ya = /* @__PURE__ */ gt(Xa, [["__scopeId", "data-v-f5908195"]]), qa = { class: "chat-container" }, Ba = { class: "sidebar-nav" }, Ka = ["src"], Na = ["onClick"], Pa = {
|
|
1775
1910
|
key: 0,
|
|
1776
1911
|
class: "nav-badge"
|
|
1777
|
-
}, ja = { class: "content-panel" },
|
|
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 = {
|
|
1778
1913
|
key: 0,
|
|
1779
1914
|
class: "online-indicator"
|
|
1780
|
-
},
|
|
1915
|
+
}, sn = { class: "friend-info" }, an = { class: "friend-header" }, nn = { class: "friend-name" }, ln = { class: "last-time" }, on = { class: "friend-preview" }, rn = { class: "last-msg" }, cn = {
|
|
1781
1916
|
key: 0,
|
|
1782
1917
|
class: "unread-badge"
|
|
1783
|
-
},
|
|
1918
|
+
}, dn = { key: 1 }, un = { class: "add-friend-section" }, vn = { class: "add-friend-icon" }, pn = ["onClick"], mn = { class: "friend-avatar-wrapper" }, fn = ["src", "alt"], hn = { class: "friend-info" }, gn = { class: "friend-name" }, yn = { key: 2 }, _n = { class: "request-info" }, bn = ["src", "alt"], kn = { class: "request-details" }, wn = { class: "request-username" }, Cn = { class: "chat-area" }, xn = {
|
|
1784
1919
|
key: 0,
|
|
1785
1920
|
class: "friend-profile"
|
|
1786
|
-
}, Un = ["src", "alt"], $n = { class: "profile-name" },
|
|
1921
|
+
}, Un = ["src", "alt"], $n = { class: "profile-name" }, Sn = { class: "profile-status" }, zn = {
|
|
1787
1922
|
key: 1,
|
|
1788
1923
|
class: "chat-window"
|
|
1789
|
-
}, An = { class: "chat-header" },
|
|
1924
|
+
}, An = { class: "chat-header" }, Vn = { class: "chat-title" }, Fn = { class: "chat-name" }, In = { class: "chat-actions" }, Rn = { class: "message-avatar" }, Mn = ["src"], Ln = {
|
|
1790
1925
|
key: 0,
|
|
1791
1926
|
class: "sender-name"
|
|
1792
|
-
}, Tn = { class: "message-bubble-wrapper" },
|
|
1927
|
+
}, Tn = { class: "message-bubble-wrapper" }, En = ["onClick"], Dn = ["src", "alt"], Wn = {
|
|
1793
1928
|
key: 0,
|
|
1794
1929
|
class: "image-size"
|
|
1795
|
-
},
|
|
1930
|
+
}, Hn = ["onClick"], Xn = { class: "file-content" }, Yn = { class: "file-icon" }, qn = { class: "file-info" }, Bn = { class: "file-name" }, Kn = { class: "file-meta" }, Nn = { key: 0 }, Pn = { class: "input-area" }, jn = {
|
|
1796
1931
|
key: 0,
|
|
1797
1932
|
class: "pending-files"
|
|
1798
|
-
},
|
|
1933
|
+
}, On = {
|
|
1799
1934
|
key: 0,
|
|
1800
1935
|
class: "pending-image-wrapper"
|
|
1801
|
-
},
|
|
1936
|
+
}, Gn = ["src", "alt"], Jn = ["onClick"], Qn = {
|
|
1802
1937
|
key: 1,
|
|
1803
1938
|
class: "pending-file-wrapper"
|
|
1804
|
-
},
|
|
1939
|
+
}, Zn = { class: "pending-file-name" }, ei = ["onClick"], ti = {
|
|
1805
1940
|
key: 1,
|
|
1806
1941
|
class: "input-actions"
|
|
1807
|
-
},
|
|
1942
|
+
}, si = { class: "input-wrapper" }, ai = ["onKeydown"], ni = { class: "send-btn-wrapper" }, ii = {
|
|
1808
1943
|
key: 2,
|
|
1809
1944
|
class: "empty-state"
|
|
1810
|
-
},
|
|
1945
|
+
}, li = { class: "empty-text" }, oi = {
|
|
1811
1946
|
key: 0,
|
|
1812
1947
|
class: "detail-panel"
|
|
1813
|
-
},
|
|
1948
|
+
}, ri = { class: "detail-content" }, ci = { class: "detail-profile" }, di = ["src", "alt"], ui = { class: "detail-name" }, vi = { class: "search-users-wrapper" }, pi = { class: "search-users-input" }, mi = { class: "users-list-scroll" }, fi = { class: "available-user-info" }, hi = ["src", "alt"], gi = { class: "available-user-name" }, yi = { class: "settings-container" }, _i = { class: "settings-avatar-section" }, bi = { class: "settings-avatar-wrapper" }, ki = ["src"], wi = { class: "settings-user-display" }, Ci = { class: "settings-nickname" }, xi = { class: "settings-username" }, Ui = { class: "settings-form-section" }, $i = { class: "settings-form-header" }, Si = { class: "settings-form-title" }, zi = { class: "settings-form" }, Ai = { class: "settings-form-item" }, Vi = {
|
|
1814
1949
|
key: 1,
|
|
1815
1950
|
class: "settings-form-value"
|
|
1816
|
-
},
|
|
1951
|
+
}, Fi = { class: "settings-form-item" }, Ii = {
|
|
1817
1952
|
key: 1,
|
|
1818
1953
|
class: "settings-form-value"
|
|
1819
|
-
},
|
|
1954
|
+
}, Ri = { class: "settings-form-item" }, Mi = {
|
|
1820
1955
|
key: 1,
|
|
1821
1956
|
class: "settings-form-value"
|
|
1822
|
-
},
|
|
1957
|
+
}, Li = { class: "settings-form-item" }, Ti = {
|
|
1823
1958
|
key: 1,
|
|
1824
1959
|
class: "settings-form-value bio-value"
|
|
1825
|
-
},
|
|
1960
|
+
}, Ei = {
|
|
1826
1961
|
key: 0,
|
|
1827
1962
|
class: "settings-form-actions"
|
|
1828
|
-
},
|
|
1963
|
+
}, Di = {
|
|
1829
1964
|
__name: "ChatWindow",
|
|
1830
1965
|
props: {
|
|
1831
1966
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -1833,317 +1968,317 @@ const ht = (w, t) => {
|
|
|
1833
1968
|
width: { type: [String, Number], default: "1100px" }
|
|
1834
1969
|
},
|
|
1835
1970
|
emits: ["update:modelValue", "open", "close", "message", "send", "error"],
|
|
1836
|
-
setup(
|
|
1837
|
-
const
|
|
1838
|
-
get: () =>
|
|
1839
|
-
set: (u) =>
|
|
1971
|
+
setup(x, { emit: t }) {
|
|
1972
|
+
const n = x, v = t, $ = we({
|
|
1973
|
+
get: () => n.modelValue,
|
|
1974
|
+
set: (u) => v("update:modelValue", u)
|
|
1840
1975
|
}), {
|
|
1841
|
-
myUsername:
|
|
1842
|
-
myAvatar:
|
|
1843
|
-
userInfo:
|
|
1844
|
-
loadingUserInfo:
|
|
1845
|
-
friendList:
|
|
1846
|
-
filteredFriendList:
|
|
1847
|
-
searchText:
|
|
1848
|
-
inputText:
|
|
1849
|
-
messagesContainer:
|
|
1850
|
-
filteredUsers:
|
|
1851
|
-
filteredAvailableUsers:
|
|
1852
|
-
currentUser:
|
|
1853
|
-
currentMessages:
|
|
1854
|
-
addFriendDialogVisible:
|
|
1855
|
-
addFriendSearchText:
|
|
1856
|
-
availableUsers:
|
|
1857
|
-
loadingAvailableUsers:
|
|
1858
|
-
friendApplyList:
|
|
1859
|
-
loadingFriendApply:
|
|
1860
|
-
formatTime:
|
|
1861
|
-
formatLastTime:
|
|
1862
|
-
scrollToBottom:
|
|
1863
|
-
getFriendList:
|
|
1864
|
-
getChatHistory:
|
|
1865
|
-
setFriendToChatStatus:
|
|
1866
|
-
selectUser:
|
|
1867
|
-
sendMessage:
|
|
1868
|
-
sendFile:
|
|
1869
|
-
sendFilesAndText:
|
|
1870
|
-
initWebSocket:
|
|
1871
|
-
closeWebSocket:
|
|
1872
|
-
reset:
|
|
1873
|
-
openAddFriendDialog:
|
|
1874
|
-
addFriend:
|
|
1875
|
-
loadFriendApplyList:
|
|
1876
|
-
agreeFriend:
|
|
1877
|
-
updateMyAvatar:
|
|
1878
|
-
getUserInfo:
|
|
1879
|
-
updateUserInfo:
|
|
1880
|
-
} =
|
|
1976
|
+
myUsername: ee,
|
|
1977
|
+
myAvatar: H,
|
|
1978
|
+
userInfo: Z,
|
|
1979
|
+
loadingUserInfo: X,
|
|
1980
|
+
friendList: ve,
|
|
1981
|
+
filteredFriendList: V,
|
|
1982
|
+
searchText: U,
|
|
1983
|
+
inputText: A,
|
|
1984
|
+
messagesContainer: f,
|
|
1985
|
+
filteredUsers: de,
|
|
1986
|
+
filteredAvailableUsers: Ae,
|
|
1987
|
+
currentUser: he,
|
|
1988
|
+
currentMessages: C,
|
|
1989
|
+
addFriendDialogVisible: ge,
|
|
1990
|
+
addFriendSearchText: Ce,
|
|
1991
|
+
availableUsers: Ve,
|
|
1992
|
+
loadingAvailableUsers: xe,
|
|
1993
|
+
friendApplyList: Se,
|
|
1994
|
+
loadingFriendApply: Fe,
|
|
1995
|
+
formatTime: Re,
|
|
1996
|
+
formatLastTime: De,
|
|
1997
|
+
scrollToBottom: We,
|
|
1998
|
+
getFriendList: Me,
|
|
1999
|
+
getChatHistory: w,
|
|
2000
|
+
setFriendToChatStatus: z,
|
|
2001
|
+
selectUser: Y,
|
|
2002
|
+
sendMessage: I,
|
|
2003
|
+
sendFile: R,
|
|
2004
|
+
sendFilesAndText: M,
|
|
2005
|
+
initWebSocket: E,
|
|
2006
|
+
closeWebSocket: N,
|
|
2007
|
+
reset: P,
|
|
2008
|
+
openAddFriendDialog: L,
|
|
2009
|
+
addFriend: q,
|
|
2010
|
+
loadFriendApplyList: te,
|
|
2011
|
+
agreeFriend: se,
|
|
2012
|
+
updateMyAvatar: le,
|
|
2013
|
+
getUserInfo: pe,
|
|
2014
|
+
updateUserInfo: B
|
|
2015
|
+
} = Lt(n.config), ae = we(() => {
|
|
1881
2016
|
var s;
|
|
1882
|
-
const u = [{ id: "chat", icon:
|
|
1883
|
-
return
|
|
1884
|
-
}),
|
|
1885
|
-
|
|
1886
|
-
},
|
|
1887
|
-
if (!
|
|
1888
|
-
await
|
|
1889
|
-
},
|
|
1890
|
-
|
|
2017
|
+
const u = [{ id: "chat", icon: Ye, badge: 0 }];
|
|
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), oe = _(!1), K = _(!1), re = _({ 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
|
+
Ue.value.visible = !1;
|
|
2021
|
+
}, et = async () => {
|
|
2022
|
+
if (!Ue.value.chat) return;
|
|
2023
|
+
await z(Ue.value.chat.id, 0) && D.value === Ue.value.chat.id && (D.value = null, W.value = null), Le();
|
|
2024
|
+
}, Te = (u) => {
|
|
2025
|
+
D.value = u.id, W.value = u, ie.value = null, oe.value = !1, Y({
|
|
1891
2026
|
id: u.id,
|
|
1892
2027
|
name: u.name,
|
|
1893
2028
|
avatar: u.avatar,
|
|
1894
2029
|
online: u.online
|
|
1895
2030
|
});
|
|
1896
|
-
},
|
|
1897
|
-
|
|
1898
|
-
},
|
|
1899
|
-
if (!
|
|
1900
|
-
if (await
|
|
1901
|
-
|
|
1902
|
-
const s =
|
|
1903
|
-
s &&
|
|
2031
|
+
}, tt = (u) => {
|
|
2032
|
+
ie.value = u, D.value = null, W.value = null;
|
|
2033
|
+
}, st = async () => {
|
|
2034
|
+
if (!ie.value) return;
|
|
2035
|
+
if (await z(ie.value.id)) {
|
|
2036
|
+
ne.value = "chat", await Oe();
|
|
2037
|
+
const s = de.value.find((b) => b.id === ie.value.id);
|
|
2038
|
+
s && Te(s), ie.value = null;
|
|
1904
2039
|
}
|
|
1905
|
-
}, st = () => {
|
|
1906
|
-
l.value = !0;
|
|
1907
2040
|
}, at = () => {
|
|
1908
|
-
|
|
1909
|
-
(u = V.value) == null || u.click();
|
|
2041
|
+
i.value = !0;
|
|
1910
2042
|
}, nt = () => {
|
|
1911
2043
|
var u;
|
|
1912
|
-
(u =
|
|
2044
|
+
(u = F.value) == null || u.click();
|
|
2045
|
+
}, it = () => {
|
|
2046
|
+
var u;
|
|
2047
|
+
(u = j.value) == null || u.click();
|
|
1913
2048
|
}, lt = (u) => {
|
|
1914
2049
|
const s = Array.from(u.target.files || []);
|
|
1915
2050
|
if (s.length !== 0) {
|
|
1916
|
-
for (const
|
|
1917
|
-
if (
|
|
1918
|
-
|
|
2051
|
+
for (const b of s) {
|
|
2052
|
+
if (b.size > 50 * 1024 * 1024) {
|
|
2053
|
+
Q.warning(`文件 ${b.name} 超过50MB,已跳过`);
|
|
1919
2054
|
continue;
|
|
1920
2055
|
}
|
|
1921
|
-
const
|
|
1922
|
-
|
|
2056
|
+
const T = URL.createObjectURL(b);
|
|
2057
|
+
O.value.push({
|
|
1923
2058
|
id: Date.now() + Math.random(),
|
|
1924
|
-
file:
|
|
1925
|
-
name:
|
|
1926
|
-
size:
|
|
1927
|
-
type:
|
|
1928
|
-
previewUrl:
|
|
1929
|
-
isImage:
|
|
2059
|
+
file: b,
|
|
2060
|
+
name: b.name,
|
|
2061
|
+
size: b.size,
|
|
2062
|
+
type: b.type,
|
|
2063
|
+
previewUrl: T,
|
|
2064
|
+
isImage: b.type.startsWith("image/")
|
|
1930
2065
|
});
|
|
1931
2066
|
}
|
|
1932
|
-
|
|
2067
|
+
j.value && (j.value.value = "");
|
|
1933
2068
|
}
|
|
2069
|
+
}, Ke = (u) => {
|
|
2070
|
+
const s = O.value[u];
|
|
2071
|
+
s.previewUrl && URL.revokeObjectURL(s.previewUrl), O.value.splice(u, 1);
|
|
1934
2072
|
}, Ne = (u) => {
|
|
1935
|
-
const s = q.value[u];
|
|
1936
|
-
s.previewUrl && URL.revokeObjectURL(s.previewUrl), q.value.splice(u, 1);
|
|
1937
|
-
}, Pe = (u) => {
|
|
1938
2073
|
if (u === 0) return "0 B";
|
|
1939
|
-
const s = 1024,
|
|
1940
|
-
return parseFloat((u / Math.pow(s,
|
|
1941
|
-
},
|
|
1942
|
-
if (!
|
|
1943
|
-
const u = [...
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
}),
|
|
1947
|
-
},
|
|
1948
|
-
var
|
|
1949
|
-
const s = (
|
|
2074
|
+
const s = 1024, b = ["B", "KB", "MB", "GB"], T = Math.floor(Math.log(u) / Math.log(s));
|
|
2075
|
+
return parseFloat((u / Math.pow(s, T)).toFixed(2)) + " " + b[T];
|
|
2076
|
+
}, Pe = async () => {
|
|
2077
|
+
if (!A.value.trim() && O.value.length === 0) return;
|
|
2078
|
+
const u = [...O.value], s = A.value;
|
|
2079
|
+
A.value = "", O.value.forEach((b) => {
|
|
2080
|
+
b.previewUrl && URL.revokeObjectURL(b.previewUrl);
|
|
2081
|
+
}), O.value = [], await M(u, s), v("send", { text: s, files: u });
|
|
2082
|
+
}, ot = (u) => {
|
|
2083
|
+
var b;
|
|
2084
|
+
const s = (b = u.clipboardData) == null ? void 0 : b.items;
|
|
1950
2085
|
if (s) {
|
|
1951
|
-
for (const
|
|
1952
|
-
if (
|
|
1953
|
-
const
|
|
1954
|
-
if (
|
|
1955
|
-
if (
|
|
1956
|
-
|
|
2086
|
+
for (const T of s)
|
|
2087
|
+
if (T.kind === "file") {
|
|
2088
|
+
const ce = T.getAsFile();
|
|
2089
|
+
if (ce) {
|
|
2090
|
+
if (ce.size > 50 * 1024 * 1024) {
|
|
2091
|
+
Q.warning(`文件 ${ce.name} 超过50MB,已跳过`);
|
|
1957
2092
|
continue;
|
|
1958
2093
|
}
|
|
1959
|
-
const
|
|
1960
|
-
|
|
2094
|
+
const ke = URL.createObjectURL(ce);
|
|
2095
|
+
O.value.push({
|
|
1961
2096
|
id: Date.now() + Math.random(),
|
|
1962
|
-
file:
|
|
1963
|
-
name:
|
|
1964
|
-
size:
|
|
1965
|
-
type:
|
|
1966
|
-
previewUrl:
|
|
1967
|
-
isImage:
|
|
2097
|
+
file: ce,
|
|
2098
|
+
name: ce.name,
|
|
2099
|
+
size: ce.size,
|
|
2100
|
+
type: ce.type,
|
|
2101
|
+
previewUrl: ke,
|
|
2102
|
+
isImage: ce.type.startsWith("image/")
|
|
1968
2103
|
});
|
|
1969
2104
|
}
|
|
1970
2105
|
}
|
|
1971
2106
|
}
|
|
1972
|
-
},
|
|
2107
|
+
}, je = (u) => {
|
|
1973
2108
|
if (!u) {
|
|
1974
|
-
|
|
2109
|
+
Q.warning("文件地址无效");
|
|
1975
2110
|
return;
|
|
1976
2111
|
}
|
|
1977
2112
|
window.open(u, "_blank");
|
|
1978
|
-
}, ot = (u) => {
|
|
1979
|
-
console.warn("图片加载失败", u);
|
|
1980
2113
|
}, rt = (u) => {
|
|
2114
|
+
console.warn("图片加载失败", u);
|
|
2115
|
+
}, ct = (u) => {
|
|
1981
2116
|
const s = u.target.files[0];
|
|
1982
2117
|
if (!s) return;
|
|
1983
2118
|
if (!s.type.startsWith("image/")) {
|
|
1984
|
-
|
|
2119
|
+
Q.error("只能上传图片文件");
|
|
1985
2120
|
return;
|
|
1986
2121
|
}
|
|
1987
2122
|
if (s.size > 5 * 1024 * 1024) {
|
|
1988
|
-
|
|
2123
|
+
Q.error("图片大小不能超过 5MB");
|
|
1989
2124
|
return;
|
|
1990
2125
|
}
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
},
|
|
1995
|
-
},
|
|
2126
|
+
const b = new FileReader();
|
|
2127
|
+
b.onload = (T) => {
|
|
2128
|
+
_e.value = T.target.result, d.value = !0;
|
|
2129
|
+
}, b.readAsDataURL(s);
|
|
2130
|
+
}, dt = async ({ file: u }) => {
|
|
1996
2131
|
if (u) {
|
|
1997
2132
|
g.value = !0;
|
|
1998
2133
|
try {
|
|
1999
|
-
const { ChatApi: s } = await Promise.resolve().then(() =>
|
|
2000
|
-
|
|
2134
|
+
const { ChatApi: s } = await Promise.resolve().then(() => Mt), T = await new s(n.config).uploadAvatar(u, ee);
|
|
2135
|
+
T.code === 200 ? (Q.success("头像上传成功"), le(T.data), Ge()) : Q.error(T.msg || "头像上传失败");
|
|
2001
2136
|
} catch (s) {
|
|
2002
|
-
console.error(s),
|
|
2137
|
+
console.error(s), Q.error("头像上传失败");
|
|
2003
2138
|
} finally {
|
|
2004
2139
|
g.value = !1;
|
|
2005
2140
|
}
|
|
2006
2141
|
}
|
|
2007
|
-
},
|
|
2008
|
-
|
|
2009
|
-
}, dt = () => {
|
|
2010
|
-
X.value = {
|
|
2011
|
-
nickname: T.value.nickname || "",
|
|
2012
|
-
email: T.value.email || "",
|
|
2013
|
-
phone: T.value.phone || "",
|
|
2014
|
-
bio: T.value.bio || ""
|
|
2015
|
-
}, D.value = !0;
|
|
2142
|
+
}, Ge = () => {
|
|
2143
|
+
_e.value = "", d.value = !1, F.value && (F.value.value = "");
|
|
2016
2144
|
}, ut = () => {
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2145
|
+
re.value = {
|
|
2146
|
+
nickname: Z.value.nickname || "",
|
|
2147
|
+
email: Z.value.email || "",
|
|
2148
|
+
phone: Z.value.phone || "",
|
|
2149
|
+
bio: Z.value.bio || ""
|
|
2150
|
+
}, K.value = !0;
|
|
2151
|
+
}, vt = () => {
|
|
2152
|
+
K.value = !1, re.value = { nickname: "", email: "", phone: "", bio: "" };
|
|
2153
|
+
}, pt = async () => {
|
|
2154
|
+
ze.value = !0;
|
|
2020
2155
|
try {
|
|
2021
|
-
await
|
|
2156
|
+
await B(re.value) ? (Q.success("保存成功"), K.value = !1) : Q.error("保存失败");
|
|
2022
2157
|
} catch (u) {
|
|
2023
|
-
console.error(u),
|
|
2158
|
+
console.error(u), Q.error("保存失败");
|
|
2024
2159
|
} finally {
|
|
2025
|
-
|
|
2160
|
+
ze.value = !1;
|
|
2026
2161
|
}
|
|
2027
|
-
},
|
|
2028
|
-
|
|
2162
|
+
}, h = () => {
|
|
2163
|
+
P(), N(), oe.value = !1, i.value = !1, Ge(), K.value = !1, v("close");
|
|
2029
2164
|
}, r = async () => {
|
|
2030
|
-
await Promise.all([
|
|
2165
|
+
await Promise.all([Me(), te(), pe()]), E(), de.value.length > 0 && Te(de.value[0]), v("open");
|
|
2031
2166
|
};
|
|
2032
2167
|
return _t(() => {
|
|
2033
|
-
document.addEventListener("click",
|
|
2034
|
-
}),
|
|
2035
|
-
document.removeEventListener("click",
|
|
2168
|
+
document.addEventListener("click", Le);
|
|
2169
|
+
}), bt(() => {
|
|
2170
|
+
document.removeEventListener("click", Le), N();
|
|
2036
2171
|
}), (u, s) => {
|
|
2037
|
-
const
|
|
2038
|
-
return
|
|
2039
|
-
modelValue:
|
|
2040
|
-
"onUpdate:modelValue": s[13] || (s[13] = (
|
|
2041
|
-
width:
|
|
2172
|
+
const b = be("el-icon"), T = be("el-input"), ce = be("el-empty"), ke = be("el-button"), He = be("el-dialog");
|
|
2173
|
+
return a(), G(He, {
|
|
2174
|
+
modelValue: $.value,
|
|
2175
|
+
"onUpdate:modelValue": s[13] || (s[13] = (Ee) => $.value = Ee),
|
|
2176
|
+
width: x.width,
|
|
2042
2177
|
"close-on-click-modal": !1,
|
|
2043
2178
|
class: "chat-dialog",
|
|
2044
2179
|
"append-to-body": "",
|
|
2045
|
-
onClosed:
|
|
2180
|
+
onClosed: h,
|
|
2046
2181
|
onOpen: r
|
|
2047
2182
|
}, {
|
|
2048
|
-
default:
|
|
2049
|
-
var
|
|
2183
|
+
default: k(() => {
|
|
2184
|
+
var Ee, o, ye;
|
|
2050
2185
|
return [
|
|
2051
|
-
e("div",
|
|
2052
|
-
e("div",
|
|
2186
|
+
e("div", qa, [
|
|
2187
|
+
e("div", Ba, [
|
|
2053
2188
|
e("div", {
|
|
2054
2189
|
class: "sidebar-avatar",
|
|
2055
|
-
onClick:
|
|
2190
|
+
onClick: at
|
|
2056
2191
|
}, [
|
|
2057
2192
|
e("img", {
|
|
2058
|
-
src: c(
|
|
2193
|
+
src: c(H),
|
|
2059
2194
|
alt: "头像",
|
|
2060
2195
|
class: "avatar-img"
|
|
2061
|
-
}, null, 8,
|
|
2196
|
+
}, null, 8, Ka)
|
|
2062
2197
|
]),
|
|
2063
|
-
(
|
|
2064
|
-
key:
|
|
2065
|
-
class:
|
|
2198
|
+
(a(!0), p(me, null, fe(ae.value, (l) => (a(), p("div", {
|
|
2199
|
+
key: l.id,
|
|
2200
|
+
class: J([
|
|
2066
2201
|
"nav-item",
|
|
2067
|
-
|
|
2202
|
+
ne.value === l.id ? "nav-item-active" : "nav-item-inactive"
|
|
2068
2203
|
]),
|
|
2069
|
-
onClick: (
|
|
2204
|
+
onClick: ($e) => ne.value = l.id
|
|
2070
2205
|
}, [
|
|
2071
|
-
|
|
2072
|
-
default:
|
|
2073
|
-
(
|
|
2206
|
+
m(b, { size: 24 }, {
|
|
2207
|
+
default: k(() => [
|
|
2208
|
+
(a(), G(kt(l.icon)))
|
|
2074
2209
|
]),
|
|
2075
2210
|
_: 2
|
|
2076
2211
|
}, 1024),
|
|
2077
|
-
|
|
2078
|
-
], 10,
|
|
2212
|
+
l.badge ? (a(), p("span", Pa, y(l.badge > 99 ? "99+" : l.badge), 1)) : S("", !0)
|
|
2213
|
+
], 10, Na))), 128)),
|
|
2079
2214
|
s[14] || (s[14] = e("div", { class: "nav-spacer" }, null, -1)),
|
|
2080
|
-
|
|
2215
|
+
x.config.modules.settings ? (a(), p("div", {
|
|
2081
2216
|
key: 0,
|
|
2082
2217
|
class: "nav-item nav-item-inactive",
|
|
2083
|
-
onClick: s[0] || (s[0] = (
|
|
2218
|
+
onClick: s[0] || (s[0] = (l) => i.value = !0),
|
|
2084
2219
|
title: "设置"
|
|
2085
2220
|
}, [
|
|
2086
|
-
|
|
2087
|
-
default:
|
|
2088
|
-
|
|
2221
|
+
m(b, { size: 24 }, {
|
|
2222
|
+
default: k(() => [
|
|
2223
|
+
m(c($t))
|
|
2089
2224
|
]),
|
|
2090
2225
|
_: 1
|
|
2091
2226
|
})
|
|
2092
|
-
])) :
|
|
2227
|
+
])) : S("", !0)
|
|
2093
2228
|
]),
|
|
2094
2229
|
e("div", ja, [
|
|
2095
|
-
e("div",
|
|
2096
|
-
|
|
2097
|
-
modelValue: c(
|
|
2098
|
-
"onUpdate:modelValue": s[1] || (s[1] = (
|
|
2230
|
+
e("div", Oa, [
|
|
2231
|
+
m(T, {
|
|
2232
|
+
modelValue: c(U),
|
|
2233
|
+
"onUpdate:modelValue": s[1] || (s[1] = (l) => Ie(U) ? U.value = l : null),
|
|
2099
2234
|
placeholder: "搜索",
|
|
2100
|
-
"prefix-icon": c(
|
|
2235
|
+
"prefix-icon": c(qe)
|
|
2101
2236
|
}, null, 8, ["modelValue", "prefix-icon"])
|
|
2102
2237
|
]),
|
|
2103
|
-
e("div",
|
|
2104
|
-
|
|
2105
|
-
(
|
|
2106
|
-
key:
|
|
2107
|
-
class:
|
|
2238
|
+
e("div", Ga, [
|
|
2239
|
+
ne.value === "chat" ? (a(), p("div", Ja, [
|
|
2240
|
+
(a(!0), p(me, null, fe(c(de), (l) => (a(), p("div", {
|
|
2241
|
+
key: l.id,
|
|
2242
|
+
class: J([
|
|
2108
2243
|
"chat-item",
|
|
2109
|
-
|
|
2244
|
+
D.value === l.id ? "chat-item-active" : ""
|
|
2110
2245
|
]),
|
|
2111
|
-
onClick: (
|
|
2112
|
-
onContextmenu:
|
|
2246
|
+
onClick: ($e) => Te(l),
|
|
2247
|
+
onContextmenu: Be(($e) => u.showContextMenu($e, l), ["prevent", "stop"])
|
|
2113
2248
|
}, [
|
|
2114
|
-
e("div",
|
|
2249
|
+
e("div", Za, [
|
|
2115
2250
|
e("img", {
|
|
2116
|
-
src:
|
|
2117
|
-
alt:
|
|
2251
|
+
src: l.avatar,
|
|
2252
|
+
alt: l.name,
|
|
2118
2253
|
class: "friend-avatar"
|
|
2119
|
-
}, null, 8,
|
|
2120
|
-
|
|
2254
|
+
}, null, 8, en),
|
|
2255
|
+
l.online ? (a(), p("span", tn)) : S("", !0)
|
|
2121
2256
|
]),
|
|
2122
|
-
e("div",
|
|
2123
|
-
e("div",
|
|
2124
|
-
e("span",
|
|
2125
|
-
e("span",
|
|
2257
|
+
e("div", sn, [
|
|
2258
|
+
e("div", an, [
|
|
2259
|
+
e("span", nn, y(l.name), 1),
|
|
2260
|
+
e("span", ln, y(c(De)(l.lastTime)), 1)
|
|
2126
2261
|
]),
|
|
2127
|
-
e("div",
|
|
2128
|
-
e("span",
|
|
2129
|
-
|
|
2262
|
+
e("div", on, [
|
|
2263
|
+
e("span", rn, y(l.lastMsg), 1),
|
|
2264
|
+
l.unread > 0 ? (a(), p("span", cn, y(l.unread > 99 ? "99+" : l.unread), 1)) : S("", !0)
|
|
2130
2265
|
])
|
|
2131
2266
|
])
|
|
2132
|
-
], 42,
|
|
2133
|
-
])) :
|
|
2134
|
-
|
|
2135
|
-
e("div",
|
|
2267
|
+
], 42, Qa))), 128))
|
|
2268
|
+
])) : S("", !0),
|
|
2269
|
+
ne.value === "friends" && x.config.modules.friends ? (a(), p("div", dn, [
|
|
2270
|
+
e("div", un, [
|
|
2136
2271
|
e("div", {
|
|
2137
2272
|
class: "add-friend-btn",
|
|
2138
|
-
onClick: s[2] || (s[2] = (...
|
|
2273
|
+
onClick: s[2] || (s[2] = (...l) => c(L) && c(L)(...l))
|
|
2139
2274
|
}, [
|
|
2140
|
-
e("div",
|
|
2141
|
-
|
|
2275
|
+
e("div", vn, [
|
|
2276
|
+
m(b, {
|
|
2142
2277
|
class: "text-white",
|
|
2143
2278
|
size: 20
|
|
2144
2279
|
}, {
|
|
2145
|
-
default:
|
|
2146
|
-
|
|
2280
|
+
default: k(() => [
|
|
2281
|
+
m(c(St))
|
|
2147
2282
|
]),
|
|
2148
2283
|
_: 1
|
|
2149
2284
|
})
|
|
@@ -2151,92 +2286,92 @@ const ht = (w, t) => {
|
|
|
2151
2286
|
s[15] || (s[15] = e("span", { class: "add-friend-text" }, "添加好友", -1))
|
|
2152
2287
|
])
|
|
2153
2288
|
]),
|
|
2154
|
-
(
|
|
2155
|
-
key:
|
|
2289
|
+
(a(!0), p(me, null, fe(c(V), (l) => (a(), p("div", {
|
|
2290
|
+
key: l.id,
|
|
2156
2291
|
class: "chat-item",
|
|
2157
|
-
onClick: (
|
|
2292
|
+
onClick: ($e) => tt(l)
|
|
2158
2293
|
}, [
|
|
2159
|
-
e("div",
|
|
2294
|
+
e("div", mn, [
|
|
2160
2295
|
e("img", {
|
|
2161
|
-
src:
|
|
2162
|
-
alt:
|
|
2296
|
+
src: l.avatar,
|
|
2297
|
+
alt: l.name,
|
|
2163
2298
|
class: "friend-avatar"
|
|
2164
|
-
}, null, 8,
|
|
2299
|
+
}, null, 8, fn),
|
|
2165
2300
|
e("span", {
|
|
2166
|
-
class:
|
|
2301
|
+
class: J([
|
|
2167
2302
|
"online-indicator",
|
|
2168
|
-
|
|
2303
|
+
l.online ? "online" : "offline"
|
|
2169
2304
|
])
|
|
2170
2305
|
}, null, 2)
|
|
2171
2306
|
]),
|
|
2172
|
-
e("div",
|
|
2173
|
-
e("span",
|
|
2307
|
+
e("div", hn, [
|
|
2308
|
+
e("span", gn, y(l.name), 1)
|
|
2174
2309
|
])
|
|
2175
|
-
], 8,
|
|
2176
|
-
])) :
|
|
2177
|
-
|
|
2178
|
-
c(
|
|
2310
|
+
], 8, pn))), 128))
|
|
2311
|
+
])) : S("", !0),
|
|
2312
|
+
ne.value === "apply" && x.config.modules.apply ? (a(), p("div", yn, [
|
|
2313
|
+
c(Fe) ? (a(), G(ce, {
|
|
2179
2314
|
key: 0,
|
|
2180
2315
|
description: "加载中..."
|
|
2181
|
-
})) : c(
|
|
2316
|
+
})) : c(Se).length === 0 ? (a(), G(ce, {
|
|
2182
2317
|
key: 1,
|
|
2183
2318
|
description: "暂无好友申请"
|
|
2184
|
-
})) : (
|
|
2185
|
-
key:
|
|
2319
|
+
})) : (a(!0), p(me, { key: 2 }, fe(c(Se), (l) => (a(), p("div", {
|
|
2320
|
+
key: l.applyUser || l.id,
|
|
2186
2321
|
class: "friend-request-item"
|
|
2187
2322
|
}, [
|
|
2188
2323
|
e("div", _n, [
|
|
2189
2324
|
e("img", {
|
|
2190
|
-
src: `https://api.dicebear.com/7.x/avataaars/svg?seed=${
|
|
2191
|
-
alt:
|
|
2325
|
+
src: `https://api.dicebear.com/7.x/avataaars/svg?seed=${l.applyUser}`,
|
|
2326
|
+
alt: l.applyUser,
|
|
2192
2327
|
class: "request-avatar"
|
|
2193
|
-
}, null, 8,
|
|
2194
|
-
e("div",
|
|
2195
|
-
e("div",
|
|
2328
|
+
}, null, 8, bn),
|
|
2329
|
+
e("div", kn, [
|
|
2330
|
+
e("div", wn, y(l.applyUser), 1),
|
|
2196
2331
|
s[16] || (s[16] = e("div", { class: "request-desc" }, "请求添加你为好友", -1))
|
|
2197
2332
|
])
|
|
2198
2333
|
]),
|
|
2199
|
-
|
|
2334
|
+
m(ke, {
|
|
2200
2335
|
type: "primary",
|
|
2201
2336
|
size: "small",
|
|
2202
|
-
onClick: (
|
|
2337
|
+
onClick: ($e) => c(se)(l.applyUser)
|
|
2203
2338
|
}, {
|
|
2204
|
-
default:
|
|
2205
|
-
|
|
2339
|
+
default: k(() => [...s[17] || (s[17] = [
|
|
2340
|
+
ue("同意", -1)
|
|
2206
2341
|
])]),
|
|
2207
2342
|
_: 1
|
|
2208
2343
|
}, 8, ["onClick"])
|
|
2209
2344
|
]))), 128))
|
|
2210
|
-
])) :
|
|
2345
|
+
])) : S("", !0)
|
|
2211
2346
|
])
|
|
2212
2347
|
]),
|
|
2213
|
-
e("div",
|
|
2214
|
-
|
|
2348
|
+
e("div", Cn, [
|
|
2349
|
+
ie.value && !W.value ? (a(), p("div", xn, [
|
|
2215
2350
|
e("img", {
|
|
2216
|
-
src:
|
|
2217
|
-
alt:
|
|
2351
|
+
src: ie.value.avatar,
|
|
2352
|
+
alt: ie.value.name,
|
|
2218
2353
|
class: "profile-avatar"
|
|
2219
2354
|
}, null, 8, Un),
|
|
2220
|
-
e("div", $n,
|
|
2221
|
-
e("div",
|
|
2355
|
+
e("div", $n, y(ie.value.name), 1),
|
|
2356
|
+
e("div", Sn, [
|
|
2222
2357
|
e("span", {
|
|
2223
|
-
class:
|
|
2358
|
+
class: J([
|
|
2224
2359
|
"status-dot",
|
|
2225
|
-
|
|
2360
|
+
ie.value.online ? "status-online" : "status-offline"
|
|
2226
2361
|
])
|
|
2227
2362
|
}, null, 2),
|
|
2228
|
-
e("span", null,
|
|
2363
|
+
e("span", null, y(ie.value.online ? "在线" : "离线"), 1)
|
|
2229
2364
|
]),
|
|
2230
|
-
|
|
2365
|
+
m(ke, {
|
|
2231
2366
|
type: "primary",
|
|
2232
2367
|
size: "large",
|
|
2233
|
-
onClick:
|
|
2368
|
+
onClick: st,
|
|
2234
2369
|
class: "start-chat-btn"
|
|
2235
2370
|
}, {
|
|
2236
|
-
default:
|
|
2237
|
-
|
|
2238
|
-
default:
|
|
2239
|
-
|
|
2371
|
+
default: k(() => [
|
|
2372
|
+
m(b, null, {
|
|
2373
|
+
default: k(() => [
|
|
2374
|
+
m(c(Ye))
|
|
2240
2375
|
]),
|
|
2241
2376
|
_: 1
|
|
2242
2377
|
}),
|
|
@@ -2244,31 +2379,31 @@ const ht = (w, t) => {
|
|
|
2244
2379
|
]),
|
|
2245
2380
|
_: 1
|
|
2246
2381
|
})
|
|
2247
|
-
])) :
|
|
2248
|
-
|
|
2382
|
+
])) : S("", !0),
|
|
2383
|
+
W.value ? (a(), p("div", zn, [
|
|
2249
2384
|
e("div", An, [
|
|
2250
|
-
e("div",
|
|
2251
|
-
e("span", Fn,
|
|
2385
|
+
e("div", Vn, [
|
|
2386
|
+
e("span", Fn, y(W.value.name), 1),
|
|
2252
2387
|
e("span", {
|
|
2253
|
-
class:
|
|
2388
|
+
class: J([
|
|
2254
2389
|
"status-badge",
|
|
2255
|
-
|
|
2390
|
+
W.value.online ? "status-badge-online" : "status-badge-offline"
|
|
2256
2391
|
])
|
|
2257
|
-
},
|
|
2392
|
+
}, y(W.value.online ? "在线" : "离线"), 3)
|
|
2258
2393
|
]),
|
|
2259
2394
|
e("div", In, [
|
|
2260
|
-
|
|
2261
|
-
default:
|
|
2262
|
-
|
|
2395
|
+
m(b, { class: "action-icon" }, {
|
|
2396
|
+
default: k(() => [
|
|
2397
|
+
m(c(qe))
|
|
2263
2398
|
]),
|
|
2264
2399
|
_: 1
|
|
2265
2400
|
}),
|
|
2266
|
-
|
|
2401
|
+
m(b, {
|
|
2267
2402
|
class: "action-icon",
|
|
2268
|
-
onClick: s[3] || (s[3] = (
|
|
2403
|
+
onClick: s[3] || (s[3] = (l) => oe.value = !oe.value)
|
|
2269
2404
|
}, {
|
|
2270
|
-
default:
|
|
2271
|
-
|
|
2405
|
+
default: k(() => [
|
|
2406
|
+
m(c(zt))
|
|
2272
2407
|
]),
|
|
2273
2408
|
_: 1
|
|
2274
2409
|
})
|
|
@@ -2276,258 +2411,258 @@ const ht = (w, t) => {
|
|
|
2276
2411
|
]),
|
|
2277
2412
|
e("div", {
|
|
2278
2413
|
ref_key: "messagesContainer",
|
|
2279
|
-
ref:
|
|
2414
|
+
ref: f,
|
|
2280
2415
|
class: "messages-container"
|
|
2281
2416
|
}, [
|
|
2282
|
-
(
|
|
2283
|
-
key:
|
|
2284
|
-
class:
|
|
2417
|
+
(a(!0), p(me, null, fe(c(C), (l, $e) => (a(), p("div", {
|
|
2418
|
+
key: $e,
|
|
2419
|
+
class: J([
|
|
2285
2420
|
"message-wrapper",
|
|
2286
|
-
|
|
2421
|
+
l.isSelf ? "message-self" : "message-other"
|
|
2287
2422
|
])
|
|
2288
2423
|
}, [
|
|
2289
|
-
e("div",
|
|
2424
|
+
e("div", Rn, [
|
|
2290
2425
|
e("img", {
|
|
2291
|
-
src:
|
|
2426
|
+
src: l.isSelf ? c(H) : W.value.avatar,
|
|
2292
2427
|
class: "avatar-sm"
|
|
2293
|
-
}, null, 8,
|
|
2428
|
+
}, null, 8, Mn)
|
|
2294
2429
|
]),
|
|
2295
2430
|
e("div", {
|
|
2296
|
-
class:
|
|
2431
|
+
class: J([
|
|
2297
2432
|
"message-content-wrapper",
|
|
2298
|
-
|
|
2433
|
+
l.isSelf ? "content-self" : "content-other"
|
|
2299
2434
|
])
|
|
2300
2435
|
}, [
|
|
2301
|
-
|
|
2436
|
+
l.isSelf ? S("", !0) : (a(), p("div", Ln, y(W.value.name), 1)),
|
|
2302
2437
|
e("div", Tn, [
|
|
2303
|
-
|
|
2438
|
+
l.type === "text" ? (a(), p("div", {
|
|
2304
2439
|
key: 0,
|
|
2305
|
-
class:
|
|
2440
|
+
class: J([
|
|
2306
2441
|
"message-bubble",
|
|
2307
|
-
|
|
2442
|
+
l.isSelf ? "bubble-self" : "bubble-other"
|
|
2308
2443
|
])
|
|
2309
|
-
},
|
|
2444
|
+
}, y(l.text), 3)) : l.type === "file" && l.fileType === "image" ? (a(), p("div", {
|
|
2310
2445
|
key: 1,
|
|
2311
|
-
class:
|
|
2446
|
+
class: J([
|
|
2312
2447
|
"message-bubble",
|
|
2313
2448
|
"image-bubble",
|
|
2314
|
-
|
|
2449
|
+
l.isSelf ? "bubble-self" : "bubble-other"
|
|
2315
2450
|
]),
|
|
2316
|
-
onClick: (
|
|
2451
|
+
onClick: (mt) => je(l.fileUrl)
|
|
2317
2452
|
}, [
|
|
2318
2453
|
e("img", {
|
|
2319
|
-
src:
|
|
2320
|
-
alt:
|
|
2454
|
+
src: l.fileUrl,
|
|
2455
|
+
alt: l.fileName,
|
|
2321
2456
|
class: "message-image",
|
|
2322
|
-
onError:
|
|
2457
|
+
onError: rt
|
|
2323
2458
|
}, null, 40, Dn),
|
|
2324
|
-
|
|
2325
|
-
], 10,
|
|
2459
|
+
l.fileSize ? (a(), p("div", Wn, y(Ne(l.fileSize)), 1)) : S("", !0)
|
|
2460
|
+
], 10, En)) : l.type === "file" ? (a(), p("div", {
|
|
2326
2461
|
key: 2,
|
|
2327
|
-
class:
|
|
2462
|
+
class: J([
|
|
2328
2463
|
"message-bubble",
|
|
2329
2464
|
"file-bubble",
|
|
2330
|
-
|
|
2465
|
+
l.isSelf ? "bubble-self" : "bubble-other"
|
|
2331
2466
|
]),
|
|
2332
|
-
onClick: (
|
|
2467
|
+
onClick: (mt) => je(l.fileUrl)
|
|
2333
2468
|
}, [
|
|
2334
|
-
e("div",
|
|
2335
|
-
e("div",
|
|
2336
|
-
|
|
2337
|
-
default:
|
|
2338
|
-
|
|
2469
|
+
e("div", Xn, [
|
|
2470
|
+
e("div", Yn, [
|
|
2471
|
+
m(b, { size: 28 }, {
|
|
2472
|
+
default: k(() => [
|
|
2473
|
+
m(c(At))
|
|
2339
2474
|
]),
|
|
2340
2475
|
_: 1
|
|
2341
2476
|
})
|
|
2342
2477
|
]),
|
|
2343
|
-
e("div",
|
|
2344
|
-
e("div",
|
|
2345
|
-
e("div",
|
|
2346
|
-
|
|
2347
|
-
default:
|
|
2348
|
-
|
|
2478
|
+
e("div", qn, [
|
|
2479
|
+
e("div", Bn, y(l.fileName || l.text), 1),
|
|
2480
|
+
e("div", Kn, [
|
|
2481
|
+
m(b, { size: 12 }, {
|
|
2482
|
+
default: k(() => [
|
|
2483
|
+
m(c(Vt))
|
|
2349
2484
|
]),
|
|
2350
2485
|
_: 1
|
|
2351
2486
|
}),
|
|
2352
2487
|
s[19] || (s[19] = e("span", null, "点击下载", -1)),
|
|
2353
|
-
|
|
2488
|
+
l.fileSize ? (a(), p("span", Nn, "· " + y(Ne(l.fileSize)), 1)) : S("", !0)
|
|
2354
2489
|
])
|
|
2355
2490
|
])
|
|
2356
2491
|
])
|
|
2357
|
-
], 10,
|
|
2492
|
+
], 10, Hn)) : S("", !0),
|
|
2358
2493
|
e("div", {
|
|
2359
|
-
class:
|
|
2494
|
+
class: J([
|
|
2360
2495
|
"message-time",
|
|
2361
|
-
|
|
2496
|
+
l.isSelf ? "time-right" : "time-left"
|
|
2362
2497
|
])
|
|
2363
|
-
},
|
|
2498
|
+
}, y(c(Re)(l.time)), 3)
|
|
2364
2499
|
])
|
|
2365
2500
|
], 2)
|
|
2366
2501
|
], 2))), 128))
|
|
2367
2502
|
], 512),
|
|
2368
|
-
e("div",
|
|
2369
|
-
|
|
2370
|
-
(
|
|
2371
|
-
key:
|
|
2503
|
+
e("div", Pn, [
|
|
2504
|
+
O.value.length > 0 ? (a(), p("div", jn, [
|
|
2505
|
+
(a(!0), p(me, null, fe(O.value, (l, $e) => (a(), p("div", {
|
|
2506
|
+
key: l.id,
|
|
2372
2507
|
class: "pending-file"
|
|
2373
2508
|
}, [
|
|
2374
|
-
|
|
2509
|
+
l.isImage ? (a(), p("div", On, [
|
|
2375
2510
|
e("img", {
|
|
2376
|
-
src:
|
|
2377
|
-
alt:
|
|
2511
|
+
src: l.previewUrl,
|
|
2512
|
+
alt: l.name,
|
|
2378
2513
|
class: "pending-image"
|
|
2379
|
-
}, null, 8,
|
|
2514
|
+
}, null, 8, Gn),
|
|
2380
2515
|
e("button", {
|
|
2381
|
-
onClick: (
|
|
2516
|
+
onClick: (mt) => Ke($e),
|
|
2382
2517
|
class: "remove-file-btn"
|
|
2383
|
-
}, " × ", 8,
|
|
2384
|
-
])) : (
|
|
2385
|
-
|
|
2386
|
-
default:
|
|
2387
|
-
|
|
2518
|
+
}, " × ", 8, Jn)
|
|
2519
|
+
])) : (a(), p("div", Qn, [
|
|
2520
|
+
m(b, { class: "pending-file-icon" }, {
|
|
2521
|
+
default: k(() => [
|
|
2522
|
+
m(c(Ze))
|
|
2388
2523
|
]),
|
|
2389
2524
|
_: 1
|
|
2390
2525
|
}),
|
|
2391
|
-
e("span",
|
|
2526
|
+
e("span", Zn, y(l.name), 1),
|
|
2392
2527
|
e("button", {
|
|
2393
|
-
onClick: (
|
|
2528
|
+
onClick: (mt) => Ke($e),
|
|
2394
2529
|
class: "remove-file-btn"
|
|
2395
|
-
}, " × ", 8,
|
|
2530
|
+
}, " × ", 8, ei)
|
|
2396
2531
|
]))
|
|
2397
2532
|
]))), 128))
|
|
2398
|
-
])) :
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
default:
|
|
2402
|
-
|
|
2533
|
+
])) : S("", !0),
|
|
2534
|
+
x.config.modules.fileUpload ? (a(), p("div", ti, [
|
|
2535
|
+
m(b, { class: "action-icon" }, {
|
|
2536
|
+
default: k(() => [
|
|
2537
|
+
m(c(Ye))
|
|
2403
2538
|
]),
|
|
2404
2539
|
_: 1
|
|
2405
2540
|
}),
|
|
2406
|
-
|
|
2541
|
+
m(b, {
|
|
2407
2542
|
class: "action-icon",
|
|
2408
|
-
onClick:
|
|
2543
|
+
onClick: it
|
|
2409
2544
|
}, {
|
|
2410
|
-
default:
|
|
2411
|
-
|
|
2545
|
+
default: k(() => [
|
|
2546
|
+
m(c(Ze))
|
|
2412
2547
|
]),
|
|
2413
2548
|
_: 1
|
|
2414
2549
|
}),
|
|
2415
|
-
|
|
2416
|
-
default:
|
|
2417
|
-
|
|
2550
|
+
m(b, { class: "action-icon" }, {
|
|
2551
|
+
default: k(() => [
|
|
2552
|
+
m(c(Ft))
|
|
2418
2553
|
]),
|
|
2419
2554
|
_: 1
|
|
2420
2555
|
})
|
|
2421
|
-
])) :
|
|
2422
|
-
e("div",
|
|
2423
|
-
|
|
2424
|
-
"onUpdate:modelValue": s[4] || (s[4] = (
|
|
2425
|
-
onKeydown:
|
|
2426
|
-
onPaste:
|
|
2556
|
+
])) : S("", !0),
|
|
2557
|
+
e("div", si, [
|
|
2558
|
+
wt(e("textarea", {
|
|
2559
|
+
"onUpdate:modelValue": s[4] || (s[4] = (l) => Ie(A) ? A.value = l : null),
|
|
2560
|
+
onKeydown: Ct(Be(Pe, ["prevent"]), ["enter"]),
|
|
2561
|
+
onPaste: ot,
|
|
2427
2562
|
placeholder: "输入消息或粘贴文件...",
|
|
2428
2563
|
class: "message-input",
|
|
2429
2564
|
rows: "3"
|
|
2430
|
-
}, null, 40,
|
|
2431
|
-
[
|
|
2565
|
+
}, null, 40, ai), [
|
|
2566
|
+
[xt, c(A)]
|
|
2432
2567
|
])
|
|
2433
2568
|
]),
|
|
2434
|
-
e("div",
|
|
2435
|
-
|
|
2569
|
+
e("div", ni, [
|
|
2570
|
+
m(ke, {
|
|
2436
2571
|
type: "primary",
|
|
2437
|
-
disabled: !c(
|
|
2438
|
-
onClick:
|
|
2572
|
+
disabled: !c(A).trim() && O.value.length === 0,
|
|
2573
|
+
onClick: Pe,
|
|
2439
2574
|
class: "send-btn"
|
|
2440
2575
|
}, {
|
|
2441
|
-
default:
|
|
2442
|
-
|
|
2576
|
+
default: k(() => [...s[20] || (s[20] = [
|
|
2577
|
+
ue(" 发送 ", -1)
|
|
2443
2578
|
])]),
|
|
2444
2579
|
_: 1
|
|
2445
2580
|
}, 8, ["disabled"])
|
|
2446
2581
|
]),
|
|
2447
2582
|
e("input", {
|
|
2448
2583
|
ref_key: "fileInputRef",
|
|
2449
|
-
ref:
|
|
2584
|
+
ref: j,
|
|
2450
2585
|
type: "file",
|
|
2451
2586
|
multiple: "",
|
|
2452
2587
|
class: "hidden-file-input",
|
|
2453
2588
|
onChange: lt
|
|
2454
2589
|
}, null, 544)
|
|
2455
2590
|
])
|
|
2456
|
-
])) :
|
|
2457
|
-
|
|
2591
|
+
])) : ie.value ? S("", !0) : (a(), p("div", ii, [
|
|
2592
|
+
m(b, {
|
|
2458
2593
|
size: 64,
|
|
2459
2594
|
class: "empty-icon"
|
|
2460
2595
|
}, {
|
|
2461
|
-
default:
|
|
2462
|
-
|
|
2596
|
+
default: k(() => [
|
|
2597
|
+
m(c(It))
|
|
2463
2598
|
]),
|
|
2464
2599
|
_: 1
|
|
2465
2600
|
}),
|
|
2466
|
-
e("div",
|
|
2601
|
+
e("div", li, y(ne.value === "apply" ? "在左侧选择好友申请" : "在左侧选择好友开始聊天"), 1)
|
|
2467
2602
|
]))
|
|
2468
2603
|
]),
|
|
2469
|
-
|
|
2604
|
+
oe.value ? (a(), p("div", oi, [
|
|
2470
2605
|
s[22] || (s[22] = e("div", { class: "detail-header" }, "聊天详情", -1)),
|
|
2471
|
-
e("div",
|
|
2472
|
-
e("div",
|
|
2606
|
+
e("div", ri, [
|
|
2607
|
+
e("div", ci, [
|
|
2473
2608
|
e("img", {
|
|
2474
|
-
src: (
|
|
2475
|
-
alt: (o =
|
|
2609
|
+
src: (Ee = W.value) == null ? void 0 : Ee.avatar,
|
|
2610
|
+
alt: (o = W.value) == null ? void 0 : o.name,
|
|
2476
2611
|
class: "detail-avatar"
|
|
2477
|
-
}, null, 8,
|
|
2478
|
-
e("div",
|
|
2612
|
+
}, null, 8, di),
|
|
2613
|
+
e("div", ui, y((ye = W.value) == null ? void 0 : ye.name), 1),
|
|
2479
2614
|
s[21] || (s[21] = e("div", { class: "detail-actions" }, [
|
|
2480
2615
|
e("div", { class: "detail-action-item" }, "查找聊天记录"),
|
|
2481
2616
|
e("div", { class: "detail-action-item" }, "清空聊天记录")
|
|
2482
2617
|
], -1))
|
|
2483
2618
|
])
|
|
2484
2619
|
])
|
|
2485
|
-
])) :
|
|
2620
|
+
])) : S("", !0)
|
|
2486
2621
|
]),
|
|
2487
|
-
|
|
2488
|
-
modelValue: c(
|
|
2489
|
-
"onUpdate:modelValue": s[6] || (s[6] = (
|
|
2622
|
+
m(He, {
|
|
2623
|
+
modelValue: c(ge),
|
|
2624
|
+
"onUpdate:modelValue": s[6] || (s[6] = (l) => Ie(ge) ? ge.value = l : null),
|
|
2490
2625
|
title: "添加好友",
|
|
2491
2626
|
width: "500px",
|
|
2492
2627
|
"append-to-body": ""
|
|
2493
2628
|
}, {
|
|
2494
|
-
default:
|
|
2495
|
-
e("div",
|
|
2496
|
-
e("div",
|
|
2497
|
-
|
|
2498
|
-
modelValue: c(
|
|
2499
|
-
"onUpdate:modelValue": s[5] || (s[5] = (
|
|
2629
|
+
default: k(() => [
|
|
2630
|
+
e("div", vi, [
|
|
2631
|
+
e("div", pi, [
|
|
2632
|
+
m(T, {
|
|
2633
|
+
modelValue: c(Ce),
|
|
2634
|
+
"onUpdate:modelValue": s[5] || (s[5] = (l) => Ie(Ce) ? Ce.value = l : null),
|
|
2500
2635
|
placeholder: "搜索用户",
|
|
2501
|
-
"prefix-icon": c(
|
|
2636
|
+
"prefix-icon": c(qe)
|
|
2502
2637
|
}, null, 8, ["modelValue", "prefix-icon"])
|
|
2503
2638
|
])
|
|
2504
2639
|
]),
|
|
2505
|
-
e("div",
|
|
2506
|
-
c(
|
|
2640
|
+
e("div", mi, [
|
|
2641
|
+
c(xe) ? (a(), G(ce, {
|
|
2507
2642
|
key: 0,
|
|
2508
2643
|
description: "加载中..."
|
|
2509
|
-
})) : c(
|
|
2644
|
+
})) : c(Ae).length === 0 ? (a(), G(ce, {
|
|
2510
2645
|
key: 1,
|
|
2511
2646
|
description: "暂无用户"
|
|
2512
|
-
})) : (
|
|
2513
|
-
key:
|
|
2647
|
+
})) : (a(!0), p(me, { key: 2 }, fe(c(Ae), (l) => (a(), p("div", {
|
|
2648
|
+
key: l.username,
|
|
2514
2649
|
class: "available-user-item"
|
|
2515
2650
|
}, [
|
|
2516
|
-
e("div",
|
|
2651
|
+
e("div", fi, [
|
|
2517
2652
|
e("img", {
|
|
2518
|
-
src: `https://api.dicebear.com/7.x/avataaars/svg?seed=${
|
|
2519
|
-
alt:
|
|
2653
|
+
src: `https://api.dicebear.com/7.x/avataaars/svg?seed=${l.username}`,
|
|
2654
|
+
alt: l.username,
|
|
2520
2655
|
class: "available-user-avatar"
|
|
2521
|
-
}, null, 8,
|
|
2522
|
-
e("div",
|
|
2656
|
+
}, null, 8, hi),
|
|
2657
|
+
e("div", gi, y(l.username), 1)
|
|
2523
2658
|
]),
|
|
2524
|
-
|
|
2659
|
+
m(ke, {
|
|
2525
2660
|
type: "primary",
|
|
2526
2661
|
size: "small",
|
|
2527
|
-
onClick: (
|
|
2662
|
+
onClick: ($e) => c(q)(l)
|
|
2528
2663
|
}, {
|
|
2529
|
-
default:
|
|
2530
|
-
|
|
2664
|
+
default: k(() => [...s[23] || (s[23] = [
|
|
2665
|
+
ue("添加", -1)
|
|
2531
2666
|
])]),
|
|
2532
2667
|
_: 1
|
|
2533
2668
|
}, 8, ["onClick"])
|
|
@@ -2536,171 +2671,171 @@ const ht = (w, t) => {
|
|
|
2536
2671
|
]),
|
|
2537
2672
|
_: 1
|
|
2538
2673
|
}, 8, ["modelValue"]),
|
|
2539
|
-
|
|
2540
|
-
modelValue:
|
|
2541
|
-
"onUpdate:modelValue": s[11] || (s[11] = (
|
|
2674
|
+
m(He, {
|
|
2675
|
+
modelValue: i.value,
|
|
2676
|
+
"onUpdate:modelValue": s[11] || (s[11] = (l) => i.value = l),
|
|
2542
2677
|
title: "个人设置",
|
|
2543
2678
|
width: "560px",
|
|
2544
2679
|
"close-on-click-modal": !1,
|
|
2545
2680
|
"append-to-body": "",
|
|
2546
2681
|
class: "settings-dialog"
|
|
2547
2682
|
}, {
|
|
2548
|
-
default:
|
|
2549
|
-
e("div",
|
|
2550
|
-
e("div",
|
|
2551
|
-
e("div",
|
|
2683
|
+
default: k(() => [
|
|
2684
|
+
e("div", yi, [
|
|
2685
|
+
e("div", _i, [
|
|
2686
|
+
e("div", bi, [
|
|
2552
2687
|
e("img", {
|
|
2553
|
-
src: c(
|
|
2688
|
+
src: c(H),
|
|
2554
2689
|
alt: "头像",
|
|
2555
2690
|
class: "settings-avatar"
|
|
2556
|
-
}, null, 8,
|
|
2557
|
-
|
|
2691
|
+
}, null, 8, ki),
|
|
2692
|
+
x.config.modules.avatarCrop ? (a(), p("div", {
|
|
2558
2693
|
key: 0,
|
|
2559
2694
|
class: "settings-avatar-edit",
|
|
2560
|
-
onClick:
|
|
2695
|
+
onClick: nt
|
|
2561
2696
|
}, [
|
|
2562
|
-
|
|
2697
|
+
m(b, {
|
|
2563
2698
|
size: 18,
|
|
2564
2699
|
class: "settings-avatar-icon"
|
|
2565
2700
|
}, {
|
|
2566
|
-
default:
|
|
2567
|
-
|
|
2701
|
+
default: k(() => [
|
|
2702
|
+
m(c(Rt))
|
|
2568
2703
|
]),
|
|
2569
2704
|
_: 1
|
|
2570
2705
|
})
|
|
2571
|
-
])) :
|
|
2706
|
+
])) : S("", !0),
|
|
2572
2707
|
e("input", {
|
|
2573
2708
|
ref_key: "avatarInputRef",
|
|
2574
|
-
ref:
|
|
2709
|
+
ref: F,
|
|
2575
2710
|
type: "file",
|
|
2576
2711
|
accept: "image/*",
|
|
2577
2712
|
class: "hidden-avatar-input",
|
|
2578
|
-
onChange:
|
|
2713
|
+
onChange: ct
|
|
2579
2714
|
}, null, 544)
|
|
2580
2715
|
]),
|
|
2581
|
-
e("div",
|
|
2582
|
-
e("div",
|
|
2583
|
-
e("div",
|
|
2716
|
+
e("div", wi, [
|
|
2717
|
+
e("div", Ci, y(c(Z).nickname || c(ee)), 1),
|
|
2718
|
+
e("div", xi, "@" + y(c(ee)), 1)
|
|
2584
2719
|
])
|
|
2585
2720
|
]),
|
|
2586
|
-
e("div",
|
|
2587
|
-
e("div", $
|
|
2588
|
-
e("div",
|
|
2589
|
-
|
|
2590
|
-
default:
|
|
2591
|
-
|
|
2721
|
+
e("div", Ui, [
|
|
2722
|
+
e("div", $i, [
|
|
2723
|
+
e("div", Si, [
|
|
2724
|
+
m(b, null, {
|
|
2725
|
+
default: k(() => [
|
|
2726
|
+
m(c(Qe))
|
|
2592
2727
|
]),
|
|
2593
2728
|
_: 1
|
|
2594
2729
|
}),
|
|
2595
|
-
s[24] || (s[24] =
|
|
2730
|
+
s[24] || (s[24] = ue(" 个人信息 ", -1))
|
|
2596
2731
|
]),
|
|
2597
|
-
|
|
2732
|
+
K.value ? S("", !0) : (a(), G(ke, {
|
|
2598
2733
|
key: 0,
|
|
2599
2734
|
type: "primary",
|
|
2600
2735
|
size: "small",
|
|
2601
|
-
onClick:
|
|
2736
|
+
onClick: ut,
|
|
2602
2737
|
class: "settings-edit-btn"
|
|
2603
2738
|
}, {
|
|
2604
|
-
default:
|
|
2605
|
-
|
|
2739
|
+
default: k(() => [...s[25] || (s[25] = [
|
|
2740
|
+
ue(" 编辑 ", -1)
|
|
2606
2741
|
])]),
|
|
2607
2742
|
_: 1
|
|
2608
2743
|
}))
|
|
2609
2744
|
]),
|
|
2610
|
-
e("div",
|
|
2611
|
-
e("div",
|
|
2745
|
+
e("div", zi, [
|
|
2746
|
+
e("div", Ai, [
|
|
2612
2747
|
s[26] || (s[26] = e("label", { class: "settings-form-label" }, "昵称", -1)),
|
|
2613
|
-
|
|
2748
|
+
K.value ? (a(), G(T, {
|
|
2614
2749
|
key: 0,
|
|
2615
|
-
modelValue:
|
|
2616
|
-
"onUpdate:modelValue": s[7] || (s[7] = (
|
|
2750
|
+
modelValue: re.value.nickname,
|
|
2751
|
+
"onUpdate:modelValue": s[7] || (s[7] = (l) => re.value.nickname = l),
|
|
2617
2752
|
placeholder: "请输入昵称",
|
|
2618
2753
|
size: "large"
|
|
2619
|
-
}, null, 8, ["modelValue"])) : (
|
|
2754
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", Vi, y(c(Z).nickname || "未设置"), 1))
|
|
2620
2755
|
]),
|
|
2621
|
-
e("div",
|
|
2756
|
+
e("div", Fi, [
|
|
2622
2757
|
s[27] || (s[27] = e("label", { class: "settings-form-label" }, "邮箱", -1)),
|
|
2623
|
-
|
|
2758
|
+
K.value ? (a(), G(T, {
|
|
2624
2759
|
key: 0,
|
|
2625
|
-
modelValue:
|
|
2626
|
-
"onUpdate:modelValue": s[8] || (s[8] = (
|
|
2760
|
+
modelValue: re.value.email,
|
|
2761
|
+
"onUpdate:modelValue": s[8] || (s[8] = (l) => re.value.email = l),
|
|
2627
2762
|
placeholder: "请输入邮箱",
|
|
2628
2763
|
size: "large"
|
|
2629
|
-
}, null, 8, ["modelValue"])) : (
|
|
2764
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", Ii, y(c(Z).email || "未设置"), 1))
|
|
2630
2765
|
]),
|
|
2631
|
-
e("div",
|
|
2766
|
+
e("div", Ri, [
|
|
2632
2767
|
s[28] || (s[28] = e("label", { class: "settings-form-label" }, "手机号", -1)),
|
|
2633
|
-
|
|
2768
|
+
K.value ? (a(), G(T, {
|
|
2634
2769
|
key: 0,
|
|
2635
|
-
modelValue:
|
|
2636
|
-
"onUpdate:modelValue": s[9] || (s[9] = (
|
|
2770
|
+
modelValue: re.value.phone,
|
|
2771
|
+
"onUpdate:modelValue": s[9] || (s[9] = (l) => re.value.phone = l),
|
|
2637
2772
|
placeholder: "请输入手机号",
|
|
2638
2773
|
size: "large"
|
|
2639
|
-
}, null, 8, ["modelValue"])) : (
|
|
2774
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", Mi, y(c(Z).phone || "未设置"), 1))
|
|
2640
2775
|
]),
|
|
2641
|
-
e("div",
|
|
2776
|
+
e("div", Li, [
|
|
2642
2777
|
s[29] || (s[29] = e("label", { class: "settings-form-label" }, "个人简介", -1)),
|
|
2643
|
-
|
|
2778
|
+
K.value ? (a(), G(T, {
|
|
2644
2779
|
key: 0,
|
|
2645
|
-
modelValue:
|
|
2646
|
-
"onUpdate:modelValue": s[10] || (s[10] = (
|
|
2780
|
+
modelValue: re.value.bio,
|
|
2781
|
+
"onUpdate:modelValue": s[10] || (s[10] = (l) => re.value.bio = l),
|
|
2647
2782
|
type: "textarea",
|
|
2648
2783
|
rows: 4,
|
|
2649
2784
|
placeholder: "介绍一下自己吧...",
|
|
2650
2785
|
size: "large"
|
|
2651
|
-
}, null, 8, ["modelValue"])) : (
|
|
2786
|
+
}, null, 8, ["modelValue"])) : (a(), p("div", Ti, y(c(Z).bio || "这个人很懒,什么都没写~"), 1))
|
|
2652
2787
|
]),
|
|
2653
|
-
|
|
2654
|
-
|
|
2788
|
+
K.value ? (a(), p("div", Ei, [
|
|
2789
|
+
m(ke, {
|
|
2655
2790
|
size: "default",
|
|
2656
|
-
onClick:
|
|
2791
|
+
onClick: vt
|
|
2657
2792
|
}, {
|
|
2658
|
-
default:
|
|
2659
|
-
|
|
2793
|
+
default: k(() => [...s[30] || (s[30] = [
|
|
2794
|
+
ue("取消", -1)
|
|
2660
2795
|
])]),
|
|
2661
2796
|
_: 1
|
|
2662
2797
|
}),
|
|
2663
|
-
|
|
2798
|
+
m(ke, {
|
|
2664
2799
|
type: "primary",
|
|
2665
2800
|
size: "default",
|
|
2666
|
-
loading:
|
|
2667
|
-
onClick:
|
|
2801
|
+
loading: ze.value,
|
|
2802
|
+
onClick: pt
|
|
2668
2803
|
}, {
|
|
2669
|
-
default:
|
|
2670
|
-
|
|
2804
|
+
default: k(() => [...s[31] || (s[31] = [
|
|
2805
|
+
ue("保存更改", -1)
|
|
2671
2806
|
])]),
|
|
2672
2807
|
_: 1
|
|
2673
2808
|
}, 8, ["loading"])
|
|
2674
|
-
])) :
|
|
2809
|
+
])) : S("", !0)
|
|
2675
2810
|
])
|
|
2676
2811
|
])
|
|
2677
2812
|
])
|
|
2678
2813
|
]),
|
|
2679
2814
|
_: 1
|
|
2680
2815
|
}, 8, ["modelValue"]),
|
|
2681
|
-
|
|
2816
|
+
m(yt, {
|
|
2682
2817
|
modelValue: d.value,
|
|
2683
|
-
"onUpdate:modelValue": s[12] || (s[12] = (
|
|
2684
|
-
src:
|
|
2685
|
-
onConfirm:
|
|
2818
|
+
"onUpdate:modelValue": s[12] || (s[12] = (l) => d.value = l),
|
|
2819
|
+
src: _e.value,
|
|
2820
|
+
onConfirm: dt
|
|
2686
2821
|
}, null, 8, ["modelValue", "src"]),
|
|
2687
|
-
|
|
2822
|
+
Ue.value.visible ? (a(), p("div", {
|
|
2688
2823
|
key: 0,
|
|
2689
2824
|
class: "context-menu",
|
|
2690
|
-
style:
|
|
2825
|
+
style: Xe({ left: Ue.value.x + "px", top: Ue.value.y + "px" })
|
|
2691
2826
|
}, [
|
|
2692
2827
|
e("div", {
|
|
2693
2828
|
class: "context-menu-item",
|
|
2694
|
-
onClick:
|
|
2829
|
+
onClick: et
|
|
2695
2830
|
}, "删除聊天")
|
|
2696
|
-
], 4)) :
|
|
2831
|
+
], 4)) : S("", !0)
|
|
2697
2832
|
];
|
|
2698
2833
|
}),
|
|
2699
2834
|
_: 1
|
|
2700
2835
|
}, 8, ["modelValue", "width"]);
|
|
2701
2836
|
};
|
|
2702
2837
|
}
|
|
2703
|
-
},
|
|
2838
|
+
}, Wi = /* @__PURE__ */ gt(Di, [["__scopeId", "data-v-a76a4ef3"]]), Hi = {
|
|
2704
2839
|
// API 配置
|
|
2705
2840
|
api: {
|
|
2706
2841
|
baseUrl: "",
|
|
@@ -2763,30 +2898,30 @@ const ht = (w, t) => {
|
|
|
2763
2898
|
allowedTypes: ["*"]
|
|
2764
2899
|
}
|
|
2765
2900
|
};
|
|
2766
|
-
function
|
|
2767
|
-
const t =
|
|
2901
|
+
function Ki(x = {}) {
|
|
2902
|
+
const t = Tt(Hi, x);
|
|
2768
2903
|
return t.api.baseUrl || console.warn("[VueChatKit] 请配置 api.baseUrl"), t.api.websocketUrl || console.warn("[VueChatKit] 请配置 api.websocketUrl"), t.user.username || console.warn("[VueChatKit] 请配置 user.username"), t;
|
|
2769
2904
|
}
|
|
2770
|
-
function
|
|
2771
|
-
const
|
|
2772
|
-
for (const
|
|
2773
|
-
t[
|
|
2774
|
-
return
|
|
2905
|
+
function Tt(x, t) {
|
|
2906
|
+
const n = { ...x };
|
|
2907
|
+
for (const v in t)
|
|
2908
|
+
t[v] && typeof t[v] == "object" && !Array.isArray(t[v]) ? n[v] = Tt(x[v] || {}, t[v]) : n[v] = t[v];
|
|
2909
|
+
return n;
|
|
2775
2910
|
}
|
|
2776
|
-
const
|
|
2777
|
-
install(
|
|
2778
|
-
|
|
2911
|
+
const Ni = {
|
|
2912
|
+
install(x) {
|
|
2913
|
+
x.component("ChatPanel", Ya), x.component("ChatWindow", Wi), x.component("AvatarCrop", yt);
|
|
2779
2914
|
}
|
|
2780
2915
|
};
|
|
2781
2916
|
export {
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2917
|
+
yt as AvatarCrop,
|
|
2918
|
+
ht as ChatApi,
|
|
2919
|
+
Ya as ChatPanel,
|
|
2920
|
+
Dt as ChatWebSocket,
|
|
2921
|
+
Wi as ChatWindow,
|
|
2922
|
+
Wt as HttpClient,
|
|
2923
|
+
Ni as VueChatKit,
|
|
2924
|
+
Ki as createChatConfig,
|
|
2925
|
+
Ni as default,
|
|
2926
|
+
Lt as useChat
|
|
2792
2927
|
};
|