feat:gacha抽卡数颜色判断

This commit is contained in:
yysforget 2024-07-12 16:09:01 +08:00
parent 8c99081c6f
commit e988948770
2 changed files with 24 additions and 3 deletions

View file

@ -185,6 +185,13 @@ const NORMAL_LIST = [
'啜泣摇篮', '啜泣摇篮',
]; ];
const FLOORS_MAP = {
'邦布频段': [50, 70],
'音擎频段': [50, 70],
'独家频段': [60, 80],
'常驻频段': [60, 80],
};
function getLevelFromList(ast, lst) { function getLevelFromList(ast, lst) {
if (ast === 0) { if (ast === 0) {
return 2; return 2;
@ -241,17 +248,28 @@ export async function anaylizeGachaLog(uid) {
} }
if (list.length > 0) { if (list.length > 0) {
list[list.length - 1]['totalCount'] = i - preIndex; list[list.length - 1]['totalCount'] = i - preIndex;
if (i - preIndex <= FLOORS_MAP[name][0]) {
list[list.length - 1]['color'] = 'rgb(63, 255, 0)';
} else if (i - preIndex >= FLOORS_MAP[name][1]) {
list[list.length - 1]['color'] = 'rgb(255, 20, 20)';
}
} }
list.push({ list.push({
...item, ...item,
rank_type_label: RANK_MAP[item.rank_type], rank_type_label: RANK_MAP[item.rank_type],
isUp: isUp, isUp: isUp,
totalCount: '-', totalCount: '-',
color: 'white',
}); });
preIndex = i; preIndex = i;
} }
if (i === data.length - 1 && list.length > 0) { if (i === data.length - 1 && list.length > 0) {
list[list.length - 1]['totalCount'] = i - preIndex + 1; list[list.length - 1]['totalCount'] = i - preIndex + 1;
if (i - preIndex + 1 <= FLOORS_MAP[name][0]) {
list[list.length - 1]['color'] = 'rgb(63, 255, 0)';
} else if (i - preIndex + 1 >= FLOORS_MAP[name][1]) {
list[list.length - 1]['color'] = 'rgb(255, 20, 20)';
}
} }
i++; i++;
} }
@ -279,8 +297,11 @@ export async function anaylizeGachaLog(uid) {
level = getLevelFromList(avgUp, [51, 55, 61, 68, 70]); level = getLevelFromList(avgUp, [51, 55, 61, 68, 70]);
} else if ('独家频段' === name) { } else if ('独家频段' === name) {
level = getLevelFromList(avgUp, [74, 87, 99, 105, 120]); level = getLevelFromList(avgUp, [74, 87, 99, 105, 120]);
} else if ('常驻频段' === name) { }
level = getLevelFromList(avgUp, [53, 60, 68, 73, 75]); }
if (avgFive !== '-') {
if ('常驻频段' === name) {
level = getLevelFromList(avgFive, [53, 60, 68, 73, 75]);
} }
} }
const tag = HOMO_TAG[level]; const tag = HOMO_TAG[level];

View file

@ -45,7 +45,7 @@
<div class="image"> <div class="image">
<img src="{{inv.square_icon}}" alt=""> <img src="{{inv.square_icon}}" alt="">
</div> </div>
<div class="count">{{inv?.totalCount}}抽</div> <div class="count" style="color: {{inv?.color}};">{{inv?.totalCount}}抽</div>
</div> </div>
{{/each}} {{/each}}
</div> </div>