♻️ 二次简化

This commit is contained in:
BTMuli
2023-10-14 14:46:58 +08:00
parent 58e3c0e1a6
commit 214991fdd9
4 changed files with 21 additions and 40 deletions

View File

@@ -6,7 +6,7 @@
</div>
<div v-if="!loading" class="pool-grid">
<div v-for="pool in poolCards" :key="pool.postId" class="pool-card">
<div class="pool-cover" @click="toPost(pool)">
<div class="pool-cover" @click="createPost(pool.postId, pool.title)">
<img :src="pool.cover" alt="cover" />
</div>
<div class="pool-bottom">
@@ -49,17 +49,12 @@
</template>
<script lang="ts" setup>
import { ref, onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import Mys from "../../plugins/Mys";
import { useAppStore } from "../../store/modules/app";
import { useHomeStore } from "../../store/modules/home";
import { createPost, createTGWindow } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc";
// vue
const router = useRouter();
// store
const homeStore = useHomeStore();
@@ -176,11 +171,6 @@ async function toOuter(url: string, title: string): Promise<void> {
createTGWindow(url, "Sub_window", `Pool_${title}`, 1200, 800, true, true);
}
function toPost(pool: TGApp.Plugins.Mys.Gacha.RenderCard): void {
const isDev = useAppStore().devMode;
createPost(pool.postId.toString(), isDev);
}
onUnmounted(() => {
Object.keys(timer.value).forEach((key) => {
clearInterval(timer.value[Number(key)]);

View File

@@ -15,12 +15,14 @@
<v-list class="position-list">
<v-list-item :title="card.title" :subtitle="card.abstract">
<template #prepend>
<v-avatar rounded="0" @click="toPost(card)">
<v-avatar rounded="0" @click="createPost(card.postId, card.title)">
<v-img :src="card.icon" class="position-icon" />
</v-avatar>
</template>
<template #append>
<v-btn class="position-card-btn" @click="toPost(card)"> 查看 </v-btn>
<v-btn class="position-card-btn" @click="createPost(card.postId, card.title)">
查看
</v-btn>
</template>
</v-list-item>
</v-list>
@@ -45,16 +47,11 @@
</template>
<script lang="ts" setup>
import { ref, onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import Mys from "../../plugins/Mys";
import { useAppStore } from "../../store/modules/app";
import { createPost } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc";
// vue
const router = useRouter();
// loading
const loading = ref<boolean>(true);
@@ -106,11 +103,6 @@ onMounted(async () => {
loading.value = false;
});
function toPost(card: TGApp.Plugins.Mys.Position.RenderCard): void {
const isDev = useAppStore().devMode;
createPost(card.postId.toString(), isDev);
}
onUnmounted(() => {
Object.keys(positionTimer.value).forEach((key) => {
clearInterval(positionTimer.value[Number(key)]);