diff --git a/web/console-fe/src/i18n/langs/en/common.ts b/web/console-fe/src/i18n/langs/en/common.ts index 679423d7..ee87583a 100644 --- a/web/console-fe/src/i18n/langs/en/common.ts +++ b/web/console-fe/src/i18n/langs/en/common.ts @@ -36,5 +36,6 @@ export default { format: 'Format', snippet: 'Snippet', submit: 'Submit', - updateTime: 'Update Time' + updateTime: 'Update Time', + quote: 'Quote' } diff --git a/web/console-fe/src/i18n/langs/zhCn/common.ts b/web/console-fe/src/i18n/langs/zhCn/common.ts index 18726315..08005383 100644 --- a/web/console-fe/src/i18n/langs/zhCn/common.ts +++ b/web/console-fe/src/i18n/langs/zhCn/common.ts @@ -36,5 +36,6 @@ export default { format: '格式化', snippet: '片段', submit: '提交', - updateTime: "更新时间" + updateTime: '更新时间', + quote: '引用' } diff --git a/web/console-fe/src/router/index.ts b/web/console-fe/src/router/index.ts index 8ce14b1b..32a80ee2 100644 --- a/web/console-fe/src/router/index.ts +++ b/web/console-fe/src/router/index.ts @@ -46,6 +46,7 @@ const routes: Array = [ }, children: [ { + name: 'ConsoleIndex', path: "index", component: () => import("../views/pages/console/ConsoleOnline.vue") } diff --git a/web/console-fe/src/views/pages/admin/snippet/SnippetConsole.vue b/web/console-fe/src/views/pages/admin/snippet/SnippetConsole.vue index 06a527dd..46ab0f16 100644 --- a/web/console-fe/src/views/pages/admin/snippet/SnippetConsole.vue +++ b/web/console-fe/src/views/pages/admin/snippet/SnippetConsole.vue @@ -16,14 +16,18 @@ - - - - - - + + + + + + + + + + + + @@ -58,6 +62,7 @@ import {useI18n} from 'vue-i18n'; import Common from "@/common/Common"; import {createHeaders} from "@/views/pages/admin/snippet/SnippetGenerate"; import {SnippetService} from "@/services/SnippetService"; +import router from "@/router"; export default defineComponent({ name: "SnippetConsoleView", @@ -148,6 +153,10 @@ export default defineComponent({ this.visibleSnippetInfo = false; this.applyId = 0; this.handlerInitialize(this.pagination.current, this.pagination.pageSize); + }, + handlerGoConsoleIndex(id: number) + { + router.push('/console/index?id=' + id + '&from=snippet'); } } }); diff --git a/web/console-fe/src/views/pages/console/ConsoleOnline.vue b/web/console-fe/src/views/pages/console/ConsoleOnline.vue index 525732a8..462e4932 100644 --- a/web/console-fe/src/views/pages/console/ConsoleOnline.vue +++ b/web/console-fe/src/views/pages/console/ConsoleOnline.vue @@ -113,6 +113,8 @@ import * as monaco from 'monaco-editor'; import MonacoEditor from 'monaco-editor-vue3'; import {defineComponent} from "vue"; import SnippetDetails from "@/views/pages/admin/snippet/SnippetDetails.vue"; +import {useRouter} from "vue-router"; +import {SnippetService} from "@/services/SnippetService"; export default defineComponent({ name: "DashboardConsoleView", @@ -139,7 +141,29 @@ export default defineComponent({ snippetDetails: false } }, + created() + { + this.handlerInitialize(); + }, methods: { + handlerInitialize() + { + const router = useRouter(); + if (router.currentRoute?.value?.query) { + const id = router.currentRoute.value.query.id as unknown as number; + const from = router.currentRoute.value.query.from; + if (id && from) { + if (from === 'snippet') { + new SnippetService().getById(id) + .then((response) => { + if (response.status) { + this.editorValue = response.data.code; + } + }); + } + } + } + }, handlerEditorDidMount(editor: any) { const suggestions = new LanguageService().transSuggestions([]);