forked from Arondight/Adachi-BOT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenshin-aby.html
282 lines (278 loc) · 12.3 KB
/
genshin-aby.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8" />
<title>genshin-aby</title>
<script src="../../data/js/vue2.min.js"></script>
<link rel="stylesheet" href="./component/aby/aby.css" />
</head>
<body>
<div id="app">
<div class="container-vertical">
<div class="container-vertical">
<div class="card overview">
<div class="title">{{uid}} 的深境螺旋战绩</div>
<p class="overall-challenge-date">{{start_time}} - {{end_time}}</p>
<!--结构化模版开始-->
<div class="overall-challenge-times-by-char">
<div
class="challenge-times-per-char-base"
v-for="(reveal,index) in reveal_rank"
v-if="index < 9"
:key="index"
>
<div class="background-general" :class="'star-' + reveal.rarity">
<img class="avatar-overall-battle-times" :src="reveal.avatar_icon" alt="ERROR" />
</div>
<div class="description-general">{{reveal.value}}次</div>
</div>
</div>
<!--结构化模版结束-->
</div>
<div class="container-horizontal no-margin-left no-margin-bottom no-margin-right">
<div class="card strongest-hit">
<div class="no-background banner-strongest-hit">最强一击</div>
<!--结构化模版开始-->
<div class="container-strongest-hit">
<div
class="challenge-times-per-char-base"
v-for="(damage,index) in damage_rank"
v-if="index = 1"
:key="index"
>
<div class="background-general" :class="'star-' + damage.rarity">
<img class="strongest-hit" :src="imageUrlReplacement(damage.avatar_icon)" alt="ERROR" />
</div>
<div class="description-general strongest-hit">{{damage.value}}</div>
</div>
</div>
<!--结构化模版结束-->
</div>
<div class="card summary">
<div class="banner-middle first-banner">战斗次数</div>
<div class="banner-summary">{{total_battle_times}}</div>
<div class="banner-middle">最深抵达</div>
<div class="banner-summary">{{max_floor}}</div>
<div class="banner-middle">获得渊星</div>
<div class="banner-summary">{{total_star}}<span class="abyss-star large">*</span></div>
</div>
</div>
<div class="container-horizontal no-margin-left no-margin-right no-margin-bottom allow-wrap">
<!--米游社新API适配模版开始-->
<div class="card card-avatar-details">
<div class="banner-middle no-background">最多击破</div>
<!--结构化模版开始-->
<div class="container-strongest-hit">
<div
class="challenge-times-per-char-base"
v-for="(defeat,index) in defeat_rank"
v-if="index = 1"
:key="index"
>
<div class="background-general" :class="'star-' + defeat.rarity">
<img class="avatar-details" :src="imageUrlReplacement(defeat.avatar_icon)" alt="ERROR" />
</div>
<div class="description-general strongest-hit">{{defeat.value}}</div>
</div>
</div>
<!--结构化模版结束-->
</div>
<!--米游社新API适配模版结束-->
<!--米游社新API适配模版开始-->
<div class="card card-avatar-details">
<div class="banner-middle no-background">承受伤害</div>
<!--结构化模版开始-->
<div class="container-strongest-hit">
<div
class="challenge-times-per-char-base"
v-for="(take_damage,index) in take_damage_rank"
v-if="index = 1"
:key="index"
>
<div class="background-general" :class="'star-' + take_damage.rarity">
<img class="avatar-details" :src="imageUrlReplacement(take_damage.avatar_icon)" alt="ERROR" />
</div>
<div class="description-general strongest-hit">{{take_damage.value}}</div>
</div>
</div>
<!--结构化模版结束-->
</div>
<!--米游社新API适配模版结束-->
<!--米游社新API适配模版开始-->
<div class="card card-avatar-details">
<div class="banner-middle no-background">元素战技</div>
<!--结构化模版开始-->
<div class="container-strongest-hit">
<div
class="challenge-times-per-char-base"
v-for="(normal_skill,index) in normal_skill_rank"
v-if="index = 1"
:key="index"
>
<div class="background-general" :class="'star-' + normal_skill.rarity">
<img class="avatar-details" :src="imageUrlReplacement(normal_skill.avatar_icon)" alt="ERROR" />
</div>
<div class="description-general strongest-hit">{{normal_skill.value}}</div>
</div>
</div>
<!--结构化模版结束-->
</div>
<!--米游社新API适配模版结束-->
<!--米游社新API适配模版开始-->
<div class="card card-avatar-details">
<div class="banner-middle no-background">元素爆发</div>
<!--结构化模版开始-->
<div class="container-strongest-hit">
<div
class="challenge-times-per-char-base"
v-for="(energy_skill,index) in energy_skill_rank"
v-if="index = 1"
:key="index"
>
<div class="background-general" :class="'star-' + energy_skill.rarity">
<img class="avatar-details" :src="imageUrlReplacement(energy_skill.avatar_icon)" alt="ERROR" />
</div>
<div class="description-general strongest-hit">{{energy_skill.value}}</div>
</div>
</div>
<!--结构化模版结束-->
</div>
<!--米游社新API适配模版结束-->
</div>
</div>
<div class="card credit">
<div class="credit no-margin">CREATED BY</div>
<div class="credit no-margin">Adachi-BOT</div>
</div>
</div>
<!--深渊模块开始-->
<div class="container-vertical abyss-details no-margin-left no-margin-top" v-if="displayFloorDetails">
<!--深渊数据开始-->
<div class="card abyss" v-for="n in 4">
<!--placeholder开始,如果该楼层有数据就显示数据,如果没有数据则显示"NO DATA"-->
<div class="abyss-empty-record-placeholder" v-if="!floors.hasOwnProperty(n-1)">
<div class="banner-left banner-abyss banner-placeholder">
<p>{{parseInt(n) + 8}}-X</p>
</div>
<div class="container-vertical">
<div class="abyss-details-placeholder">
<p class="text-placeholder">----NO DATA----</p>
<p class="text-placeholder">没有找到该层的深境螺旋记录。</p>
<p class="text-placeholder">可能米游社数据当前还未更新,</p>
<p class="text-placeholder">如果确实通关过当期该层深渊,</p>
<p class="text-placeholder">请等待一段时间再次尝试查询。</p>
</div>
</div>
</div>
<!--placeholder结束-->
<div class="level" v-if="floors.hasOwnProperty(n-1)">
<div v-for="level in floors[n-1].levels">
<div class="battle" v-for="battle in level.battles">
<div class="banner-left banner-abyss" v-if="battle.index==1">
<p style="font-size: 20px">{{floors[n - 1].index}}-{{level.index}}</p>
<div class="container-abyss-stars">
<p class="abyss-star less-glow" v-for="index in level.star" v-if="battle.index==1">*</p>
</div>
<div class="abyss-time">
<p>{{formatDate(new Date(battle.timestamp * 1000), "yy/MM/dd")}}</p>
<p>
<!--因为不是等宽字体,所以要给冒号做单独kerning来确保视觉效果-->
<span>{{formatDate(new Date(battle.timestamp * 1000), "hh")}}</span>
<span class="kerning">:</span>
<span>{{formatDate(new Date(battle.timestamp * 1000), "mm")}}</span>
<span class="kerning">:</span>
<span>{{formatDate(new Date(battle.timestamp * 1000), "ss")}}</span>
</p>
</div>
</div>
<!--下面就是展示人物的屎山代码了,睡起来改-->
<div class="container-abyss-window">
<div class="container-horizontal abyss-char-windows no-margin">
<div class="abyss-level-per-char-base" v-for="avatar in battle.avatars">
<div class="background-general" :class="'star-' + avatar.rarity">
<img class="avatar-general" :src="avatar.icon" alt="ERROR" />
</div>
<div class="description-general">LV.{{avatar.level}}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--深渊数据结束-->
</div>
<!--深渊模块结束-->
</div>
</body>
<script type="module">
import { getParams } from "./component/common/param.js";
new Vue({
el: "#app",
data: {
uid: 0,
start_time: "",
end_time: "",
total_battle_times: 0,
max_floor: "",
total_star: 0,
reveal_rank: [],
defeat_rank: [],
take_damage_rank: [],
normal_skill_rank: [],
energy_skill_rank: [],
damage_rank: [],
floors: [],
displayFloorDetails: false,
},
methods: {
padLeftZero(str) {
return ("00" + str).substr(str.length);
},
formatDate(date, fmt) {
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
}
const o = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
};
for (const k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
const str = o[k] + "";
fmt = fmt.replace(RegExp.$1, 1 === RegExp.$1.length ? str : this.padLeftZero(str));
}
}
return fmt;
},
imageUrlReplacement(imageURL) {
return imageURL.replace(/_side/gi, "");
},
},
mounted() {
const params = getParams(window.location.href);
this.uid = params.uid;
this.start_time = this.formatDate(new Date(params.data.start_time * 1000), "yyyy/MM/dd");
this.end_time = this.formatDate(new Date(params.data.end_time * 1000), "yyyy/MM/dd");
this.total_battle_times = params.data.total_battle_times;
this.max_floor = params.data.max_floor;
this.total_star = params.data.total_star;
this.reveal_rank = params.data.reveal_rank;
this.defeat_rank = params.data.defeat_rank;
this.take_damage_rank = params.data.take_damage_rank;
this.normal_skill_rank = params.data.normal_skill_rank;
this.energy_skill_rank = params.data.energy_skill_rank;
this.damage_rank = params.data.damage_rank;
this.floors = params.data.floors.slice(-4);
if (this.floors.length !== 0) {
if (this.floors[0]["levels"].length !== 0) {
this.displayFloorDetails = true;
}
}
},
});
</script>
</html>