mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-09 08:48:21 +08:00
🐛 修复 Qodana 报错
This commit is contained in:
12
src/App.vue
12
src/App.vue
@@ -21,8 +21,8 @@ import { app, event, fs, window } from "@tauri-apps/api";
|
||||
import { useAppStore } from "./store/modules/app";
|
||||
|
||||
const appStore = useAppStore();
|
||||
const isMain = ref(false as boolean);
|
||||
const theme = ref(appStore.theme as string);
|
||||
const isMain = ref<boolean>(false);
|
||||
const theme = ref<string>(appStore.theme);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
// 获取当前窗口
|
||||
@@ -42,9 +42,9 @@ onMounted(async () => {
|
||||
});
|
||||
|
||||
// 监听主题变化
|
||||
async function listenOnTheme() {
|
||||
async function listenOnTheme(): Promise<void> {
|
||||
await event.listen("readTheme", (e) => {
|
||||
const themeGet = e.payload as string;
|
||||
const themeGet = <string>e.payload;
|
||||
if (theme.value !== themeGet) {
|
||||
theme.value = themeGet;
|
||||
document.documentElement.className = theme.value;
|
||||
@@ -52,7 +52,7 @@ async function listenOnTheme() {
|
||||
});
|
||||
}
|
||||
|
||||
async function checkLoad() {
|
||||
async function checkLoad(): Promise<void> {
|
||||
if (appStore.loading) {
|
||||
console.info("数据已加载!");
|
||||
return;
|
||||
@@ -63,7 +63,7 @@ async function checkLoad() {
|
||||
}
|
||||
|
||||
// 创建数据文件夹
|
||||
async function createDataDir() {
|
||||
async function createDataDir(): Promise<void> {
|
||||
console.info("开始创建数据文件夹...");
|
||||
// 如果不存在则创建
|
||||
if (!(await fs.exists("userData", { dir: fs.BaseDirectory.AppLocalData }))) {
|
||||
|
||||
@@ -4,16 +4,18 @@
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { onMounted, ref } from "vue";
|
||||
import TItemBox, { type TItemBoxData } from "../main/t-itembox.vue";
|
||||
import TItemBox from "../main/t-itembox.vue";
|
||||
// utils
|
||||
import TGSqlite from "../../plugins/Sqlite";
|
||||
// types
|
||||
import type { TItemBoxData } from "../main/t-itembox.vue";
|
||||
|
||||
interface TibAbyssDetailProps {
|
||||
modelValue: TGApp.Sqlite.Abyss.CharacterInfo;
|
||||
}
|
||||
|
||||
const props = defineProps<TibAbyssDetailProps>();
|
||||
const box = ref({} as TItemBoxData);
|
||||
const box = ref<TItemBoxData>(<TItemBoxData>{});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await TGSqlite.getAppCharacter(props.modelValue.id);
|
||||
|
||||
@@ -4,22 +4,25 @@
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { onMounted, ref } from "vue";
|
||||
import TItemBox, { TItemBoxData } from "../main/t-itembox.vue";
|
||||
import TItemBox from "../main/t-itembox.vue";
|
||||
// utils
|
||||
import TGSqlite from "../../plugins/Sqlite";
|
||||
// types
|
||||
import type { TItemBoxData } from "../main/t-itembox.vue";
|
||||
|
||||
interface TibAbyssOverviewProps {
|
||||
modelValue: TGApp.Sqlite.Abyss.Character;
|
||||
}
|
||||
|
||||
const props = defineProps<TibAbyssOverviewProps>();
|
||||
const box = ref({} as TItemBoxData);
|
||||
const box = ref<TItemBoxData>(<TItemBoxData>{});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await TGSqlite.getAppCharacter(props.modelValue.id);
|
||||
box.value = {
|
||||
height: "80px",
|
||||
ltSize: "30px",
|
||||
clickable: false,
|
||||
bg: `/icon/bg/${props.modelValue.star}-Star.webp`,
|
||||
icon: `/WIKI/character/icon/${props.modelValue.id}.webp`,
|
||||
lt: `/icon/element/${res.element}元素.webp`,
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { computed } from "vue";
|
||||
import TItemBox, { TItemBoxData } from "../main/t-itembox.vue";
|
||||
import TItemBox from "../main/t-itembox.vue";
|
||||
// types
|
||||
import type { TItemBoxData } from "../main/t-itembox.vue";
|
||||
|
||||
interface TibCalendarItemProps {
|
||||
model: "avatar" | "weapon";
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { computed } from "vue";
|
||||
import TItemBox2, { TItemBox2Data } from "../main/t-itembox-2.vue";
|
||||
import TItemBox2 from "../main/t-itembox-2.vue";
|
||||
// types
|
||||
import type { TItemBox2Data } from "../main/t-itembox-2.vue";
|
||||
|
||||
interface TMiniWeaponProps {
|
||||
item: TGApp.App.Calendar.Material;
|
||||
}
|
||||
const props = defineProps<TMiniWeaponProps>();
|
||||
const box = computed(() => {
|
||||
const box = computed<TItemBox2Data>(() => {
|
||||
return {
|
||||
bg: props.item.bg,
|
||||
icon: props.item.icon,
|
||||
@@ -18,6 +20,6 @@ const box = computed(() => {
|
||||
width: "150px",
|
||||
height: "45px",
|
||||
name: props.item.name,
|
||||
} as TItemBox2Data;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { onMounted, ref } from "vue";
|
||||
import TItemBox, { TItemBoxData } from "../main/t-itembox.vue";
|
||||
import TItemBox from "../main/t-itembox.vue";
|
||||
// types
|
||||
import type { TItemBoxData } from "../main/t-itembox.vue";
|
||||
|
||||
interface TibUrAvatarProps {
|
||||
modelValue: TGApp.Sqlite.Record.Avatar;
|
||||
}
|
||||
|
||||
const props = defineProps<TibUrAvatarProps>();
|
||||
const box = ref({} as TItemBoxData);
|
||||
const getName = () => {
|
||||
const box = ref<TItemBoxData>(<TItemBoxData>{});
|
||||
const getName = (): string => {
|
||||
return props.modelValue.id === 10000005
|
||||
? "旅行者-空"
|
||||
: props.modelValue.id === 10000007
|
||||
@@ -36,7 +38,7 @@ onMounted(async () => {
|
||||
};
|
||||
});
|
||||
|
||||
function showData() {
|
||||
function showData(): void {
|
||||
// todo @click 应该出来的是一个弹窗,而不是 console
|
||||
console.log(props.modelValue);
|
||||
}
|
||||
|
||||
@@ -4,17 +4,20 @@
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { computed } from "vue";
|
||||
import TItemBox, { TItemBoxData } from "../main/t-itembox.vue";
|
||||
import TItemBox from "../main/t-itembox.vue";
|
||||
// types
|
||||
import type { TItemBoxData } from "../main/t-itembox.vue";
|
||||
|
||||
interface TibCalendarWeaponProps {
|
||||
modelValue: TGApp.App.Weapon.WikiBriefInfo;
|
||||
}
|
||||
|
||||
const props = defineProps<TibCalendarWeaponProps>();
|
||||
const box = computed(() => {
|
||||
const box = computed<TItemBoxData>(() => {
|
||||
return {
|
||||
bg: props.modelValue.bg,
|
||||
icon: props.modelValue.icon,
|
||||
clickable: true,
|
||||
size: "128px",
|
||||
height: "128px",
|
||||
display: "inner",
|
||||
@@ -22,6 +25,6 @@ const box = computed(() => {
|
||||
ltSize: "40px",
|
||||
innerText: props.modelValue.name,
|
||||
innerHeight: 30,
|
||||
} as TItemBoxData;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -13,7 +13,7 @@ const scrollTop = ref(0); // 滚动条距离顶部的距离
|
||||
const canTop = ref(false); // 默认不显示
|
||||
|
||||
// 监听滚动事件
|
||||
function handleScroll() {
|
||||
function handleScroll(): void {
|
||||
scrollTop.value = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
// 超过500px显示回到顶部按钮
|
||||
canTop.value = scrollTop.value > 500;
|
||||
@@ -26,7 +26,7 @@ function handleScroll() {
|
||||
}
|
||||
|
||||
// 点击回到顶部
|
||||
function handleScrollTop() {
|
||||
function handleScrollTop(): void {
|
||||
let timer = 0;
|
||||
cancelAnimationFrame(timer);
|
||||
timer = requestAnimationFrame(function fn() {
|
||||
@@ -42,7 +42,6 @@ function handleScrollTop() {
|
||||
}
|
||||
|
||||
// 监听滚动事件
|
||||
// @ts-ignore
|
||||
onMounted(() => {
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
});
|
||||
|
||||
@@ -1,32 +1,91 @@
|
||||
<template>
|
||||
<div class="tib-box">
|
||||
<div class="tib-bg">
|
||||
<div
|
||||
class="tib-box"
|
||||
:style="{
|
||||
width: modelValue.size,
|
||||
height: modelValue.height,
|
||||
cursor: modelValue.clickable ? 'pointer' : 'default',
|
||||
}"
|
||||
>
|
||||
<div
|
||||
class="tib-bg"
|
||||
:style="{
|
||||
width: modelValue.size,
|
||||
height: modelValue.size,
|
||||
}"
|
||||
>
|
||||
<slot name="bg">
|
||||
<img :src="modelValue.bg" alt="bg" />
|
||||
</slot>
|
||||
</div>
|
||||
<div class="tib-icon">
|
||||
<div
|
||||
class="tib-icon"
|
||||
:style="{
|
||||
width: modelValue.size,
|
||||
height: modelValue.size,
|
||||
}"
|
||||
>
|
||||
<slot name="icon">
|
||||
<img :src="modelValue.icon" alt="icon" />
|
||||
</slot>
|
||||
</div>
|
||||
<div class="tib-cover">
|
||||
<div class="tib-lt">
|
||||
<div
|
||||
class="tib-cover"
|
||||
:style="{
|
||||
width: modelValue.size,
|
||||
height: modelValue.size,
|
||||
}"
|
||||
>
|
||||
<div
|
||||
class="tib-lt"
|
||||
:style="{
|
||||
width: modelValue.ltSize,
|
||||
height: modelValue.ltSize,
|
||||
}"
|
||||
>
|
||||
<img :src="modelValue.lt" alt="lt" />
|
||||
</div>
|
||||
<div v-show="modelValue.rt" class="tib-rt">
|
||||
<div
|
||||
v-show="modelValue.rt"
|
||||
class="tib-rt"
|
||||
:style="{
|
||||
width: modelValue.rtSize,
|
||||
height: modelValue.rtSize,
|
||||
}"
|
||||
>
|
||||
{{ modelValue.rt }}
|
||||
</div>
|
||||
<div class="tib-inner">
|
||||
<div
|
||||
class="tib-inner"
|
||||
:style="{
|
||||
height: `${props.modelValue.innerHeight ?? 0}px`,
|
||||
fontSize: `${props.modelValue.innerHeight ? props.modelValue.innerHeight / 2 : 0}px`,
|
||||
}"
|
||||
>
|
||||
<slot name="inner-icon">
|
||||
<img v-show="modelValue.innerIcon" :src="modelValue.innerIcon" alt="inner-icon" />
|
||||
<img
|
||||
v-show="modelValue.innerIcon"
|
||||
:src="modelValue.innerIcon"
|
||||
alt="inner-icon"
|
||||
:style="{
|
||||
width: `${props.modelValue.innerHeight ?? 0}px`,
|
||||
height: `${props.modelValue.innerHeight ?? 0}px`,
|
||||
}"
|
||||
/>
|
||||
</slot>
|
||||
<slot name="inner-text">
|
||||
<span>{{ modelValue.innerText }}</span>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="modelValue.display === 'outer'" class="tib-outer">
|
||||
<div
|
||||
v-if="modelValue.display === 'outer'"
|
||||
class="tib-outer"
|
||||
:style="{
|
||||
height: `${props.modelValue.outerHeight ?? 0}px`,
|
||||
fontSize: `${props.modelValue.outerHeight ? props.modelValue.outerHeight / 2 : 0}px`,
|
||||
}"
|
||||
>
|
||||
<slot name="outer-text">
|
||||
<span>{{ modelValue.outerText }}</span>
|
||||
</slot>
|
||||
@@ -34,8 +93,6 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
|
||||
export interface TItemBoxData {
|
||||
bg: string;
|
||||
icon: string;
|
||||
@@ -59,19 +116,10 @@ interface TItemBoxProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TItemBoxProps>();
|
||||
|
||||
const getCursor = computed(() => (props.modelValue.clickable ? "pointer" : "default"));
|
||||
const getInnerHeight = computed(() => `${props.modelValue.innerHeight}px`);
|
||||
const getInnerFont = computed(() => `${props.modelValue.innerHeight / 2}px`);
|
||||
const getOuterHeight = computed(() => `${props.modelValue.outerHeight}px`);
|
||||
const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.tib-box {
|
||||
position: relative;
|
||||
width: v-bind(modelValue[ "size"]);
|
||||
height: v-bind(modelValue[ "height"]);
|
||||
cursor: v-bind(getCursor);
|
||||
}
|
||||
|
||||
.tib-bg {
|
||||
@@ -79,8 +127,6 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
width: v-bind(modelValue[ "size"]);
|
||||
height: v-bind(modelValue[ "size"]);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
@@ -93,8 +139,6 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
.tib-icon {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: v-bind(modelValue[ "size"]);
|
||||
height: v-bind(modelValue[ "size"]);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
@@ -109,8 +153,6 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
width: v-bind(modelValue[ "size"]);
|
||||
height: v-bind(modelValue[ "size"]);
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -122,8 +164,6 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
width: v-bind(modelValue[ "ltSize"]);
|
||||
height: v-bind(modelValue[ "ltSize"]);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 5px;
|
||||
@@ -140,8 +180,6 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
width: v-bind(modelValue[ "rtSize"]);
|
||||
height: v-bind(modelValue[ "rtSize"]);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(0 0 0 / 40%);
|
||||
@@ -157,7 +195,6 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
left: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: v-bind(getInnerHeight);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(20 20 20 / 40%);
|
||||
@@ -165,12 +202,9 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
border-bottom-right-radius: 5px;
|
||||
color: var(--common-color-white);
|
||||
font-family: var(--font-title);
|
||||
font-size: v-bind(getInnerFont);
|
||||
}
|
||||
|
||||
.tib-inner img {
|
||||
width: v-bind(getInnerHeight);
|
||||
height: v-bind(getInnerHeight);
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
@@ -178,9 +212,7 @@ const getOuterFont = computed(() => `${props.modelValue.outerHeight / 2}px`);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: v-bind(getOuterHeight);
|
||||
color: var(--common-text-title);
|
||||
font-size: v-bind(getOuterFont);
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -92,7 +92,7 @@ defineExpose({
|
||||
loading,
|
||||
});
|
||||
|
||||
function poolLastInterval(postId: number) {
|
||||
function poolLastInterval(postId: number): void {
|
||||
const pool = poolCards.value.find((pool) => pool.postId === postId);
|
||||
if (!pool) return;
|
||||
if (poolTimeGet.value[postId] === "未开始") {
|
||||
@@ -156,7 +156,7 @@ onMounted(async () => {
|
||||
});
|
||||
|
||||
// 检测新卡池
|
||||
function checkCover(data: TGApp.Plugins.Mys.Gacha.Data[]) {
|
||||
function checkCover(data: TGApp.Plugins.Mys.Gacha.Data[]): boolean {
|
||||
// 如果没有缓存
|
||||
if (!homeStore.poolCover || Object.keys(homeStore.poolCover).length === 0) {
|
||||
return false;
|
||||
@@ -180,7 +180,7 @@ function checkCover(data: TGApp.Plugins.Mys.Gacha.Data[]) {
|
||||
});
|
||||
}
|
||||
|
||||
async function toOuter(url: string, title: string) {
|
||||
async function toOuter(url: string, title: string): Promise<void> {
|
||||
if (!url) {
|
||||
barText.value = "链接为空!";
|
||||
barColor.value = "error";
|
||||
@@ -190,14 +190,14 @@ async function toOuter(url: string, title: string) {
|
||||
createTGWindow(url, "祈愿", title, 1200, 800, true, true);
|
||||
}
|
||||
|
||||
function getLastPoolTime(time: number) {
|
||||
function getLastPoolTime(time: number): string {
|
||||
const hour = Math.floor(time / 1000 / 60 / 60);
|
||||
const minute = Math.floor((time / 1000 / 60 / 60 - hour) * 60);
|
||||
const second = Math.floor(((time / 1000 / 60 / 60 - hour) * 60 - minute) * 60);
|
||||
return `${hour}:${minute.toFixed(0).padStart(2, "0")}:${second.toFixed(0).padStart(2, "0")}`;
|
||||
}
|
||||
|
||||
function toPost(pool: TGApp.Plugins.Mys.Gacha.RenderCard) {
|
||||
function toPost(pool: TGApp.Plugins.Mys.Gacha.RenderCard): void {
|
||||
const path = router.resolve({
|
||||
name: "帖子详情",
|
||||
params: {
|
||||
|
||||
@@ -68,7 +68,7 @@ defineExpose({
|
||||
loading,
|
||||
});
|
||||
|
||||
function positionLastInterval(postId: number) {
|
||||
function positionLastInterval(postId: number): void {
|
||||
const timeGet = positionTimeGet.value[postId];
|
||||
if (timeGet === "未知" || timeGet === "已结束") {
|
||||
clearInterval(positionTimer.value[postId]);
|
||||
@@ -104,7 +104,7 @@ onMounted(async () => {
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
function getLastPositionTime(time: number) {
|
||||
function getLastPositionTime(time: number): string {
|
||||
const day = Math.floor(time / (24 * 3600 * 1000));
|
||||
const hour = Math.floor((time % (24 * 3600 * 1000)) / (3600 * 1000));
|
||||
const minute = Math.floor((time % (3600 * 1000)) / (60 * 1000));
|
||||
@@ -114,7 +114,7 @@ function getLastPositionTime(time: number) {
|
||||
.padStart(2, "0")}:${second.toFixed(0).padStart(2, "0")}`;
|
||||
}
|
||||
|
||||
async function toPost(card: TGApp.Plugins.Mys.Position.RenderCard) {
|
||||
async function toPost(card: TGApp.Plugins.Mys.Position.RenderCard): Promise<void> {
|
||||
// 获取路由路径
|
||||
const path = router.resolve({
|
||||
name: "帖子详情",
|
||||
|
||||
@@ -163,7 +163,7 @@ const open = computed({
|
||||
},
|
||||
});
|
||||
|
||||
function collapse() {
|
||||
function collapse(): void {
|
||||
rail.value = !rail.value;
|
||||
appStore.sidebar.collapse = rail.value;
|
||||
}
|
||||
@@ -172,14 +172,14 @@ onMounted(async () => {
|
||||
await listenOnTheme();
|
||||
});
|
||||
|
||||
async function listenOnTheme() {
|
||||
async function listenOnTheme(): Promise<void> {
|
||||
await event.listen("readTheme", (e) => {
|
||||
const theme = e.payload as string;
|
||||
const theme = <string>e.payload;
|
||||
themeGet.value = theme === "default" ? "default" : "dark";
|
||||
});
|
||||
}
|
||||
|
||||
async function switchTheme() {
|
||||
async function switchTheme(): Promise<void> {
|
||||
await event.emit("readTheme", themeGet.value === "default" ? "dark" : "default");
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
<div class="tsl-box">
|
||||
<img src="/src/assets/icons/arrow-right.svg" alt="right" />
|
||||
<slot>
|
||||
{{ title }}
|
||||
{{ props.title }}
|
||||
</slot>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
const props = defineProps<{
|
||||
title: string;
|
||||
}>();
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.tsl-box {
|
||||
|
||||
@@ -31,14 +31,14 @@ onMounted(async () => {
|
||||
await listenOnTheme();
|
||||
});
|
||||
|
||||
async function switchTheme() {
|
||||
async function switchTheme(): Promise<void> {
|
||||
appStore.changeTheme();
|
||||
await event.emit("readTheme", themeGet.value);
|
||||
}
|
||||
|
||||
async function listenOnTheme() {
|
||||
async function listenOnTheme(): Promise<void> {
|
||||
await event.listen("readTheme", (e) => {
|
||||
const theme = e.payload as string;
|
||||
const theme = <string>e.payload;
|
||||
themeGet.value = theme === "default" ? "default" : "dark";
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="toc-material-grid">
|
||||
<TibCalendarMaterial v-for="item in itemVal.materials" :item="item" />
|
||||
<TibCalendarMaterial
|
||||
v-for="(item, index) in itemVal.materials"
|
||||
:key="index"
|
||||
:item="item"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<img src="/source/UI/item-line.webp" alt="line" class="toc-line" />
|
||||
@@ -48,7 +52,7 @@ import TibCalendarItem from "../itembox/tib-calendar-item.vue";
|
||||
import TibCalendarMaterial from "../itembox/tib-calendar-material.vue";
|
||||
// utils
|
||||
import { createTGWindow } from "../../utils/TGWindow";
|
||||
//plugins
|
||||
// plugins
|
||||
import Mys from "../../plugins/Mys";
|
||||
|
||||
interface ToCalendarProps {
|
||||
@@ -67,18 +71,20 @@ const props = defineProps<ToCalendarProps>();
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => emits("update:modelValue", value),
|
||||
set: (value) => {
|
||||
emits("update:modelValue", value);
|
||||
},
|
||||
});
|
||||
const itemType = computed(() => props.dataType);
|
||||
const itemVal = computed<TGApp.App.Calendar.Item>(() => props.dataVal);
|
||||
const snackbar = ref<boolean>(false);
|
||||
|
||||
const onCancel = () => {
|
||||
const onCancel = (): void => {
|
||||
visible.value = false;
|
||||
emits("cancel");
|
||||
};
|
||||
|
||||
function toDetail(item: TGApp.App.Calendar.Item) {
|
||||
function toDetail(item: TGApp.App.Calendar.Item): void {
|
||||
if (item.contentId === 0) {
|
||||
snackbar.value = true;
|
||||
return;
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
<div class="toc-top">
|
||||
<div class="toc-title">请选择要跳转的频道</div>
|
||||
<div class="toc-list">
|
||||
<div v-for="item in channelList" class="toc-list-item" @click="toChannel(item.link)">
|
||||
<div
|
||||
v-for="(item, index) in channelList"
|
||||
:key="index"
|
||||
class="toc-list-item"
|
||||
@click="toChannel(item.link)"
|
||||
>
|
||||
<img :src="item.icon" alt="icon" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
@@ -28,9 +33,7 @@ interface ToChannelProps {
|
||||
modelValue: boolean;
|
||||
}
|
||||
|
||||
interface ToChannelEmits {
|
||||
(e: "update:modelValue", value: boolean): void;
|
||||
}
|
||||
type ToChannelEmits = (e: "update:modelValue", value: boolean) => void;
|
||||
|
||||
interface ToChannelItem {
|
||||
title: string;
|
||||
@@ -45,7 +48,9 @@ const emits = defineEmits<ToChannelEmits>();
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => emits("update:modelValue", value),
|
||||
set: (value) => {
|
||||
emits("update:modelValue", value);
|
||||
},
|
||||
});
|
||||
const router = useRouter();
|
||||
|
||||
@@ -87,13 +92,15 @@ const channelList: ToChannelItem[] = [
|
||||
},
|
||||
];
|
||||
|
||||
function onCancel() {
|
||||
function onCancel(): void {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
function toChannel(link: string) {
|
||||
async function toChannel(link: string): Promise<void> {
|
||||
visible.value = false;
|
||||
router.push(link);
|
||||
await router.push(link).then(() => {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 300);
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
<template>
|
||||
<div class="tud-t-box">
|
||||
<div class="tud-t-title">
|
||||
<div
|
||||
class="tud-t-box"
|
||||
:style="{
|
||||
fontFamily: props.mode === 'level' ? 'var(--font-text)' : 'var(--font-title)',
|
||||
}"
|
||||
>
|
||||
<div
|
||||
class="tud-t-title"
|
||||
:style="{
|
||||
fontSize: props.mode === 'level' ? '18px' : '20px',
|
||||
}"
|
||||
>
|
||||
<slot name="title">
|
||||
<span>{{ props.name }}</span>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="tud-t-val">
|
||||
<div
|
||||
class="tud-t-val"
|
||||
:style="{
|
||||
fontSize: props.mode === 'level' ? '18px' : '20px',
|
||||
}"
|
||||
>
|
||||
<img src="/icon/star/Abyss.webp" alt="Abyss" />
|
||||
<slot name="val">
|
||||
<span>{{ props.val }}</span>
|
||||
@@ -14,9 +29,6 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
import { computed, ComputedRef } from "vue";
|
||||
|
||||
interface TuaDetailTitleProps {
|
||||
name: string;
|
||||
val: number;
|
||||
@@ -24,13 +36,6 @@ interface TuaDetailTitleProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TuaDetailTitleProps>();
|
||||
|
||||
const getFont: ComputedRef<string> = computed(() => {
|
||||
return props.mode === "level" ? "var(--font-text)" : "var(--font-title)";
|
||||
});
|
||||
const getFontSize: ComputedRef<string> = computed(() => {
|
||||
return props.mode === "level" ? "18px" : "20px";
|
||||
});
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.tud-t-box {
|
||||
@@ -39,12 +44,10 @@ const getFontSize: ComputedRef<string> = computed(() => {
|
||||
height: 30px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-family: v-bind(getFont);
|
||||
}
|
||||
|
||||
.tud-t-title {
|
||||
color: var(--common-text-content);
|
||||
font-size: v-bind(getFontSize);
|
||||
}
|
||||
|
||||
.tud-t-val {
|
||||
@@ -52,7 +55,6 @@ const getFontSize: ComputedRef<string> = computed(() => {
|
||||
align-items: center;
|
||||
color: var(--common-color-white);
|
||||
font-family: var(--font-text);
|
||||
font-size: v-bind(getFontSize);
|
||||
text-shadow: 0 0 10px var(--common-color-yellow);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<span>命之座</span>
|
||||
</template>
|
||||
<template #content>
|
||||
<TucDetailConstellation v-model="props.modelValue" />
|
||||
<TucDetailConstellation :model-value="props.modelValue" />
|
||||
<div class="tuc-ddc-content">
|
||||
<div class="tuc-ddc-top">
|
||||
{{ props.modelValue.name }}
|
||||
@@ -18,7 +18,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #desc>
|
||||
<span v-html="parseDesc(props.modelValue.description)" />
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<span v-html="parseDesc(props.modelValue.description)"></span>
|
||||
</template>
|
||||
</TucDetailDesc>
|
||||
</template>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<span>圣遗物</span>
|
||||
</template>
|
||||
<template #content>
|
||||
<TucDetailRelic v-model="props.modelValue" pos="props.modelValue.pos" />
|
||||
<TucDetailRelic :model-value="props.modelValue" pos="props.modelValue.pos" />
|
||||
<div class="tuc-ddr-content">
|
||||
<div class="tuc-ddrc-top">
|
||||
<span>{{ props.modelValue.name }}</span>
|
||||
@@ -18,7 +18,7 @@
|
||||
</template>
|
||||
<template #desc>
|
||||
<div class="tuc-ddrd-title">{{ props.modelValue.set.name }}:</div>
|
||||
<div v-for="desc in props.modelValue.set.effect" class="tuc-ddrc-desc">
|
||||
<div v-for="(desc, index) in props.modelValue.set.effect" :key="index" class="tuc-ddrc-desc">
|
||||
<span>{{ desc.active }}件套:</span>
|
||||
<span>{{ desc.description }}</span>
|
||||
</div>
|
||||
|
||||
@@ -108,7 +108,9 @@ const emits = defineEmits<ToUcDetailEmits>();
|
||||
const props = defineProps<ToUcDetailProps>();
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => emits("update:modelValue", value),
|
||||
set: (value) => {
|
||||
emits("update:modelValue", value);
|
||||
},
|
||||
});
|
||||
const showCostumeSwitch = ref(false);
|
||||
|
||||
@@ -139,12 +141,12 @@ const selected = ref({
|
||||
});
|
||||
|
||||
// 加载数据
|
||||
function loadData() {
|
||||
function loadData(): void {
|
||||
if (!props.modelValue) return;
|
||||
data.value.weapon = JSON.parse(props.dataVal.weapon);
|
||||
data.value.constellation = JSON.parse(props.dataVal.constellation);
|
||||
if (props.dataVal.reliquary !== "") {
|
||||
const relics = <Array<TGApp.Sqlite.Character.RoleReliquary>>JSON.parse(props.dataVal.reliquary);
|
||||
const relics = <TGApp.Sqlite.Character.RoleReliquary[]>JSON.parse(props.dataVal.reliquary);
|
||||
relics.map((item) => {
|
||||
switch (item.pos) {
|
||||
case 1:
|
||||
@@ -195,7 +197,7 @@ const weaponBox = computed(() => {
|
||||
};
|
||||
});
|
||||
|
||||
const onCancel = () => {
|
||||
const onCancel = (): void => {
|
||||
visible.value = false;
|
||||
emits("cancel");
|
||||
};
|
||||
@@ -208,7 +210,7 @@ function showDetail(
|
||||
| false,
|
||||
type: "命座" | "武器" | "圣遗物",
|
||||
pos: number = 0,
|
||||
) {
|
||||
): void {
|
||||
if (!item) return;
|
||||
switch (type) {
|
||||
case "命座":
|
||||
@@ -229,7 +231,7 @@ function showDetail(
|
||||
};
|
||||
}
|
||||
|
||||
function switchBg() {
|
||||
function switchBg(): void {
|
||||
if (data.value.bg === props.dataVal.img) {
|
||||
data.value.bg = data.value.costume[0].icon;
|
||||
} else {
|
||||
|
||||
@@ -15,7 +15,7 @@ interface TurAvatarGridProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TurAvatarGridProps>();
|
||||
const data = computed(() => JSON.parse(<string>props.modelValue) as TGApp.Sqlite.Record.Avatar[]);
|
||||
const data = computed<TGApp.Sqlite.Record.Avatar[]>(() => JSON.parse(<string>props.modelValue));
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.tur-ag-box {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="props.modelValue === undefined">暂无数据</div>
|
||||
<div v-else class="tur-hg-box">
|
||||
<TurHomeSub v-for="home in homes" :data="home" />
|
||||
<TurHomeSub v-for="(home, index) in homes" :key="index" :data="home" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@@ -14,11 +14,12 @@ interface TurHomeGridProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TurHomeGridProps>();
|
||||
const homes = computed(() => {
|
||||
const res = JSON.parse(props.modelValue || "[]") as TGApp.Sqlite.Record.Home[];
|
||||
const homes = computed<TGApp.Sqlite.Record.Home[]>(() => {
|
||||
const res = JSON.parse(props.modelValue ?? "[]");
|
||||
if (res.length > 0) {
|
||||
return res;
|
||||
}
|
||||
return [];
|
||||
});
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
@@ -28,7 +28,7 @@ interface TurOverviewGridProps {
|
||||
}
|
||||
|
||||
const props = defineProps<TurOverviewGridProps>();
|
||||
const data = computed(() => JSON.parse(<string>props.modelValue) as TGApp.Sqlite.Record.Stats);
|
||||
const data = computed<TGApp.Sqlite.Record.Stats>(() => JSON.parse(<string>props.modelValue));
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
.tur-og-box {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-if="props.modelValue === undefined">暂无数据</div>
|
||||
<div v-else class="tur-wg-box">
|
||||
<TurWorldSub v-for="area in getData()" :data="area" :theme="theme" />
|
||||
<TurWorldSub v-for="(area, index) in getData()" :key="index" :data="area" :theme="theme" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@@ -23,8 +23,8 @@ const theme = computed(() => {
|
||||
}
|
||||
});
|
||||
|
||||
function getData() {
|
||||
return JSON.parse(<string>props.modelValue) as TGApp.Sqlite.Record.WorldExplore[];
|
||||
function getData(): TGApp.Sqlite.Record.WorldExplore[] {
|
||||
return JSON.parse(<string>props.modelValue);
|
||||
}
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
@@ -69,9 +69,9 @@ onMounted(async () => {
|
||||
: (getUrl.value.icon = getUrl.value.iconDark);
|
||||
});
|
||||
|
||||
async function listenOnTheme() {
|
||||
async function listenOnTheme(): Promise<void> {
|
||||
await event.listen("readTheme", (e) => {
|
||||
const theme = e.payload as string;
|
||||
const theme = <string>e.payload;
|
||||
if (theme === "dark") {
|
||||
getUrl.value.icon = getUrl.value.iconLight;
|
||||
} else {
|
||||
|
||||
@@ -69,7 +69,7 @@ onMounted(async () => {
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
async function initUserRecordData() {
|
||||
async function initUserRecordData(): Promise<void> {
|
||||
const recordGet = await TGSqlite.getUserRecord(user.value.gameUid);
|
||||
if (recordGet !== false) {
|
||||
recordData.value = recordGet;
|
||||
@@ -79,7 +79,7 @@ async function initUserRecordData() {
|
||||
}
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
async function refresh(): Promise<void> {
|
||||
loadingTitle.value = "正在获取战绩数据";
|
||||
loading.value = true;
|
||||
const res = await TGRequest.User.getRecord(recordCookie.value, user.value);
|
||||
@@ -93,12 +93,12 @@ async function refresh() {
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
function getTitle() {
|
||||
function getTitle(): string {
|
||||
const role = <TGApp.Sqlite.Record.Role>JSON.parse(recordData.value.role);
|
||||
return `${role.nickname} Lv.${role.level}【${recordData.value.uid}】`;
|
||||
}
|
||||
|
||||
async function shareRecord() {
|
||||
async function shareRecord(): Promise<void> {
|
||||
const recordBox = <HTMLElement>document.querySelector(".ur-box");
|
||||
const fileName = `【原神战绩】-${user.value.gameUid}`;
|
||||
loadingTitle.value = "正在生成图片";
|
||||
|
||||
@@ -22,7 +22,7 @@ const snackbar = ref(false);
|
||||
// data
|
||||
const cardsInfo = computed(() => AppCharacterData);
|
||||
|
||||
function toOuter(item: TGApp.App.Character.WikiBriefInfo) {
|
||||
function toOuter(item: TGApp.App.Character.WikiBriefInfo): void {
|
||||
if (item.contentId === 0) {
|
||||
snackbar.value = true;
|
||||
return;
|
||||
|
||||
@@ -128,27 +128,21 @@ const CardsInfoA = ref<TGApp.App.GCG.WikiBriefInfo[]>([]);
|
||||
const CardsInfoM = ref<TGApp.App.GCG.WikiBriefInfo[]>([]);
|
||||
const CardsInfoS = ref<TGApp.App.GCG.WikiBriefInfo[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
await loadData();
|
||||
onMounted(() => {
|
||||
for (const item of allCards.value) {
|
||||
if (item.type === "角色牌") CardsInfoC.value.push(item);
|
||||
if (item.type === "行动牌") CardsInfoA.value.push(item);
|
||||
if (item.type === "魔物牌") CardsInfoM.value.push(item);
|
||||
}
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
async function loadData() {
|
||||
await Promise.allSettled(
|
||||
allCards.value.map(async (item) => {
|
||||
if (item.type === "角色牌") CardsInfoC.value.push(item);
|
||||
if (item.type === "行动牌") CardsInfoA.value.push(item);
|
||||
if (item.type === "魔物牌") CardsInfoM.value.push(item);
|
||||
}),
|
||||
);
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
function toOuter(cardName: string, cardId: number) {
|
||||
function toOuter(cardName: string, cardId: number): void {
|
||||
const url = Mys.Api.Obc.replace("{contentId}", cardId.toString());
|
||||
createTGWindow(url, "GCG", cardName, 1200, 800, true);
|
||||
}
|
||||
|
||||
async function searchCard() {
|
||||
async function searchCard(): Promise<void> {
|
||||
loading.value = true;
|
||||
if (search.value === "") {
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -22,7 +22,7 @@ const snackbar = ref<boolean>(false);
|
||||
// data
|
||||
const cardsInfo = computed(() => AppWeaponData);
|
||||
|
||||
function toOuter(item: TGApp.App.Weapon.WikiBriefInfo) {
|
||||
function toOuter(item: TGApp.App.Weapon.WikiBriefInfo): void {
|
||||
if (item.contentId === 0) {
|
||||
snackbar.value = true;
|
||||
return;
|
||||
|
||||
@@ -21,9 +21,9 @@ import { appWindow } from "@tauri-apps/api/window";
|
||||
import TGRequest from "../web/request/TGRequest";
|
||||
|
||||
// loading
|
||||
const loading = ref(true as boolean);
|
||||
const loadingTitle = ref("正在加载");
|
||||
const loadingEmpty = ref(false as boolean);
|
||||
const loading = ref<boolean>(true);
|
||||
const loadingTitle = ref<string>("正在加载");
|
||||
const loadingEmpty = ref<boolean>(false);
|
||||
|
||||
// 数据
|
||||
const annoId = Number(useRoute().params.anno_id);
|
||||
|
||||
@@ -78,7 +78,7 @@ const lotteryTimer = ref<any>(null);
|
||||
// 参与方式
|
||||
const participationMethod = ref<string>("未知");
|
||||
|
||||
function flushTimeStatus() {
|
||||
function flushTimeStatus(): void {
|
||||
const timeNow = new Date().getTime();
|
||||
const timeDiff = Number(jsonData.draw_time) * 1000 - timeNow;
|
||||
if (timeDiff <= 0) {
|
||||
@@ -94,16 +94,14 @@ function flushTimeStatus() {
|
||||
}
|
||||
|
||||
// 数据
|
||||
const lotteryId = useRoute().params.lottery_id as string;
|
||||
const lotteryId = <string>useRoute().params.lottery_id;
|
||||
const lotteryCard = ref<TGApp.Plugins.Mys.Lottery.RenderCard>(
|
||||
{} as TGApp.Plugins.Mys.Lottery.RenderCard,
|
||||
);
|
||||
let jsonData = reactive<TGApp.Plugins.Mys.Lottery.FullData>(
|
||||
{} as TGApp.Plugins.Mys.Lottery.FullData,
|
||||
<TGApp.Plugins.Mys.Lottery.RenderCard>{},
|
||||
);
|
||||
let jsonData = reactive<TGApp.Plugins.Mys.Lottery.FullData>(<TGApp.Plugins.Mys.Lottery.FullData>{});
|
||||
const timeStatus = ref<string>("未知");
|
||||
|
||||
function backPost() {
|
||||
function backPost(): void {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
@@ -140,7 +138,7 @@ onMounted(async () => {
|
||||
});
|
||||
|
||||
// 获取参与方式
|
||||
function getUpWay(upWay: string) {
|
||||
function getUpWay(upWay: string): string {
|
||||
switch (upWay) {
|
||||
case "Forward":
|
||||
return "转发";
|
||||
|
||||
Reference in New Issue
Block a user