️ 优化部分逻辑

This commit is contained in:
目棃
2024-01-18 21:08:17 +08:00
parent 2ad534cf3a
commit 4a8f6c1640
3 changed files with 10 additions and 18 deletions

View File

@@ -54,9 +54,6 @@
</div>
</div>
</div>
<v-snackbar v-model="showBar" :color="barColor" timeout="1000">
{{ barText }}
</v-snackbar>
</div>
</template>
<script lang="ts" setup>
@@ -66,16 +63,13 @@ import Mys from "../../plugins/Mys";
import { useHomeStore } from "../../store/modules/home";
import { createPost, createTGWindow } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc";
import showSnackbar from "../func/snackbar";
// store
const homeStore = useHomeStore();
// loading
const loading = ref<boolean>(true);
// snackbar
const showBar = ref<boolean>(false);
const barText = ref<string>("");
const barColor = ref<string>("error");
const hasNew = ref<boolean>(false);
const showNew = ref<boolean>(false);
@@ -88,10 +82,7 @@ const poolTimePass = ref<Record<number, number>>({});
const timer = ref<Record<number, any>>({});
// expose
defineExpose({
name: "限时祈愿",
loading,
});
defineExpose({ name: "限时祈愿", loading });
function poolLastInterval(postId: number): TGApp.Plugins.Mys.Gacha.RenderCard | undefined {
const pool = poolCards.value.find((pool) => pool.postId === postId);
@@ -191,9 +182,10 @@ function checkCover(data: TGApp.Plugins.Mys.Gacha.Data[]): boolean {
async function toOuter(url: string, title: string): Promise<void> {
if (!url) {
barText.value = "链接为空!";
barColor.value = "error";
showBar.value = true;
showSnackbar({
text: "链接为空!",
color: "error",
});
return;
}
createTGWindow(url, "Sub_window", `Pool_${title}`, 1200, 800, true, true);

View File

@@ -16,8 +16,8 @@
<v-window-item v-for="(value, index) in tabValues" :key="index" :value="value">
<div class="anno-grid">
<v-card v-for="item in annoCards[value]" :key="item.id" class="anno-card">
<div class="anno-cover" @click="createAnno(item)" :title="item.title">
<img :src="item.banner" alt="cover" />
<div class="anno-cover" :title="item.title">
<img :src="item.banner" alt="cover" @click="createAnno(item)" />
<div class="anno-info">
<div class="anno-id">ID:{{ item.id }}</div>
<div class="anno-time">

View File

@@ -29,8 +29,8 @@
<v-window-item v-for="(value, index) in tabValues" :key="index" :value="value">
<div class="news-grid">
<v-card v-for="item in postData[value]" :key="item.postId" class="news-card">
<div class="news-cover" @click="createPost(item)">
<img :src="item.cover" alt="cover" />
<div class="news-cover">
<img :src="item.cover" alt="cover" @click="createPost(item)" />
<div v-if="value === 'activity'" class="news-card-act">
<div
class="nca-status"