♻️ 首页日历组件添加wiki跳转,移除wiki子窗口

This commit is contained in:
目棃
2024-01-16 12:05:27 +08:00
parent b8d823298e
commit 7cc27cce96
7 changed files with 62 additions and 466 deletions

View File

@@ -26,20 +26,13 @@
<v-btn variant="outlined" @click="toDetail(itemVal)">详情</v-btn>
</div>
</div>
<div class="close-div">
<div class="close-btn" @click="onCancel">
<v-icon>mdi-close</v-icon>
</div>
</div>
</div>
</TOverlay>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { useRouter } from "vue-router";
import Mys from "../../plugins/Mys";
import { createTGWindow } from "../../utils/TGWindow";
import showSnackbar from "../func/snackbar";
import TibCalendarItem from "../itembox/tib-calendar-item.vue";
import TibCalendarMaterial from "../itembox/tib-calendar-material.vue";
import TOverlay from "../main/t-overlay.vue";
@@ -52,12 +45,15 @@ interface ToCalendarProps {
interface ToCalendarEmits {
(e: "update:modelValue", value: boolean): void;
(e: "cancel"): void;
}
const emits = defineEmits<ToCalendarEmits>();
const props = defineProps<ToCalendarProps>();
const router = useRouter();
const visible = computed({
get: () => props.modelValue,
set: (value) => {
@@ -72,17 +68,12 @@ const onCancel = (): void => {
emits("cancel");
};
function toDetail(item: TGApp.App.Calendar.Item): void {
if (item.contentId === 0) {
const itemType = item.itemType === "character" ? "角色" : "武器";
showSnackbar({
text: `[${itemType}] ${item.name} 暂无详情`,
color: "warn",
});
return;
async function toDetail(item: TGApp.App.Calendar.Item): Promise<void> {
if (item.itemType === "character") {
await router.push(`/wiki/character/${item.id}`);
} else {
await router.push(`/wiki/weapon/${item.id}`);
}
const url = Mys.Api.Obc.replace("{contentId}", item.contentId.toString());
createTGWindow(url, "Sub_window", `Content_${item.contentId} ${item.name}`, 1200, 800, true);
}
</script>
<style scoped>
@@ -161,25 +152,4 @@ function toDetail(item: TGApp.App.Calendar.Item): void {
font-family: var(--font-title);
font-size: 20px;
}
.close-div {
display: flex;
width: 100%;
height: 60px;
align-items: center;
justify-content: center;
}
.close-btn {
display: flex;
width: 30px;
height: 30px;
align-items: center;
justify-content: center;
border: 1px solid var(--common-shadow-2);
border-radius: 50%;
background: var(--app-page-bg);
color: var(--tgc-yellow-1);
cursor: pointer;
}
</style>