wip: 출력 시작
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
</BFormSelectOption>
|
||||
</BFormSelect>
|
||||
</div>
|
||||
<!--<GeneralBasicCard v-if="targetGeneral" :general="targetGeneral" :nation="" />-->
|
||||
<GeneralBasicCard v-if="targetGeneral && nationInfo" :general="targetGeneral" :nation="nationInfo" />
|
||||
<BottomBar></BottomBar>
|
||||
</BContainer>
|
||||
</template>
|
||||
@@ -41,6 +41,7 @@ import { unwrap } from "@/util/unwrap";
|
||||
import { merge2DArrToObjectArr } from "@/util/merge2DArrToObjectArr";
|
||||
import { getNpcColor } from "@/common_legacy";
|
||||
import GeneralBasicCard from "./components/GeneralBasicCard.vue";
|
||||
import type { NationStaticItem } from "./defs";
|
||||
|
||||
const toasts = unwrap(useToast());
|
||||
|
||||
@@ -57,12 +58,15 @@ const orderBy = ref<keyof typeof textMap>("turntime");
|
||||
const targetGeneral = ref<GeneralListItemP1>();
|
||||
const targetGeneralID = ref(queryValues.generalID ?? undefined);
|
||||
|
||||
const nationInfo = ref<NationStaticItem>();
|
||||
|
||||
watch([generalList, targetGeneralID], ([generalList, targetGeneralID]) => {
|
||||
if (targetGeneralID === undefined) return;
|
||||
targetGeneral.value = generalList.get(targetGeneralID);
|
||||
});
|
||||
|
||||
watch([generalList, orderBy], ([generalList, orderBy]) => {
|
||||
console.log(generalList);
|
||||
const list = Array.from(generalList.values());
|
||||
list.sort((a, b) => {
|
||||
const [, getter, isAsc] = textMap[orderBy];
|
||||
@@ -90,16 +94,24 @@ async function reload(): Promise<void> {
|
||||
console.log("갱신 시도");
|
||||
|
||||
try {
|
||||
const nationP = SammoAPI.Nation.GetNationInfo({});
|
||||
const { column, list, permission, troops, env } = await SammoAPI.Nation.GeneralList();
|
||||
|
||||
if (permission === 0) {
|
||||
throw "권한이 부족합니다.";
|
||||
}
|
||||
|
||||
console.log(list);
|
||||
const rawGeneralList = merge2DArrToObjectArr(column, list);
|
||||
|
||||
const newList = new Map<number, GeneralListItemP1>();
|
||||
for (const general of rawGeneralList) {
|
||||
newList.set(general.no, general);
|
||||
}
|
||||
generalList.value = newList;
|
||||
|
||||
const { nation } = await nationP;
|
||||
nationInfo.value = nation;
|
||||
} catch (e) {
|
||||
toasts.danger({
|
||||
title: "오류",
|
||||
|
||||
Reference in New Issue
Block a user