From ffe7251026e923ea83e16fd3684c8f4cd477a6a7 Mon Sep 17 00:00:00 2001 From: Kokomi <102026640+yoimiya-kokomi@users.noreply.github.com> Date: Thu, 29 Jun 2023 04:18:38 +0800 Subject: [PATCH] =?UTF-8?q?UID=E5=88=97=E8=A1=A8=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=9B=BE=E5=83=8F=E8=BF=9B=E8=A1=8C=E6=B8=B2=E6=9F=93=EF=BC=8C?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=B0=9A=E6=9C=AA=E5=AE=8C=E5=85=A8=E7=A8=B3?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/model/db/UserDB.js | 15 +- plugins/genshin/model/user.js | 20 +- .../genshin/resources/html/user/uid-list.css | 168 +++++++++++++-- .../genshin/resources/html/user/uid-list.html | 50 +++-- .../genshin/resources/html/user/uid-list.less | 195 ++++++++++++++++-- 5 files changed, 399 insertions(+), 49 deletions(-) diff --git a/plugins/genshin/model/db/UserDB.js b/plugins/genshin/model/db/UserDB.js index 604e381..c06c1e5 100644 --- a/plugins/genshin/model/db/UserDB.js +++ b/plugins/genshin/model/db/UserDB.js @@ -76,7 +76,20 @@ class UserDB extends BaseModel { } }) db.ltuids = ltuids.join(',') - db.games = user._games + let games = {} + lodash.forEach(user._games, (gameDs, game) => { + games[game] = { + uid: gameDs.uid, + data: {} + } + lodash.forEach(gameDs.data, (ds, uid) => { + games[game].data[uid] = { + uid: ds.uid, + type: ds.type + } + }) + }) + db.games = games await this.save() } } diff --git a/plugins/genshin/model/user.js b/plugins/genshin/model/user.js index 3b144cb..0aed94c 100644 --- a/plugins/genshin/model/user.js +++ b/plugins/genshin/model/user.js @@ -191,7 +191,7 @@ export default class User extends base { } /** #uid */ - async showUid () { + async showUid_bak () { let user = await this.user() let msg = [] let typeMap = { ck: 'CK Uid', reg: '绑定 Uid' } @@ -216,7 +216,7 @@ export default class User extends base { } /** #uid */ - async showUid2 () { + async showUid () { let user = await this.user() let uids = [{ key: 'gs', @@ -233,6 +233,9 @@ export default class User extends base { if (player) { uidDs.name = player.name uidDs.level = player.level + let imgs = player?.faceImgs || {} + uidDs.face = imgs.face + uidDs.banner = imgs.banner } }) }) @@ -425,13 +428,14 @@ export default class User extends base { await user.save() if (fs.existsSync(`./data/MysCookie/${qq}.yaml`)) { try { - let src = `./data/MysCookie/${qq}.yaml`; - let dest = `./temp/MysCookieBak/${qq}.yaml`; - await fs.promises.unlink(dest).catch((_) => { }); - await fs.promises.copyFile(src, dest); - await fs.promises.unlink(src); + let src = `./data/MysCookie/${qq}.yaml` + let dest = `./temp/MysCookieBak/${qq}.yaml` + await fs.promises.unlink(dest).catch((_) => { + }) + await fs.promises.copyFile(src, dest) + await fs.promises.unlink(src) } catch (err) { - console.log(err); + console.log(err) } } count++ diff --git a/plugins/genshin/resources/html/user/uid-list.css b/plugins/genshin/resources/html/user/uid-list.css index f61bb23..52c7584 100644 --- a/plugins/genshin/resources/html/user/uid-list.css +++ b/plugins/genshin/resources/html/user/uid-list.css @@ -1,21 +1,165 @@ -.uid-list { - display: flex; +.container { + width: 500px; } -.uid-list .cont { - background: rgba(0, 0, 0, 0.5); - margin: 5px; - width: 50%; +.uid-list .game-cont { + background: rgba(255, 255, 255, 0.65); + margin: 0 0 10px; + border-radius: 10px; + overflow: hidden; } -.uid-list .cont .cont-body { +.uid-list .game-cont .game-title { + font-size: 16px; + background: rgba(255, 255, 255, 0.8); + padding: 8px 15px 5px; +} +.uid-list .game-cont .game-title strong { + margin-right: 15px; +} +.uid-list .game-cont .game-title span { + font-size: 12px; + color: #888; +} +.uid-list .game-cont .game-title nobr { + font-size: 12px; + background: #888; + color: #fff; + display: inline-block; + padding: 1px 2px; + border-radius: 3px; + margin: 0 1px; +} +.uid-list .game-cont .cont-body { background: none; padding: 0; } -.uid-list li { - list-style: none; - display: flex; - height: 30px; +.uid-list .game-ul { + padding: 8px; +} +.uid-list .game-idx { + height: 50px; + padding: 13px 0; + margin-right: 5px; +} +.uid-list .game-idx span { + display: block; + width: 18px; + height: 22px; + border-radius: 6px; + background: #fff; + text-align: center; + font-size: 14px; + line-height: 22px; +} +.uid-list .game-bar { + height: 50px; line-height: 30px; margin: 0; - border-radius: 5px; + border-radius: 25px; + background: right top no-repeat #f0ece4; + background-size: auto 100%; + padding: 3px; + width: 425px; + display: flex; + position: relative; +} +.uid-list .game-bar .face { + width: 44px; + height: 44px; + border-radius: 22px; + box-shadow: 0 0 1px #000, 0 0 5px rgba(0, 0, 0, 0.5); + border: 1px solid #fff; + overflow: hidden; + background-size: cover; +} +.uid-list .game-bar .face span { + display: block; + width: 64px; + height: 64px; + background-size: auto 100%; + background-repeat: no-repeat; +} +.uid-list .game-bar .info { + padding: 4px 10px; + line-height: 18px; + color: #414e64; +} +.uid-list .game-bar .info .uid { + font-size: 16px; + display: flex; +} +.uid-list .game-bar .info .uid span { + display: block; + padding-right: 5px; +} +.uid-list .game-bar .info .uid strong { + width: 35px; + font-size: 12px; + font-weight: normal; + background: #4a5366; + height: 18px; + display: block; + text-align: center; + border-radius: 4px; + color: #fff; + vertical-align: middle; + transform: scale(0.9); +} +.uid-list .game-bar .info .uid strong.ck { + background: #d3bc8e; + color: #3a2702; + font-weight: bold; + box-shadow: 0 0 3px 0 #000; +} +.uid-list .game-bar .info .uid strong.reg { + background: #666; +} +.uid-list .game-bar .info .name { + font-size: 16px; +} +.uid-list .game-bar .info .no-info { + font-size: 12px; + color: #555; +} +.uid-list .game-bar:after { + display: block; + content: ""; + width: 28px; + height: 28px; + border-radius: 50%; + border: 2px solid #ece5d8; + opacity: 0; + box-shadow: 0 0 1px #000, 0 0 5px rgba(0, 0, 0, 0.5); + position: absolute; + right: 8px; + top: 8px; +} +.uid-list .game-li { + display: flex; + margin-bottom: 10px; +} +.uid-list .game-li:last-child { + margin-bottom: 0; +} +.uid-list .game-li.active .game-bar:after { + opacity: 1; + background: url('../../img/icon/check.webp') center center no-repeat #4a5366; + background-size: 70% auto; +} +.tips { + background: rgba(255, 255, 255, 0.8); + border-radius: 10px; + font-size: 12px; + padding: 8px 12px; + color: #555; + margin-bottom: 10px; +} +.tips nobr { + font-size: 12px; + background: #555; + color: #fff; + display: inline-block; + padding: 1px 2px; + border-radius: 3px; + margin: 0 1px; } /*# sourceMappingURL=uid-list.css.map */ \ No newline at end of file diff --git a/plugins/genshin/resources/html/user/uid-list.html b/plugins/genshin/resources/html/user/uid-list.html index d4fb8ad..0435f30 100644 --- a/plugins/genshin/resources/html/user/uid-list.html +++ b/plugins/genshin/resources/html/user/uid-list.html @@ -9,31 +9,51 @@ gs:{mark:'#'}, sr:{mark:'*'} }; }} -
-
111
+ +
+ #开头为原神,*开头为星穹铁道。发送CK可绑定CK对应uid
+ #删除uid1 + 删除指定序号uid + + #绑定123456789 + 绑定对应uid
+
{{each uids game}} {{set mark = game.key==='gs'? '#':'*'}} -
-
{{game.name}}{{mark}}uid+序号切换
-
- +
+
{{game.name}}使用{{mark}}uid1切换uid +
+
{{each game.uidList uid idx}} -
-
{{idx+1}}
- {{if uid.name && uid.level}} -
{{uid.name}} (Lv.{{uid.level}})
- {{/if}} -
- {{uid.type==='ck'?'CK':'绑定'}} - {{uid.uid}} +
+
+ {{idx+1}} +
+
+
+
+
+ {{uid.uid}} + {{uid.type==='ck'?'CK':'绑定'}} +
+ {{if uid.name && uid.level}} +
+
{{uid.name}} Lv.{{uid.level}}
+
+ {{else}} +
暂无uid信息
+ {{/if}} +
{{/each}} -
+
{{/each}}
+ + {{/block}} \ No newline at end of file diff --git a/plugins/genshin/resources/html/user/uid-list.less b/plugins/genshin/resources/html/user/uid-list.less index 60265b9..75abff8 100644 --- a/plugins/genshin/resources/html/user/uid-list.less +++ b/plugins/genshin/resources/html/user/uid-list.less @@ -1,11 +1,40 @@ +.container { + width: 500px; +} .uid-list { - display: flex; - .cont { - background: rgba(0, 0, 0, 0.5); - margin: 5px; - width: 50%; + .game-cont { + background: rgba(255, 255, 255, .65); + margin: 0 0 10px; + border-radius: 10px; + overflow: hidden; + + .game-title { + font-size: 16px; + background: rgba(255, 255, 255, .8); + padding: 8px 15px 5px; + + + strong { + margin-right: 15px; + } + + span { + font-size: 12px; + color: #888; + } + + nobr { + font-size: 12px; + background: #888; + color: #fff; + display: inline-block; + padding: 1px 2px; + border-radius: 3px; + margin: 0 1px; + } + } .cont-body { background: none; @@ -13,16 +42,156 @@ } } - li { - list-style: none; - display: flex; - height: 30px; - line-height: 30px; - margin: 0; - border-radius: 5px; + .game-ul { + padding: 8px; + } - strong { + .game-idx { + height: 50px; + padding: 13px 0; + margin-right: 5px; + span { + display: block; + width: 18px; + height: 22px; + border-radius: 6px; + background: #fff; + text-align: center; + font-size: 14px; + line-height: 22px; } } + + .game-bar { + height: 50px; + line-height: 30px; + margin: 0; + border-radius: 25px; + background: right top no-repeat #f0ece4; + background-size: auto 100%; + padding: 3px; + width: 425px; + display: flex; + position: relative; + + .face { + width: 44px; + height: 44px; + border-radius: 22px; + box-shadow: 0 0 1px #000, 0 0 5px rgba(0, 0, 0, .5); + border: 1px solid #fff; + overflow: hidden; + background-size: cover; + + span { + display: block; + width: 64px; + height: 64px; + background-size: auto 100%; + background-repeat: no-repeat; + } + } + + .info { + padding: 4px 10px; + line-height: 18px; + color: #414e64; + + .uid { + font-size: 16px; + display: flex; + + span { + display: block; + padding-right: 5px; + } + + strong { + width: 35px; + font-size: 12px; + font-weight: normal; + background: #4a5366; + height: 18px; + display: block; + text-align: center; + border-radius: 4px; + color: #fff; + vertical-align: middle; + transform: scale(.9); + + &.ck { + background: #d3bc8e; + color: #3a2702; + font-weight: bold; + box-shadow: 0 0 3px 0 #000; + } + + &.reg { + background: #666; + } + } + } + + .name { + font-size: 16px; + } + + .no-info { + font-size: 12px; + color: #555; + } + } + + &:after { + display: block; + content: ""; + width: 28px; + height: 28px; + border-radius: 50%; + border: 2px solid #ece5d8; + opacity: 0; + box-shadow: 0 0 1px #000, 0 0 5px rgba(0, 0, 0, .5); + position: absolute; + right: 8px; + top: 8px; + } + } + + .game-li { + display: flex; + margin-bottom: 10px; + + &:last-child { + margin-bottom: 0; + } + + &.active { + .game-bar:after { + opacity: 1; + background: url('../../img/icon/check.webp') center center no-repeat #4a5366; + background-size: 70% auto; + } + } + } +} + +.tips { + background: rgba(255, 255, 255, .8); + border-radius: 10px; + font-size: 12px; + padding: 8px 12px; + color: #555; + margin-bottom: 10px; + + + nobr { + font-size: 12px; + background: #555; + color: #fff; + display: inline-block; + padding: 1px 2px; + border-radius: 3px; + margin: 0 1px; + } } \ No newline at end of file