mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-07 23:51:41 +08:00
@@ -531,6 +531,7 @@ const gallerySliderControl = reactive({
|
||||
const deleteCloud = ref<boolean>(false)
|
||||
const isAlwaysForceReload = ref<boolean>(false)
|
||||
const choosedPicBed = ref<string[]>([])
|
||||
const galleryPicBedFilterSetting = ref<string[]>([])
|
||||
const lastChoosed = ref<number>(-1)
|
||||
const isShiftKeyPress = ref<boolean>(false)
|
||||
const searchText = ref<string>('')
|
||||
@@ -907,6 +908,7 @@ async function initConf() {
|
||||
: t('pages.gallery.longUrl')
|
||||
isAlwaysForceReload.value = (await getConfig<boolean>(configPaths.settings.isAlwaysForceReload)) || false
|
||||
deleteCloud.value = (await getConfig<boolean>(configPaths.settings.deleteCloudFile)) || false
|
||||
galleryPicBedFilterSetting.value = (await getConfig<string[]>(configPaths.settings.galleryPicBedFilter)) || []
|
||||
}
|
||||
|
||||
const updateGalleryHandler = () => {
|
||||
@@ -949,7 +951,13 @@ function formatFileName(name: string) {
|
||||
}
|
||||
|
||||
function getGallery(): IGalleryItem[] {
|
||||
if (debouncedSearchText.value || choosedPicBed.value.length > 0 || debouncedSearchTextURL.value || dateRange.value) {
|
||||
if (
|
||||
debouncedSearchText.value ||
|
||||
choosedPicBed.value.length > 0 ||
|
||||
debouncedSearchTextURL.value ||
|
||||
dateRange.value ||
|
||||
galleryPicBedFilterSetting.value.length > 0
|
||||
) {
|
||||
return images.value
|
||||
.filter(item => {
|
||||
let isInChoosedPicBed = true
|
||||
@@ -958,6 +966,8 @@ function getGallery(): IGalleryItem[] {
|
||||
let isIncludesDateRange = true
|
||||
if (choosedPicBed.value.length > 0) {
|
||||
isInChoosedPicBed = choosedPicBed.value.some(type => type === item.type)
|
||||
} else if (galleryPicBedFilterSetting.value.length > 0) {
|
||||
isInChoosedPicBed = galleryPicBedFilterSetting.value.some(type => type === item.type)
|
||||
}
|
||||
if (debouncedSearchText.value) {
|
||||
isIncludesSearchText = customStrMatch(item.fileName || '', debouncedSearchText.value)
|
||||
|
||||
@@ -533,6 +533,19 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-section">
|
||||
<h2>{{ t('pages.settings.upload.galleryPicBedFilter') }}</h2>
|
||||
<p>{{ t('pages.settings.upload.galleryPicBedFilterDescription') }}</p>
|
||||
|
||||
<div class="checkbox-group">
|
||||
<label v-for="item in picBedGlobal" :key="`gallery-${item.name}`" class="checkbox-option">
|
||||
<input v-model="galleryPicBedFilterList" type="checkbox" :value="item.type" class="checkbox-input" />
|
||||
<span class="checkbox-indicator" />
|
||||
<span class="checkbox-label">{{ item.name }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Advanced Settings Tab -->
|
||||
@@ -1271,6 +1284,7 @@ const { confirm } = useConfirm()
|
||||
const message = useMessage()
|
||||
const activeName = ref<'system' | 'sync' | 'upload' | 'advanced' | 'update'>('system')
|
||||
const showPicBedList = ref<string[]>([])
|
||||
const galleryPicBedFilterList = ref<string[]>([])
|
||||
|
||||
// Tab configuration
|
||||
const tabs = computed(() => [
|
||||
@@ -1534,6 +1548,7 @@ async function initData() {
|
||||
const settings = config.settings || {}
|
||||
const picBed = config.picBed
|
||||
showPicBedList.value = picBedGlobal.value.filter(item => item.visible).map(item => item.name)
|
||||
galleryPicBedFilterList.value = settings.galleryPicBedFilter || []
|
||||
formKeys.forEach(key => {
|
||||
;(formOfSetting.value as any)[key] = settings[key] ?? formOfSetting.value[key]
|
||||
})
|
||||
@@ -1665,12 +1680,20 @@ watch(showPicBedList, val => {
|
||||
handleShowPicBedListChange(val)
|
||||
})
|
||||
|
||||
watch(galleryPicBedFilterList, val => {
|
||||
handleGalleryPicBedFilterChange(val)
|
||||
})
|
||||
|
||||
function handleShowPicBedListChange(val: ICheckBoxValueType[]) {
|
||||
const list = picBedGlobal.value.map(item => ({ ...item, visible: val.includes(item.name) }))
|
||||
saveConfig({ [configPaths.picBed.list]: list })
|
||||
updatePicBedGlobal()
|
||||
}
|
||||
|
||||
function handleGalleryPicBedFilterChange(val: ICheckBoxValueType[]) {
|
||||
saveConfig({ [configPaths.settings.galleryPicBedFilter]: val })
|
||||
}
|
||||
|
||||
function handleAutoStartChange(val: ICheckBoxValueType) {
|
||||
saveConfig(configPaths.settings.autoStart, val)
|
||||
window.electron.sendRPC(IRPCActionType.PICLIST_AUTO_START, val)
|
||||
|
||||
Reference in New Issue
Block a user