This commit is contained in:
parent
3071859a3d
commit
2a6672613a
@ -28,7 +28,7 @@
|
||||
"unplugin-auto-import": "^19.3.0",
|
||||
"unplugin-vue-components": "^28.8.0",
|
||||
"vue": "^3.5.17",
|
||||
"vue-i18n": "12.0.0-alpha.2",
|
||||
"vue-i18n": "9.14.3",
|
||||
"vue-router": "^4.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.mingliqiye.disk.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.InputStream;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
||||
@ -11,8 +13,8 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
|
||||
@RequestMapping
|
||||
@Tag(name = "前端路由", description = "统一匹配路径指向VueRouter")
|
||||
public class IndexController {
|
||||
|
||||
@RequestMapping(value = { "/", "/{path:^(?!static|apis|blob).*$}/**" })
|
||||
@Operation(summary = "VueRouter 主路由")
|
||||
@GetMapping(value = { "/", "/{path:^(?!static|apis|blob).*$}/**" })
|
||||
public ResponseEntity<StreamingResponseBody> index() {
|
||||
StreamingResponseBody streamingResponseBody = s -> {
|
||||
try (InputStream stream = this.getClass().getResourceAsStream("/html/index.html")) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
.n-collapse-item__header
|
||||
padding-top: 0 !important
|
||||
.n-collapse-item__header-main
|
||||
padding-left: 10px !important
|
||||
|
||||
.n-collapse-item__content-wrapper
|
||||
|
@ -9,11 +9,13 @@
|
||||
|
||||
html {
|
||||
color: #3c3c3c;
|
||||
--text-color: 60, 60, 60;
|
||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
||||
}
|
||||
|
||||
html.dark {
|
||||
color: #d5d5d5;
|
||||
--text-color: 213, 213, 213;
|
||||
}
|
||||
|
||||
.swagger-ui .info {
|
||||
|
@ -45,13 +45,13 @@
|
||||
<n-collapse accordion default-expanded-names="1">
|
||||
<template v-for="(v2, k2) in v.data">
|
||||
<template v-for="(v3, k3) in v2">
|
||||
<OpenApiDocMethod :id="`${k}+${k3}-${k2}`" :type="k3" :url="k2" />
|
||||
<OpenApiDocMethod :id="`${k}+${k3}-${k2}`" :type="k3" :url="k2" :data="v3" />
|
||||
</template>
|
||||
</template>
|
||||
</n-collapse>
|
||||
</NCard>
|
||||
</n-tab-pane>
|
||||
<n-tab-pane name="架构" tab="架构">
|
||||
<n-tab-pane name="schema" tab="架构">
|
||||
<NCard
|
||||
:segmented="{
|
||||
content: true,
|
||||
@ -66,7 +66,9 @@
|
||||
</div>
|
||||
</template>
|
||||
<n-collapse accordion default-expanded-names="2">
|
||||
<OpenApiDocSchema v-for="(v, k) in data?.components?.schemas" :data="v" :name="k" />
|
||||
<OpenApiDocSchema :id="`schema+${k}`" v-for="(v, k) in
|
||||
data?.components?.schemas"
|
||||
:data="v" :name="k" />
|
||||
</n-collapse>
|
||||
</NCard>
|
||||
</n-tab-pane>
|
||||
@ -105,7 +107,10 @@ import OpenApiDocSecuritySchemes from '@/components/OpenApiDocSecuritySchemes.vu
|
||||
|
||||
const data = ref<OpenAPIV3_1.Document>();
|
||||
const tags = ref<{
|
||||
[key: string]: { data: { [key: string]: OpenAPIV3_1.PathItemObject }; description: string };
|
||||
[key: string]: {
|
||||
data: { [key: string]: OpenAPIV3_1.PathItemObject };
|
||||
description: string;
|
||||
};
|
||||
}>({});
|
||||
export type TFunctionType = (args: string) => string;
|
||||
export type getApiFunType = (args: string) => PromiseLike<string>;
|
||||
@ -123,7 +128,10 @@ onMounted(() => {
|
||||
for (const model in models) {
|
||||
for (const i of models[model]?.tags) {
|
||||
if (!tags.value[i]) {
|
||||
tags.value[i] = { data: {}, description: data.value?.tags?.find((is) => is.name === i)?.description };
|
||||
tags.value[i] = {
|
||||
data: {},
|
||||
description: data.value?.tags?.find((is) => is.name === i)?.description,
|
||||
};
|
||||
}
|
||||
tags.value[i].data[pathsKey] = models;
|
||||
}
|
||||
@ -140,8 +148,13 @@ function hashback(to: RouteLocationNormalizedGeneric) {
|
||||
const tab = to.hash.split('+')?.[0].replace('#', '');
|
||||
setTimeout(() => {
|
||||
tabValue.value = tab;
|
||||
document.getElementById(to.hash.replace('#', ''))?.scrollIntoView();
|
||||
}, 100);
|
||||
setTimeout(()=>{
|
||||
const ele = document.getElementById(to.hash.replace('#', ''));
|
||||
ele?.scrollIntoView();
|
||||
const ele2 = ele?.children[0].children[0];
|
||||
ele2?.click()
|
||||
},100)
|
||||
}, 100 );
|
||||
}
|
||||
|
||||
const removeAfterEach = router.afterEach(hashback);
|
||||
|
@ -28,12 +28,17 @@
|
||||
</div>
|
||||
|
||||
<label style="font-weight: 700">{{ url }}</label>
|
||||
<label style="font-weight: 700;color:var(--color-des-text);">{{
|
||||
data?.summary
|
||||
}}</label>
|
||||
</div>
|
||||
</template>
|
||||
<div></div>
|
||||
</n-collapse-item>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { OpenAPIV3_1 } from 'openapi-types';
|
||||
|
||||
const prop = defineProps({
|
||||
type: {
|
||||
type: String as PropType<'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | 'connect'>,
|
||||
@ -43,6 +48,7 @@ const prop = defineProps({
|
||||
type: [String, Number],
|
||||
required: true,
|
||||
},
|
||||
data:Object as PropType<OpenAPIV3_1.PathItemObject>
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@ -51,6 +57,7 @@ const prop = defineProps({
|
||||
border-radius: 3px;
|
||||
border: 1px solid $color !important;
|
||||
--color: #{$color};
|
||||
--color-des-text: rgba(var(--text-color), 0.5);
|
||||
}
|
||||
|
||||
.get {
|
||||
|
@ -3,6 +3,7 @@
|
||||
<template #header>
|
||||
<div f n-c style="padding: 10px; height: calc(100% - 10px); display: flex; gap: 20px">
|
||||
<label style="font-weight: 700">{{ name }}</label>
|
||||
<label style="font-weight: 700;color:var(--color-des-text);"></label>
|
||||
</div>
|
||||
</template>
|
||||
<div></div>
|
||||
@ -20,6 +21,7 @@ const props = defineProps({
|
||||
@mixin method-style($color) {
|
||||
background: rgba($color, 0.1);
|
||||
border-radius: 3px;
|
||||
--color-des-text: rgba(var(--text-color), 0.5);
|
||||
border: 1px solid $color !important;
|
||||
--color: #{$color};
|
||||
}
|
||||
|
@ -3,22 +3,32 @@
|
||||
<template #header>
|
||||
<div f n-c style="padding: 10px; height: calc(100% - 10px); display: flex; gap: 20px">
|
||||
<label style="font-weight: 700">{{ name }}</label>
|
||||
<label style="font-weight: 700;color:var(--color-des-text);">{{ data?.description
|
||||
}}</label>
|
||||
</div>
|
||||
</template>
|
||||
<div></div>
|
||||
</n-collapse-item>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { PropType } from 'vue';
|
||||
import type { OpenAPIV3_1 } from 'openapi-types';
|
||||
const props = defineProps({
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
data:{
|
||||
type:Object as PropType<OpenAPIV3_1.SecuritySchemeObject>
|
||||
}
|
||||
});
|
||||
|
||||
console.log(props.data);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@mixin method-style($color) {
|
||||
background: rgba($color, 0.1);
|
||||
--color-des-text: rgba(var(--text-color), 0.5);
|
||||
border-radius: 3px;
|
||||
border: 1px solid $color !important;
|
||||
--color: #{$color};
|
||||
|
@ -16,7 +16,7 @@
|
||||
}"
|
||||
@click="router.push({ name: 'home' })">
|
||||
<Icon icon="material-symbols:home" />
|
||||
{{ $t('nav.title.home') }}
|
||||
{{ t('nav.title.home') }}
|
||||
<div class="after"></div>
|
||||
</div>
|
||||
<div
|
||||
@ -86,7 +86,15 @@
|
||||
<script lang="ts" setup>
|
||||
import Icon from '@/components/Icon.vue';
|
||||
import { UseBoolRef } from '@/util';
|
||||
import { type languageIndexItemValueType, message, messageData, router, UseAuthStore, UseSettingStore } from '@/plugin';
|
||||
import {
|
||||
i18n,
|
||||
type languageIndexItemValueType,
|
||||
message,
|
||||
messageData,
|
||||
router,
|
||||
UseAuthStore,
|
||||
UseSettingStore,
|
||||
} from '@/plugin';
|
||||
import { getSysInfo } from '@/api/system.ts';
|
||||
import type { SelectOption } from 'naive-ui/es/select/src/interface';
|
||||
import type { VNodeChild } from 'vue';
|
||||
@ -154,6 +162,10 @@ function openFile() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const t = i18n.global.t;
|
||||
window.i18n = i18n;
|
||||
console.log(t);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
html.dark {
|
||||
|
@ -7,10 +7,9 @@ import App from './App.vue';
|
||||
import { i18n, installI18n, pinia, router } from './plugin';
|
||||
|
||||
const app = createApp(App);
|
||||
app.use(i18n);
|
||||
app.use(pinia);
|
||||
app.use(router);
|
||||
app.mount('#app');
|
||||
console.log(i18n);
|
||||
|
||||
await installI18n();
|
||||
app.use(i18n);
|
||||
installI18n().then(() => {
|
||||
app.use(router);
|
||||
app.mount('#app');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user