♻️ 战绩世界探索数据结构调整

This commit is contained in:
BTMuli
2025-09-11 13:29:27 +08:00
parent 286c1e2459
commit bd37e3e491
6 changed files with 89 additions and 20 deletions

View File

@@ -9,10 +9,22 @@
<div class="tur-ws-content">
<div class="tur-ws-title">
<span>{{ data.name }}</span>
<span v-if="data.offering" class="tur-ws-sub">
<img :src="data.offering.icon" alt="offer" />
<span>{{ data.offering.name }}-</span>
<span>{{ data.offering.level }}</span>
<span v-if="data.offerings?.length === 1" class="tur-ws-sub">
<img :src="data.offerings[0].icon" alt="offer" />
<span>{{ data.offerings[0].name }}-</span>
<span>{{ data.offerings[0].level }}</span>
<span></span>
</span>
</div>
<div class="tur-ws-offerings" v-if="data.offerings && data.offerings.length > 1">
<span
v-for="(offer, idx) in data.offerings"
:key="idx"
class="tur-ws-sub"
:title="offer.name + '-' + offer.level + '级'"
>
<img :src="offer.icon" alt="offer" />
<span>{{ offer.level }}</span>
<span></span>
</span>
</div>
@@ -33,6 +45,24 @@
<span>%</span>
</div>
</div>
<div
v-if="
data.area_exploration_list &&
data.area_exploration_list.length > 0 &&
data.exploration < 1000
"
class="tur-ws-areas"
>
<span
v-for="area in data.area_exploration_list.filter((i) => i.exploration_percentage < 1000)"
:key="area.name"
class="tur-ws-sub"
>
<span>{{ area.name }}</span>
<span>{{ Math.min(area.exploration_percentage / 10, 100) }}</span>
<span>%</span>
</span>
</div>
<div v-if="data.reputation" class="tur-ws-sub">
<span>声望等级:</span>
<span>{{ data.reputation }}</span>
@@ -84,6 +114,7 @@ const icon = computed<string>(() => {
}
.tur-ws-icon {
position: relative;
z-index: 1;
width: 64px;
height: 64px;
@@ -96,6 +127,7 @@ const icon = computed<string>(() => {
}
.tur-ws-content {
position: relative;
z-index: 1;
width: calc(100% - 68px);
height: 100%;
@@ -111,6 +143,21 @@ const icon = computed<string>(() => {
font-size: 18px;
}
.tur-ws-offerings {
display: flex;
align-items: center;
justify-content: start;
column-gap: 8px;
}
.tur-ws-areas {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: start;
gap: 4px 8px;
}
.tur-ws-sub {
display: flex;
align-items: center;

View File

@@ -113,6 +113,7 @@ async function loadRecord(): Promise<void> {
const record = await TSUserRecord.getRecord(uidCur.value);
if (!record) return;
recordData.value = record;
console.log(recordData.value);
}
async function refreshRecord(): Promise<void> {

View File

@@ -124,10 +124,12 @@ function transStat(data: TGApp.Game.Record.Stats): TGApp.Sqlite.Record.Stats {
/**
* @description 将探索信息转换为数据库中的数据
* @since Beta v0.8.1
* @param {TGApp.Game.Record.WorldExplore[]} data 城市探索信息
* @returns {TGApp.Sqlite.Record.WorldExplore[]} 转换后的城市探索信息
* @param {Array<TGApp.Game.Record.WorldExplore>} data 城市探索信息
* @returns {Array<TGApp.Sqlite.Record.WorldExplore>} 转换后的城市探索信息
*/
function transWorld(data: TGApp.Game.Record.WorldExplore[]): TGApp.Sqlite.Record.WorldExplore[] {
function transWorld(
data: Array<TGApp.Game.Record.WorldExplore>,
): Array<TGApp.Sqlite.Record.WorldExplore> {
const areaParent = data.filter((i) => i.parent_id === 0);
const areaChild = data.filter((i) => i.parent_id !== 0);
const worlds: TGApp.Sqlite.Record.WorldExplore[] = [];
@@ -141,16 +143,11 @@ function transWorld(data: TGApp.Game.Record.WorldExplore[]): TGApp.Sqlite.Record
bg: area.background_image,
cover: area.cover,
exploration: area.exploration_percentage,
area_exploration_list: area.area_exploration_list,
children: [],
};
if (area.type === "Reputation") world.reputation = area.level;
if (area.offerings !== undefined && area.offerings.length > 0) {
world.offering = {
name: area.offerings[0].name,
level: area.offerings[0].level,
icon: area.offerings[0].icon,
};
}
if (area.offerings !== undefined && area.offerings.length > 0) world.offerings = area.offerings;
// 对纳塔的特殊处理
if (area.name === "纳塔") {
world.icon =

View File

@@ -175,7 +175,7 @@ declare namespace TGApp.Game.Record {
/**
* @description 世界探索信息类型
* @interface WorldExplore
* @since Beta 0.7.2
* @since Beta 0.8.1
* @property {number} level - 声望等级
* @property {number} exploration_percentage - 探索千分比
* @property {string} icon - 图标
@@ -195,7 +195,7 @@ declare namespace TGApp.Game.Record {
* @property {boolean} index_active - 索引激活
* @property {boolean} detail_active - 详细激活
* @property {number} seven_status_level - 七天神像等级
* @property {NataReputation[] | null} nata_reputation - 纳塔声望
* @property {NataReputation | null} nata_reputation - 纳塔声望
* @property {number} world_type - 世界类型
*/
type WorldExplore = {
@@ -212,7 +212,7 @@ declare namespace TGApp.Game.Record {
background_image: string;
inner_icon: string;
cover: string;
area_exploration_list: Array<unknown>;
area_exploration_list: Array<AreaExploration>;
boss_list: Array<unknown>;
is_hot: boolean;
index_active: boolean;
@@ -232,6 +232,15 @@ declare namespace TGApp.Game.Record {
*/
type WorldOffering = { name: string; level: number; icon: string };
/**
* @description 区域探索类型
* @interface AreaExploration
* @since Beta v0.8.1
* @property {string} name - 名称
* @property {number} exploration_percentage - 探索千分比
*/
type AreaExploration = { name: string; exploration_percentage: number };
/**
* @description 纳塔声望类型
* @interface NataReputation

View File

@@ -137,7 +137,7 @@ declare namespace TGApp.Sqlite.Record {
/**
* @description 世界探索信息类型
* @interface WorldExplore
* @since Beta v0.7.2
* @since Beta v0.8.1
* @property {number} id - 地区 ID
* @property {string} name - 地区名称
* @property {string} iconLight - 地区图标(亮)
@@ -145,6 +145,7 @@ declare namespace TGApp.Sqlite.Record {
* @property {string} cover - 封面
* @property {number} reputation - 地区声望等级
* @property {WorldOffering} offering - 地区供奉信息
* @property {Array<WorldOffering>} offerings - 地区供奉列表
* @property {number} exploration - 地区探索进度
* @property {Array<WorldChild>} children - 子地区
*/
@@ -156,8 +157,13 @@ declare namespace TGApp.Sqlite.Record {
bg: string;
cover: string;
reputation?: number;
/**
* @deprecated 已弃用,建议使用 offerings
*/
offering?: WorldOffering;
offerings?: Array<WorldOffering>;
exploration: number;
area_exploration_list?: Array<AreaExploration>;
children: Array<WorldChild>;
};
@@ -171,6 +177,15 @@ declare namespace TGApp.Sqlite.Record {
*/
type WorldOffering = { name: string; level: number; icon: string };
/**
* @description 区域探索类型
* @interface AreaExploration
* @since Beta v0.8.1
* @property {string} name - 名称
* @property {number} exploration_percentage - 探索千分比
*/
type AreaExploration = { name: string; exploration_percentage: number };
/**
* @description 子地区类型
* @interface WorldChild

View File

@@ -1,7 +1,7 @@
/**
* @file utils/toolFunc.ts
* @description 一些工具函数
* @since Beta v0.8.0
* @since Beta v0.8.1
*/
import { AvatarExtResTypeEnum, AvatarExtTypeEnum } from "@enum/bbs.js";
@@ -220,7 +220,7 @@ export function isColorSimilar(colorBg: string, colorText: string): boolean {
/**
* @description 解析带样式的文本
* @since Beta v0.8.0
* @since Beta v0.8.1
* @param {string} desc - 带样式的文本
* @returns {string} 解析后的文本
*/