#刻晴卡片等模块样式微调

This commit is contained in:
yoimiya-kokomi 2022-09-24 06:57:42 +08:00
parent cab038a0b9
commit 5b311612b7
16 changed files with 111 additions and 128 deletions

View File

@ -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: `<style>html,body,#container{width:${width}px}</style>`,
widthStyle: `<style>html,body,#container{width:${width}px} ${imgCss}</style>`,
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 })

View File

@ -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`)
},

View File

@ -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 = {
// 根据圣遗物名称获取套装

View File

@ -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 () {

View File

@ -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 () {

View File

@ -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;

View File

@ -10,7 +10,7 @@
<div>
<div class="char-title">
<div class="char-name">
<strong>{{data.sName}}</strong>
<strong>{{data.sName||data.name}}</strong>
{{if data.fetter}} <span class="fetter fetter{{data.fetter}}"></span> {{/if}}
{{if typeof(data.cons)!=='undefined'}} <span class="cons cons-{{data.cons}}">{{data.cons}}命</span> {{/if}}
</div>

View File

@ -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)
}
}

View File

@ -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;

View File

@ -129,7 +129,7 @@ body {
}
&:nth-child(even) {
background: rgba(230, 230, 230, .85);
background: rgba(235, 235, 235, .85);
}
& > div {

View File

@ -0,0 +1,6 @@
export default {
恒常机关之心: '恒常之心',
'武炼之魂·孤影': '公子·孤影',
'吞天之鲸·只角': '公子·只角',
'魔王之刃·残片': '公子·残片'
}

View File

@ -1266,10 +1266,5 @@
"star": 5
}
}
},
"undefined": {
"id": 0,
"type": "boss",
"star": 1
}
}

View File

@ -0,0 +1,39 @@
export default {
炽烈的炎之魔女: '魔女',
昔日宗室之仪: '宗室',
翠绿之影: '风套',
千岩牢固: '千岩',
流浪大地的乐团: '乐团',
绝缘之旗印: '绝缘',
被怜爱的少女: '少女',
沉沦之心: '水套',
角斗士的终幕礼: '角斗',
冰风迷途的勇士: '冰套',
逆飞的流星: '逆飞',
苍白之火: '苍白',
华馆梦醒形骸记: '华馆',
战狂: '战狂',
悠古的磐岩: '岩套',
渡过烈火的贤人: '渡火',
游医: '游医',
教官: '教官',
冒险家: '冒险',
追忆之注连: '追忆',
海染砗磲: '海染',
如雷的盛怒: '如雷',
染血的骑士道: '染血',
平息鸣雷的尊者: '平雷',
流放者: '流放',
学士: '学士',
行者之心: '行者',
幸运儿: '幸运',
勇士之心: '勇士',
守护之心: '守护',
武人: '武人',
赌徒: '赌徒',
奇迹: '奇迹',
辰砂往生录: '辰砂',
来歆余响: '余响',
深林的记忆: '草套',
饰金之梦: '饰金'
}

View File

@ -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

View File

@ -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 */

View File

@ -415,6 +415,7 @@ body {
span {
background: rgba(50, 50, 50, 0.4);
border-radius: 0 5px 5px 0;
color: #fff;
}
}
}