Skip to content

Commit

Permalink
feat(Tool): 新增资源管理页 (#196)
Browse files Browse the repository at this point in the history
* feat(Tool): 将指令测试调整到子菜单

* feat(Tool): 新增资源上传页
  • Loading branch information
JustAnotherID authored May 24, 2024
1 parent ec8f429 commit 9d2b3a1
Show file tree
Hide file tree
Showing 18 changed files with 380 additions and 25 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<link rel="icon" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="default-src *;
img-src * 'self' http: https: data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *;
img-src * 'self' http: https: data: blob:;
script-src 'self' 'unsafe-inline' 'unsafe-eval' *;
style-src 'self' 'unsafe-inline' *">
<!-- element css cdn, if you use custom theme, remove it. -->
<!-- <link
Expand Down
11 changes: 7 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<page-custom-text v-if="tabName === 'customText'" :category="textCategory"/>
<page-custom-reply v-if="tabName === 'customReply'"/>
<page-mod v-if="tabName === 'mod'" :category="textCategory"/>
<page-test v-if="tabName === 'test'"/>
<page-tool v-if="tabName === 'toolSettings'" :category="toolCategory"/>
<page-about v-if="tabName === 'about'"/>
</div>
</div>
Expand Down Expand Up @@ -131,7 +131,6 @@ import PageMod from "./components/PageMod.vue"
import PageCustomReply from "./components/mod/PageCustomReply.vue"
import PageLog from "./components/PageLog.vue";
import PageAbout from "./components/PageAbout.vue"
import PageTest from "./components/PageTest.vue"
import {onBeforeMount, ref, watch, computed} from 'vue'
import {useStore} from './store'
import {ElMessage, ElMessageBox} from 'element-plus'
Expand Down Expand Up @@ -252,11 +251,12 @@ const rightbox = ref(null)
let tabName = ref("log")
let textCategory = ref("")
let miscSettingsCategory = ref("")
let toolCategory = ref("")
const needh100 = ref(false)
const drawerMenu = ref<boolean>(false)
const switchTo = (tab: 'overview' | 'miscSettings' | 'log' | 'customText' | 'mod' | 'customReply' | 'imConns' | 'banList' | 'test' | 'about', name: string = '') => {
const switchTo = (tab: 'overview' | 'miscSettings' | 'log' | 'customText' | 'mod' | 'customReply' | 'imConns' | 'banList' | 'toolSettings' | 'about', name: string = '') => {
tabName.value = tab
textCategory.value = ''
if (tab === 'customText') {
Expand All @@ -268,7 +268,10 @@ const switchTo = (tab: 'overview' | 'miscSettings' | 'log' | 'customText' | 'mod
if (tab === 'miscSettings') {
miscSettingsCategory.value = name
}
needh100.value = ['test'].includes(tab)
if (tab === 'toolSettings') {
toolCategory.value = name
}
needh100.value = ['toolSettings'].includes(tab)
drawerMenu.value = false
}
Expand Down
17 changes: 12 additions & 5 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ declare module 'vue' {
CensorLog: typeof import('./components/mod/censor/CensorLog.vue')['default']
CensorWords: typeof import('./components/mod/censor/CensorWords.vue')['default']
CensorWordTip: typeof import('./components/mod/censor/CensorWordTip.vue')['default']
CustomReplyCondition: typeof import('./components/tools/custom-reply-condition.vue')['default']
CustomReplyCondition: typeof import('./components/utils/custom-reply-condition.vue')['default']
CustomTextBox: typeof import('./components/customText/CustomTextBox.vue')['default']
DiffViewer: typeof import('./components/tools/diff-viewer.vue')['default']
DiffViewer: typeof import('./components/utils/diff-viewer.vue')['default']
ElAffix: typeof import('element-plus/es')['ElAffix']
ElAlert: typeof import('element-plus/es')['ElAlert']
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
Expand All @@ -38,6 +38,7 @@ declare module 'vue' {
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink']
Expand Down Expand Up @@ -67,15 +68,15 @@ declare module 'vue' {
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload']
FoldableCard: typeof import('./components/tools/foldable-card.vue')['default']
FoldableCard: typeof import('./components/utils/foldable-card.vue')['default']
HelpConfigTags: typeof import('./components/mod/helpdoc/HelpConfigTags.vue')['default']
IBiFileBreak: typeof import('~icons/bi/file-break')['default']
IBiFiletypeJson: typeof import('~icons/bi/filetype-json')['default']
IBiFiletypeXlsx: typeof import('~icons/bi/filetype-xlsx')['default']
IBiFolder2: typeof import('~icons/bi/folder2')['default']
ICarbonContainerSoftware: typeof import('~icons/carbon/container-software')['default']
Menu: typeof import('./components/Menu.vue')['default']
Nested: typeof import('./components/tools/nested.vue')['default']
Nested: typeof import('./components/utils/nested.vue')['default']
PageAbout: typeof import('./components/PageAbout.vue')['default']
PageCensor: typeof import('./components/mod/PageCensor.vue')['default']
PageConnectInfoItems: typeof import('./components/PageConnectInfoItems.vue')['default']
Expand All @@ -92,8 +93,14 @@ declare module 'vue' {
PageMiscGroup: typeof import('./components/misc/PageMiscGroup.vue')['default']
PageMiscSettings: typeof import('./components/misc/PageMiscSettings.vue')['default']
PageMod: typeof import('./components/PageMod.vue')['default']
PageResource: typeof import('./components/tool/PageResource.vue')['default']
PageStory: typeof import('./components/mod/PageStory.vue')['default']
PageTest: typeof import('./components/PageTest.vue')['default']
PageTest: typeof import('./components/tool/PageTest.vue')['default']
PageTool: typeof import('./components/PageTool.vue')['default']
ResourceRender: typeof import('./components/utils/resource-render.vue')['default']
StoryBackup: typeof import('./components/mod/story/StoryBackup.vue')['default']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}
22 changes: 15 additions & 7 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,20 @@
</el-menu-item>
</el-sub-menu>

<el-menu-item index="8" @click="switchTo('test')">
<el-icon>
<chat-line-round/>
</el-icon>
<span>指令测试</span>
</el-menu-item>
<el-sub-menu index="8">
<template #title>
<el-icon>
<tools/>
</el-icon>
<span>辅助工具</span>
</template>
<el-menu-item :index="`8-test`" @click="switchTo('toolSettings', 'test')">
<span>指令测试</span>
</el-menu-item>
<el-menu-item :index="`8-upload`" @click="switchTo('toolSettings', 'upload')">
<span>资源管理</span>
</el-menu-item>
</el-sub-menu>

<el-menu-item index="9" @click="switchTo('about')">
<el-icon>
Expand All @@ -111,7 +119,7 @@ import {
Setting,
Star,
Operation,
ChatLineRound,
Tools,
EditPen
} from '@element-plus/icons-vue'
Expand Down
11 changes: 11 additions & 0 deletions src/components/PageTool.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<page-test v-if="category === 'test'"/>
<page-upload v-else-if="category === 'upload'"/>
</template>

<script setup lang="ts">
import PageTest from "~/components/tool/PageTest.vue";
import PageUpload from "~/components/tool/PageResource.vue";
const props = defineProps<{ category: string }>();
</script>
2 changes: 1 addition & 1 deletion src/components/misc/PageMiscBackup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ import {
QuestionFilled,
BrushFilled, DocumentChecked
} from '@element-plus/icons-vue'
import DiffViewer from "~/components/tools/diff-viewer.vue";
import DiffViewer from "~/components/utils/diff-viewer.vue";
import {sum} from "lodash-es";
const store = useStore()
Expand Down
4 changes: 2 additions & 2 deletions src/components/mod/PageCustomReply.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
import { onBeforeMount, onBeforeUnmount, ref, watch, nextTick, computed } from 'vue';
import { urlBase } from "~/backend";
import { useStore } from '~/store';
import nestedDraggable from "../tools/nested.vue";
import nestedDraggable from "../utils/nested.vue";
import { ElMessage, ElMessageBox } from 'element-plus'
import {
DocumentChecked,
Expand All @@ -183,7 +183,7 @@ import {
Upload,
Plus
} from '@element-plus/icons-vue'
import CustomReplyCondition from "~/components/tools/custom-reply-condition.vue";
import CustomReplyCondition from "~/components/utils/custom-reply-condition.vue";
const store = useStore()
const dialogFormVisible = ref(false)
Expand Down
2 changes: 1 addition & 1 deletion src/components/mod/PageJs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ import {
import * as dayjs from 'dayjs'
import {basicSetup, EditorView} from "codemirror"
import {javascript} from "@codemirror/lang-javascript"
import DiffViewer from "~/components/tools/diff-viewer.vue";
import DiffViewer from "~/components/utils/diff-viewer.vue";
import {isEqual, size} from "lodash-es";
import {JsPluginConfig, JsPluginConfigItem, JsScriptInfo} from "~/type";
Expand Down
4 changes: 2 additions & 2 deletions src/components/mod/PageMiscDeck.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ import {
Warning,
CircleClose,
} from '@element-plus/icons-vue'
import DiffViewer from "~/components/tools/diff-viewer.vue";
import FoldableCard from "~/components/tools/foldable-card.vue";
import DiffViewer from "~/components/utils/diff-viewer.vue";
import FoldableCard from "~/components/utils/foldable-card.vue";
const store = useStore()
Expand Down
Loading

0 comments on commit 9d2b3a1

Please sign in to comment.