diff --git a/apps/character/avatar-card.js b/apps/character/avatar-card.js index 1755128f..0476662f 100644 --- a/apps/character/avatar-card.js +++ b/apps/character/avatar-card.js @@ -62,21 +62,28 @@ async function renderCard (e, ds, renderType = 'card') { // 计算皇冠个数 data.crownNum = lodash.filter(lodash.map(data.talent, (d) => d.original), (d) => d >= 10).length } + } else { + data = char.getData('id,name,sName') } let width = 600 + let imgCss = '' + let scale = 1.2 if (bg.mode === 'left') { - width = 600 * bg.width / bg.height + const height = 480 + width = height * bg.width / bg.height + imgCss = `img.bg{width:auto;height:${height}px;}` + scale = 1.45 } // 渲染图像 let msgRes = await Common.render('character/character-card', { saveId: uid, uid, bg, - widthStyle: ``, + widthStyle: ``, mode: bg.mode, custom, data - }, { e, scale: 1.4, retMsgId: true }) + }, { e, scale, retMsgId: true }) if (msgRes && msgRes.message_id) { // 如果消息发送成功,就将message_id和图片路径存起来,1小时过期 await redis.set(`miao:original-picture:${msgRes.message_id}`, bg.img, { EX: 3600 }) diff --git a/components/Data.js b/components/Data.js index 3fdafb03..08759177 100644 --- a/components/Data.js +++ b/components/Data.js @@ -91,6 +91,11 @@ let Data = { return {} }, + async importDefault (file, root) { + let ret = await Data.importModule(file, root) + return ret.default || {} + }, + async import (name) { return await Data.importModule(`components/optional-lib/${name}.js`) }, diff --git a/models/Artifact.js b/models/Artifact.js index d758960f..a03b0ec1 100644 --- a/models/Artifact.js +++ b/models/Artifact.js @@ -3,6 +3,7 @@ import lodash from 'lodash' import { Data } from '../components/index.js' let artisMap = {} +const abbr = await Data.importDefault('resources/meta/reliquaries/abbr.js') async function init () { let artis = Data.readJSON('resources/meta/reliquaries/data.json') @@ -14,46 +15,6 @@ async function init () { await init() -const abbr = { - 炽烈的炎之魔女: '魔女', - 昔日宗室之仪: '宗室', - 翠绿之影: '风套', - 千岩牢固: '千岩', - 流浪大地的乐团: '乐团', - 绝缘之旗印: '绝缘', - 被怜爱的少女: '少女', - 沉沦之心: '水套', - 角斗士的终幕礼: '角斗', - 冰风迷途的勇士: '冰套', - 逆飞的流星: '逆飞', - 苍白之火: '苍白', - 华馆梦醒形骸记: '华馆', - 战狂: '战狂', - 悠古的磐岩: '岩套', - 渡过烈火的贤人: '渡火', - 游医: '游医', - 教官: '教官', - 冒险家: '冒险', - 追忆之注连: '追忆', - 海染砗磲: '海染', - 如雷的盛怒: '如雷', - 染血的骑士道: '染血', - 平息鸣雷的尊者: '平雷', - 流放者: '流放', - 学士: '学士', - 行者之心: '行者', - 幸运儿: '幸运', - 勇士之心: '勇士', - 守护之心: '守护', - 武人: '武人', - 赌徒: '赌徒', - 奇迹: '奇迹', - 辰砂往生录: '辰砂', - 来歆余响: '余响', - 深林的记忆: '草套', - 饰金之梦: '饰金' -} - let Artifact = { // 根据圣遗物名称获取套装 diff --git a/models/Material.js b/models/Material.js index 054ac51c..47c526a2 100644 --- a/models/Material.js +++ b/models/Material.js @@ -4,6 +4,7 @@ import { Data } from '../components/index.js' import MaterialMeta from './material-lib/MaterialMeta.js' let data = Data.readJSON('resources/meta/material/data.json') +let abbr = await Data.importDefault('resources/meta/material/abbr.js') let mMap = {} let getItem = (ds) => { mMap[ds.name] = { @@ -44,10 +45,11 @@ class Material extends Base { } get abbr () { + let name = this.name if (this.type === 'talent') { - return Data.regRet(/「(.+)」/, this.name, 1) || this.name + return Data.regRet(/「(.+)」/, name, 1) || name } - return this.name + return abbr[name] || name } get title () { diff --git a/models/Weapon.js b/models/Weapon.js index b4171eb1..cd58401d 100644 --- a/models/Weapon.js +++ b/models/Weapon.js @@ -1,9 +1,10 @@ import lodash from 'lodash' import Base from './Base.js' import { Data } from '../components/index.js' -import WeaponMeta from './weapon/WeaponMeta.js' let data = Data.readJSON('resources/meta/weapons/data.json') +let abbr = await Data.importDefault('resources/meta/weapon/abbr.js') + let wData = {} lodash.forEach(data, (ds) => { wData[ds.name] = ds @@ -28,7 +29,7 @@ class Weapon extends Base { } get abbr () { - return WeaponMeta.getAbbr(this.name) + return abbr[this.name] || this.name } get title () { diff --git a/resources/character/character-card.css b/resources/character/character-card.css index 0067aada..c8178baf 100644 --- a/resources/character/character-card.css +++ b/resources/character/character-card.css @@ -299,30 +299,32 @@ body { background: url('../common/item/artifact-icon.webp') center no-repeat; background-size: 60% auto; } -.bottom-mode { - width: 600px; -} -.bottom-mode .char-title { - padding-top: 20px; -} -.bottom-mode .char-lv { - padding-top: 5px; -} -.bottom-mode .copyright { +.copyright { font-size: 12px; position: absolute; bottom: 0; margin: 0; right: 0; height: 25px; + left: 0; line-height: 25px; padding: 0 10px; + background: rgba(0, 0, 0, 0.5); + text-align: right; + z-index: 4; } -.bottom-mode .copyright.data-source { +.copyright.data-source { border-top: 1px solid rgba(255, 255, 255, 0.3); left: 0; text-align: left; - background: rgba(0, 0, 0, 0.5); + background: none; + z-index: 5; +} +.bottom-mode .char-title { + padding-top: 20px; +} +.bottom-mode .char-lv { + padding-top: 5px; } .bottom-mode .char-detail { position: absolute; @@ -365,31 +367,13 @@ body { padding-top: 5px; } .left-mode { - height: 600px; width: auto; } .left-mode .container { width: auto; } -.left-mode img.bg { - width: auto; - height: 600px; -} -.left-mode .copyright { - font-size: 12px; - position: absolute; - bottom: 0; - margin: 0; - right: 0; - height: 25px; - line-height: 25px; - padding: 0 10px; -} .left-mode .copyright.data-source { border-top: 1px solid rgba(255, 255, 255, 0.3); - left: 0; - text-align: left; - background: rgba(0, 0, 0, 0.5); } .left-mode .char-detail { position: absolute; diff --git a/resources/character/character-card.html b/resources/character/character-card.html index 6f1216ac..c8fcbede 100644 --- a/resources/character/character-card.html +++ b/resources/character/character-card.html @@ -10,7 +10,7 @@
- {{data.sName}} + {{data.sName||data.name}} {{if data.fetter}} {{/if}} {{if typeof(data.cons)!=='undefined'}} {{data.cons}}命 {{/if}}
diff --git a/resources/character/character-card.less b/resources/character/character-card.less index 83273a79..dce3910c 100644 --- a/resources/character/character-card.less +++ b/resources/character/character-card.less @@ -351,8 +351,30 @@ body { } } +.copyright { + font-size: 12px; + position: absolute; + bottom: 0; + margin: 0; + right: 0; + height: 25px; + left: 0; + line-height: 25px; + padding: 0 10px; + background: rgba(0, 0, 0, 0.5); + text-align: right; + z-index: 4; + + &.data-source { + border-top: 1px solid rgba(255, 255, 255, .3); + left: 0; + text-align: left; + background: none; + z-index: 5; + } +} + .bottom-mode { - width: 600px; .char-title { padding-top: 20px; @@ -362,24 +384,6 @@ body { padding-top: 5px; } - .copyright { - font-size: 12px; - position: absolute; - bottom: 0; - margin: 0; - right: 0; - height: 25px; - line-height: 25px; - padding: 0 10px; - - &.data-source { - border-top: 1px solid rgba(255, 255, 255, .3); - left: 0; - text-align: left; - background: rgba(0, 0, 0, 0.5) - } - } - .char-detail { position: absolute; bottom: 25px; @@ -434,33 +438,16 @@ body { } .left-mode { - height: 600px; width: auto; .container { width: auto; } - img.bg { - width: auto; - height: 600px; - } - .copyright { - font-size: 12px; - position: absolute; - bottom: 0; - margin: 0; - right: 0; - height: 25px; - line-height: 25px; - padding: 0 10px; &.data-source { border-top: 1px solid rgba(255, 255, 255, .3); - left: 0; - text-align: left; - background: rgba(0, 0, 0, 0.5) } } diff --git a/resources/character/profile-stat.css b/resources/character/profile-stat.css index 122aa4ff..ba93add3 100644 --- a/resources/character/profile-stat.css +++ b/resources/character/profile-stat.css @@ -132,7 +132,7 @@ body { background: rgba(255, 255, 255, 0.85); } .cont .tr:nth-child(even) { - background: rgba(230, 230, 230, 0.85); + background: rgba(235, 235, 235, 0.85); } .cont .tr > div { text-align: center; diff --git a/resources/character/profile-stat.less b/resources/character/profile-stat.less index 1e2c9f75..f8e5bff3 100644 --- a/resources/character/profile-stat.less +++ b/resources/character/profile-stat.less @@ -129,7 +129,7 @@ body { } &:nth-child(even) { - background: rgba(230, 230, 230, .85); + background: rgba(235, 235, 235, .85); } & > div { diff --git a/resources/meta/material/abbr.js b/resources/meta/material/abbr.js new file mode 100644 index 00000000..6a0f3a7c --- /dev/null +++ b/resources/meta/material/abbr.js @@ -0,0 +1,6 @@ +export default { + 恒常机关之心: '恒常之心', + '武炼之魂·孤影': '公子·孤影', + '吞天之鲸·只角': '公子·只角', + '魔王之刃·残片': '公子·残片' +} diff --git a/resources/meta/material/data.json b/resources/meta/material/data.json index 9d8957a4..48cf2d5d 100644 --- a/resources/meta/material/data.json +++ b/resources/meta/material/data.json @@ -1266,10 +1266,5 @@ "star": 5 } } - }, - "undefined": { - "id": 0, - "type": "boss", - "star": 1 } } \ No newline at end of file diff --git a/resources/meta/reliquaries/abbr.js b/resources/meta/reliquaries/abbr.js new file mode 100644 index 00000000..f37ab146 --- /dev/null +++ b/resources/meta/reliquaries/abbr.js @@ -0,0 +1,39 @@ +export default { + 炽烈的炎之魔女: '魔女', + 昔日宗室之仪: '宗室', + 翠绿之影: '风套', + 千岩牢固: '千岩', + 流浪大地的乐团: '乐团', + 绝缘之旗印: '绝缘', + 被怜爱的少女: '少女', + 沉沦之心: '水套', + 角斗士的终幕礼: '角斗', + 冰风迷途的勇士: '冰套', + 逆飞的流星: '逆飞', + 苍白之火: '苍白', + 华馆梦醒形骸记: '华馆', + 战狂: '战狂', + 悠古的磐岩: '岩套', + 渡过烈火的贤人: '渡火', + 游医: '游医', + 教官: '教官', + 冒险家: '冒险', + 追忆之注连: '追忆', + 海染砗磲: '海染', + 如雷的盛怒: '如雷', + 染血的骑士道: '染血', + 平息鸣雷的尊者: '平雷', + 流放者: '流放', + 学士: '学士', + 行者之心: '行者', + 幸运儿: '幸运', + 勇士之心: '勇士', + 守护之心: '守护', + 武人: '武人', + 赌徒: '赌徒', + 奇迹: '奇迹', + 辰砂往生录: '辰砂', + 来歆余响: '余响', + 深林的记忆: '草套', + 饰金之梦: '饰金' +} diff --git a/models/weapon/WeaponMeta.js b/resources/meta/weapons/abbr.js similarity index 85% rename from models/weapon/WeaponMeta.js rename to resources/meta/weapons/abbr.js index 784370dc..ce88135d 100644 --- a/models/weapon/WeaponMeta.js +++ b/resources/meta/weapons/abbr.js @@ -1,4 +1,4 @@ -export const abbr = { +export default { 磐岩结绿: '绿箭', 赤角石溃杵: '赤角', 终末嗟叹之诗: '终末', @@ -23,9 +23,3 @@ export const abbr = { 讨龙英杰谭: '讨龙', 神射手之誓: '神射手' } -let WeaponMeta = { - getAbbr (name) { - return abbr[name] || name - } -} -export default WeaponMeta \ No newline at end of file diff --git a/resources/wiki/character-talent.css b/resources/wiki/character-talent.css index ab7689d1..9d4af752 100644 --- a/resources/wiki/character-talent.css +++ b/resources/wiki/character-talent.css @@ -357,5 +357,6 @@ body { .talent-common-info > div span { background: rgba(50, 50, 50, 0.4); border-radius: 0 5px 5px 0; + color: #fff; } /*# sourceMappingURL=character-talent.css.map */ \ No newline at end of file diff --git a/resources/wiki/character-talent.less b/resources/wiki/character-talent.less index 8be971ad..307b360b 100644 --- a/resources/wiki/character-talent.less +++ b/resources/wiki/character-talent.less @@ -415,6 +415,7 @@ body { span { background: rgba(50, 50, 50, 0.4); border-radius: 0 5px 5px 0; + color: #fff; } } } \ No newline at end of file