mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-27 06:12:12 +08:00
add eslint prettier unocss
This commit is contained in:
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/dist
|
||||
7
.eslintrc.json
Normal file
7
.eslintrc.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": ["@antfu", "prettier"],
|
||||
"rules": {
|
||||
"antfu/if-newline": ["off"],
|
||||
"no-console": ["off"]
|
||||
}
|
||||
}
|
||||
2
.prettierignore
Normal file
2
.prettierignore
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/dist
|
||||
3
.prettierrc.json
Normal file
3
.prettierrc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"singleQuote": true
|
||||
}
|
||||
Binary file not shown.
13
README.md
13
README.md
@@ -1,13 +1,14 @@
|
||||
# Auto_Bangumi_WebUI
|
||||
|
||||
基于[Auto_Bangumi](https://github.com/EstrellaXD/Auto_Bangumi)的WebUI
|
||||
基于[Auto_Bangumi](https://github.com/EstrellaXD/Auto_Bangumi)的 WebUI
|
||||
|
||||
目前适配了`Auto_Bangumi`的v1版本api
|
||||
目前适配了`Auto_Bangumi`的 v1 版本 api
|
||||
|
||||
主要功能为:
|
||||
- 查看订阅番剧(仅mikan源)
|
||||
- 订阅其他来源的新番rss
|
||||
- 订阅旧番rss
|
||||
|
||||
- 查看订阅番剧(仅 mikan 源)
|
||||
- 订阅其他来源的新番 rss
|
||||
- 订阅旧番 rss
|
||||
- debug
|
||||
- 重置`Auto_Bangumi`的数据
|
||||
- 查看日志
|
||||
- 查看日志
|
||||
|
||||
5
auto-imports.d.ts
vendored
5
auto-imports.d.ts
vendored
@@ -1,5 +0,0 @@
|
||||
// Generated by 'unplugin-auto-import'
|
||||
export {}
|
||||
declare global {
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<title>Auto_Bangumi</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
44
package.json
44
package.json
@@ -1,33 +1,43 @@
|
||||
{
|
||||
"name": "ab-webui",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vueuse/core": "^8.9.4",
|
||||
"axios": "^0.27.2",
|
||||
"element-plus": "^2.2.10",
|
||||
"element-plus": "^2.3.4",
|
||||
"modern-normalize": "^1.1.0",
|
||||
"pinia": "^2.0.16",
|
||||
"vue": "^3.2.37",
|
||||
"vue-global-api": "^0.4.1",
|
||||
"vue-router": "4"
|
||||
"pinia": "^2.0.35",
|
||||
"vue": "^3.2.47",
|
||||
"vue-router": "^4.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.0.6",
|
||||
"@antfu/eslint-config": "^0.38.5",
|
||||
"@types/node": "^18.16.0",
|
||||
"@unocss/preset-rem-to-px": "^0.51.8",
|
||||
"@unocss/reset": "^0.51.8",
|
||||
"@vicons/carbon": "^0.12.0",
|
||||
"@vicons/utils": "^0.1.4",
|
||||
"@vitejs/plugin-vue": "^3.0.0",
|
||||
"sass": "^1.54.0",
|
||||
"typescript": "^4.6.4",
|
||||
"unplugin-auto-import": "^0.10.0",
|
||||
"unplugin-vue-components": "^0.21.1",
|
||||
"vite": "^3.0.0",
|
||||
"vue-tsc": "^0.38.4"
|
||||
"@vitejs/plugin-vue": "^3.2.0",
|
||||
"eslint": "^8.39.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"prettier": "^2.8.8",
|
||||
"sass": "^1.62.0",
|
||||
"typescript": "^4.9.5",
|
||||
"unocss": "^0.51.8",
|
||||
"unplugin-auto-import": "^0.10.3",
|
||||
"unplugin-vue-components": "^0.21.2",
|
||||
"vite": "^3.2.6",
|
||||
"vue-tsc": "^0.38.9"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3606
pnpm-lock.yaml
generated
3606
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
10
src/App.vue
10
src/App.vue
@@ -1,14 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
||||
import { IconConfigProvider } from '@vicons/utils'
|
||||
import zhCn from 'element-plus/lib/locale/lang/zh-cn';
|
||||
import { IconConfigProvider } from '@vicons/utils';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Suspense>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<icon-config-provider size="18">
|
||||
<IconConfigProvider size="18">
|
||||
<RouterView />
|
||||
</icon-config-provider>
|
||||
</IconConfigProvider>
|
||||
</el-config-provider>
|
||||
</Suspense>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import axios from "axios";
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 添加番剧订阅
|
||||
* @param type 'new' 添加新番, ’old‘ 添加旧番
|
||||
* @param rss_link
|
||||
* @param rss_link
|
||||
*/
|
||||
const addBangumi = (type: string, rss_link: string) => {
|
||||
if(type === 'new') {
|
||||
function addBangumi(type: string, rss_link: string) {
|
||||
if (type === 'new') {
|
||||
return axios.post('api/v1/subscribe', { rss_link });
|
||||
} else if(type === 'old') {
|
||||
} else if (type === 'old') {
|
||||
return axios.post('api/v1/collection', { rss_link });
|
||||
} else {
|
||||
console.error('type错误, type应为 new 或 old');
|
||||
@@ -18,7 +17,7 @@ const addBangumi = (type: string, rss_link: string) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取AB存储的数据
|
||||
* 获取AB存储的数据
|
||||
*/
|
||||
const getABData = () => axios.get('api/v1/data');
|
||||
|
||||
@@ -28,8 +27,4 @@ const getABData = () => axios.get('api/v1/data');
|
||||
*/
|
||||
const removeRule = (name: string) => axios.get(`api/v1/removeRule/${name}`);
|
||||
|
||||
export {
|
||||
addBangumi,
|
||||
getABData,
|
||||
removeRule
|
||||
}
|
||||
export { addBangumi, getABData, removeRule };
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import axios from 'axios'
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 获取AB的日志
|
||||
* 获取AB的日志
|
||||
*/
|
||||
const getABLog = () => axios.get('api/v1/log');
|
||||
|
||||
/**
|
||||
* 重置 AB 的数据,程序会在下一轮检索中重新添加 RSS 订阅信息。
|
||||
* 重置 AB 的数据,程序会在下一轮检索中重新添加 RSS 订阅信息。
|
||||
*/
|
||||
const resetRule = () => axios.get('api/v1/resetRule');
|
||||
|
||||
export {
|
||||
getABLog,
|
||||
resetRule,
|
||||
}
|
||||
export { getABLog, resetRule };
|
||||
|
||||
57
src/auto-imports.d.ts
vendored
Normal file
57
src/auto-imports.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Generated by 'unplugin-auto-import'
|
||||
export {}
|
||||
declare global {
|
||||
const EffectScope: typeof import('vue')['EffectScope']
|
||||
const computed: typeof import('vue')['computed']
|
||||
const createApp: typeof import('vue')['createApp']
|
||||
const customRef: typeof import('vue')['customRef']
|
||||
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||
const defineComponent: typeof import('vue')['defineComponent']
|
||||
const effectScope: typeof import('vue')['effectScope']
|
||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||
const h: typeof import('vue')['h']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
const isReadonly: typeof import('vue')['isReadonly']
|
||||
const isRef: typeof import('vue')['isRef']
|
||||
const markRaw: typeof import('vue')['markRaw']
|
||||
const nextTick: typeof import('vue')['nextTick']
|
||||
const onActivated: typeof import('vue')['onActivated']
|
||||
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||
const onMounted: typeof import('vue')['onMounted']
|
||||
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||
const onUpdated: typeof import('vue')['onUpdated']
|
||||
const provide: typeof import('vue')['provide']
|
||||
const reactive: typeof import('vue')['reactive']
|
||||
const readonly: typeof import('vue')['readonly']
|
||||
const ref: typeof import('vue')['ref']
|
||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||
const shallowRef: typeof import('vue')['shallowRef']
|
||||
const toRaw: typeof import('vue')['toRaw']
|
||||
const toRef: typeof import('vue')['toRef']
|
||||
const toRefs: typeof import('vue')['toRefs']
|
||||
const triggerRef: typeof import('vue')['triggerRef']
|
||||
const unref: typeof import('vue')['unref']
|
||||
const useAttrs: typeof import('vue')['useAttrs']
|
||||
const useCssModule: typeof import('vue')['useCssModule']
|
||||
const useCssVars: typeof import('vue')['useCssVars']
|
||||
const useRoute: typeof import('vue-router')['useRoute']
|
||||
const useRouter: typeof import('vue-router')['useRouter']
|
||||
const useSlots: typeof import('vue')['useSlots']
|
||||
const watch: typeof import('vue')['watch']
|
||||
const watchEffect: typeof import('vue')['watchEffect']
|
||||
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||
}
|
||||
2
components.d.ts → src/components.d.ts
vendored
2
components.d.ts → src/components.d.ts
vendored
@@ -27,6 +27,6 @@ declare module '@vue/runtime-core' {
|
||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
ShowResults: typeof import('./src/components/ShowResults.vue')['default']
|
||||
ShowResults: typeof import('./components/ShowResults.vue')['default']
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
title: string,
|
||||
results: object | null
|
||||
defineProps<{
|
||||
title: string;
|
||||
results: object | null;
|
||||
}>();
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const handleClose = () => {
|
||||
function handleClose() {
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
const open = () => {
|
||||
function open() {
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
open,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -34,13 +34,13 @@ defineExpose({
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
.dia-log{
|
||||
.results{
|
||||
<style lang="scss" scope>
|
||||
.dia-log {
|
||||
.results {
|
||||
padding: 1em;
|
||||
line-height: 1.5;
|
||||
color: #fff;
|
||||
background: #333;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
18
src/main.ts
18
src/main.ts
@@ -1,14 +1,12 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import 'vue-global-api'
|
||||
import 'modern-normalize/modern-normalize.css'
|
||||
import { createApp } from 'vue';
|
||||
import { Icon } from '@vicons/utils';
|
||||
import router from './router';
|
||||
import { Icon } from '@vicons/utils'
|
||||
import App from './App.vue';
|
||||
|
||||
const app = createApp(App)
|
||||
import '@unocss/reset/tailwind-compat.css';
|
||||
import 'virtual:uno.css';
|
||||
|
||||
const app = createApp(App);
|
||||
app.component('Icon', Icon);
|
||||
|
||||
app.use(router)
|
||||
|
||||
app.mount('#app')
|
||||
app.use(router);
|
||||
app.mount('#app');
|
||||
|
||||
@@ -6,14 +6,10 @@ import YMenu from './YMenu.vue';
|
||||
<div class="app-layout">
|
||||
<el-container>
|
||||
<el-header class="header">
|
||||
<img
|
||||
src="@/assets/logo.png"
|
||||
alt="logo"
|
||||
class="logo"
|
||||
>
|
||||
<img src="@/assets/logo.png" alt="logo" class="logo" />
|
||||
</el-header>
|
||||
|
||||
<el-container style="overflow: hidden;">
|
||||
<el-container style="overflow: hidden">
|
||||
<el-aside width="auto">
|
||||
<YMenu />
|
||||
</el-aside>
|
||||
@@ -28,14 +24,14 @@ import YMenu from './YMenu.vue';
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.app-layout {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
|
||||
@media screen and (max-width: 980px){
|
||||
@media screen and (max-width: 980px) {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
@@ -51,4 +47,4 @@ import YMenu from './YMenu.vue';
|
||||
height: 70%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router'
|
||||
import { Home, Debug, DocumentBlank } from '@vicons/carbon';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { Debug, DocumentBlank, Home } from '@vicons/carbon';
|
||||
import { useWindowSize } from '@vueuse/core';
|
||||
|
||||
const { fullPath } = useRoute();
|
||||
@@ -16,7 +16,7 @@ watchEffect(() => {
|
||||
} else {
|
||||
isCollapse.value = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -26,7 +26,6 @@ watchEffect(() => {
|
||||
:collapse="isCollapse"
|
||||
router
|
||||
>
|
||||
|
||||
<el-menu-item index="/bangumi">
|
||||
<Icon>
|
||||
<Home />
|
||||
@@ -46,16 +45,15 @@ watchEffect(() => {
|
||||
</Icon>
|
||||
<template #title>日志</template>
|
||||
</el-menu-item>
|
||||
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.app-menu {
|
||||
height: 100%;
|
||||
|
||||
.xicon {
|
||||
margin-right: .5em;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -3,32 +3,27 @@ import ShowResults from '@/components/ShowResults.vue';
|
||||
import { addBangumi } from '@/api/bangumi';
|
||||
|
||||
const props = defineProps<{
|
||||
type: string
|
||||
}>()
|
||||
type: string;
|
||||
}>();
|
||||
|
||||
const rssLink = ref('');
|
||||
const loading = ref(false);
|
||||
const dialog = ref();
|
||||
const dialogData = ref(null);
|
||||
|
||||
const add = async () => {
|
||||
async function add() {
|
||||
loading.value = true;
|
||||
const res = await addBangumi(props.type, rssLink.value);
|
||||
if (res){
|
||||
if (res) {
|
||||
loading.value = false;
|
||||
dialogData.value = res.data;
|
||||
dialog.value.open();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ShowResults
|
||||
ref="dialog"
|
||||
title="执行结果"
|
||||
:results="dialogData"
|
||||
/>
|
||||
<ShowResults ref="dialog" title="执行结果" :results="dialogData" />
|
||||
|
||||
<el-card shadow="hover">
|
||||
<template #header>
|
||||
@@ -39,19 +34,13 @@ const add = async () => {
|
||||
</template>
|
||||
|
||||
<div class="card-con">
|
||||
<el-input
|
||||
v-model="rssLink"
|
||||
placeholder="请输入番剧的rss链接"
|
||||
>
|
||||
<el-input v-model="rssLink" placeholder="请输入番剧的rss链接">
|
||||
<template #append>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="add"
|
||||
>订阅</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="add"
|
||||
>订阅</el-button
|
||||
>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -11,23 +11,15 @@ const dialog = ref();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ShowResults
|
||||
ref="dialog"
|
||||
title="执行结果"
|
||||
:results="dialogData"
|
||||
/>
|
||||
<ShowResults ref="dialog" title="执行结果" :results="dialogData" />
|
||||
|
||||
<div class="bangumi-data">
|
||||
<el-collapse
|
||||
accordion
|
||||
v-model="activeName"
|
||||
>
|
||||
|
||||
<el-collapse-item
|
||||
title="已订阅番剧"
|
||||
name="1"
|
||||
>
|
||||
<span class="tips">注: 目前只能管理 mikan 源, 如通过 api 添加其他来源的新番将 <b>不会</b> 出现在此处</span>
|
||||
<el-collapse v-model="activeName" accordion>
|
||||
<el-collapse-item title="已订阅番剧" name="1">
|
||||
<span class="tips"
|
||||
>注: 目前只能管理 mikan 源, 如通过 api 添加其他来源的新番将
|
||||
<b>不会</b> 出现在此处</span
|
||||
>
|
||||
<el-table
|
||||
:data="bangumiData.bangumi_info"
|
||||
stripe
|
||||
@@ -35,40 +27,22 @@ const dialog = ref();
|
||||
style="width: 100%"
|
||||
max-height="40vh"
|
||||
>
|
||||
<el-table-column
|
||||
prop="official_title"
|
||||
label="番名"
|
||||
min-width="250"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="season"
|
||||
label="季度"
|
||||
width="60"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="dpi"
|
||||
label="分辨率"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="subtitle"
|
||||
label="字幕"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="group"
|
||||
label="字幕组"
|
||||
/>
|
||||
<el-table-column prop="official_title" label="番名" min-width="250" />
|
||||
<el-table-column prop="season" label="季度" width="60" />
|
||||
<el-table-column prop="dpi" label="分辨率" />
|
||||
<el-table-column prop="subtitle" label="字幕" />
|
||||
<el-table-column prop="group" label="字幕组" />
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
|
||||
</el-collapse>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.bangumi-data {
|
||||
.tips {
|
||||
line-height: 2;
|
||||
color: #F56C6C;
|
||||
color: #f56c6c;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import BangumiData from './components/BangumiData.vue'
|
||||
import AddBangumi from './components/AddBangumi.vue'
|
||||
import BangumiData from './components/BangumiData.vue';
|
||||
import AddBangumi from './components/AddBangumi.vue';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -14,7 +14,6 @@ import AddBangumi from './components/AddBangumi.vue'
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
|
||||
<!-- S 添加新番 -->
|
||||
<el-col :xs="24" :sm="24" :md="12" :lg="8">
|
||||
<AddBangumi type="new" />
|
||||
@@ -26,15 +25,14 @@ import AddBangumi from './components/AddBangumi.vue'
|
||||
<AddBangumi type="old" />
|
||||
</el-col>
|
||||
<!-- E 添加旧番 -->
|
||||
|
||||
</el-row>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.el-row {
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
5
src/pages/config/index.vue
Normal file
5
src/pages/config/index.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<script lang="ts" setup></script>
|
||||
|
||||
<template>
|
||||
<div class="config"></div>
|
||||
</template>
|
||||
@@ -1,21 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import 'element-plus/es/components/message/style/css';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { resetRule } from '@/api/debug';
|
||||
import 'element-plus/es/components/message/style/css'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const loading = ref(false);
|
||||
const reset = async () => {
|
||||
async function reset() {
|
||||
const res = await resetRule();
|
||||
if (res.data === "Success") {
|
||||
if (res.data === 'Success') {
|
||||
ElMessage({
|
||||
message: '数据已重置, 建议重启容器',
|
||||
type: 'success',
|
||||
})
|
||||
});
|
||||
} else {
|
||||
ElMessage({
|
||||
message: `错误: ${res.data}`,
|
||||
type: 'error',
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -23,7 +23,6 @@ const reset = async () => {
|
||||
<template>
|
||||
<section class="debug">
|
||||
<el-row :gutter="20">
|
||||
|
||||
<!-- S 重置数据 -->
|
||||
<el-col :xs="24" :sm="12" :lg="8">
|
||||
<el-card shadow="hover">
|
||||
@@ -34,20 +33,13 @@ const reset = async () => {
|
||||
</template>
|
||||
|
||||
<div class="card-con">
|
||||
<el-button
|
||||
type="danger"
|
||||
:loading="loading"
|
||||
@click="reset"
|
||||
>重置</el-button>
|
||||
<el-button type="danger" :loading="loading" @click="reset"
|
||||
>重置</el-button
|
||||
>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- E 重置数据 -->
|
||||
|
||||
</el-row>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
</style>
|
||||
@@ -4,12 +4,12 @@ import { getABLog } from '@/api/debug';
|
||||
const log = ref(null);
|
||||
const timer = ref<NodeJS.Timer | null>(null);
|
||||
|
||||
const getLog = async () => {
|
||||
async function getLog() {
|
||||
const res = await getABLog();
|
||||
log.value = res.data;
|
||||
}
|
||||
|
||||
const autoUpdate = () => {
|
||||
function autoUpdate() {
|
||||
timer.value = setInterval(getLog, 5000);
|
||||
}
|
||||
getLog();
|
||||
@@ -17,7 +17,7 @@ getLog();
|
||||
onMounted(autoUpdate);
|
||||
onUnmounted(() => {
|
||||
clearInterval(Number(timer.value));
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -26,7 +26,7 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.log-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -38,4 +38,4 @@ onUnmounted(() => {
|
||||
white-space: break-spaces;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -4,6 +4,7 @@ const YLayout = () => import('../pages/YLayout.vue');
|
||||
const YBangumi = () => import('../pages/bangumi/index.vue');
|
||||
const YDebug = () => import('../pages/debug/index.vue');
|
||||
const YLog = () => import('../pages/journal/index.vue');
|
||||
const YConfig = () => import('../pages/config/index.vue');
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@@ -13,23 +14,27 @@ const routes = [
|
||||
children: [
|
||||
{
|
||||
path: 'bangumi',
|
||||
component: YBangumi
|
||||
component: YBangumi,
|
||||
},
|
||||
{
|
||||
path: 'debug',
|
||||
component: YDebug
|
||||
component: YDebug,
|
||||
},
|
||||
{
|
||||
path: 'log',
|
||||
component: YLog
|
||||
}
|
||||
]
|
||||
component: YLog,
|
||||
},
|
||||
{
|
||||
path: 'config',
|
||||
component: YConfig,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes,
|
||||
})
|
||||
});
|
||||
|
||||
export default router;
|
||||
export default router;
|
||||
|
||||
6
src/vite-env.d.ts
vendored
6
src/vite-env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
import type { DefineComponent } from 'vue';
|
||||
const component: DefineComponent<{}, {}, any>;
|
||||
export default component;
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
"@/*": ["src/*"],
|
||||
"#/*": ["src/types/*"]
|
||||
},
|
||||
"types": [
|
||||
"element-plus/global"
|
||||
]
|
||||
"types": ["element-plus/global"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
|
||||
17
unocss.config.ts
Normal file
17
unocss.config.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
defineConfig,
|
||||
presetAttributify,
|
||||
presetIcons,
|
||||
presetUno,
|
||||
} from 'unocss';
|
||||
import presetRemToPx from '@unocss/preset-rem-to-px';
|
||||
|
||||
export default defineConfig({
|
||||
presets: [
|
||||
presetUno(),
|
||||
presetRemToPx(),
|
||||
presetAttributify(),
|
||||
presetIcons({ autoInstall: true, cdn: 'https://esm.sh/' }),
|
||||
],
|
||||
shortcuts: [[/^wh-(.*)$/, ([, t]) => `w-${t} h-${t}`]],
|
||||
});
|
||||
@@ -1,32 +1,37 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path';
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
import { resolve } from 'node:path';
|
||||
import UnoCSS from 'unocss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import AutoImport from 'unplugin-auto-import/vite';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
plugins: [
|
||||
vue(),
|
||||
UnoCSS(),
|
||||
AutoImport({
|
||||
imports: ['vue', 'vue-router'],
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
resolvers: [ElementPlusResolver()],
|
||||
}),
|
||||
Components({
|
||||
dts: 'src/components.d.ts',
|
||||
resolvers: [ElementPlusResolver()],
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src'),
|
||||
'#': resolve(__dirname, 'types')
|
||||
}
|
||||
'#': resolve(__dirname, 'types'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
'/api': 'http://192.168.0.2:7892'
|
||||
}
|
||||
}
|
||||
})
|
||||
'/api': 'http://127.0.0.1:7892',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user