mirror of https://github.com/certd/certd
chore: env
parent
e0466409d0
commit
81d6c0ebdf
|
@ -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({
|
||||
|
|
|
@ -1,23 +1,8 @@
|
|||
import { Rule, RuleType } from '@midwayjs/validate';
|
||||
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
|
||||
import { BaseController } from '../../../basic/base-controller.js';
|
||||
import { Constants } from '../../../basic/constants.js';
|
||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
||||
import { SysInstallInfo, SysPublicSettings } from '../../system/service/models.js';
|
||||
|
||||
export class SmsCodeReq {
|
||||
@Rule(RuleType.number().required())
|
||||
phoneCode: number;
|
||||
|
||||
@Rule(RuleType.string().required())
|
||||
mobile: string;
|
||||
|
||||
@Rule(RuleType.string().required().max(10))
|
||||
randomStr: string;
|
||||
|
||||
@Rule(RuleType.number().required().max(4))
|
||||
imgCode: string;
|
||||
}
|
||||
import { SysInstallInfo, SysPublicSettings, SysSiteInfo } from '../../system/service/models.js';
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -38,4 +23,10 @@ export class BasicSettingsController extends BaseController {
|
|||
const settings = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
return this.ok(settings);
|
||||
}
|
||||
|
||||
@Get('/siteInfo', { summary: Constants.per.guest })
|
||||
public async getSiteInfo() {
|
||||
const settings = await this.sysSettingsService.getSetting(SysSiteInfo);
|
||||
return this.ok(settings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,3 +38,13 @@ export class SysLicenseInfo extends BaseSettings {
|
|||
static __access__ = 'private';
|
||||
license?: string;
|
||||
}
|
||||
|
||||
export class SysSiteInfo extends BaseSettings {
|
||||
static __title__ = '站点信息';
|
||||
static __key__ = 'sys.site';
|
||||
static __access__ = 'public';
|
||||
TITLE?: string;
|
||||
SLOGAN?: string;
|
||||
LOGO?: string;
|
||||
ICP_NO?: string;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue