feat(build): move build to .env.local
This commit is contained in:
parent
bc92656e20
commit
3b6c48f1d0
12
src/App.vue
12
src/App.vue
|
@ -10,10 +10,11 @@ import type {ControlMsg, ServerMsg} from "@/api";
|
|||
import {ControlEvent, ControlMsgType} from "@/api";
|
||||
import {routeCtrlMsg, routeModuleServerMsg} from "@/router/msgRouter";
|
||||
import {globalNotify} from "@/composables/notification";
|
||||
import {isDevMode} from "@/composables/buildMode";
|
||||
import {getTrialDate, isDevMode, isOTAEnabled, isTrialMode} from "@/composables/buildMode";
|
||||
import {useSystemModule} from "@/composables/useSystemModule";
|
||||
import {useDataFlowModule} from "@/composables/useDataFlowModule";
|
||||
import {useUpdateModule} from "@/composables/useUpdateModule";
|
||||
import {ElMessageBox} from "element-plus";
|
||||
|
||||
const wsState = useWsStore();
|
||||
|
||||
|
@ -53,7 +54,16 @@ onMounted(() => {
|
|||
|
||||
useSystemModule();
|
||||
useDataFlowModule();
|
||||
|
||||
if (isOTAEnabled()) {
|
||||
useUpdateModule();
|
||||
}
|
||||
|
||||
if (isTrialMode()) {
|
||||
ElMessageBox.alert('感谢您试用串口透传固件,如果觉得好用,可购买标准版支持我,谢谢!', getTrialDate(), {
|
||||
confirmButtonText: '好的',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
export function isDevMode() {
|
||||
return import.meta.env.VITE_APP_MODE === 'dev';
|
||||
}
|
||||
|
||||
export function isOTAEnabled() {
|
||||
return import.meta.env.VITE_ENABLE_OTA === 'true';
|
||||
}
|
||||
|
||||
export function isTrialMode() {
|
||||
return import.meta.env.VITE_TRIAL_MODE === "true"
|
||||
}
|
||||
|
||||
export function getTrialDate() {
|
||||
return import.meta.env.VITE_TRIAL_DATE || "1970-01-01";
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import Uart from '@/views/Uart.vue'
|
|||
import Page404 from '@/views/404.vue'
|
||||
import Update from '@/views/Update.vue'
|
||||
import {translate} from "@/locales";
|
||||
import {isOTAEnabled} from "@/composables/buildMode";
|
||||
|
||||
|
||||
const router = createRouter({
|
||||
|
@ -43,7 +44,7 @@ const router = createRouter({
|
|||
path: '/update:ext(.*)',
|
||||
meta: {title: translate('page.update')},
|
||||
name: 'update',
|
||||
component: Update,
|
||||
component: isOTAEnabled() ? Update : Page404,
|
||||
}, {
|
||||
path: '/:catchAll(.*)', // This will match all paths that aren't matched by above routes
|
||||
name: 'NotFound',
|
||||
|
|
|
@ -115,6 +115,7 @@ import {ControlEvent} from "@/api";
|
|||
import {useRoute} from "vue-router";
|
||||
import { useFullscreen } from '@vueuse/core'
|
||||
import {useUpdateStore} from "@/stores/useUpdateStore";
|
||||
import {isOTAEnabled} from "@/composables/buildMode";
|
||||
|
||||
const wsStore = useWsStore();
|
||||
const updateStore = useUpdateStore();
|
||||
|
@ -178,12 +179,16 @@ const sideBarItems: Item[] = ([
|
|||
}, {
|
||||
name: translate("page.feedback"),
|
||||
href: "/feedback",
|
||||
}, {
|
||||
},
|
||||
]);
|
||||
|
||||
if (isOTAEnabled()) {
|
||||
sideBarItems.push({
|
||||
name: translate("page.update"),
|
||||
href: "/update",
|
||||
badge: computed(() => updateStore.canUpdate),
|
||||
},
|
||||
]);
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue