Compare commits

...

2 Commits

Author SHA1 Message Date
2a6672613a
no message
All checks were successful
Gitea Actions Build / Build (push) Successful in 1m23s
2025-07-01 08:03:23 +08:00
3071859a3d
no message 2025-07-01 10:25:43 +08:00
11 changed files with 64 additions and 43 deletions

View File

@ -9,6 +9,7 @@
"build-jar-auto": "run-p \"build-only\" && gradle -Dorg.gradle.java.home=/opt/jdk/21.0.7/ build-jar", "build-jar-auto": "run-p \"build-only\" && gradle -Dorg.gradle.java.home=/opt/jdk/21.0.7/ build-jar",
"build": "run-p type-check \"build-only {@}\" --", "build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview", "preview": "vite preview",
"build-preview": "run-p build-only && vite preview",
"build-only": "vite build", "build-only": "vite build",
"type-check": "vue-tsc --build", "type-check": "vue-tsc --build",
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore", "lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
@ -27,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,7 +148,12 @@ 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(()=>{
const ele = document.getElementById(to.hash.replace('#', ''));
ele?.scrollIntoView();
const ele2 = ele?.children[0].children[0];
ele2?.click()
},100)
}, 100 ); }, 100 );
} }

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

@ -87,11 +87,11 @@
import Icon from '@/components/Icon.vue'; import Icon from '@/components/Icon.vue';
import { UseBoolRef } from '@/util'; import { UseBoolRef } from '@/util';
import { import {
i18n,
type languageIndexItemValueType, type languageIndexItemValueType,
message, message,
messageData, messageData,
router, router,
t,
UseAuthStore, UseAuthStore,
UseSettingStore, UseSettingStore,
} from '@/plugin'; } from '@/plugin';
@ -162,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

@ -4,13 +4,12 @@ import './assets/index.sass';
import { createApp } from 'vue'; import { createApp } from 'vue';
import App from './App.vue'; import App from './App.vue';
import { installI18n, pinia, router } from './plugin'; import { i18n, installI18n, pinia, router } from './plugin';
installI18n().then((i18n) => {
const app = createApp(App); const app = createApp(App);
app.use(i18n);
app.use(pinia); app.use(pinia);
app.use(i18n);
installI18n().then(() => {
app.use(router); app.use(router);
app.mount('#app'); app.mount('#app');
console.log(i18n);
}); });

View File

@ -32,22 +32,12 @@ export const messages: languageType | any = {};
export const messageData = ref<languageIndexItemValueType[]>([]); export const messageData = ref<languageIndexItemValueType[]>([]);
export let i18n: ReturnType< export const i18n = createI18n({
typeof createI18n< legacy: false,
{ locale: 'zh-cn',
legacy: boolean; fallbackLocale: 'zh-cn',
locale: string; messages,
fallbackLocale: string; });
messages: any;
},
any,
any
>
>;
export function t(data: string): string {
return i18n.global.t(data);
}
export async function installI18n() { export async function installI18n() {
const data: languageIndexType = await loadIndexFile(); const data: languageIndexType = await loadIndexFile();
@ -59,14 +49,4 @@ export async function installI18n() {
}); });
messages[i.id] = await loadLanguageFile(i.file); messages[i.id] = await loadLanguageFile(i.file);
} }
console.log(messages);
console.log(languagedatas);
console.log(messageData);
i18n = createI18n({
legacy: false,
locale: 'zh-cn',
fallbackLocale: 'zh-cn',
messages,
});
return i18n;
} }