新增一个 devEnv 用于判断生产环境|开发环境

fix #26
This commit is contained in:
BTMuli
2023-05-24 15:45:03 +08:00
parent d1e39ed8cd
commit f55a688aae
4 changed files with 23 additions and 12 deletions

View File

@@ -119,7 +119,7 @@
调试
</v-list-subheader>
<v-divider inset class="border-opacity-75" />
<v-list-item title="开发者模式" subtitle="开启后将显示调试信息">
<v-list-item v-if="appStore.devEnv" title="调试模式" subtitle="开启后将显示调试信息">
<template #prepend>
<v-icon>mdi-bug</v-icon>
</template>
@@ -138,12 +138,9 @@
<span style="cursor: pointer" @click="tryConfirm('inputCookie')">手动输入 Cookie</span>
</template>
<template #append>
<div style="cursor: pointer" @click="toOuter('https://github.com/BTMuli/Tauri.Genshin/issues/18')">
<span>如何获取 Cookie</span>
<v-icon @click="">
mdi-help-circle-outline
</v-icon>
</div>
<v-icon style="cursor: pointer" @click="toOuter('https://github.com/BTMuli/Tauri.Genshin/issues/18')">
mdi-help-circle-outline
</v-icon>
</template>
</v-list-item>
<v-list-item title="删除 IndexedDB" prepend-icon="mdi-delete" @click="tryConfirm('delDB')" />
@@ -178,7 +175,6 @@
<script lang="ts" setup>
// vue
import { computed, onMounted, ref } from "vue";
import { getBuildTime } from "../utils/TGBuild";
import TLoading from "../components/t-loading.vue";
import TConfirm from "../components/t-confirm.vue";
// tauri
@@ -204,7 +200,7 @@ const achievementsStore = useAchievementsStore();
// About App
const versionApp = ref("" as string);
const versionTauri = ref("" as string);
const buildTime = ref(getBuildTime());
const buildTime = computed(() => appStore.buildTime);
// About OS
const osPlatform = ref("" as string);

View File

@@ -12,8 +12,12 @@ import TPosition from "../components/t-position.vue";
import TCalendar from "../components/t-calendar.vue";
// store
import { useHomeStore } from "../store/modules/home";
import { useAppStore } from "../store/modules/app";
// utils
import { getBuildTime } from "../utils/TGBuild";
// store
const appStore = useAppStore();
const homeStore = useHomeStore();
// loading
@@ -57,6 +61,13 @@ 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) {