Compare commits

..

No commits in common. "c51326b6984d030cc9cf9f79fd58c138ea9851f8" and "704da3a6928657a1dce2654c109f1633e20524db" have entirely different histories.

17 changed files with 26 additions and 218 deletions

View File

@ -1,43 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/language-config.schema.json",
"title": "Language Configuration",
"description": "Schema for validating language configuration files",
"type": "object",
"properties": {
"languages": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Display name of the language",
"pattern": "^[\\w\\s-]+$"
},
"id": {
"type": "string",
"description": "Language identifier in locale format",
"pattern": "^[a-z]{2}-[a-z]{2}$"
},
"file": {
"type": "string",
"description": "Language file name",
"pattern": "^[A-Z]{2}_[A-Z]{2}\\.json$"
}
},
"required": [
"title",
"id",
"file"
],
"additionalProperties": false
}
}
},
"required": [
"languages"
],
"additionalProperties": false
}

View File

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

View File

@ -1,18 +1,7 @@
<template>
<n-config-provider :theme="useSettingStore.theme === 'dark' ? darkTheme : lightTheme" abstract>
<n-loading-bar-provider>
<n-message-provider>
<Index />
</n-message-provider>
</n-loading-bar-provider>
</n-config-provider>
<Index />
</template>
<script lang="ts" setup>
import Index from '@/layout/index.vue';
import { darkTheme, lightTheme } from 'naive-ui';
import { UseSettingStore } from '@/plugin';
const useSettingStore = UseSettingStore();
</script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<link href="./assets/index.svg" rel="icon">
<meta content="width=device-width, initial-scale=0.8" name="viewport">
<title>pan-disk</title>
<title>Vite App</title>
</head>
<body>
<main id="app"></main>

View File

@ -1,15 +0,0 @@
{
"$schema": "https://git.mingliqiye.com/mingliqiye/pan-disk/raw/branch/master/languageSchema.json",
"languages": [
{
"title": "中国-汉语",
"id": "zh-cn",
"file": "ZH_CN.json"
},
{
"title": "US-English",
"id": "en-us",
"file": "EN_US.json"
}
]
}

View File

