fix: 연감 페이지에서 지도가 다른 왕조 일람 역사 지도 에러

This commit is contained in:
2022-05-15 18:09:18 +09:00
parent e447a8d038
commit 93895bfb6b
2 changed files with 33 additions and 11 deletions
+24 -10
View File
@@ -15,7 +15,7 @@
<MapViewer <MapViewer
:server-nick="serverNick" :server-nick="serverNick"
:serverID="queryServerID" :serverID="queryServerID"
:map-name="unwrap(gameConstStore?.gameConst.mapName)" :map-name="mapName"
:map-data="history.map" :map-data="history.map"
:is-detail-map="true" :is-detail-map="true"
:city-position="cityPosition" :city-position="cityPosition"
@@ -31,7 +31,7 @@
<div class="content"> <div class="content">
<template v-for="(item, idx) in history.global_history" :key="idx"> <template v-for="(item, idx) in history.global_history" :key="idx">
<!-- eslint-disable-next-line vue/no-v-html --> <!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="formatLog(item)"/> <div v-html="formatLog(item)" />
</template> </template>
</div> </div>
</div> </div>
@@ -40,7 +40,7 @@
<div class="content"> <div class="content">
<template v-for="(item, idx) in history.global_action" :key="idx"> <template v-for="(item, idx) in history.global_action" :key="idx">
<!-- eslint-disable-next-line vue/no-v-html --> <!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="formatLog(item)"/> <div v-html="formatLog(item)" />
</template> </template>
</div> </div>
</div> </div>
@@ -56,6 +56,7 @@ declare const staticValues: {
currentYearMonth: number; currentYearMonth: number;
serverNick: string; serverNick: string;
serverID: string; serverID: string;
mapName: string;
}; };
declare const query: { declare const query: {
yearMonth: number | null; yearMonth: number | null;
@@ -76,7 +77,7 @@ import { joinYearMonth } from "./util/joinYearMonth";
import { parseYearMonth } from "./util/parseYearMonth"; import { parseYearMonth } from "./util/parseYearMonth";
import { formatLog } from "./utilGame/formatLog"; import { formatLog } from "./utilGame/formatLog";
import SimpleNationList from "./components/SimpleNationList.vue"; import SimpleNationList from "./components/SimpleNationList.vue";
import MapViewer, { type CityPositionMap, type MapCityParsedRaw, type MapCityParsed} from "./components/MapViewer.vue"; import MapViewer, { type CityPositionMap, type MapCityParsedRaw, type MapCityParsed } from "./components/MapViewer.vue";
import { getGameConstStore, type GameConstStore } from "./GameConstStore"; import { getGameConstStore, type GameConstStore } from "./GameConstStore";
import { unwrap } from "@/util/unwrap"; import { unwrap } from "@/util/unwrap";
@@ -99,6 +100,7 @@ void Promise.all([storeP]).then(() => {
asyncReady.value = true; asyncReady.value = true;
}); });
const mapName = staticValues.mapName;
const cityPosition = getCityPosition(); const cityPosition = getCityPosition();
const formatCityInfoText = formatCityInfo; const formatCityInfoText = formatCityInfo;
const imagePath = window.pathConfig.gameImage; const imagePath = window.pathConfig.gameImage;
@@ -122,8 +124,11 @@ function generateYearMonthList(): { text: string; value: number }[] {
if (queryYearMonth.value === yearMonth) { if (queryYearMonth.value === yearMonth) {
info.push("선택"); info.push("선택");
} }
info.push("현재");
result.push({ text: `${year}${month}${info.length > 0 ? `(${info.join(", ")})` : ""}`, value: yearMonth }); if (staticValues.serverID === query.serverID) {
info.push("현재");
result.push({ text: `${year}${month}${info.length > 0 ? `(${info.join(", ")})` : ""}`, value: yearMonth });
}
return result; return result;
} }
@@ -136,12 +141,21 @@ watch(queryYearMonth, async (yearMonth) => {
queryYearMonth.value = firstYearMonth.value; queryYearMonth.value = firstYearMonth.value;
return; return;
} }
if (yearMonth > lastYearMonth.value + 1) {
queryYearMonth.value = lastYearMonth.value + 1; if (staticValues.serverID === query.serverID) {
return; if (yearMonth > lastYearMonth.value + 1) {
queryYearMonth.value = lastYearMonth.value + 1;
return;
}
}
else{
if (yearMonth > lastYearMonth.value) {
queryYearMonth.value = lastYearMonth.value;
return;
}
} }
if (yearMonth > lastYearMonth.value) { if (yearMonth > lastYearMonth.value && staticValues.serverID === query.serverID) {
try { try {
const result = await SammoAPI.Global.GetCurrentHistory(); const result = await SammoAPI.Global.GetCurrentHistory();
history.value = result.data; history.value = result.data;
+9 -1
View File
@@ -23,7 +23,14 @@ if ($serverID !== UniqueConst::$serverID) {
[$f_year, $f_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID); [$f_year, $f_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID);
[$l_year, $l_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID); [$l_year, $l_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID);
[$currentYear, $currentMonth] = $gameStor->getValuesAsArray(['year', 'month']);
if($serverID === UniqueConst::$serverID){
[$currentYear, $currentMonth] = $gameStor->getValuesAsArray(['year', 'month']);
}
else{
[$currentYear, $currentMonth] = [$l_year, $l_month];
}
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID); $me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID);
@@ -46,6 +53,7 @@ $me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $
'currentYearMonth' => Util::joinYearMonth($currentYear, $currentMonth), 'currentYearMonth' => Util::joinYearMonth($currentYear, $currentMonth),
'serverNick' => DB::prefix(), 'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID, 'serverID' => UniqueConst::$serverID,
'mapName' => $mapName,
], ],
'query' => [ 'query' => [
'serverID' => $serverID, 'serverID' => $serverID,