️ 优化部分逻辑

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> </div>
</div> </div>
<v-snackbar v-model="showBar" :color="barColor" timeout="1000">
{{ barText }}
</v-snackbar>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -66,16 +63,13 @@ import Mys from "../../plugins/Mys";
import { useHomeStore } from "../../store/modules/home"; import { useHomeStore } from "../../store/modules/home";
import { createPost, createTGWindow } from "../../utils/TGWindow"; import { createPost, createTGWindow } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc"; import { stamp2LastTime } from "../../utils/toolFunc";
import showSnackbar from "../func/snackbar";
// store // store
const homeStore = useHomeStore(); const homeStore = useHomeStore();
// loading // loading
const loading = ref<boolean>(true); 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 hasNew = ref<boolean>(false);
const showNew = ref<boolean>(false); const showNew = ref<boolean>(false);
@@ -88,10 +82,7 @@ const poolTimePass = ref<Record<number, number>>({});
const timer = ref<Record<number, any>>({}); const timer = ref<Record<number, any>>({});
// expose // expose
defineExpose({ defineExpose({ name: "限时祈愿", loading });
name: "限时祈愿",
loading,
});
function poolLastInterval(postId: number): TGApp.Plugins.Mys.Gacha.RenderCard | undefined { function poolLastInterval(postId: number): TGApp.Plugins.Mys.Gacha.RenderCard | undefined {
const pool = poolCards.value.find((pool) => pool.postId === postId); 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> { async function toOuter(url: string, title: string): Promise<void> {
if (!url) { if (!url) {
barText.value = "链接为空!"; showSnackbar({
barColor.value = "error"; text: "链接为空!",
showBar.value = true; color: "error",
});
return; return;
} }
createTGWindow(url, "Sub_window", `Pool_${title}`, 1200, 800, true, true); 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"> <v-window-item v-for="(value, index) in tabValues" :key="index" :value="value">
<div class="anno-grid"> <div class="anno-grid">
<v-card v-for="item in annoCards[value]" :key="item.id" class="anno-card"> <v-card v-for="item in annoCards[value]" :key="item.id" class="anno-card">
<div class="anno-cover" @click="createAnno(item)" :title="item.title"> <div class="anno-cover" :title="item.title">
<img :src="item.banner" alt="cover" /> <img :src="item.banner" alt="cover" @click="createAnno(item)" />
<div class="anno-info"> <div class="anno-info">
<div class="anno-id">ID:{{ item.id }}</div> <div class="anno-id">ID:{{ item.id }}</div>
<div class="anno-time"> <div class="anno-time">

View File

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