💄 先把所有用到 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) => { (v) => {
if (v) { if (v) {
showOut.value = true; showOut.value = true;
setTimeout(() => {
showIn.value = true;
}, 0);
} else {
showIn.value = false; showIn.value = false;
} else {
setTimeout(() => {
showIn.value = false;
}, 100);
setTimeout(() => { setTimeout(() => {
showOut.value = false; showOut.value = false;
}, 200); }, 300);
} }
}, },
); );

View File

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

View File

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

View File

@@ -1,11 +1,11 @@
<template> <template>
<TLoading v-if="loading" :title="loadingTitle" :subtitle="loadingSubtitle" /> <TLoading v-model="loading" :title="loadingTitle" :subtitle="loadingSubtitle" />
<component :is="item" v-for="item in components" v-show="!loading" :key="item" :ref="setItemRef" /> <component :is="item" v-for="item in components" :key="item" :ref="setItemRef" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // 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 TLoading from "../components/main/t-loading.vue";
import TPool from "../components/main/t-pool.vue"; import TPool from "../components/main/t-pool.vue";
import TPosition from "../components/main/t-position.vue"; import TPosition from "../components/main/t-position.vue";
@@ -45,6 +45,14 @@ function readLoading (): void {
onMounted(async () => { onMounted(async () => {
loadingTitle.value = "正在加载首页"; 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(); const showItems = homeStore.getShowValue();
await Promise.allSettled( await Promise.allSettled(
showItems.map((item) => { showItems.map((item) => {
@@ -61,13 +69,6 @@ onMounted(async () => {
}), }),
); );
timer.value = setInterval(readLoading, 100); 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) { function setItemRef (item: any) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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