Compare commits

..

No commits in common. "2a6672613af43b21a7b468a10b06ab6be306e535" and "570c41bc116bff9def40d6b69361dc6a2b174a71" have entirely different histories.

11 changed files with 43 additions and 64 deletions

View File

@ -9,7 +9,6 @@
"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",
@ -28,7 +27,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": "9.14.3", "vue-i18n": "12.0.0-alpha.2",
"vue-router": "^4.5.1" "vue-router": "^4.5.1"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,10 +1,8 @@
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;
@ -13,8 +11,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 主路由")
@GetMapping(value = { "/", "/{path:^(?!static|apis|blob).*$}/**" }) @RequestMapping(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,7 +6,6 @@
.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,13 +9,11 @@
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" :data="v3" /> <OpenApiDocMethod :id="`${k}+${k3}-${k2}`" :type="k3" :url="k2" />
</template> </template>
</template> </template>
</n-collapse> </n-collapse>
</NCard> </NCard>
</n-tab-pane> </n-tab-pane>
<n-tab-pane name="schema" tab="架构"> <n-tab-pane name="架构" tab="架构">
<NCard <NCard
:segmented="{ :segmented="{
content: true, content: true,
@ -66,9 +66,7 @@
</div> </div>
</template> </template>
<n-collapse accordion default-expanded-names="2"> <n-collapse accordion default-expanded-names="2">
<OpenApiDocSchema :id="`schema+${k}`" v-for="(v, k) in <OpenApiDocSchema v-for="(v, k) in data?.components?.schemas" :data="v" :name="k" />
data?.components?.schemas"
:data="v" :name="k" />
</n-collapse> </n-collapse>
</NCard> </NCard>
</n-tab-pane> </n-tab-pane>
@ -107,10 +105,7 @@ 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]: { [key: string]: { data: { [key: string]: OpenAPIV3_1.PathItemObject }; description: 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>;
@ -128,10 +123,7 @@ 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] = { tags.value[i] = { data: {}, description: data.value?.tags?.find((is) => is.name === i)?.description };
data: {},
description: data.value?.tags?.find((is) => is.name === i)?.description,
};
} }
tags.value[i].data[pathsKey] = models; tags.value[i].data[pathsKey] = models;
} }
@ -148,13 +140,8 @@ 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;
setTimeout(()=>{ document.getElementById(to.hash.replace('#', ''))?.scrollIntoView();
const ele = document.getElementById(to.hash.replace('#', '')); }, 100);
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,17 +28,12 @@
</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'>,
@ -48,7 +43,6 @@ 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>
@ -57,7 +51,6 @@ 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,7 +3,6 @@
<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>
@ -21,7 +20,6 @@ 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,32 +3,22 @@
<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,10 +162,6 @@ 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,12 +4,13 @@ import './assets/index.sass';
import { createApp } from 'vue'; import { createApp } from 'vue';
import App from './App.vue'; import App from './App.vue';
import { i18n, installI18n, pinia, router } from './plugin'; import { installI18n, pinia, router } from './plugin';
const app = createApp(App); installI18n().then((i18n) => {
app.use(pinia); const app = createApp(App);
app.use(i18n); app.use(i18n);
installI18n().then(() => { app.use(pinia);
app.use(router); app.use(router);
app.mount('#app'); app.mount('#app');
console.log(i18n);
}); });

View File

@ -32,12 +32,22 @@ export const messages: languageType | any = {};
export const messageData = ref<languageIndexItemValueType[]>([]); export const messageData = ref<languageIndexItemValueType[]>([]);
export const i18n = createI18n({ export let i18n: ReturnType<
legacy: false, typeof createI18n<
locale: 'zh-cn', {
fallbackLocale: 'zh-cn', legacy: boolean;
messages, locale: string;
}); 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();
@ -49,4 +59,14 @@ 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;
} }