From 82c7673a4960d02cda77adfee8bbd6db26231525 Mon Sep 17 00:00:00 2001 From: 728 Date: Tue, 31 Oct 2023 23:52:17 +0800 Subject: [PATCH] cdt #43 --- ismism.ts/ui/bind/section.ts | 35 ++++++++++++++++++++++---------- ismism.ts/ui/bind/template.ts | 2 +- ismism.ts/ui/index/template.html | 1 + 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ismism.ts/ui/bind/section.ts b/ismism.ts/ui/bind/section.ts index ec3abea..ba5a6b3 100644 --- a/ismism.ts/ui/bind/section.ts +++ b/ismism.ts/ui/bind/section.ts @@ -136,6 +136,11 @@ export function dtl( s += `\n生效日期:${utc_dt(eft)}\n失效日期:${utc_dt(exp)}` if (eft > Date.now()) d.msg.classList.add("green") } + if ("aug" in r && r.aug) s += `\n\n追加积分:\n\n` + + (r.aug as NonNullable).map(a => + `${utc_dt(a.utc)}(联络员:${usr.get(a.sec!)}#${a.sec})\n` + + `${a.msg}:${a.amt > 0 ? "+" : ""}${a.amt}` + ).join("\n\n") d.msg.innerText = s if (q.que == "dbt" && !r.sec) d.msg.classList.add("green") if (pas && is_in(pas.sec, r._id.soc)) { @@ -151,17 +156,25 @@ export function dtl( d.fin.remove() } else d.clr.disabled = false }) - if (q.que == "dbt" && !r.sec) { - d.fin.addEventListener("click", async () => { - d.fin.disabled = true - const p = await pos({ put: "dbt", id: r._id, sec: pas.usr }) - if (p) { - d.mta.innerText += `(联络员:${pas.nam}#${pas.usr})` - d.msg.classList.remove("green") - d.fin.remove() - } else d.fin.disabled = false - }) - } else d.fin.remove() + if (q.que == "dbt" && !r.sec) d.fin.addEventListener("click", async () => { + d.fin.disabled = true + const p = await pos({ put: "dbt", id: r._id, sec: pas.usr }) + if (p) { + d.mta.innerText += `(联络员:${pas.nam}#${pas.usr})` + d.msg.classList.remove("green") + d.fin.remove() + } else d.fin.disabled = false + }); else d.fin.remove() + if (q.que == "cdt" && r.sec) d.aug.addEventListener("click", () => { + const [msg, amt] = [ + put_s("积分类型:(如 '积分奖励')"), + put_s("积分额度:(整数)"), + ] + const btn = btn_pos(pas, `#s${r._id.soc}`, () => ({ + put: "cdt", id: r._id, msg: msg.val(), amt: parseInt(amt.val()) + })) + article(msg.bind, amt.bind, btn) + }); else d.aug.remove() } else[d.clr, d.fin].forEach(el => el.remove()) b.dtl.append(d.bind) }) diff --git a/ismism.ts/ui/bind/template.ts b/ismism.ts/ui/bind/template.ts index ada78bc..705c53e 100644 --- a/ismism.ts/ui/bind/template.ts +++ b/ismism.ts/ui/bind/template.ts @@ -21,7 +21,7 @@ const template = { sms: { nbr: tag("input"), sms: tag("button"), hint: tag("p") }, code: { code: tag("input"), send: tag("button") }, dtl: { dtl: tag("p") }, - rec: { usr: tag("a"), soc: tag("a"), mta: tag("section"), msg: tag("section"), clr: tag("button"), fin: tag("button") }, + rec: { usr: tag("a"), soc: tag("a"), mta: tag("section"), msg: tag("section"), clr: tag("button"), fin: tag("button"), aug: tag("button") }, put_s: { str: tag("input") }, put_adm: { adm1: tag("select"), adm2: tag("select") }, put_t: { txt: tag("textarea") }, diff --git a/ismism.ts/ui/index/template.html b/ismism.ts/ui/index/template.html index 92e88ba..7e3af0b 100644 --- a/ismism.ts/ui/index/template.html +++ b/ismism.ts/ui/index/template.html @@ -47,6 +47,7 @@
+