ui soc #15
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
// deno-lint-ignore-file no-window-prefix
|
// deno-lint-ignore-file no-window-prefix
|
||||||
import { Agenda, Rec, User } from "../../../cli/json.ts"
|
import { Agenda, Rec, Soc, User } from "../../../cli/json.ts"
|
||||||
import { utc_medium, utc_short } from "../../src/date.ts"
|
import { utc_medium, utc_short } from "../../src/date.ts"
|
||||||
import { Goal, Tag, Rec as Id } from "../../src/typ.ts"
|
import { Goal, Tag, Rec as Id } from "../../src/typ.ts"
|
||||||
|
|
||||||
@ -167,7 +167,6 @@ function erec(
|
|||||||
const count = [work.rec.length, worker.rec.length, fund.rec.length]
|
const count = [work.rec.length, worker.rec.length, fund.rec.length]
|
||||||
b.forEach((btn, n) => {
|
b.forEach((btn, n) => {
|
||||||
btn.getElementsByTagName("span")[0].innerText = `${count[n]}`
|
btn.getElementsByTagName("span")[0].innerText = `${count[n]}`
|
||||||
d[n].style.display = "none"
|
|
||||||
btn.addEventListener("click", () => toggle(btn, d[n]))
|
btn.addEventListener("click", () => toggle(btn, d[n]))
|
||||||
})
|
})
|
||||||
const role = new Map(worker.rec.map(r => [r.uid, r.role]))
|
const role = new Map(worker.rec.map(r => [r.uid, r.role]))
|
||||||
@ -267,10 +266,45 @@ function euser(
|
|||||||
|
|
||||||
if (soc.length === 0) csoc.innerText += "无"
|
if (soc.length === 0) csoc.innerText += "无"
|
||||||
else for (const s of soc) {
|
else for (const s of soc) {
|
||||||
const [_, [a]] = template("member", ["member"]);
|
const a = csoc.appendChild(document.createElement("a"))
|
||||||
(a as HTMLAnchorElement).href = `#s${s._id}`
|
a.classList.add("member-soc")
|
||||||
|
a.href = `#s${s._id}`
|
||||||
a.innerText = s.name
|
a.innerText = s.name
|
||||||
csoc.appendChild(a)
|
}
|
||||||
|
|
||||||
|
erec([bwork, bworker, bfund], [dwork, dworker, dfund], rec)
|
||||||
|
|
||||||
|
el.appendChild(t)
|
||||||
|
}
|
||||||
|
function esoc(
|
||||||
|
el: HTMLElement,
|
||||||
|
sid: number,
|
||||||
|
{ name, utc, uid, uname, rec }: Soc
|
||||||
|
) {
|
||||||
|
el.innerHTML = ""
|
||||||
|
const [t, [
|
||||||
|
cidname, cid, cname, cdate, cuser,
|
||||||
|
bwork, bworker, bfund, dwork, dworker, dfund,
|
||||||
|
]] = template("soc", [
|
||||||
|
"idname", "id", "name", "date", "user",
|
||||||
|
"tab.work", "tab.worker", "tab.fund", "rec.work", "rec.worker", "rec.fund",
|
||||||
|
]);
|
||||||
|
|
||||||
|
(cidname as HTMLAnchorElement).href = `#s${sid}`
|
||||||
|
cid.innerText = `s${sid}`
|
||||||
|
if (hash === cid.innerText) cid.classList.add("darkgray")
|
||||||
|
else cid.classList.remove("darkgray")
|
||||||
|
cname.innerText = name
|
||||||
|
cdate.innerText = `注册时间: ${utc_medium(utc)}`
|
||||||
|
|
||||||
|
const user = new Map(uname)
|
||||||
|
cuser.innerText = uid.length === 0 ? "社团成员:无" : `社团成员(${uid.length}):`
|
||||||
|
for (const u of uid) {
|
||||||
|
const a = cuser.appendChild(document.createElement("a"))
|
||||||
|
a.classList.add("member-user")
|
||||||
|
a.href = `#u${u}`
|
||||||
|
a.innerText = user.get(u)!
|
||||||
|
cuser.appendChild(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
erec([bwork, bworker, bfund], [dwork, dworker, dfund], rec)
|
erec([bwork, bworker, bfund], [dwork, dworker, dfund], rec)
|
||||||
@ -284,7 +318,7 @@ window.addEventListener("hashchange", () => {
|
|||||||
const main = document.getElementById("main")!
|
const main = document.getElementById("main")!
|
||||||
switch (hash[0]) {
|
switch (hash[0]) {
|
||||||
case "u": json(hash).then(u => euser(main, parseInt(hash.substring(1)), u)); break
|
case "u": json(hash).then(u => euser(main, parseInt(hash.substring(1)), u)); break
|
||||||
case "s": break
|
case "s": json(hash).then(s => esoc(main, parseInt(hash.substring(1)), s)); break
|
||||||
case "a": eagenda(main, agenda.filter(a =>
|
case "a": eagenda(main, agenda.filter(a =>
|
||||||
a._id === parseInt(hash.substring(1))
|
a._id === parseInt(hash.substring(1))
|
||||||
)); break
|
)); break
|
||||||
|
@ -149,12 +149,21 @@
|
|||||||
background: var(--purple);
|
background: var(--purple);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.member {
|
a.member-soc {
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
background: var(--black);
|
background: var(--black);
|
||||||
|
margin: 0.5ch 0.5ch 0 0;
|
||||||
padding: 0.1em 8px;
|
padding: 0.1em 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.member-user::after {
|
||||||
|
content: ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
a.member-user:last-child:after {
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
|
||||||
button.photo-prev,
|
button.photo-prev,
|
||||||
button.photo-next,
|
button.photo-next,
|
||||||
button.tab {
|
button.tab {
|
||||||
@ -178,7 +187,8 @@
|
|||||||
a.video:hover,
|
a.video:hover,
|
||||||
a.detail:hover,
|
a.detail:hover,
|
||||||
a.initial:hover,
|
a.initial:hover,
|
||||||
a.uname:hover {
|
a.uname:hover,
|
||||||
|
a.member-user:hover {
|
||||||
color: var(--amber);
|
color: var(--amber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +198,7 @@
|
|||||||
|
|
||||||
a.tag:hover,
|
a.tag:hover,
|
||||||
a.aname:hover,
|
a.aname:hover,
|
||||||
a.member:hover,
|
a.member-soc:hover,
|
||||||
button.photo-prev:hover,
|
button.photo-prev:hover,
|
||||||
button.photo-next:hover,
|
button.photo-next:hover,
|
||||||
button.tab:hover {
|
button.tab:hover {
|
||||||
@ -402,6 +412,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.rec {
|
div.rec {
|
||||||
|
display: none;
|
||||||
background: var(--lightgray);
|
background: var(--lightgray);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
padding: 16px 8px;
|
padding: 16px 8px;
|
||||||
@ -535,7 +546,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template id="video"><a href="" target="_blank" rel="noopener" class="video">title</a></template>
|
<template id="video"><a href="" target="_blank" rel="noopener" class="video">title</a></template>
|
||||||
<template id="member"><a class="member">member</a></template>
|
|
||||||
<template id="agenda">
|
<template id="agenda">
|
||||||
<article>
|
<article>
|
||||||
<section>
|
<section>
|
||||||
@ -607,6 +617,25 @@
|
|||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
|
<template id="soc">
|
||||||
|
<article>
|
||||||
|
<section>
|
||||||
|
<a class="idname"><code class="id">id</code> <span class="name">name</span></a>
|
||||||
|
<div class="date">date</div>
|
||||||
|
<div class="user">社团成员:</div>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<div class="rec-tab">
|
||||||
|
<button class="tab work"><span>123</span> 条工作日志 ❯</button>
|
||||||
|
<button class="tab worker"><span>123</span> 次活动参与 ❯</button>
|
||||||
|
<button class="tab fund"><span>123</span> 次活动支持 ❯</button>
|
||||||
|
</div>
|
||||||
|
<div class="rec work"></div>
|
||||||
|
<div class="rec worker"></div>
|
||||||
|
<div class="rec fund"></div>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
Reference in New Issue
Block a user