mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: 比赛广播消息时显示发送者uid
This commit is contained in:
1 parent
923d10fb84
commit
549c68cfa4
7 files changed
+35
-27
No files matched your search
@@ -2,14 +2,19 @@ import { AutoloadPage } from 'vj/misc/Page';
|
||||
import request from 'vj/utils/request';
|
||||
|
||||
export default new AutoloadPage('media', async () => {
|
||||
const items = [];
|
||||
const resolvers = [];
|
||||
const users = $('div[data-user]');
|
||||
users.get().forEach((ele) => {
|
||||
items.push({ type: 'user', id: $(ele).text() });
|
||||
resolvers.push((html) => $(ele).replaceWith($(html)));
|
||||
});
|
||||
if (!items.length) return;
|
||||
const res = await request.post('/media', { items });
|
||||
for (let i = 0; i < res.length; i++) resolvers[i](res[i]);
|
||||
async function parseMedia($dom = $(document.body)) {
|
||||
const items = [];
|
||||
const resolvers = [];
|
||||
const users = $dom.find('div[data-user]');
|
||||
users.get().forEach((ele) => {
|
||||
items.push({ type: 'user', id: $(ele).text() });
|
||||
resolvers.push((html) => $(ele).replaceWith($(html)));
|
||||
});
|
||||
if (!items.length) return;
|
||||
const res = await request.post('/media', { items });
|
||||
for (let i = 0; i < res.length; i++) resolvers[i](res[i]);
|
||||
}
|
||||
|
||||
await parseMedia();
|
||||
$(document).on('vjContentNew', (e) => parseMedia($(e.target)));
|
||||
});
|
||||
Reference in new issue
Block a user