💄 先把所有用到 loading 的给转了一下

This commit is contained in:
BTMuli
2023-05-25 22:06:40 +08:00
parent 9e95fb29b0
commit 749f68f982
10 changed files with 117 additions and 133 deletions

View File

@@ -54,14 +54,14 @@ watch(
(v) => {
if (v) {
showOut.value = true;
setTimeout(() => {
showIn.value = true;
}, 0);
} else {
showIn.value = false;
} else {
setTimeout(() => {
showIn.value = false;
}, 100);
setTimeout(() => {
showOut.value = false;
}, 200);
}, 300);
}
},
);

View File

@@ -22,10 +22,8 @@
</v-btn>
</template>
</v-app-bar>
<div v-show="loading">
<TLoading :title="loadingTitle" />
</div>
<div v-show="!loading" class="wrap">
<TLoading v-model="loading" :title="loadingTitle" />
<div class="wrap">
<!-- 左侧菜单 -->
<div class="left-wrap">
<v-list v-for="series in seriesList" :key="series.id" class="card-left" @click="selectSeries(series.id)">

View File

@@ -1,94 +1,90 @@
<template>
<div v-if="loading">
<TLoading :title="loadingTitle" />
</div>
<div v-else>
<v-tabs v-model="tab" align-tabs="start" class="anno-tab">
<v-tab value="activity">
活动公告
</v-tab>
<v-tab value="game">
游戏公告
</v-tab>
<v-spacer />
<v-btn class="switch-btn" @click="switchNews">
<template #prepend>
<v-icon>mdi-bullhorn</v-icon>
</template>
切换米游社咨讯
</v-btn>
</v-tabs>
<v-window v-model="tab">
<v-window-item value="activity">
<div class="anno-grid">
<v-card v-for="item in annoCards.activity" :key="item.id" class="anno-card" width="340">
<div class="anno-cover" @click="toPost(item)">
<img :src="item.banner" alt="cover">
</div>
<v-card-title>
{{ item.title }}
</v-card-title>
<v-card-subtitle>{{ item.subtitle }}</v-card-subtitle>
<v-card-actions>
<v-btn class="anno-btn" @click="toPost(item)">
<template #prepend>
<img :src="item.tagIcon || '../assets/icons/arrow-right.svg'" alt="right">
</template>
查看
</v-btn>
<v-card-subtitle v-show="!appStore.devMode">
<v-icon>mdi-calendar</v-icon>
{{ item.startTime.split(" ")[0] }} -
{{ item.endTime.split(" ")[0] }}
</v-card-subtitle>
<v-card-subtitle v-show="appStore.devMode">
id: {{ item.id }}
</v-card-subtitle>
<v-btn v-show="appStore.devMode" class="card-dev-btn" @click="toJson(item)">
<template #prepend>
<img src="../assets/icons/arrow-right.svg" alt="right">
</template>
查看数据
</v-btn>
</v-card-actions>
</v-card>
</div>
</v-window-item>
<v-window-item value="game">
<div class="anno-grid">
<v-card v-for="item in annoCards.game" :key="item.id" class="anno-card" width="340">
<div class="anno-cover" @click="toPost(item)">
<img :src="item.banner" alt="cover">
</div>
<v-card-title>{{ item.title }}</v-card-title>
<v-card-subtitle>{{ item.subtitle }}</v-card-subtitle>
<v-card-actions>
<v-btn class="anno-btn" @click="toPost(item)">
<template #prepend>
<img :src="item.tagIcon || '../assets/icons/arrow-right.svg'" alt="right">
</template>
查看
</v-btn>
<v-card-subtitle v-show="!appStore.devMode">
<v-icon>mdi-calendar</v-icon>
{{ item.startTime.split(" ")[0] }} -
{{ item.endTime.split(" ")[0] }}
</v-card-subtitle>
<v-card-subtitle v-show="appStore.devMode">
id: {{ item.id }}
</v-card-subtitle>
<v-btn v-show="appStore.devMode" class="card-dev-btn" @click="toJson(item)">
<template #prepend>
<img src="../assets/icons/arrow-right.svg" alt="right">
</template>
查看数据
</v-btn>
</v-card-actions>
</v-card>
</div>
</v-window-item>
</v-window>
</div>
<TLoading v-model="loading" :title="loadingTitle" />
<v-tabs v-model="tab" align-tabs="start" class="anno-tab">
<v-tab value="activity">
活动公告
</v-tab>
<v-tab value="game">
游戏公告
</v-tab>
<v-spacer />
<v-btn class="switch-btn" @click="switchNews">
<template #prepend>
<v-icon>mdi-bullhorn</v-icon>
</template>
切换米游社咨讯
</v-btn>
</v-tabs>
<v-window v-model="tab">
<v-window-item value="activity">
<div class="anno-grid">
<v-card v-for="item in annoCards.activity" :key="item.id" class="anno-card" width="340">
<div class="anno-cover" @click="toPost(item)">
<img :src="item.banner" alt="cover">
</div>
<v-card-title>
{{ item.title }}
</v-card-title>
<v-card-subtitle>{{ item.subtitle }}</v-card-subtitle>
<v-card-actions>
<v-btn class="anno-btn" @click="toPost(item)">
<template #prepend>
<img :src="item.tagIcon || '../assets/icons/arrow-right.svg'" alt="right">
</template>
查看
</v-btn>
<v-card-subtitle v-show="!appStore.devMode">
<v-icon>mdi-calendar</v-icon>
{{ item.startTime.split(" ")[0] }} -
{{ item.endTime.split(" ")[0] }}
</v-card-subtitle>
<v-card-subtitle v-show="appStore.devMode">
id: {{ item.id }}
</v-card-subtitle>
<v-btn v-show="appStore.devMode" class="card-dev-btn" @click="toJson(item)">
<template #prepend>
<img src="../assets/icons/arrow-right.svg" alt="right">
</template>
查看数据
</v-btn>
</v-card-actions>
</v-card>
</div>
</v-window-item>
<v-window-item value="game">
<div class="anno-grid">
<v-card v-for="item in annoCards.game" :key="item.id" class="anno-card" width="340">
<div class="anno-cover" @click="toPost(item)">
<img :src="item.banner" alt="cover">
</div>
<v-card-title>{{ item.title }}</v-card-title>
<v-card-subtitle>{{ item.subtitle }}</v-card-subtitle>
<v-card-actions>
<v-btn class="anno-btn" @click="toPost(item)">
<template #prepend>
<img :src="item.tagIcon || '../assets/icons/arrow-right.svg'" alt="right">
</template>
查看
</v-btn>
<v-card-subtitle v-show="!appStore.devMode">
<v-icon>mdi-calendar</v-icon>
{{ item.startTime.split(" ")[0] }} -
{{ item.endTime.split(" ")[0] }}
</v-card-subtitle>
<v-card-subtitle v-show="appStore.devMode">
id: {{ item.id }}
</v-card-subtitle>
<v-btn v-show="appStore.devMode" class="card-dev-btn" @click="toJson(item)">
<template #prepend>
<img src="../assets/icons/arrow-right.svg" alt="right">
</template>
查看数据
</v-btn>
</v-card-actions>
</v-card>
</div>
</v-window-item>
</v-window>
</template>
<script lang="ts" setup>

