This commit is contained in:
putyy
2024-12-23 16:59:18 +08:00
parent f92d898136
commit 6d2705112d
22 changed files with 131 additions and 138 deletions

View File

@@ -12,9 +12,9 @@
import NaiveProvider from '@/components/NaiveProvider.vue'
import {darkTheme, lightTheme, zhCN} from 'naive-ui'
import {useIndexStore} from "@/stores"
import {computed, onMounted, watch} from "vue"
import type {wsType} from "@/types/ws"
import {computed, onMounted} from "vue"
import {useEventStore} from "@/stores/event"
import {appType} from "@/types/app";
const store = useIndexStore()
const eventStore = useEventStore()
@@ -33,7 +33,7 @@ onMounted(async () => {
eventStore.init()
eventStore.addHandle({
type: "message",
event: (res: wsType.Message)=>{
event: (res: appType.Message)=>{
switch (res?.code) {
case 0:
window?.$message?.error(res.message)

View File

@@ -58,7 +58,7 @@
<script lang="ts" setup>
import {useIndexStore} from "@/stores"
import {BrowserOpenURL} from "../../wailsjs/runtime";
import {BrowserOpenURL} from "../../wailsjs/runtime"
const store = useIndexStore()
const props = defineProps(["showModal"])
const emits = defineEmits(["update:showModal"])

View File

@@ -35,7 +35,6 @@ const minimizeWindow = () => {
WindowMinimise()
}
const maximizeWindow = () => {
console.log("maximizeWindow")
isMaximized.value = !isMaximized.value;
if (isMaximized.value) {
WindowFullscreen()

View File

@@ -47,7 +47,7 @@
</template>
<script lang="ts" setup>
import type {MenuOption} from "naive-ui"
import {MenuOption} from "naive-ui"
import {NIcon} from "naive-ui"
import {computed, h, ref, watch} from "vue"
import {useRoute, useRouter} from "vue-router"
@@ -55,7 +55,7 @@ import {
CloudOutline,
SettingsOutline,
HelpCircleOutline,
MoonOutline
MoonOutline, SunnyOutline
} from "@vicons/ionicons5"
import {useIndexStore} from "@/stores"
import Footer from "@/components/Footer.vue"
@@ -75,6 +75,10 @@ const globalConfig = computed(()=>{
return store.globalConfig
})
const theme = computed(() => {
return store.globalConfig.Theme === "darkTheme" ? renderIcon(SunnyOutline) : renderIcon(MoonOutline)
})
watch(() => route.path, (newPath, oldPath) => {
menuValue.value = route.fullPath.substring(1)
});
@@ -100,7 +104,7 @@ const footerOptions = ref([
{
label: "主题",
key: 'theme',
icon: renderIcon(MoonOutline),
icon: theme,
},
{
label: "关于",

View File

@@ -1,8 +1,6 @@
export const DwStatus = {
ready: "就绪",
running: "运行中",
pause: "暂停",
wait: "等待",
error: "错误",
done: "完成",
handle: "已下载,后续处理",

View File

@@ -1,7 +1,7 @@
import {defineStore} from "pinia"
import {ref} from "vue"
import type {wsType} from "@/types/ws"
import {EventsOn} from "../../wailsjs/runtime"
import {appType} from "@/types/app"
export const useEventStore = defineStore('ws-store', () => {
const handles = ref<any>({})
@@ -17,7 +17,7 @@ export const useEventStore = defineStore('ws-store', () => {
})
}
const addHandle = (handle: wsType.Handle) => {
const addHandle = (handle: appType.Handle) => {
handles.value[handle.type] = handle.event
}

View File

@@ -2,7 +2,7 @@ import {defineStore} from 'pinia'
import {ref} from "vue"
import type {appType} from "@/types/app"
import appApi from "@/api/app"
import {Environment} from "../../wailsjs/runtime";
import {Environment} from "../../wailsjs/runtime"
export const useIndexStore = defineStore("index-store", () => {
const appInfo = ref<appType.App>({

View File

@@ -44,4 +44,14 @@ export namespace appType {
Status: string
Message: string
}
interface Message {
code: number
message: string
}
interface Handle {
type: string
event: any
}
}

View File

@@ -1,21 +0,0 @@
export namespace wsType {
interface Event {
type: string
event: any
data: any
}
interface Handle {
type: string
event: any
}
interface Message {
code: number
message: string
}
interface Clipboard {
content: string
}
}

View File

@@ -40,10 +40,10 @@ import ShowLoading from "@/components/ShowLoading.vue"
import {getDecryptionArray} from '@/assets/js/decrypt.js'
import {useIndexStore} from "@/stores"
import appApi from "@/api/app"
import {DwStatus} from "@/const";
import {DwStatus} from "@/const"
import ResAction from "@/components/ResAction.vue"
import {useEventStore} from "@/stores/event";
import {BrowserOpenURL, ClipboardSetText} from "../../wailsjs/runtime";
import {useEventStore} from "@/stores/event"
import {BrowserOpenURL, ClipboardSetText} from "../../wailsjs/runtime"
const eventStore = useEventStore()