mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-07 05:32:52 +08:00
🐛 Fix(custom): fix the value not update issue when set per picbed preprocess
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
- Windows 便携模式,无需安装运行,数据存储在程序目录下的 `data` 文件夹中,且支持自动更新
|
- Windows 便携模式,无需安装运行,数据存储在程序目录下的 `data` 文件夹中,且支持自动更新
|
||||||
- Linux 新增 `rpm` 安装包
|
- Linux 新增 `rpm` 安装包
|
||||||
- 新增图床编辑卡片页面,解决多配置切换时的混乱问题
|
- 新增图床编辑卡片页面,解决多配置切换时的混乱问题
|
||||||
|
- 优化了图床独立处理设置的配置保存逻辑
|
||||||
- 文件浏览页面新增列表模式支持。
|
- 文件浏览页面新增列表模式支持。
|
||||||
- 现在第一次启动时根据系统语言自动选择界面语言
|
- 现在第一次启动时根据系统语言自动选择界面语言
|
||||||
- 现在windows系统第一次启动时会默认显示主界面
|
- 现在windows系统第一次启动时会默认显示主界面
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
|
|
||||||
### 🐛 问题修复
|
### 🐛 问题修复
|
||||||
|
|
||||||
|
- 修复了图片预处理设置中,单图床设置时变量值没有及时更新的问题
|
||||||
- 修复了管理页面中排序下拉框显示异常的问题
|
- 修复了管理页面中排序下拉框显示异常的问题
|
||||||
- 修复了管理页面图床列表未正确高亮当前选中项的问题
|
- 修复了管理页面图床列表未正确高亮当前选中项的问题
|
||||||
- 修复了管理页面markdown预览内容没有正确渲染的问题
|
- 修复了管理页面markdown预览内容没有正确渲染的问题
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Use custom `javascript` scripts to extend PicList's functionality without the ne
|
|||||||
- Added `rpm` installation package for Linux.
|
- Added `rpm` installation package for Linux.
|
||||||
- Added image hosting editing card page to resolve confusion when switching multiple configurations.
|
- Added image hosting editing card page to resolve confusion when switching multiple configurations.
|
||||||
- Added list mode support to the file browsing page.
|
- Added list mode support to the file browsing page.
|
||||||
|
- Optimized the configuration saving logic for independent image hosting processing settings.
|
||||||
- Now automatically selects the interface language based on the system language on the first launch.
|
- Now automatically selects the interface language based on the system language on the first launch.
|
||||||
- Now the main interface will be displayed by default on the first launch of Windows systems.
|
- Now the main interface will be displayed by default on the first launch of Windows systems.
|
||||||
- Now supports manually disabling GPU acceleration to resolve black screen or flickering issues caused by some hardware compatibility.
|
- Now supports manually disabling GPU acceleration to resolve black screen or flickering issues caused by some hardware compatibility.
|
||||||
@@ -53,6 +54,7 @@ Use custom `javascript` scripts to extend PicList's functionality without the ne
|
|||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- Fixed the issue in the image preprocessing settings where variable values were not updated in a timely manner when setting a single image hosting.
|
||||||
- Fixed the issue where the sort dropdown box on the management page displayed abnormally.
|
- Fixed the issue where the sort dropdown box on the management page displayed abnormally.
|
||||||
- Fixed the issue where the image hosting list on the management page did not correctly highlight the currently selected item.
|
- Fixed the issue where the image hosting list on the management page did not correctly highlight the currently selected item.
|
||||||
- Fixed the issue where the markdown preview content on the management page did not render correctly.
|
- Fixed the issue where the markdown preview content on the management page did not render correctly.
|
||||||
|
|||||||
@@ -1402,6 +1402,11 @@ function safeSetMapValue(form: any, fieldName: string, picbedType: string, value
|
|||||||
if (!form[mapFieldName]) {
|
if (!form[mapFieldName]) {
|
||||||
form[mapFieldName] = {}
|
form[mapFieldName] = {}
|
||||||
}
|
}
|
||||||
|
const globalValue = form[fieldName]
|
||||||
|
const isSameValue =
|
||||||
|
fieldName === 'formatConvertObj'
|
||||||
|
? JSON.stringify(JSON.parse(value)) === JSON.stringify(JSON.parse(globalValue || '{}'))
|
||||||
|
: value === globalValue
|
||||||
const isValueDefault =
|
const isValueDefault =
|
||||||
fieldName === 'formatConvertObj'
|
fieldName === 'formatConvertObj'
|
||||||
? JSON.stringify(JSON.parse(value)) === JSON.stringify(defaultValue)
|
? JSON.stringify(JSON.parse(value)) === JSON.stringify(defaultValue)
|
||||||
@@ -1410,7 +1415,7 @@ function safeSetMapValue(form: any, fieldName: string, picbedType: string, value
|
|||||||
fieldName === 'formatConvertObj'
|
fieldName === 'formatConvertObj'
|
||||||
? JSON.stringify(form[fieldName]) === JSON.stringify(defaultValue)
|
? JSON.stringify(form[fieldName]) === JSON.stringify(defaultValue)
|
||||||
: form[fieldName] === defaultValue
|
: form[fieldName] === defaultValue
|
||||||
if (isValueDefault && isFormValueDefault) {
|
if ((isValueDefault && isFormValueDefault) || isSameValue) {
|
||||||
delete form[mapFieldName][picbedType]
|
delete form[mapFieldName][picbedType]
|
||||||
} else {
|
} else {
|
||||||
if (fieldName === 'formatConvertObj') {
|
if (fieldName === 'formatConvertObj') {
|
||||||
|
|||||||
@@ -23,16 +23,16 @@
|
|||||||
<div
|
<div
|
||||||
v-for="picbed in availablePicbeds"
|
v-for="picbed in availablePicbeds"
|
||||||
:key="picbed.type"
|
:key="picbed.type"
|
||||||
class="flex flex-wrap items-center justify-between rounded-sm border border-border bg-bg p-3 transition-all duration-fast ease-apple hover:border-accent hover:bg-surface"
|
class="flex flex-wrap items-center justify-between rounded-sm border border-border bg-bg p-3 transition-all duration-fast ease-apple hover:border-2 hover:border-accent hover:bg-surface"
|
||||||
>
|
>
|
||||||
<label class="m-0 flex-1 text-sm font-medium text-main">{{ picbed.name }}</label>
|
<label class="m-0 flex-1 text-sm font-medium text-main">{{ picbed.name }}</label>
|
||||||
<!-- Checkbox input -->
|
<!-- Checkbox input -->
|
||||||
<div v-if="inputType === 'checkbox'" class="flex items-center rounded-xl">
|
<div v-if="inputType === 'checkbox'" class="flex items-center rounded-xl">
|
||||||
<label
|
<label
|
||||||
class="flex cursor-pointer items-center gap-4 rounded-lg border border-border transition-all duration-200 ease-apple hover:border-accent"
|
class="flex cursor-pointer items-center gap-4 rounded-lg border border-border transition-all duration-200 ease-apple"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
:checked="getMapValue(mapField, picbed.type, defaultValue)"
|
:checked="currentValuesMap[picbed.type]"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="peer hidden"
|
class="peer hidden"
|
||||||
@change="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).checked)"
|
@change="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).checked)"
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<!-- Range input -->
|
<!-- Range input -->
|
||||||
<div v-else-if="inputType === 'range'" class="flex flex-wrap items-center gap-2 rounded-sm shadow-sm">
|
<div v-else-if="inputType === 'range'" class="flex flex-wrap items-center gap-2 rounded-sm shadow-sm">
|
||||||
<input
|
<input
|
||||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
:value="currentValuesMap[picbed.type]"
|
||||||
type="range"
|
type="range"
|
||||||
:min="rangeMin"
|
:min="rangeMin"
|
||||||
:max="rangeMax"
|
:max="rangeMax"
|
||||||
@@ -56,14 +56,14 @@
|
|||||||
<div
|
<div
|
||||||
class="inline-flex min-w-14 items-center justify-center rounded-md bg-accent px-1 py-1 text-sm font-semibold text-white shadow-sm"
|
class="inline-flex min-w-14 items-center justify-center rounded-md bg-accent px-1 py-1 text-sm font-semibold text-white shadow-sm"
|
||||||
>
|
>
|
||||||
{{ getMapValue(mapField, picbed.type, defaultValue) }}{{ rangeSuffix }}
|
{{ currentValuesMap[picbed.type] }}{{ rangeSuffix }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Number input -->
|
<!-- Number input -->
|
||||||
<input
|
<input
|
||||||
v-else-if="inputType === 'number'"
|
v-else-if="inputType === 'number'"
|
||||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
:value="currentValuesMap[picbed.type]"
|
||||||
type="number"
|
type="number"
|
||||||
:min="numberMin"
|
:min="numberMin"
|
||||||
:max="numberMax"
|
:max="numberMax"
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
<!-- Text input -->
|
<!-- Text input -->
|
||||||
<input
|
<input
|
||||||
v-else-if="inputType === 'text'"
|
v-else-if="inputType === 'text'"
|
||||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
:value="currentValuesMap[picbed.type]"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-[100px] rounded-sm border border-border bg-bg p-1 text-sm text-main outline-none placeholder:text-xs focus:border-accent focus:bg-surface"
|
class="w-[100px] rounded-sm border border-border bg-bg p-1 text-sm text-main outline-none placeholder:text-xs focus:border-accent focus:bg-surface"
|
||||||
:placeholder="textPlaceholder"
|
:placeholder="textPlaceholder"
|
||||||
@@ -84,13 +84,13 @@
|
|||||||
<!-- Color input -->
|
<!-- Color input -->
|
||||||
<div v-else-if="inputType === 'color'" class="flex items-center gap-2">
|
<div v-else-if="inputType === 'color'" class="flex items-center gap-2">
|
||||||
<input
|
<input
|
||||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
:value="currentValuesMap[picbed.type]"
|
||||||
type="color"
|
type="color"
|
||||||
class="rounded-sm border border-border bg-bg p-1 text-sm text-main outline-none focus:border-accent focus:bg-surface"
|
class="rounded-sm border border-border bg-bg p-1 text-sm text-main outline-none focus:border-accent focus:bg-surface"
|
||||||
@input="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).value)"
|
@input="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).value)"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
:value="currentValuesMap[picbed.type]"
|
||||||
type="text"
|
type="text"
|
||||||
class="w-[100px] rounded-sm border border-border bg-bg p-1 text-sm text-main outline-none placeholder:text-xs focus:border-accent focus:bg-surface"
|
class="w-[100px] rounded-sm border border-border bg-bg p-1 text-sm text-main outline-none placeholder:text-xs focus:border-accent focus:bg-surface"
|
||||||
@input="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).value)"
|
@input="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).value)"
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
<!-- Select input -->
|
<!-- Select input -->
|
||||||
<select
|
<select
|
||||||
v-else-if="inputType === 'select'"
|
v-else-if="inputType === 'select'"
|
||||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
:value="currentValuesMap[picbed.type]"
|
||||||
class="w-[100px] rounded-sm border border-border bg-bg text-sm text-main outline-none placeholder:text-xs focus:border-accent focus:bg-surface"
|
class="w-[100px] rounded-sm border border-border bg-bg text-sm text-main outline-none placeholder:text-xs focus:border-accent focus:bg-surface"
|
||||||
@change="e => handleMapChange(picbed.type, (e.target as HTMLSelectElement).value)"
|
@change="e => handleMapChange(picbed.type, (e.target as HTMLSelectElement).value)"
|
||||||
>
|
>
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
:id="`radio-${picbed.type}-${option.value}`"
|
:id="`radio-${picbed.type}-${option.value}`"
|
||||||
:checked="getMapValue(mapField, picbed.type, defaultValue) === option.value"
|
:checked="currentValuesMap[picbed.type] === option.value"
|
||||||
:value="option.value"
|
:value="option.value"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="peer hidden"
|
class="peer hidden"
|
||||||
@@ -203,13 +203,18 @@ const availablePicbeds = computed(() => {
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
function getMapValue(mapObj: Record<string, any> | undefined, picbedType: string, defaultValue: any) {
|
const currentValuesMap = computed(() => {
|
||||||
if (!mapObj) return defaultValue
|
if (!mapField) return {}
|
||||||
const rawMapObj = getRawData(mapObj)
|
|
||||||
const value =
|
const result: Record<string, any> = {}
|
||||||
rawMapObj[picbedType] !== undefined ? rawMapObj[picbedType] : globalValue !== undefined ? globalValue : defaultValue
|
for (const picbed of availablePicbeds.value) {
|
||||||
return typeof value === 'object' ? JSON.stringify(getRawData(value)) : value
|
const type = picbed.type
|
||||||
}
|
const val = mapField[type] !== undefined ? mapField[type] : globalValue !== undefined ? globalValue : defaultValue
|
||||||
|
|
||||||
|
result[type] = typeof val === 'object' ? JSON.stringify(getRawData(val)) : val
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
function handleMapChange(picbedType: string, value: any, id?: string) {
|
function handleMapChange(picbedType: string, value: any, id?: string) {
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|||||||
@@ -905,6 +905,7 @@
|
|||||||
<SettingSection>
|
<SettingSection>
|
||||||
<CustomSwitch
|
<CustomSwitch
|
||||||
v-model="advancedRename.enable"
|
v-model="advancedRename.enable"
|
||||||
|
small
|
||||||
:title="t('pages.settings.upload.enableAdvancedRname')"
|
:title="t('pages.settings.upload.enableAdvancedRname')"
|
||||||
:description="t('pages.settings.upload.enableAdvancedRnameDesc')"
|
:description="t('pages.settings.upload.enableAdvancedRnameDesc')"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user