yx-web-sdk 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +424 -0
- package/dist/AntdIcon-B0sjNvGu.mjs +307 -0
- package/dist/CloseOutlined-DDb89ei3.mjs +37 -0
- package/dist/_plugin-vue_export-helper-1tPrXgE0.mjs +10 -0
- package/dist/ait-person-popover/index.d.ts +3 -0
- package/dist/ait-person-popover/index.js +5 -0
- package/dist/ait-person-popover/index.vue.d.ts +39 -0
- package/dist/chat-card/index.d.ts +3 -0
- package/dist/chat-card/index.js +5 -0
- package/dist/chat-card/index.vue.d.ts +25 -0
- package/dist/chat-content/index.d.ts +3 -0
- package/dist/chat-content/index.js +5 -0
- package/dist/chat-content/index.vue.d.ts +51 -0
- package/dist/chat-page/index.d.ts +3 -0
- package/dist/chat-page/index.js +5 -0
- package/dist/chat-page/index.vue.d.ts +6 -0
- package/dist/chat-room/index.d.ts +3 -0
- package/dist/chat-room/index.js +5 -0
- package/dist/chat-room/index.vue.d.ts +9 -0
- package/dist/common-avatar/index.d.ts +3 -0
- package/dist/common-avatar/index.js +5 -0
- package/dist/common-avatar/index.vue.d.ts +17 -0
- package/dist/components/ait-person-popover/index.d.ts +3 -0
- package/dist/components/ait-person-popover/index.vue.d.ts +39 -0
- package/dist/components/chat-card/index.d.ts +3 -0
- package/dist/components/chat-card/index.vue.d.ts +25 -0
- package/dist/components/chat-content/composables/ait-person.d.ts +86 -0
- package/dist/components/chat-content/index.d.ts +3 -0
- package/dist/components/chat-content/index.vue.d.ts +51 -0
- package/dist/components/chat-page/index.d.ts +3 -0
- package/dist/components/chat-page/index.vue.d.ts +6 -0
- package/dist/components/chat-room/index.d.ts +3 -0
- package/dist/components/chat-room/index.vue.d.ts +9 -0
- package/dist/components/common-avatar/index.d.ts +3 -0
- package/dist/components/common-avatar/index.vue.d.ts +17 -0
- package/dist/components/icon-font/index.d.ts +47 -0
- package/dist/components/index-entry/index.d.ts +2 -0
- package/dist/components/index-entry/index.vue.d.ts +25 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/list.d.ts +2 -0
- package/dist/components/members-sidebar/index.d.ts +3 -0
- package/dist/components/members-sidebar/index.vue.d.ts +4 -0
- package/dist/components/notice-box/index.d.ts +3 -0
- package/dist/components/notice-box/index.vue.d.ts +13 -0
- package/dist/components/server-channel-sidebar/index.d.ts +3 -0
- package/dist/components/server-channel-sidebar/index.vue.d.ts +18 -0
- package/dist/global.css +39 -0
- package/dist/icon-font/index.d.ts +47 -0
- package/dist/icon-font/index.js +7 -0
- package/dist/index/style.css +199 -0
- package/dist/index/style2.css +175 -0
- package/dist/index/style3.css +36 -0
- package/dist/index/style4.css +168 -0
- package/dist/index/style5.css +147 -0
- package/dist/index/style6.css +43 -0
- package/dist/index/style7.css +491 -0
- package/dist/index/style8.css +19 -0
- package/dist/index-3sSWCzxu.mjs +225 -0
- package/dist/index-4m4OVlx8.mjs +611 -0
- package/dist/index-CFI0URc5.mjs +135 -0
- package/dist/index-Dg8Q3cli.mjs +1092 -0
- package/dist/index-entry/index.d.ts +2 -0
- package/dist/index-entry/index.js +271 -0
- package/dist/index-entry/index.vue.d.ts +25 -0
- package/dist/index-entry/style.css +51 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.vue_vue_type_script_setup_true_lang-DkMXpHkt.mjs +158 -0
- package/dist/index.vue_vue_type_style_index_0_lang-CfLKcYM9.mjs +102 -0
- package/dist/index.vue_vue_type_style_index_0_lang-CibeOmhP.mjs +407 -0
- package/dist/index.vue_vue_type_style_index_0_lang-CmfE8EVU.mjs +288 -0
- package/dist/index.vue_vue_type_style_index_0_lang-XiDTgYoZ.mjs +1012 -0
- package/dist/index.vue_vue_type_style_index_0_lang-Y-vyKHWz.mjs +36985 -0
- package/dist/members-sidebar/index.d.ts +3 -0
- package/dist/members-sidebar/index.js +5 -0
- package/dist/members-sidebar/index.vue.d.ts +4 -0
- package/dist/notice-box/index.d.ts +3 -0
- package/dist/notice-box/index.js +5 -0
- package/dist/notice-box/index.vue.d.ts +13 -0
- package/dist/plugin/index.d.ts +22 -0
- package/dist/resolver/index.d.ts +22 -0
- package/dist/resolver/index.es.js +36 -0
- package/dist/resolver/index.umd.js +40 -0
- package/dist/server-channel-sidebar/index.d.ts +3 -0
- package/dist/server-channel-sidebar/index.js +5 -0
- package/dist/server-channel-sidebar/index.vue.d.ts +18 -0
- package/dist/stores/channel.d.ts +114 -0
- package/dist/stores/global.d.ts +15 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/qchat.d.ts +397 -0
- package/dist/stores/sdk.d.ts +48 -0
- package/dist/stores/server.d.ts +58 -0
- package/dist/stores/user.d.ts +9 -0
- package/dist/style.css +1359 -0
- package/dist/types/missing.d.ts +14 -0
- package/dist/utils/events.d.ts +7 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/storage.d.ts +15 -0
- package/dist/yx-web-sdk.es.js +41593 -0
- package/dist/yx-web-sdk.umd.js +41590 -0
- package/package.json +191 -0
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
import { createVNode, defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, unref, Fragment, renderList, normalizeClass, withCtx, toDisplayString, createBlock, createCommentVNode, withModifiers, createTextVNode } from "vue";
|
|
2
|
+
import { Form, Tooltip, Badge, Modal, Input, Button, Checkbox, message } from "ant-design-vue";
|
|
3
|
+
import { u as useImSdkStore, a as useServerStore, b as useChannelStore, c as useUserStore, _ as _sfc_main$1 } from "./index.vue_vue_type_style_index_0_lang-Y-vyKHWz.mjs";
|
|
4
|
+
import { I as IconFont } from "./index-Dg8Q3cli.mjs";
|
|
5
|
+
import { I as Icon } from "./AntdIcon-B0sjNvGu.mjs";
|
|
6
|
+
import { C as CloseOutlined } from "./CloseOutlined-DDb89ei3.mjs";
|
|
7
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.mjs";
|
|
8
|
+
var PlusOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
|
|
9
|
+
function _objectSpread$1(target) {
|
|
10
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
11
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
12
|
+
var ownKeys = Object.keys(source);
|
|
13
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
14
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
15
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
ownKeys.forEach(function(key) {
|
|
19
|
+
_defineProperty$1(target, key, source[key]);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
function _defineProperty$1(obj, key, value) {
|
|
25
|
+
if (key in obj) {
|
|
26
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
27
|
+
} else {
|
|
28
|
+
obj[key] = value;
|
|
29
|
+
}
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
32
|
+
var PlusOutlined = function PlusOutlined2(props, context) {
|
|
33
|
+
var p = _objectSpread$1({}, props, context.attrs);
|
|
34
|
+
return createVNode(Icon, _objectSpread$1({}, p, {
|
|
35
|
+
"icon": PlusOutlined$1
|
|
36
|
+
}), null);
|
|
37
|
+
};
|
|
38
|
+
PlusOutlined.displayName = "PlusOutlined";
|
|
39
|
+
PlusOutlined.inheritAttrs = false;
|
|
40
|
+
var SettingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z" } }] }, "name": "setting", "theme": "outlined" };
|
|
41
|
+
function _objectSpread(target) {
|
|
42
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
43
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
44
|
+
var ownKeys = Object.keys(source);
|
|
45
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
46
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
47
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
ownKeys.forEach(function(key) {
|
|
51
|
+
_defineProperty(target, key, source[key]);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return target;
|
|
55
|
+
}
|
|
56
|
+
function _defineProperty(obj, key, value) {
|
|
57
|
+
if (key in obj) {
|
|
58
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
59
|
+
} else {
|
|
60
|
+
obj[key] = value;
|
|
61
|
+
}
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
var SettingOutlined = function SettingOutlined2(props, context) {
|
|
65
|
+
var p = _objectSpread({}, props, context.attrs);
|
|
66
|
+
return createVNode(Icon, _objectSpread({}, p, {
|
|
67
|
+
"icon": SettingOutlined$1
|
|
68
|
+
}), null);
|
|
69
|
+
};
|
|
70
|
+
SettingOutlined.displayName = "SettingOutlined";
|
|
71
|
+
SettingOutlined.inheritAttrs = false;
|
|
72
|
+
const _hoisted_1 = { class: "sidebar-container" };
|
|
73
|
+
const _hoisted_2 = { class: "server-sidebar" };
|
|
74
|
+
const _hoisted_3 = { class: "server-list" };
|
|
75
|
+
const _hoisted_4 = { class: "logo-wrap" };
|
|
76
|
+
const _hoisted_5 = { class: "logo" };
|
|
77
|
+
const _hoisted_6 = ["onClick"];
|
|
78
|
+
const _hoisted_7 = { class: "server-icon" };
|
|
79
|
+
const _hoisted_8 = ["src", "alt"];
|
|
80
|
+
const _hoisted_9 = {
|
|
81
|
+
key: 1,
|
|
82
|
+
class: "server-initial"
|
|
83
|
+
};
|
|
84
|
+
const _hoisted_10 = { class: "channel-sidebar" };
|
|
85
|
+
const _hoisted_11 = {
|
|
86
|
+
key: 0,
|
|
87
|
+
class: "server-header"
|
|
88
|
+
};
|
|
89
|
+
const _hoisted_12 = { class: "server-name" };
|
|
90
|
+
const _hoisted_13 = { class: "channel-list" };
|
|
91
|
+
const _hoisted_14 = ["onClick"];
|
|
92
|
+
const _hoisted_15 = { class: "channel-name" };
|
|
93
|
+
const _hoisted_16 = { class: "channel-icon" };
|
|
94
|
+
const _hoisted_17 = { class: "user-panel-float" };
|
|
95
|
+
const _hoisted_18 = { class: "user-avatar" };
|
|
96
|
+
const _hoisted_19 = { class: "user-info" };
|
|
97
|
+
const _hoisted_20 = { class: "user-name" };
|
|
98
|
+
const _hoisted_21 = { class: "user-actions" };
|
|
99
|
+
const _hoisted_22 = { class: "header-container" };
|
|
100
|
+
const _hoisted_23 = { class: "header-title" };
|
|
101
|
+
const _hoisted_24 = { class: "invite-content" };
|
|
102
|
+
const _hoisted_25 = { class: "invite-subtitle" };
|
|
103
|
+
const _hoisted_26 = { class: "channel-tag" };
|
|
104
|
+
const _hoisted_27 = { class: "invite-link-wrap" };
|
|
105
|
+
const _hoisted_28 = { class: "header-container" };
|
|
106
|
+
const _hoisted_29 = { class: "header-title" };
|
|
107
|
+
const _hoisted_30 = { class: "footer-container" };
|
|
108
|
+
const _hoisted_31 = { class: "footer-buttons" };
|
|
109
|
+
const limit = 20;
|
|
110
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
111
|
+
...{
|
|
112
|
+
name: "ServerChannelSidebar"
|
|
113
|
+
},
|
|
114
|
+
__name: "index",
|
|
115
|
+
props: {
|
|
116
|
+
request: { type: Function }
|
|
117
|
+
},
|
|
118
|
+
emits: ["selectServer", "selectChannel"],
|
|
119
|
+
setup(__props, { emit: __emit }) {
|
|
120
|
+
const props = __props;
|
|
121
|
+
const FormItem = Form.Item;
|
|
122
|
+
const inviteCode = ref("");
|
|
123
|
+
const emit = __emit;
|
|
124
|
+
const imSdkStore = useImSdkStore();
|
|
125
|
+
const serverStore = useServerStore();
|
|
126
|
+
const channelStore = useChannelStore();
|
|
127
|
+
const userStore = useUserStore();
|
|
128
|
+
const channelModalVisible = ref(false);
|
|
129
|
+
const isEditChannelMode = ref(false);
|
|
130
|
+
const inviteModalVisible = ref(false);
|
|
131
|
+
const channelForm = ref({ channelId: "", name: "", topic: "", viewMode: 0, ext: "" });
|
|
132
|
+
const savingChannel = ref(false);
|
|
133
|
+
const currentAccount = computed(() => imSdkStore.currentAccount);
|
|
134
|
+
const serverList = computed(() => serverStore.serverList);
|
|
135
|
+
const curServer = computed(() => serverStore.curServer);
|
|
136
|
+
const channelList = computed(() => channelStore.channelList);
|
|
137
|
+
const currentChannel = computed(() => channelStore.currentChannel);
|
|
138
|
+
const userProfile = computed(() => {
|
|
139
|
+
return userStore.userProfile;
|
|
140
|
+
});
|
|
141
|
+
const inviteLink = computed(() => {
|
|
142
|
+
if (!curServer.value) return "";
|
|
143
|
+
const baseUrl = window.location.origin;
|
|
144
|
+
return `${baseUrl}/im?server_id=${curServer.value.serverId}&invite_code=${inviteCode.value}`;
|
|
145
|
+
});
|
|
146
|
+
const getServerInitial = (name) => {
|
|
147
|
+
var _a;
|
|
148
|
+
return ((_a = name == null ? void 0 : name.charAt(0)) == null ? void 0 : _a.toUpperCase()) || "S";
|
|
149
|
+
};
|
|
150
|
+
const getServerUnread = (serverId) => {
|
|
151
|
+
const server = serverList.value.find((s) => s.serverId === serverId);
|
|
152
|
+
return (server == null ? void 0 : server.unReadInfo) || 0;
|
|
153
|
+
};
|
|
154
|
+
const getChannelUnread = (channelId) => {
|
|
155
|
+
const channel = channelList.value.find((c) => c.channelId === channelId);
|
|
156
|
+
return (channel == null ? void 0 : channel.unreadCount) || 0;
|
|
157
|
+
};
|
|
158
|
+
const handleSelectServer = (server) => {
|
|
159
|
+
emit("selectServer", server);
|
|
160
|
+
};
|
|
161
|
+
const handleSelectChannel = (channel) => {
|
|
162
|
+
emit("selectChannel", channel);
|
|
163
|
+
};
|
|
164
|
+
const handleShowChannelModal = () => {
|
|
165
|
+
isEditChannelMode.value = false;
|
|
166
|
+
channelForm.value = { channelId: "", name: "", topic: "", viewMode: 0, ext: "" };
|
|
167
|
+
channelModalVisible.value = true;
|
|
168
|
+
};
|
|
169
|
+
const handleShowEditChannelModal = (channel) => {
|
|
170
|
+
isEditChannelMode.value = true;
|
|
171
|
+
channelForm.value = {
|
|
172
|
+
channelId: channel.channelId,
|
|
173
|
+
name: channel.name || "",
|
|
174
|
+
topic: channel.topic || "",
|
|
175
|
+
viewMode: channel.viewMode || 0,
|
|
176
|
+
ext: channel.ext || ""
|
|
177
|
+
};
|
|
178
|
+
channelModalVisible.value = true;
|
|
179
|
+
};
|
|
180
|
+
const handleSaveChannel = async () => {
|
|
181
|
+
var _a;
|
|
182
|
+
if (!channelForm.value.name || !curServer.value) return;
|
|
183
|
+
if (isEditChannelMode.value && !channelForm.value.channelId) return;
|
|
184
|
+
savingChannel.value = true;
|
|
185
|
+
try {
|
|
186
|
+
if (isEditChannelMode.value) {
|
|
187
|
+
await channelStore.updateChannel({
|
|
188
|
+
serverId: curServer.value.serverId,
|
|
189
|
+
channelId: channelForm.value.channelId,
|
|
190
|
+
name: channelForm.value.name,
|
|
191
|
+
topic: channelForm.value.topic || void 0,
|
|
192
|
+
viewMode: channelForm.value.viewMode,
|
|
193
|
+
ext: channelForm.value.ext || ""
|
|
194
|
+
});
|
|
195
|
+
const channelIndex = channelStore.channelList.findIndex((c) => c.channelId === channelForm.value.channelId);
|
|
196
|
+
if (channelIndex !== -1) {
|
|
197
|
+
channelStore.channelList[channelIndex] = {
|
|
198
|
+
...channelStore.channelList[channelIndex],
|
|
199
|
+
name: channelForm.value.name,
|
|
200
|
+
topic: channelForm.value.topic || "",
|
|
201
|
+
viewMode: channelForm.value.viewMode,
|
|
202
|
+
ext: channelForm.value.ext || ""
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (((_a = currentChannel.value) == null ? void 0 : _a.channelId) === channelForm.value.channelId) {
|
|
206
|
+
channelStore.resetCurrentChannel();
|
|
207
|
+
}
|
|
208
|
+
message.success("修改成功");
|
|
209
|
+
} else {
|
|
210
|
+
const newChannel = await channelStore.createChannel({
|
|
211
|
+
serverId: curServer.value.serverId,
|
|
212
|
+
name: channelForm.value.name,
|
|
213
|
+
topic: channelForm.value.topic || void 0,
|
|
214
|
+
type: "message",
|
|
215
|
+
viewMode: channelForm.value.viewMode,
|
|
216
|
+
ext: channelForm.value.ext || ""
|
|
217
|
+
});
|
|
218
|
+
message.success("创建成功");
|
|
219
|
+
if (newChannel) {
|
|
220
|
+
emit("selectChannel", newChannel);
|
|
221
|
+
}
|
|
222
|
+
await channelStore.getChannelsByPage({ serverId: curServer.value.serverId, timetag: 0, limit });
|
|
223
|
+
}
|
|
224
|
+
channelModalVisible.value = false;
|
|
225
|
+
} catch (error) {
|
|
226
|
+
const err = error;
|
|
227
|
+
message.error(err.message || (isEditChannelMode.value ? "修改失败" : "创建失败"));
|
|
228
|
+
} finally {
|
|
229
|
+
savingChannel.value = false;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const handleDeleteChannel = async () => {
|
|
233
|
+
if (!channelForm.value.channelId || !curServer.value) return;
|
|
234
|
+
Modal.confirm({
|
|
235
|
+
title: "确认删除",
|
|
236
|
+
content: `确定要删除频道「${channelForm.value.name}」吗?此操作不可恢复。`,
|
|
237
|
+
okText: "删除",
|
|
238
|
+
okType: "danger",
|
|
239
|
+
cancelText: "取消",
|
|
240
|
+
wrapClassName: "delete-channel-modal",
|
|
241
|
+
async onOk() {
|
|
242
|
+
var _a;
|
|
243
|
+
try {
|
|
244
|
+
await window.qchat.qchatChannel.deleteChannel({
|
|
245
|
+
channelId: channelForm.value.channelId
|
|
246
|
+
});
|
|
247
|
+
message.success("删除成功");
|
|
248
|
+
channelModalVisible.value = false;
|
|
249
|
+
await channelStore.getChannelsByPage({
|
|
250
|
+
serverId: curServer.value.serverId,
|
|
251
|
+
timetag: 0,
|
|
252
|
+
limit
|
|
253
|
+
});
|
|
254
|
+
if (((_a = currentChannel.value) == null ? void 0 : _a.channelId) === channelForm.value.channelId) {
|
|
255
|
+
if (channelStore.channelList.length > 0) {
|
|
256
|
+
emit("selectChannel", channelStore.channelList[0]);
|
|
257
|
+
} else {
|
|
258
|
+
channelStore.setCurChannel(null);
|
|
259
|
+
channelStore.clearCurChannelMsgs();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
} catch (error) {
|
|
263
|
+
const err = error;
|
|
264
|
+
message.error(err.message || "删除失败");
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
const handleShowInviteModal = async () => {
|
|
270
|
+
if (!curServer.value) {
|
|
271
|
+
message.warning("请先选择服务器");
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const res = await props.request({
|
|
275
|
+
url: `/api/v1/im/invite/generate`,
|
|
276
|
+
method: "POST",
|
|
277
|
+
data: {
|
|
278
|
+
server_id: curServer.value.serverId
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
console.log("res", res);
|
|
282
|
+
inviteCode.value = res.data.invite_code;
|
|
283
|
+
inviteModalVisible.value = true;
|
|
284
|
+
};
|
|
285
|
+
const handleUserSettings = async () => {
|
|
286
|
+
if (!curServer.value) {
|
|
287
|
+
message.warning("请先选择服务器");
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const res = await props.request({
|
|
291
|
+
url: `/api/v1/im/server/sync`,
|
|
292
|
+
method: "POST",
|
|
293
|
+
params: {
|
|
294
|
+
server_id: curServer.value.serverId
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
console.log("res", res);
|
|
298
|
+
if (res.status === 200) {
|
|
299
|
+
handleSelectServer(curServer.value);
|
|
300
|
+
message.success("同步成功");
|
|
301
|
+
} else {
|
|
302
|
+
message.error("同步失败");
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
const handleCopyInviteLink = async () => {
|
|
306
|
+
try {
|
|
307
|
+
await navigator.clipboard.writeText(inviteLink.value);
|
|
308
|
+
message.success("链接已复制到剪贴板");
|
|
309
|
+
} catch {
|
|
310
|
+
const textArea = document.createElement("textarea");
|
|
311
|
+
textArea.value = inviteLink.value;
|
|
312
|
+
document.body.appendChild(textArea);
|
|
313
|
+
textArea.select();
|
|
314
|
+
document.execCommand("copy");
|
|
315
|
+
document.body.removeChild(textArea);
|
|
316
|
+
message.success("链接已复制到剪贴板");
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
return (_ctx, _cache) => {
|
|
320
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
321
|
+
createElementVNode("div", _hoisted_2, [
|
|
322
|
+
createElementVNode("div", _hoisted_3, [
|
|
323
|
+
createElementVNode("div", _hoisted_4, [
|
|
324
|
+
createElementVNode("div", _hoisted_5, [
|
|
325
|
+
createVNode(unref(IconFont), {
|
|
326
|
+
type: "gt-logo-picture",
|
|
327
|
+
size: 20
|
|
328
|
+
})
|
|
329
|
+
])
|
|
330
|
+
]),
|
|
331
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(serverList.value, (server) => {
|
|
332
|
+
var _a;
|
|
333
|
+
return openBlock(), createElementBlock("div", {
|
|
334
|
+
key: server.serverId,
|
|
335
|
+
class: normalizeClass(["server-item", { active: ((_a = curServer.value) == null ? void 0 : _a.serverId) === server.serverId }]),
|
|
336
|
+
onClick: ($event) => handleSelectServer(server)
|
|
337
|
+
}, [
|
|
338
|
+
createVNode(unref(Tooltip), {
|
|
339
|
+
title: server.name,
|
|
340
|
+
placement: "right"
|
|
341
|
+
}, {
|
|
342
|
+
default: withCtx(() => [
|
|
343
|
+
createElementVNode("div", _hoisted_7, [
|
|
344
|
+
server.icon ? (openBlock(), createElementBlock("img", {
|
|
345
|
+
key: 0,
|
|
346
|
+
src: server.icon,
|
|
347
|
+
alt: server.name
|
|
348
|
+
}, null, 8, _hoisted_8)) : (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(getServerInitial(server.name)), 1))
|
|
349
|
+
])
|
|
350
|
+
]),
|
|
351
|
+
_: 2
|
|
352
|
+
}, 1032, ["title"]),
|
|
353
|
+
getServerUnread(server.serverId) > 0 ? (openBlock(), createBlock(unref(Badge), {
|
|
354
|
+
key: 0,
|
|
355
|
+
count: getServerUnread(server.serverId),
|
|
356
|
+
"overflow-count": 99,
|
|
357
|
+
class: "unread-badge"
|
|
358
|
+
}, null, 8, ["count"])) : createCommentVNode("", true)
|
|
359
|
+
], 10, _hoisted_6);
|
|
360
|
+
}), 128))
|
|
361
|
+
])
|
|
362
|
+
]),
|
|
363
|
+
createElementVNode("div", _hoisted_10, [
|
|
364
|
+
curServer.value ? (openBlock(), createElementBlock("div", _hoisted_11, [
|
|
365
|
+
createElementVNode("div", _hoisted_12, toDisplayString(curServer.value.name), 1),
|
|
366
|
+
userProfile.value.type === 1 ? (openBlock(), createBlock(unref(IconFont), {
|
|
367
|
+
key: 0,
|
|
368
|
+
type: "gt-a-line-2",
|
|
369
|
+
size: 20,
|
|
370
|
+
class: "invite-btn",
|
|
371
|
+
onClick: handleShowInviteModal
|
|
372
|
+
})) : createCommentVNode("", true)
|
|
373
|
+
])) : createCommentVNode("", true),
|
|
374
|
+
createElementVNode("div", _hoisted_13, [
|
|
375
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(channelList.value, (channel) => {
|
|
376
|
+
var _a;
|
|
377
|
+
return openBlock(), createElementBlock("div", {
|
|
378
|
+
key: channel.channelId,
|
|
379
|
+
class: normalizeClass(["channel-item", { active: ((_a = currentChannel.value) == null ? void 0 : _a.channelId) === channel.channelId }]),
|
|
380
|
+
onClick: ($event) => handleSelectChannel(channel)
|
|
381
|
+
}, [
|
|
382
|
+
_cache[11] || (_cache[11] = createElementVNode("span", { class: "channel-icon" }, "#", -1)),
|
|
383
|
+
createElementVNode("span", _hoisted_15, toDisplayString(channel.name), 1),
|
|
384
|
+
getChannelUnread(channel.channelId) > 0 ? (openBlock(), createBlock(unref(Badge), {
|
|
385
|
+
key: 0,
|
|
386
|
+
count: getChannelUnread(channel.channelId),
|
|
387
|
+
"overflow-count": 99,
|
|
388
|
+
class: "channel-unread"
|
|
389
|
+
}, null, 8, ["count"])) : createCommentVNode("", true),
|
|
390
|
+
createVNode(unref(SettingOutlined), {
|
|
391
|
+
class: "channel-setting",
|
|
392
|
+
onClick: withModifiers(($event) => handleShowEditChannelModal(channel), ["stop"])
|
|
393
|
+
}, null, 8, ["onClick"])
|
|
394
|
+
], 10, _hoisted_14);
|
|
395
|
+
}), 128)),
|
|
396
|
+
curServer.value && userProfile.value.type === 1 ? (openBlock(), createElementBlock("div", {
|
|
397
|
+
key: 0,
|
|
398
|
+
class: "add-channel-item",
|
|
399
|
+
onClick: handleShowChannelModal
|
|
400
|
+
}, [
|
|
401
|
+
createElementVNode("span", _hoisted_16, [
|
|
402
|
+
createVNode(unref(PlusOutlined))
|
|
403
|
+
]),
|
|
404
|
+
_cache[12] || (_cache[12] = createElementVNode("span", { class: "channel-name" }, "创建频道", -1))
|
|
405
|
+
])) : createCommentVNode("", true)
|
|
406
|
+
])
|
|
407
|
+
]),
|
|
408
|
+
createElementVNode("div", _hoisted_17, [
|
|
409
|
+
createElementVNode("div", _hoisted_18, [
|
|
410
|
+
createVNode(_sfc_main$1, {
|
|
411
|
+
avatar: userProfile.value.avatar,
|
|
412
|
+
nick: userProfile.value.nick,
|
|
413
|
+
accid: currentAccount.value,
|
|
414
|
+
width: 36,
|
|
415
|
+
border: 0
|
|
416
|
+
}, null, 8, ["avatar", "nick", "accid"])
|
|
417
|
+
]),
|
|
418
|
+
createElementVNode("div", _hoisted_19, [
|
|
419
|
+
createElementVNode("div", _hoisted_20, toDisplayString(userProfile.value.nick || currentAccount.value), 1),
|
|
420
|
+
_cache[13] || (_cache[13] = createElementVNode("div", { class: "user-status" }, [
|
|
421
|
+
createElementVNode("span", { class: "status-dot" }),
|
|
422
|
+
createTextVNode(" 在线 ")
|
|
423
|
+
], -1))
|
|
424
|
+
]),
|
|
425
|
+
createElementVNode("div", _hoisted_21, [
|
|
426
|
+
createVNode(unref(Tooltip), {
|
|
427
|
+
title: "同步用户资料",
|
|
428
|
+
placement: "left"
|
|
429
|
+
}, {
|
|
430
|
+
default: withCtx(() => [
|
|
431
|
+
createVNode(unref(IconFont), {
|
|
432
|
+
type: "gt-line-Refresh1",
|
|
433
|
+
class: "action-btn",
|
|
434
|
+
size: 16,
|
|
435
|
+
onClick: handleUserSettings
|
|
436
|
+
})
|
|
437
|
+
]),
|
|
438
|
+
_: 1
|
|
439
|
+
})
|
|
440
|
+
])
|
|
441
|
+
]),
|
|
442
|
+
createVNode(unref(Modal), {
|
|
443
|
+
open: inviteModalVisible.value,
|
|
444
|
+
"onUpdate:open": _cache[2] || (_cache[2] = ($event) => inviteModalVisible.value = $event),
|
|
445
|
+
footer: null,
|
|
446
|
+
closable: false,
|
|
447
|
+
"wrap-class-name": "invite-modal",
|
|
448
|
+
width: "440px",
|
|
449
|
+
onCancel: _cache[3] || (_cache[3] = ($event) => inviteModalVisible.value = false)
|
|
450
|
+
}, {
|
|
451
|
+
title: withCtx(() => {
|
|
452
|
+
var _a;
|
|
453
|
+
return [
|
|
454
|
+
createElementVNode("div", _hoisted_22, [
|
|
455
|
+
createElementVNode("div", _hoisted_23, [
|
|
456
|
+
createVNode(unref(IconFont), {
|
|
457
|
+
type: "gt-plane-Models-black",
|
|
458
|
+
class: "mr-[8px]"
|
|
459
|
+
}),
|
|
460
|
+
createTextVNode(" 邀请朋友加入 " + toDisplayString((_a = curServer.value) == null ? void 0 : _a.name), 1)
|
|
461
|
+
]),
|
|
462
|
+
createElementVNode("div", {
|
|
463
|
+
class: "header-close",
|
|
464
|
+
onClick: _cache[0] || (_cache[0] = ($event) => channelModalVisible.value = false)
|
|
465
|
+
}, [
|
|
466
|
+
createVNode(unref(CloseOutlined))
|
|
467
|
+
])
|
|
468
|
+
])
|
|
469
|
+
];
|
|
470
|
+
}),
|
|
471
|
+
default: withCtx(() => {
|
|
472
|
+
var _a;
|
|
473
|
+
return [
|
|
474
|
+
createElementVNode("div", _hoisted_24, [
|
|
475
|
+
createElementVNode("div", _hoisted_25, [
|
|
476
|
+
_cache[14] || (_cache[14] = createTextVNode(" 接收者将直接进入 ", -1)),
|
|
477
|
+
createElementVNode("span", _hoisted_26, "#" + toDisplayString(((_a = currentChannel.value) == null ? void 0 : _a.name) || "默认频道"), 1)
|
|
478
|
+
]),
|
|
479
|
+
_cache[16] || (_cache[16] = createElementVNode("div", { class: "invite-desc" }, "分享此链接以邀请其他人来本服务器!", -1)),
|
|
480
|
+
createElementVNode("div", _hoisted_27, [
|
|
481
|
+
createVNode(unref(Input), {
|
|
482
|
+
value: inviteLink.value,
|
|
483
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => inviteLink.value = $event),
|
|
484
|
+
readonly: "",
|
|
485
|
+
class: "invite-link-input"
|
|
486
|
+
}, null, 8, ["value"]),
|
|
487
|
+
createVNode(unref(Button), {
|
|
488
|
+
type: "primary",
|
|
489
|
+
class: "copy-btn",
|
|
490
|
+
onClick: handleCopyInviteLink
|
|
491
|
+
}, {
|
|
492
|
+
default: withCtx(() => [..._cache[15] || (_cache[15] = [
|
|
493
|
+
createTextVNode(" 复制 ", -1)
|
|
494
|
+
])]),
|
|
495
|
+
_: 1
|
|
496
|
+
})
|
|
497
|
+
])
|
|
498
|
+
])
|
|
499
|
+
];
|
|
500
|
+
}),
|
|
501
|
+
_: 1
|
|
502
|
+
}, 8, ["open"]),
|
|
503
|
+
createVNode(unref(Modal), {
|
|
504
|
+
open: channelModalVisible.value,
|
|
505
|
+
"onUpdate:open": _cache[9] || (_cache[9] = ($event) => channelModalVisible.value = $event),
|
|
506
|
+
"confirm-loading": savingChannel.value,
|
|
507
|
+
"wrap-class-name": "channel-modal",
|
|
508
|
+
onOk: handleSaveChannel,
|
|
509
|
+
onCancel: _cache[10] || (_cache[10] = ($event) => channelModalVisible.value = false)
|
|
510
|
+
}, {
|
|
511
|
+
title: withCtx(() => [
|
|
512
|
+
createElementVNode("div", _hoisted_28, [
|
|
513
|
+
createElementVNode("div", _hoisted_29, [
|
|
514
|
+
createVNode(unref(IconFont), {
|
|
515
|
+
type: "gt-plane-Models-black",
|
|
516
|
+
class: "mr-[8px]"
|
|
517
|
+
}),
|
|
518
|
+
createTextVNode(" " + toDisplayString(isEditChannelMode.value ? "修改频道信息" : "创建频道"), 1)
|
|
519
|
+
]),
|
|
520
|
+
createElementVNode("div", {
|
|
521
|
+
class: "header-close",
|
|
522
|
+
onClick: _cache[7] || (_cache[7] = ($event) => channelModalVisible.value = false)
|
|
523
|
+
}, [
|
|
524
|
+
createVNode(unref(CloseOutlined))
|
|
525
|
+
])
|
|
526
|
+
])
|
|
527
|
+
]),
|
|
528
|
+
footer: withCtx(() => [
|
|
529
|
+
createElementVNode("div", _hoisted_30, [
|
|
530
|
+
createVNode(unref(Checkbox), {
|
|
531
|
+
checked: channelForm.value.viewMode === 1,
|
|
532
|
+
onChange: _cache[8] || (_cache[8] = (e) => channelForm.value.viewMode = e.target.checked ? 1 : 0)
|
|
533
|
+
}, {
|
|
534
|
+
default: withCtx(() => [..._cache[17] || (_cache[17] = [
|
|
535
|
+
createTextVNode(" 私密频道丨只有白名单成员能够查看此频道 ", -1)
|
|
536
|
+
])]),
|
|
537
|
+
_: 1
|
|
538
|
+
}, 8, ["checked"]),
|
|
539
|
+
createElementVNode("div", _hoisted_31, [
|
|
540
|
+
isEditChannelMode.value ? (openBlock(), createBlock(unref(Button), {
|
|
541
|
+
key: 0,
|
|
542
|
+
danger: "",
|
|
543
|
+
onClick: handleDeleteChannel
|
|
544
|
+
}, {
|
|
545
|
+
default: withCtx(() => [..._cache[18] || (_cache[18] = [
|
|
546
|
+
createTextVNode("删除", -1)
|
|
547
|
+
])]),
|
|
548
|
+
_: 1
|
|
549
|
+
})) : createCommentVNode("", true),
|
|
550
|
+
createVNode(unref(Button), {
|
|
551
|
+
type: "primary",
|
|
552
|
+
onClick: handleSaveChannel
|
|
553
|
+
}, {
|
|
554
|
+
default: withCtx(() => [
|
|
555
|
+
createTextVNode(toDisplayString(isEditChannelMode.value ? "保存" : "创建"), 1)
|
|
556
|
+
]),
|
|
557
|
+
_: 1
|
|
558
|
+
})
|
|
559
|
+
])
|
|
560
|
+
])
|
|
561
|
+
]),
|
|
562
|
+
default: withCtx(() => [
|
|
563
|
+
createVNode(unref(Form), { layout: "vertical" }, {
|
|
564
|
+
default: withCtx(() => [
|
|
565
|
+
createVNode(unref(FormItem), {
|
|
566
|
+
label: "频道名称",
|
|
567
|
+
rules: [{ required: true }]
|
|
568
|
+
}, {
|
|
569
|
+
default: withCtx(() => [
|
|
570
|
+
createVNode(unref(Input), {
|
|
571
|
+
value: channelForm.value.name,
|
|
572
|
+
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => channelForm.value.name = $event),
|
|
573
|
+
placeholder: "请输入频道名称"
|
|
574
|
+
}, null, 8, ["value"])
|
|
575
|
+
]),
|
|
576
|
+
_: 1
|
|
577
|
+
}),
|
|
578
|
+
createVNode(unref(FormItem), { label: "频道主题" }, {
|
|
579
|
+
default: withCtx(() => [
|
|
580
|
+
createVNode(unref(Input), {
|
|
581
|
+
value: channelForm.value.topic,
|
|
582
|
+
"onUpdate:value": _cache[5] || (_cache[5] = ($event) => channelForm.value.topic = $event),
|
|
583
|
+
placeholder: "频道介绍"
|
|
584
|
+
}, null, 8, ["value"])
|
|
585
|
+
]),
|
|
586
|
+
_: 1
|
|
587
|
+
}),
|
|
588
|
+
createVNode(unref(FormItem), { label: "频道公告" }, {
|
|
589
|
+
default: withCtx(() => [
|
|
590
|
+
createVNode(unref(Input), {
|
|
591
|
+
value: channelForm.value.ext,
|
|
592
|
+
"onUpdate:value": _cache[6] || (_cache[6] = ($event) => channelForm.value.ext = $event),
|
|
593
|
+
placeholder: "请输入频道公告"
|
|
594
|
+
}, null, 8, ["value"])
|
|
595
|
+
]),
|
|
596
|
+
_: 1
|
|
597
|
+
})
|
|
598
|
+
]),
|
|
599
|
+
_: 1
|
|
600
|
+
})
|
|
601
|
+
]),
|
|
602
|
+
_: 1
|
|
603
|
+
}, 8, ["open", "confirm-loading"])
|
|
604
|
+
]);
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
const ServerChannelSidebar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2cae689d"]]);
|
|
609
|
+
export {
|
|
610
|
+
ServerChannelSidebar as S
|
|
611
|
+
};
|