mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
chore: env
This commit is contained in:
@@ -6,6 +6,6 @@ VITE_APP_SLOGAN=让你的证书永不过期
|
||||
VITE_APP_COPYRIGHT_YEAR=2021-2024
|
||||
VITE_APP_COPYRIGHT_NAME=handsfree.work
|
||||
VITE_APP_COPYRIGHT_URL=https://certd.handsfree.work
|
||||
VITE_APP_LOGO_PATH=./images/logo/logo.svg
|
||||
VITE_APP_LOGO=./images/logo/logo.svg
|
||||
VITE_APP_PROJECT_PATH=https://github.com/certd/certd
|
||||
VITE_APP_ICP_NO=
|
||||
|
||||
|
||||
@@ -1,37 +1,25 @@
|
||||
// @ts-ignore
|
||||
import _ from "lodash-es";
|
||||
export function getEnvValue(key: string) {
|
||||
// @ts-ignore
|
||||
return import.meta.env["VITE_APP_" + key];
|
||||
}
|
||||
|
||||
export class EnvConfig {
|
||||
API: string;
|
||||
MODE: string;
|
||||
STORAGE: string;
|
||||
TITLE: string;
|
||||
SLOGAN: string;
|
||||
COPYRIGHT_YEAR: string;
|
||||
COPYRIGHT_NAME: string;
|
||||
COPYRIGHT_URL: string;
|
||||
LOGO_PATH: string;
|
||||
PM_ENABLED: string;
|
||||
ICP_NO: string;
|
||||
constructor() {
|
||||
this.init();
|
||||
}
|
||||
MODE: string = import.meta.env.MODE;
|
||||
API: string = import.meta.env.VITE_APP_API;
|
||||
STORAGE: string = import.meta.env.VITE_APP_STORAGE;
|
||||
TITLE: string = import.meta.env.VITE_APP_TITLE;
|
||||
SLOGAN: string = import.meta.env.VITE_APP_SLOGAN;
|
||||
COPYRIGHT_YEAR: string = import.meta.env.VITE_APP_COPYRIGHT_YEAR;
|
||||
COPYRIGHT_NAME: string = import.meta.env.VITE_APP_COPYRIGHT_NAME;
|
||||
COPYRIGHT_URL: string = import.meta.env.VITE_APP_COPYRIGHT_URL;
|
||||
LOGO: string = import.meta.env.VITE_APP_LOGO;
|
||||
PM_ENABLED: string = import.meta.env.VITE_APP_PM_ENABLED;
|
||||
ICP_NO: string = import.meta.env.VITE_APP_ICP_NO;
|
||||
|
||||
init() {
|
||||
// @ts-ignore
|
||||
_.forEach(import.meta.env, (value, key) => {
|
||||
if (key.startsWith("VITE_APP")) {
|
||||
key = key.replace("VITE_APP_", "");
|
||||
// @ts-ignore
|
||||
this[key] = value;
|
||||
init(env: any) {
|
||||
for (const key in this) {
|
||||
if (this.hasOwnProperty(key)) {
|
||||
this[key] = env[key];
|
||||
}
|
||||
});
|
||||
// @ts-ignore
|
||||
this.MODE = import.meta.env.MODE;
|
||||
}
|
||||
}
|
||||
|
||||
get(key: string, defaultValue: string) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="d2-page-cover">
|
||||
<div class="d2-page-cover__title">
|
||||
<div class="title-line">
|
||||
<img width="50" :src="envRef.LOGO_PATH" />
|
||||
<img width="50" :src="envRef.LOGO" />
|
||||
{{ envRef.TITLE }} v{{ version }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -46,10 +46,12 @@ import { useSettingStore } from "/@/store/modules/settings";
|
||||
|
||||
interface FormState {
|
||||
registerEnabled: boolean;
|
||||
managerOtherUserPipeline: boolean;
|
||||
}
|
||||
|
||||
const formState = reactive<Partial<FormState>>({
|
||||
registerEnabled: false
|
||||
registerEnabled: false,
|
||||
managerOtherUserPipeline: false
|
||||
});
|
||||
|
||||
async function loadSysPublicSettings() {
|
||||
@@ -61,7 +63,6 @@ async function loadSysPublicSettings() {
|
||||
loadSysPublicSettings();
|
||||
const settingsStore = useSettingStore();
|
||||
const onFinish = async (form: any) => {
|
||||
console.log("Success:", form);
|
||||
await api.PublicSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
|
||||
Reference in New Issue
Block a user