修复在极端情况下#喵喵深渊 报错的问题

This commit is contained in:
Kokomi 2022-08-04 14:04:30 +08:00
parent f1c46510bd
commit 1c744f8234
3 changed files with 18 additions and 8 deletions

View File

@ -67,19 +67,27 @@ export default class Abyss extends Base {
getAvatars () {
let ret = {}
lodash.forEach(this.reveral, (ds) => {
if(ds.id) {
ret[ds.id] = true
}
})
lodash.forEach(this.stat, (ds) => {
if(ds.id) {
ret[ds.id] = true
}
})
lodash.forEach(this.floors, (floor) => {
let levels = floor?.levels || {}
lodash.forEach(levels, (level) => {
lodash.forEach(level.up?.avatars || [], (id) => {
if(id){
ret[id] = true
}
})
lodash.forEach(level.down?.avatars || [], (id) => {
if(id){
ret[id] = true
}
})
})
})

View File

@ -1,10 +1,11 @@
{{set avatar = $data[0] || {} }}
{{set avatar = $data[0] || false }}
{{set {_res_path} = $data[1]}}
{{set weapon = avatar.weapon || {} }}
{{set talentMap = ['a','e','q'] }}
<div class="avatar-card elem-{{avatar.elem}} avatar-{{avatar.name}}">
<div class="card">
{{if avatar}}
<div class="avatar-face item-icon star{{avatar.star==4?4:5}}">
<span class="img"
style="background-image:url({{_res_path}}/meta/character/{{avatar.name}}/face_2.png)"></span>
@ -40,7 +41,7 @@
</div>
</div>
{{/if}}
</div>

View File

@ -24,10 +24,11 @@
<div class="abyss-item">
<div class="info">
<strong>{{title}}</strong>
<span>{{st[key]?.value}}</span>
<span>{{st[key]?.value || 0}}</span>
</div>
{{if st[key]}}
<% include(_tpl_path+'/avatar-card.html', [avatars[st[key]?.id],{_res_path}]) %>
{{/if}}
</div>
{{/each}}
</div>