no message
All checks were successful
Gitea Actions Build / Build (push) Successful in 1m23s

This commit is contained in:
Armamem0t 2025-07-01 08:03:23 +08:00
parent 3071859a3d
commit 2a6672613a
Signed by: minglipro
GPG Key ID: 5F355A77B22AA93B
10 changed files with 66 additions and 18 deletions

View File

@ -28,7 +28,7 @@
"unplugin-auto-import": "^19.3.0", "unplugin-auto-import": "^19.3.0",
"unplugin-vue-components": "^28.8.0", "unplugin-vue-components": "^28.8.0",
"vue": "^3.5.17", "vue": "^3.5.17",
"vue-i18n": "12.0.0-alpha.2", "vue-i18n": "9.14.3",
"vue-router": "^4.5.1" "vue-router": "^4.5.1"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,8 +1,10 @@
package com.mingliqiye.disk.controller; package com.mingliqiye.disk.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.InputStream; import java.io.InputStream;
import org.springframework.http.ResponseEntity; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
@ -11,8 +13,8 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
@RequestMapping @RequestMapping
@Tag(name = "前端路由", description = "统一匹配路径指向VueRouter") @Tag(name = "前端路由", description = "统一匹配路径指向VueRouter")
public class IndexController { public class IndexController {
@Operation(summary = "VueRouter 主路由")
@RequestMapping(value = { "/", "/{path:^(?!static|apis|blob).*$}/**" }) @GetMapping(value = { "/", "/{path:^(?!static|apis|blob).*$}/**" })
public ResponseEntity<StreamingResponseBody> index() { public ResponseEntity<StreamingResponseBody> index() {
StreamingResponseBody streamingResponseBody = s -> { StreamingResponseBody streamingResponseBody = s -> {
try (InputStream stream = this.getClass().getResourceAsStream("/html/index.html")) { try (InputStream stream = this.getClass().getResourceAsStream("/html/index.html")) {

View File

@ -6,6 +6,7 @@
.n-collapse-item__header .n-collapse-item__header
padding-top: 0 !important padding-top: 0 !important
.n-collapse-item__header-main
padding-left: 10px !important padding-left: 10px !important
.n-collapse-item__content-wrapper .n-collapse-item__content-wrapper

View File

@ -9,11 +9,13 @@
html { html {
color: #3c3c3c; color: #3c3c3c;
--text-color: 60, 60, 60;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
} }
html.dark { html.dark {
color: #d5d5d5; color: #d5d5d5;
--text-color: 213, 213, 213;
} }
.swagger-ui .info { .swagger-ui .info {

View File

@ -45,13 +45,13 @@
<n-collapse accordion default-expanded-names="1"> <n-collapse accordion default-expanded-names="1">
<template v-for="(v2, k2) in v.data"> <template v-for="(v2, k2) in v.data">
<template v-for="(v3, k3) in v2"> <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>
</template> </template>
</n-collapse> </n-collapse>
</NCard> </NCard>
</n-tab-pane> </n-tab-pane>
<n-tab-pane name="架构" tab="架构"> <n-tab-pane name="schema" tab="架构">
<NCard <NCard
:segmented="{ :segmented="{
content: true, content: true,
@ -66,7 +66,9 @@
</div> </div>
</template> </template>
<n-collapse accordion default-expanded-names="2"> <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> </n-collapse>
</NCard> </NCard>
</n-tab-pane> </n-tab-pane>
@ -105,7 +107,10 @@ import OpenApiDocSecuritySchemes from '@/components/OpenApiDocSecuritySchemes.vu
const data = ref<OpenAPIV3_1.Document>(); const data = ref<OpenAPIV3_1.Document>();
const tags = ref<{ 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 TFunctionType = (args: string) => string;
export type getApiFunType = (args: string) => PromiseLike<string>; export type getApiFunType = (args: string) => PromiseLike<string>;
@ -123,7 +128,10 @@ onMounted(() => {
for (const model in models) { for (const model in models) {
for (const i of models[model]?.tags) { for (const i of models[model]?.tags) {
if (!tags.value[i]) { 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; tags.value[i].data[pathsKey] = models;
} }
@ -140,8 +148,13 @@ function hashback(to: RouteLocationNormalizedGeneric) {
const tab = to.hash.split('+')?.[0].replace('#', ''); const tab = to.hash.split('+')?.[0].replace('#', '');
setTimeout(() => { setTimeout(() => {
tabValue.value = tab; tabValue.value = tab;
document.getElementById(to.hash.replace('#', ''))?.scrollIntoView(); setTimeout(()=>{
}, 100); 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); const removeAfterEach = router.afterEach(hashback);

View File

@ -28,12 +28,17 @@
</div> </div>
<label style="font-weight: 700">{{ url }}</label> <label style="font-weight: 700">{{ url }}</label>
<label style="font-weight: 700;color:var(--color-des-text);">{{
data?.summary
}}</label>
</div> </div>
</template> </template>
<div></div> <div></div>
</n-collapse-item> </n-collapse-item>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import type { OpenAPIV3_1 } from 'openapi-types';
const prop = defineProps({ const prop = defineProps({
type: { type: {
type: String as PropType<'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | 'connect'>, type: String as PropType<'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | 'connect'>,
@ -43,6 +48,7 @@ const prop = defineProps({
type: [String, Number], type: [String, Number],
required: true, required: true,
}, },
data:Object as PropType<OpenAPIV3_1.PathItemObject>
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -51,6 +57,7 @@ const prop = defineProps({
border-radius: 3px; border-radius: 3px;
border: 1px solid $color !important; border: 1px solid $color !important;
--color: #{$color}; --color: #{$color};
--color-des-text: rgba(var(--text-color), 0.5);
} }
.get { .get {

View File

@ -3,6 +3,7 @@
<template #header> <template #header>
<div f n-c style="padding: 10px; height: calc(100% - 10px); display: flex; gap: 20px"> <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">{{ name }}</label>
<label style="font-weight: 700;color:var(--color-des-text);"></label>
</div> </div>
</template> </template>
<div></div> <div></div>
@ -20,6 +21,7 @@ const props = defineProps({
@mixin method-style($color) { @mixin method-style($color) {
background: rgba($color, 0.1); background: rgba($color, 0.1);
border-radius: 3px; border-radius: 3px;
--color-des-text: rgba(var(--text-color), 0.5);
border: 1px solid $color !important; border: 1px solid $color !important;
--color: #{$color}; --color: #{$color};
} }

View File

@ -3,22 +3,32 @@
<template #header> <template #header>
<div f n-c style="padding: 10px; height: calc(100% - 10px); display: flex; gap: 20px"> <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">{{ name }}</label>
<label style="font-weight: 700;color:var(--color-des-text);">{{ data?.description
}}</label>
</div> </div>
</template> </template>
<div></div> <div></div>
</n-collapse-item> </n-collapse-item>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import type { PropType } from 'vue';
import type { OpenAPIV3_1 } from 'openapi-types';
const props = defineProps({ const props = defineProps({
name: { name: {
type: String, type: String,
required: true, required: true,
}, },
data:{
type:Object as PropType<OpenAPIV3_1.SecuritySchemeObject>
}
}); });
console.log(props.data);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@mixin method-style($color) { @mixin method-style($color) {
background: rgba($color, 0.1); background: rgba($color, 0.1);
--color-des-text: rgba(var(--text-color), 0.5);
border-radius: 3px; border-radius: 3px;
border: 1px solid $color !important; border: 1px solid $color !important;
--color: #{$color}; --color: #{$color};

View File

@ -16,7 +16,7 @@
}" }"
@click="router.push({ name: 'home' })"> @click="router.push({ name: 'home' })">
<Icon icon="material-symbols:home" /> <Icon icon="material-symbols:home" />
{{ $t('nav.title.home') }} {{ t('nav.title.home') }}
<div class="after"></div> <div class="after"></div>
</div> </div>
<div <div
@ -86,7 +86,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import Icon from '@/components/Icon.vue'; import Icon from '@/components/Icon.vue';
import { UseBoolRef } from '@/util'; 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 { getSysInfo } from '@/api/system.ts';
import type { SelectOption } from 'naive-ui/es/select/src/interface'; import type { SelectOption } from 'naive-ui/es/select/src/interface';
import type { VNodeChild } from 'vue'; import type { VNodeChild } from 'vue';
@ -154,6 +162,10 @@ function openFile() {
}); });
} }
} }
const t = i18n.global.t;
window.i18n = i18n;
console.log(t);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
html.dark { html.dark {

View File

@ -7,10 +7,9 @@ import App from './App.vue';
import { i18n, installI18n, pinia, router } from './plugin'; import { i18n, installI18n, pinia, router } from './plugin';
const app = createApp(App); const app = createApp(App);
app.use(i18n);
app.use(pinia); app.use(pinia);
app.use(router); app.use(i18n);
app.mount('#app'); installI18n().then(() => {
console.log(i18n); app.use(router);
app.mount('#app');
await installI18n(); });