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": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-preview": "run-p build-only && vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build",
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
@ -28,7 +27,7 @@
"unplugin-auto-import": "^19.3.0",
"unplugin-vue-components": "^28.8.0",
"vue": "^3.5.17",
"vue-i18n": "9.14.3",
"vue-i18n": "12.0.0-alpha.2",
"vue-router": "^4.5.1"
},
"devDependencies": {

View File

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

View File

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

View File

@ -9,13 +9,11 @@
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 {

View File

@ -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" :data="v3" />
<OpenApiDocMethod :id="`${k}+${k3}-${k2}`" :type="k3" :url="k2" />
</template>
</template>
</n-collapse>
</NCard>
</n-tab-pane>
<n-tab-pane name="schema" tab="架构">
<n-tab-pane name="架构" tab="架构">
<NCard
:segmented="{
content: true,
@ -66,9 +66,7 @@
</div>
</template>
<n-collapse accordion default-expanded-names="2">
<OpenApiDocSchema :id="`schema+${k}`" v-for="(v, k) in
data?.components?.schemas"
:data="v" :name="k" />
<OpenApiDocSchema v-for="(v, k) in data?.components?.schemas" :data="v" :name="k" />
</n-collapse>
</NCard>
</n-tab-pane>
@ -107,10 +105,7 @@ 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>;
@ -128,10 +123,7 @@ 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;
}
@ -148,13 +140,8 @@ function hashback(to: RouteLocationNormalizedGeneric) {
const tab = to.hash.split('+')?.[0].replace('#', '');
setTimeout(() => {
tabValue.value = tab;
setTimeout(()=>{
const ele = document.getElementById(to.hash.replace('#', ''));
ele?.scrollIntoView();
const ele2 = ele?.children[0].children[0];
ele2?.click()
},100)
}, 100 );
document.getElementById(to.hash.replace('#', ''))?.scrollIntoView();
}, 100);
}
const removeAfterEach = router.afterEach(hashback);

View File

@ -28,17 +28,12 @@
</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'>,
@ -48,7 +43,6 @@ const prop = defineProps({
type: [String, Number],
required: true,
},
data:Object as PropType<OpenAPIV3_1.PathItemObject>
});
</script>
<style lang="scss" scoped>
@ -57,7 +51,6 @@ const prop = defineProps({
border-radius: 3px;
border: 1px solid $color !important;
--color: #{$color};
--color-des-text: rgba(var(--text-color), 0.5);
}
.get {

View File

@ -3,7 +3,6 @@
<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>
@ -21,7 +20,6 @@ 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};
}

View File

@ -3,32 +3,22 @@
<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};

View File

@ -87,11 +87,11 @@
import Icon from '@/components/Icon.vue';
import { UseBoolRef } from '@/util';
import {
i18n,
type languageIndexItemValueType,
message,
messageData,
router,
t,
UseAuthStore,
UseSettingStore,
} from '@/plugin';
@ -162,10 +162,6 @@ function openFile() {
});
}
}
const t = i18n.global.t;
window.i18n = i18n;
console.log(t);
</script>
<style lang="scss" scoped>
html.dark {

View File

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

View File

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