View File

@@ -1,11 +1,11 @@
<template>
<TLoading v-if="loading" :title="loadingTitle" :subtitle="loadingSubtitle" />
<component :is="item" v-for="item in components" v-show="!loading" :key="item" :ref="setItemRef" />
<TLoading v-model="loading" :title="loadingTitle" :subtitle="loadingSubtitle" />
<component :is="item" v-for="item in components" :key="item" :ref="setItemRef" />
</template>
<script lang="ts" setup>
// vue
import { ref, markRaw, onMounted, onUnmounted, onUpdated } from "vue";
import { markRaw, onMounted, onUnmounted, onUpdated, ref } from "vue";
import TLoading from "../components/main/t-loading.vue";
import TPool from "../components/main/t-pool.vue";
import TPosition from "../components/main/t-position.vue";
@@ -45,6 +45,14 @@ function readLoading (): void {
onMounted(async () => {
loadingTitle.value = "正在加载首页";
loading.value = true;
// 获取当前环境
const timeGet = getBuildTime();
appStore.devEnv = timeGet.startsWith("dev");
if (!appStore.devEnv && appStore.devMode) {
appStore.devMode = false;
}
appStore.buildTime = getBuildTime();
const showItems = homeStore.getShowValue();
await Promise.allSettled(
showItems.map((item) => {
@@ -61,13 +69,6 @@ onMounted(async () => {
}),
);
timer.value = setInterval(readLoading, 100);
// 获取当前环境
const timeGet = getBuildTime();
appStore.devEnv = timeGet.startsWith("dev");
if (!appStore.devEnv && appStore.devMode) {
appStore.devMode = false;
}
appStore.buildTime = getBuildTime();
});
function setItemRef (item: any) {

View File

@@ -1,9 +1,7 @@
<template>
<TSwitchTheme />
<div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div>
<div v-else class="anno-json">
<TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<div class="anno-json">
<div class="anno-title">
活动列表 JSON
</div>

View File

@@ -1,10 +1,8 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<TSwitchTheme />
<div v-if="loading" class="loading">
<TLoading :title="loadingTitle" :empty="loadingEmpty" />
</div>
<div v-else class="anno-body">
<TLoading v-model="loading" :title="loadingTitle" :empty="loadingEmpty" />
<div class="anno-body">
<div class="anno-title">
{{ annoData.title }}
</div>
@@ -47,6 +45,7 @@ onMounted(async () => {
}
// 获取数据
loadingTitle.value = "正在获取数据...";
loading.value = true;
try {
annoData.value = await TGRequest.Anno.getContent(annoId);
loadingTitle.value = "正在渲染数据...";
@@ -58,7 +57,7 @@ onMounted(async () => {
}
setTimeout(() => {
loading.value = false;
}, 200);
}, 1200);
});
</script>
<style lang="css" src="../assets/css/anno-parser.css" scoped />

View File

@@ -1,8 +1,6 @@
<template>
<TSwitchTheme />
<div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div>
<TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<div v-else>
<div class="lottery-div">
<div class="lottery-title">

View File

@@ -1,8 +1,6 @@
<template>
<div v-show="loading">
<TLoading :title="loadingTitle" />
</div>
<div v-show="!loading">
<div>
<TLoading v-model="loading" :title="loadingTitle" />
<v-tabs v-model="tab" align-tabs="start" class="news-tab">
<v-tab value="notice">
公告

View File

@@ -1,9 +1,7 @@
<template>
<TSwitchTheme />
<div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div>
<div v-else class="post-json">
<TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<div class="post-json">
<div class="post-title">
帖子返回内容 JSON
</div>

View File

@@ -1,10 +1,8 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<TSwitchTheme />
<div v-if="loading">
<TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div>
<div v-else class="mys-post-body" v-html="postHtml" />
<TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<div class="mys-post-body" v-html="postHtml" />
</template>
<script lang="ts" setup>
// vue