This commit is contained in:
Putoo
2026-06-02 17:58:36 +08:00
parent eb81a1c381
commit 8550d85659
11 changed files with 392 additions and 2 deletions

View File

@@ -0,0 +1 @@
<template></template>

79
Web/src/pages/map/to.vue Normal file
View File

@@ -0,0 +1,79 @@
<template>
<div class="content">
请选择城市:<br>
<div class="item" v-for="(item, index) in city" :key="index">
{{ index + 1 }}.<Abutton @click="UserToMap(item.cityId)">{{ item.cityName }}({{ GameTool.FormatCopper(item.copper) }})</Abutton>
</div>
<span v-if="city.length == 0">
暂无海图.
</span>
</div>
<div class="content">
<span v-for="item in area">
<Acheak @click="ChangeCity(item.cityId)" :on-value="cityId.toString()" :on-cheak="item.cityId.toString()">
{{ item.cityName }}</Acheak>
</span>
</div>
<div class="content" v-html="tips"></div>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: 'page-loading'
})
const area = ref<Array<any>>([]);
const city = ref<Array<any>>([]);;
const copper = ref('');
const tips = ref('');
const cityId = ref(0);
onMounted(async () => {
try {
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async (): Promise<void> => {
let npc = LocalStorageHelper.GetOnNpc();
let result = await MapService.GetCityData(Number(npc), cityId.value);
if (result.code == 0) {
area.value = result.data.area;
city.value = result.data.city;
if (cityId.value == 0) {
cityId.value = result.data.cityId;
}
tips.value = result.data.tips;
}
else {
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
PageExtend.Redirect("/map");
});
}
};
const ChangeCity = async (_cityId: number) => {
cityId.value = _cityId;
await BindData();
}
const UserToMap = async (_cityId: number) => {
MessageExtend.LoadingToast("传送中...");
let npc = LocalStorageHelper.GetOnNpc();
let result = await MapService.UserToMap(Number(npc), _cityId);
MessageExtend.LoadingClose();
if (result.code == 0) {
PageExtend.RedirectTo("/map");
}
else {
MessageExtend.ShowToast(result.msg);
}
}
</script>

View File

@@ -31,6 +31,22 @@ export class MapService {
return await ApiService.Request("get", "/Map/Map/GetAutoMapPath", { toMap });
}
/**
* 获取传送/航海城市列表
* GET /Map/Map/GetCityData
*/
static async GetCityData(npcId: number, cityId: number) {
return await ApiService.Request("get", "/Map/Map/GetCityData", { npcId, cityId });
}
/**
* 用户传送到地图
* GET /Map/Map/UserToMap
*/
static async UserToMap(npcId: number, cityId: number) {
return await ApiService.Request("get", "/Map/Map/UserToMap", { npcId, cityId });
}
/**
* 获取NPC相关信息
* GET /Map/Map/GetNpcInfo