@ -19,22 +19,12 @@
主页
<div class="after"></div>
</div>
<div
v-bind:class="{
'router-item-atc': router.currentRoute.value.path.startsWith('/file'),
'router-item': true,
}"
@click="openFile()">
<div class="router-item">
<Icon icon="material-symbols:folder-rounded" />
文件
<div class="after"></div>
</div>
<div
v-bind:class="{
'router-item-atc': router.currentRoute.value.name === 'user',
'router-item': true,
}"
@click="router.push({ name: 'user' })">
<div class="router-item">
<Icon icon="material-symbols:person-rounded" />
用户
<div class="after"></div>
@ -78,7 +68,7 @@
<script lang="ts" setup>
import Icon from '@/components/Icon.vue';
import { UseBoolRef } from '@/util';
import { message, router, UseAuthStore, UseSettingStore } from '@/plugin';
import { router, UseAuthStore, UseSettingStore } from '@/plugin';
import { getSysInfo } from '@/api/system.ts';
const useSettingStore = UseSettingStore();
@ -88,22 +78,8 @@ getSysInfo().then((r) => {
const data = r.json().data;
useSettingStore.appName = data.appName;
useSettingStore.appVersion = data.appVersion;
document.title = data.appName;
});
useAuthStore.woIsMe();
function openFile() {
if (useAuthStore.isLogin) {
router.push({
path: `/file/${useAuthStore.username}`,
});
} else {
message.error('请先登录');
router.push({
path: `/login`,
});
}
}
</script>
<style lang="scss" scoped>
html.dark {

View File

@ -1,12 +1,15 @@
<template>
<Head />
<n-back-top />
<router-view v-slot="{ Component }">
<div style="margin: 10px">
<component :is="Component" />
</div>
</router-view>
<div style="margin: 10px">
<RouterView />
</div>
</template>
<script lang="ts" setup>
import { RouterView } from 'vue-router';
import { useMessage } from 'naive-ui';
import Head from '@/layout/Head.vue';
import { setMessage } from '@/plugin';
setMessage(useMessage());
</script>
<style scoped></style>

View File

@ -1,11 +1,15 @@
<template>
<RouterView />
<n-config-provider :theme="useSettingStore.theme === 'dark' ? darkTheme : lightTheme" abstract>
<n-message-provider>
<RouterView />
</n-message-provider>
</n-config-provider>
</template>
<script lang="ts" setup>
import { useLoadingBar, useMessage } from 'naive-ui';
import { setLoadingBar, setMessage } from '@/plugin';
import { UseSettingStore } from '@/plugin';
import { RouterView } from 'vue-router';
import { darkTheme, lightTheme } from 'naive-ui';
setMessage(useMessage());
setLoadingBar(useLoadingBar());
const useSettingStore = UseSettingStore();
</script>
<style scoped></style>

View File

@ -1,12 +0,0 @@
import { createI18n } from 'vue-i18n';
export type languageType = { [key: string]: string | languageType };
const messages: languageType | any = {};
const i18n = createI18n({
legacy: false, // 使用 Composition API
locale: 'zh', // 默认语言
messages,
});
export default i18n;

View File

@ -1,17 +1,11 @@
import type { MessageApiInjection } from 'naive-ui/es/message/src/MessageProvider';
import type { LoadingBarApiInjection } from 'naive-ui/es/loading-bar/src/LoadingBarProvider';
export * from './router';
export * from './stores';
export * from './alova';
export let message: MessageApiInjection;
export let loadingBar: LoadingBarApiInjection;
export function setMessage(messages: MessageApiInjection) {
message = messages;
}
export function setLoadingBar(loadingBars: LoadingBarApiInjection) {
loadingBar = loadingBars;
}

View File

@ -1,5 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router';
import { loadingBar } from '@/plugin';
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@ -13,26 +12,6 @@ const router = createRouter({
name: 'home',
component: () => import('@/views/HomeView.vue'),
},
{
path: '/file/:pathMatch(.*)*',
name: 'file',
component: () => import('@/views/FileView.vue'),
},
{
path: '/user',
name: 'user',
component: () => import('@/views/UserView.vue'),
},
{
path: '/login',
name: 'login',
component: () => import('@/views/loginView.vue'),
},
{
path: '/register',
name: 'register',
component: () => import('@/views/RegisterView.vue'),
},
{
path: '/swagger',
name: 'api',
@ -43,10 +22,4 @@ const router = createRouter({
],
});
router.beforeEach((to, from, next) => {
loadingBar.start();
next();
setTimeout(() => loadingBar.finish(), 100);
});
export { router };

View File

@ -1,5 +1,5 @@
import { defineStore } from 'pinia';
import { login, logout, woIsMe } from '@/api';
import { login, woIsMe } from '@/api';
import { LocalStorageApi } from '@/util';
export const UseAuthStore = defineStore('auth', {
@ -39,9 +39,6 @@ export const UseAuthStore = defineStore('auth', {
})
.catch(() => this.$reset());
},
logout() {
logout().then(() => this.$reset());
},
},
persist: {
storage: LocalStorageApi.StorageApi,

View File

@ -1,9 +0,0 @@
<template>
<div></div>
</template>
<script lang="ts" setup>
import { router } from '@/plugin';
console.log(router.currentRoute);
</script>
<style scoped></style>

View File

@ -1,11 +1,10 @@
<template>
<div>
<NButton @click="useAuthStore.login('admin', 'admin')">登录</NButton>
</div>
<NButton @click="useAuthStore.login('admin', 'admin')">登录</NButton>
</template>
<script lang="ts" setup>
import { UseAuthStore } from '@/plugin';
const useAuthStore = UseAuthStore();
console.log(useAuthStore);
</script>
<style scoped></style>

View File

@ -1,3 +0,0 @@
<template></template>
<script lang="ts" setup></script>
<style scoped></style>

View File

@ -1,19 +0,0 @@
<template>
<div>
<n-button @click="useAuthStore.logout()">注销</n-button>
</div>
</template>
<script lang="ts" setup>
import { router, UseAuthStore } from '@/plugin';
import { onMounted } from 'vue';
const useAuthStore = UseAuthStore();
onMounted(() => {
if (!useAuthStore.isLogin)
router.push({
name: 'login',
});
});
</script>
<style scoped></style>

View File

@ -1,25 +0,0 @@
<template>
<div c-c f style="height: calc(100vh - 66px - 20px)">
<n-spin :delay="1000" :show="false">
<n-card
:segmented="{
content: true,
footer: 'soft',
}"
style="width: 430px"
title="登录">
<n-form border label-align="right" label-placement="left" label-width="auto">
<n-form-item label="用户名">
<n-input />
</n-form-item>
<n-form-item label="密码">
<n-input />
</n-form-item>
</n-form>
<n-button block secondary strong type="primary">登录</n-button>
</n-card>
</n-spin>
</div>
</template>
<script lang="ts" setup></script>
<style scoped></style>