Feature(custom): use custom button in qr page

This commit is contained in:
Kuingsmile
2026-01-27 16:21:07 +08:00
parent 6e0031793e
commit 5de725cbfe
3 changed files with 28 additions and 19 deletions
+7 -3
View File
@@ -42,6 +42,12 @@ import updateChecker from '~/utils/updateChecker'
const isDevelopment = process.env.NODE_ENV !== 'production' const isDevelopment = process.env.NODE_ENV !== 'production'
process.noDeprecation = true process.noDeprecation = true
const defaultStartMode = {
darwin: ISartMode.QUIET,
win32: ISartMode.MAIN,
linux: ISartMode.MINI,
}
const handleStartUpFiles = (argv: string[], cwd: string) => { const handleStartUpFiles = (argv: string[], cwd: string) => {
const files = getUploadFiles(argv, cwd, logger) const files = getUploadFiles(argv, cwd, logger)
@@ -129,9 +135,7 @@ class LifeCycle {
let startMode = let startMode =
allConfig.settings?.startMode !== undefined allConfig.settings?.startMode !== undefined
? allConfig.settings.startMode ? allConfig.settings.startMode
: process.platform === 'win32' : defaultStartMode[process.platform as keyof typeof defaultStartMode] || ISartMode.MAIN
? ISartMode.MAIN
: ISartMode.QUIET
if (process.platform === 'darwin' && startMode === ISartMode.MINI) { if (process.platform === 'darwin' && startMode === ISartMode.MINI) {
startMode = ISartMode.QUIET startMode = ISartMode.QUIET
} }
+14 -13
View File
@@ -127,9 +127,9 @@
</DialogTitle> </DialogTitle>
<div class="p-4"> <div class="p-4">
<div class="mb-5"> <div class="mb-4">
<label class="mb-2 block text-base font-medium text-main">{{ t('navigation.choosePicBed') }}</label> <label class="mb-2 block text-base font-medium text-main">{{ t('navigation.choosePicBed') }}</label>
<Listbox v-model="choosedPicBedForQRCode" multiple> <Listbox v-model="choosedPicBedForQRCode" multiple class="mb-2">
<div class="relative"> <div class="relative">
<ListboxButton <ListboxButton
class="flex w-full cursor-pointer items-center justify-between rounded-2xl border border-border bg-surface px-4 py-3 text-base text-main hover:border-accent" class="flex w-full cursor-pointer items-center justify-between rounded-2xl border border-border bg-surface px-4 py-3 text-base text-main hover:border-accent"
@@ -166,14 +166,13 @@
</div> </div>
</Listbox> </Listbox>
<button <CustomButton
v-if="choosedPicBedForQRCode.length > 0" v-if="choosedPicBedForQRCode.length > 0"
class="mt-3 flex cursor-pointer items-center gap-2 rounded-sm border-none bg-accent px-4 py-2 text-base font-medium text-white hover:bg-accent-hover" type="primary"
:icon="CopyIcon"
:text="t('navigation.copyPicBedConfig')"
@click="handleCopyPicBedConfig" @click="handleCopyPicBedConfig"
> />
<CopyIcon :size="16" />
{{ t('navigation.copyPicBedConfig') }}
</button>
</div> </div>
<div v-if="choosedPicBedForQRCode.length > 0" class="flex justify-center py-5"> <div v-if="choosedPicBedForQRCode.length > 0" class="flex justify-center py-5">
@@ -182,12 +181,13 @@
</div> </div>
<div class="flex justify-end gap-3 px-4 pb-4"> <div class="flex justify-end gap-3 px-4 pb-4">
<button <CustomButton
class="cursor-pointer rounded-sm border border-border bg-danger/50 px-4 py-2 text-base text-main hover:bg-danger/70" :text="t('navigation.close')"
class="bg-danger hover:bg-danger"
:text-class="'text-white'"
type="cus"
@click="qrcodeVisible = false" @click="qrcodeVisible = false"
> />
{{ $t('navigation.close') }}
</button>
</div> </div>
</DialogPanel> </DialogPanel>
</TransitionChild> </TransitionChild>
@@ -234,6 +234,7 @@ import { computed, nextTick, onBeforeMount, onBeforeUnmount, reactive, Ref, ref,
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import CustomButton from '@/components/common/CustomButton.vue'
import FirstTimeGuide from '@/components/FirstTimeGuide.vue' import FirstTimeGuide from '@/components/FirstTimeGuide.vue'
import ThemeSwitcher from '@/components/ui/ThemeSwitcher.vue' import ThemeSwitcher from '@/components/ui/ThemeSwitcher.vue'
import { usePicBed } from '@/hooks/useGlobal' import { usePicBed } from '@/hooks/useGlobal'
+7 -3
View File
@@ -1401,6 +1401,12 @@ const sync = ref<any>({
webdavSavePath: '', webdavSavePath: '',
}) })
const defaultStartMode = {
darwin: ISartMode.QUIET,
win32: ISartMode.MAIN,
linux: ISartMode.MINI,
}
const formOfSetting = ref<ISettingForm>({ const formOfSetting = ref<ISettingForm>({
showUpdateTip: true, showUpdateTip: true,
autoStart: false, autoStart: false,
@@ -1903,9 +1909,7 @@ async function initData() {
currentStartMode.value = currentStartMode.value =
settings.startMode !== undefined settings.startMode !== undefined
? settings.startMode ? settings.startMode
: osGlobal.value === 'win32' : defaultStartMode[osGlobal.value as keyof typeof defaultStartMode] || ISartMode.MAIN
? ISartMode.MAIN
: ISartMode.QUIET
currentSecondMode.value = settings.secondPicBedMode || 'backup' currentSecondMode.value = settings.secondPicBedMode || 'backup'
if (osGlobal.value === 'darwin' && currentStartMode.value === ISartMode.MINI) { if (osGlobal.value === 'darwin' && currentStartMode.value === ISartMode.MINI) {
currentStartMode.value = ISartMode.QUIET currentStartMode.value = ISartMode.QUIET