85 lines
2.4 KiB
Vue
85 lines
2.4 KiB
Vue
<template>
|
|
<BContainer id="container" :toast="{ root: true }" class="pageNationGeneral bg0">
|
|
<TopBackBar :title="title" />
|
|
<GeneralList v-if="asyncReady" :list="generalList" :env="envVal" :height="'fill'" />
|
|
<BottomBar />
|
|
</BContainer>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
/*declare const staticValues: {
|
|
serverNick: string,
|
|
mapName: string,
|
|
unitSet: string,
|
|
};*/
|
|
</script>
|
|
<script lang="ts" setup>
|
|
import TopBackBar from "@/components/TopBackBar.vue";
|
|
import BottomBar from "@/components/BottomBar.vue";
|
|
import { BContainer } from "bootstrap-vue-3";
|
|
import { onMounted, provide, ref } from "vue";
|
|
import { SammoAPI } from "./SammoAPI";
|
|
import { merge2DArrToObjectArr } from "./util/merge2DArrToObjectArr";
|
|
import type { GeneralListItem, GeneralListResponse } from "./defs/API/Nation";
|
|
import GeneralList from "./components/GeneralList.vue";
|
|
import { type GameConstStore, getGameConstStore } from "./GameConstStore";
|
|
|
|
const generalList = ref<GeneralListItem[]>([]);
|
|
const envVal = ref<GeneralListResponse['env']>({
|
|
year: 1,
|
|
month: 1,
|
|
turnterm: 1,
|
|
turntime: '2022-02-22 22:22:22.22222'
|
|
});
|
|
|
|
const gameConstStore = ref<GameConstStore>();
|
|
provide('gameConstStore', gameConstStore);
|
|
|
|
const asyncReady = ref(false);
|
|
|
|
const title = "세력 장수";
|
|
|
|
const storeP = getGameConstStore().then((store)=>{
|
|
gameConstStore.value = store;
|
|
});
|
|
|
|
void Promise.all([storeP]).then(()=>{
|
|
asyncReady.value = true;
|
|
});
|
|
|
|
onMounted(async () => {
|
|
try {
|
|
const { column, list, permission, env } = await SammoAPI.Nation.GeneralList();
|
|
//XXX: 로직상 똑같은데....
|
|
if (permission == 0) {
|
|
const rawGeneralList = merge2DArrToObjectArr(column, list);
|
|
generalList.value = rawGeneralList.map((v) => {return { permission, ...v }});
|
|
} else if (permission == 1) {
|
|
const rawGeneralList = merge2DArrToObjectArr(column, list);
|
|
generalList.value = rawGeneralList.map((v) => {return { permission, ...v }});
|
|
} else if ([2, 3, 4].includes(permission)) {
|
|
const rawGeneralList = merge2DArrToObjectArr(column, list);
|
|
generalList.value = rawGeneralList.map((v) => {return { permission, ...v }});
|
|
} else {
|
|
throw `?? ${permission}`;
|
|
}
|
|
envVal.value = env;
|
|
|
|
} catch (e) {
|
|
console.error(e);
|
|
throw e;
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
html, body, #app {
|
|
height: 100%;
|
|
}
|
|
|
|
.pageNationGeneral{
|
|
display: grid;
|
|
grid-template-rows: auto 1fr auto;
|
|
height: 100%;
|
|
}
|
|
</style> |