diff --git a/mayfly_go_web/src/common/sysconfig.ts b/mayfly_go_web/src/common/sysconfig.ts index 4be1c57d..8392de87 100644 --- a/mayfly_go_web/src/common/sysconfig.ts +++ b/mayfly_go_web/src/common/sysconfig.ts @@ -59,15 +59,20 @@ export async function useLoginCaptcha(): Promise { */ export async function useWatermark(): Promise { const value = await getConfigValue(UseWatermarkConfigKey); + const defaultValue = { + isUse: true, + }; if (!value) { - return { - isUse: true, - }; + return defaultValue; + } + try { + const jsonValue = JSON.parse(value); + // 将字符串转为bool + jsonValue.isUse = convertBool(jsonValue.isUse, true); + return jsonValue; + } catch (e) { + return defaultValue; } - const jsonValue = JSON.parse(value); - // 将字符串转为bool - jsonValue.isUse = convertBool(jsonValue.isUse, true); - return jsonValue; } function convertBool(value: string, defaultValue: boolean) { diff --git a/mayfly_go_web/src/components/monaco/MonacoEditor.vue b/mayfly_go_web/src/components/monaco/MonacoEditor.vue index 6c0d9670..4292612d 100644 --- a/mayfly_go_web/src/components/monaco/MonacoEditor.vue +++ b/mayfly_go_web/src/components/monaco/MonacoEditor.vue @@ -132,7 +132,7 @@ const languageArr = [ }, ]; -const options = { +const defaultOptions = { language: 'shell', theme: 'SolarizedLight', automaticLayout: true, //自适应宽高布局 @@ -223,9 +223,9 @@ const initMonacoEditorIns = () => { // options参数参考 https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IStandaloneEditorConstructionOptions.html#language // 初始化一些主题 monaco.editor.defineTheme('SolarizedLight', SolarizedLight); - options.language = state.languageMode; - options.theme = themeConfig.value.editorTheme; - monacoEditorIns = monaco.editor.create(monacoTextarea.value, Object.assign(options, props.options as any)); + defaultOptions.language = state.languageMode; + defaultOptions.theme = themeConfig.value.editorTheme; + monacoEditorIns = monaco.editor.create(monacoTextarea.value, Object.assign(defaultOptions, props.options as any)); // 监听内容改变,双向绑定 monacoEditorIns.onDidChangeModelContent(() => { diff --git a/mayfly_go_web/src/store/themeConfig.ts b/mayfly_go_web/src/store/themeConfig.ts index 92d0abb0..927aca1c 100644 --- a/mayfly_go_web/src/store/themeConfig.ts +++ b/mayfly_go_web/src/store/themeConfig.ts @@ -151,7 +151,7 @@ export const useThemeConfig = defineStore('themeConfig', { this.themeConfig.editorTheme = 'vs-dark'; } else { body.setAttribute('class', ''); - this.themeConfig.editorTheme = 'SolarizedLight'; + this.themeConfig.editorTheme = 'vs'; } }, // 设置水印配置信息 diff --git a/mayfly_go_web/src/views/ops/component/TagInfo.vue b/mayfly_go_web/src/views/ops/component/TagInfo.vue index a15b8f3f..3297671b 100644 --- a/mayfly_go_web/src/views/ops/component/TagInfo.vue +++ b/mayfly_go_web/src/views/ops/component/TagInfo.vue @@ -1,6 +1,6 @@