mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🐛 修复兑换码为空时的渲染异常
This commit is contained in:
@@ -59,25 +59,17 @@ async function tryGetCode(): Promise<void> {
|
|||||||
if (!navFind) return;
|
if (!navFind) return;
|
||||||
const actId = new URL(navFind.app_path).searchParams.get("act_id");
|
const actId = new URL(navFind.app_path).searchParams.get("act_id");
|
||||||
if (!actId) {
|
if (!actId) {
|
||||||
showSnackbar({
|
showSnackbar({ text: "未找到活动ID", color: "warn" });
|
||||||
text: "未找到活动ID",
|
|
||||||
color: "warn",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const res = await TGRequest.Nav.getCode(actId);
|
const res = await TGRequest.Nav.getCode(actId);
|
||||||
if (!Array.isArray(res)) {
|
if (!Array.isArray(res)) {
|
||||||
showSnackbar({
|
showSnackbar({ text: `[${res.retcode}] ${res.message}`, color: "warn" });
|
||||||
text: `[${res.retcode}] ${res.message}`,
|
|
||||||
color: "warn",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
codeData.value = res;
|
codeData.value = res;
|
||||||
showSnackbar({
|
showSnackbar({ text: "获取兑换码成功", color: "success" });
|
||||||
text: "获取兑换码成功",
|
await TGLogger.Info(JSON.stringify(res));
|
||||||
color: "success",
|
|
||||||
});
|
|
||||||
showOverlay.value = true;
|
showOverlay.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,27 @@
|
|||||||
<div class="tolc-title">兑换码</div>
|
<div class="tolc-title">兑换码</div>
|
||||||
<v-list-item v-for="(item, index) in props.data" :key="index">
|
<v-list-item v-for="(item, index) in props.data" :key="index">
|
||||||
<template #title>
|
<template #title>
|
||||||
{{ item.code }}
|
{{ item.code === "" ? "暂无兑换码" : item.code }}
|
||||||
</template>
|
</template>
|
||||||
<template #subtitle>
|
<template #subtitle>
|
||||||
<div v-html="item.title"></div>
|
<div v-html="item.title"></div>
|
||||||
<span>{{ timestampToDate(Number(item.to_get_time) * 1000) }}</span>
|
<span title="开放时间">{{ timestampToDate(Number(item.to_get_time) * 1000) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<img :src="item.img" alt="icon" />
|
<img
|
||||||
|
:src="item.img === '' ? '/source/UI/empty.webp' : item.img"
|
||||||
|
alt="icon"
|
||||||
|
class="tolc-icon"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
<v-btn @click="copy(item.code)" icon="mdi-content-copy" variant="outlined"></v-btn>
|
<v-btn
|
||||||
|
:disabled="item.code === ''"
|
||||||
|
@click="copy(item.code)"
|
||||||
|
icon="mdi-content-copy"
|
||||||
|
variant="outlined"
|
||||||
|
class="tolc-btn"
|
||||||
|
></v-btn>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</div>
|
</div>
|
||||||
@@ -66,4 +76,14 @@ function copy(code: string): void {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tolc-icon {
|
||||||
|
width: 40px;
|
||||||
|
margin-right: 10px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tolc-btn {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user