Feature(custom): use custom button in qr page

This commit is contained in:
Kuingsmile
2026-01-27 16:19:27 +08:00
parent 6e0031793e
commit 5de725cbfe
3 changed files with 28 additions and 19 deletions

View File

@@ -42,6 +42,12 @@ import updateChecker from '~/utils/updateChecker'
const isDevelopment = process.env.NODE_ENV !== 'production'
process.noDeprecation = true
const defaultStartMode = {
darwin: ISartMode.QUIET,
win32: ISartMode.MAIN,
linux: ISartMode.MINI,
}
const handleStartUpFiles = (argv: string[], cwd: string) => {
const files = getUploadFiles(argv, cwd, logger)
@@ -129,9 +135,7 @@ class LifeCycle {
let startMode =
allConfig.settings?.startMode !== undefined
? allConfig.settings.startMode
: process.platform === 'win32'
? ISartMode.MAIN
: ISartMode.QUIET
: defaultStartMode[process.platform as keyof typeof defaultStartMode] || ISartMode.MAIN
if (process.platform === 'darwin' && startMode === ISartMode.MINI) {
startMode = ISartMode.QUIET
}

View File

@@ -127,9 +127,9 @@
</DialogTitle>
<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>
<Listbox v-model="choosedPicBedForQRCode" multiple>
<Listbox v-model="choosedPicBedForQRCode" multiple class="mb-2">
<div class="relative">
<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"
@@ -166,14 +166,13 @@
</div>
</Listbox>
<button
<CustomButton
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"
>
<CopyIcon :size="16" />
{{ t('navigation.copyPicBedConfig') }}
</button>
/>
</div>
<div v-if="choosedPicBedForQRCode.length > 0" class="flex justify-center py-5">
@@ -182,12 +181,13 @@
</div>
<div class="flex justify-end gap-3 px-4 pb-4">
<button
class="cursor-pointer rounded-sm border border-border bg-danger/50 px-4 py-2 text-base text-main hover:bg-danger/70"
<CustomButton
:text="t('navigation.close')"
class="bg-danger hover:bg-danger"
:text-class="'text-white'"
type="cus"
@click="qrcodeVisible = false"
>
{{ $t('navigation.close') }}
</button>
/>
</div>
</DialogPanel>
</TransitionChild>
@@ -234,6 +234,7 @@ import { computed, nextTick, onBeforeMount, onBeforeUnmount, reactive, Ref, ref,
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import CustomButton from '@/components/common/CustomButton.vue'
import FirstTimeGuide from '@/components/FirstTimeGuide.vue'
import ThemeSwitcher from '@/components/ui/ThemeSwitcher.vue'
import { usePicBed } from '@/hooks/useGlobal'

View File

@@ -1401,6 +1401,12 @@ const sync = ref<any>({
webdavSavePath: '',
})
const defaultStartMode = {
darwin: ISartMode.QUIET,
win32: ISartMode.MAIN,
linux: ISartMode.MINI,
}
const formOfSetting = ref<ISettingForm>({
showUpdateTip: true,
autoStart: false,
@@ -1903,9 +1909,7 @@ async function initData() {
currentStartMode.value =
settings.startMode !== undefined
? settings.startMode
: osGlobal.value === 'win32'
? ISartMode.MAIN
: ISartMode.QUIET
: defaultStartMode[osGlobal.value as keyof typeof defaultStartMode] || ISartMode.MAIN
currentSecondMode.value = settings.secondPicBedMode || 'backup'
if (osGlobal.value === 'darwin' && currentStartMode.value === ISartMode.MINI) {
currentStartMode.value = ISartMode.QUIET