mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +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` 文件夹中,且支持自动更新
|
||||
- Linux 新增 `rpm` 安装包
|
||||
- 新增图床编辑卡片页面,解决多配置切换时的混乱问题
|
||||
- 优化了图床独立处理设置的配置保存逻辑
|
||||
- 文件浏览页面新增列表模式支持。
|
||||
- 现在第一次启动时根据系统语言自动选择界面语言
|
||||
- 现在windows系统第一次启动时会默认显示主界面
|
||||
@@ -53,6 +54,7 @@
|
||||
|
||||
### 🐛 问题修复
|
||||
|
||||
- 修复了图片预处理设置中,单图床设置时变量值没有及时更新的问题
|
||||
- 修复了管理页面中排序下拉框显示异常的问题
|
||||
- 修复了管理页面图床列表未正确高亮当前选中项的问题
|
||||
- 修复了管理页面markdown预览内容没有正确渲染的问题
|
||||
|
||||
@@ -25,6 +25,7 @@ Use custom `javascript` scripts to extend PicList's functionality without the ne
|
||||
- Added `rpm` installation package for Linux.
|
||||
- Added image hosting editing card page to resolve confusion when switching multiple configurations.
|
||||
- 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 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.
|
||||
@@ -53,6 +54,7 @@ Use custom `javascript` scripts to extend PicList's functionality without the ne
|
||||
|
||||
### 🐛 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 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.
|
||||
|
||||
@@ -1402,6 +1402,11 @@ function safeSetMapValue(form: any, fieldName: string, picbedType: string, value
|
||||
if (!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 =
|
||||
fieldName === 'formatConvertObj'
|
||||
? JSON.stringify(JSON.parse(value)) === JSON.stringify(defaultValue)
|
||||
@@ -1410,7 +1415,7 @@ function safeSetMapValue(form: any, fieldName: string, picbedType: string, value
|
||||
fieldName === 'formatConvertObj'
|
||||
? JSON.stringify(form[fieldName]) === JSON.stringify(defaultValue)
|
||||
: form[fieldName] === defaultValue
|
||||
if (isValueDefault && isFormValueDefault) {
|
||||
if ((isValueDefault && isFormValueDefault) || isSameValue) {
|
||||
delete form[mapFieldName][picbedType]
|
||||
} else {
|
||||
if (fieldName === 'formatConvertObj') {
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
<div
|
||||
v-for="picbed in availablePicbeds"
|
||||
: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>
|
||||
<!-- Checkbox input -->
|
||||
<div v-if="inputType === 'checkbox'" class="flex items-center rounded-xl">
|
||||
<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
|
||||
:checked="getMapValue(mapField, picbed.type, defaultValue)"
|
||||
:checked="currentValuesMap[picbed.type]"
|
||||
type="checkbox"
|
||||
class="peer hidden"
|
||||
@change="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).checked)"
|
||||
@@ -45,7 +45,7 @@
|
||||
<!-- Range input -->
|
||||
<div v-else-if="inputType === 'range'" class="flex flex-wrap items-center gap-2 rounded-sm shadow-sm">
|
||||
<input
|
||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
||||
:value="currentValuesMap[picbed.type]"
|
||||
type="range"
|
||||
:min="rangeMin"
|
||||
:max="rangeMax"
|
||||
@@ -56,14 +56,14 @@
|
||||
<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"
|
||||
>
|
||||
{{ getMapValue(mapField, picbed.type, defaultValue) }}{{ rangeSuffix }}
|
||||
{{ currentValuesMap[picbed.type] }}{{ rangeSuffix }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Number input -->
|
||||
<input
|
||||
v-else-if="inputType === 'number'"
|
||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
||||
:value="currentValuesMap[picbed.type]"
|
||||
type="number"
|
||||
:min="numberMin"
|
||||
:max="numberMax"
|
||||
@@ -74,7 +74,7 @@
|
||||
<!-- Text input -->
|
||||
<input
|
||||
v-else-if="inputType === 'text'"
|
||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
||||
:value="currentValuesMap[picbed.type]"
|
||||
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"
|
||||
:placeholder="textPlaceholder"
|
||||
@@ -84,13 +84,13 @@
|
||||
<!-- Color input -->
|
||||
<div v-else-if="inputType === 'color'" class="flex items-center gap-2">
|
||||
<input
|
||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
||||
:value="currentValuesMap[picbed.type]"
|
||||
type="color"
|
||||
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
|
||||
:value="getMapValue(mapField, picbed.type, defaultValue)"
|
||||
:value="currentValuesMap[picbed.type]"
|
||||
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"
|
||||
@input="e => handleMapChange(picbed.type, (e.target as HTMLInputElement).value)"
|
||||
@@ -100,7 +100,7 @@
|
||||
<!-- Select input -->
|
||||
<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"
|
||||
@change="e => handleMapChange(picbed.type, (e.target as HTMLSelectElement).value)"
|
||||
>
|
||||
@@ -118,7 +118,7 @@
|
||||
>
|
||||
<input
|
||||
:id="`radio-${picbed.type}-${option.value}`"
|
||||
:checked="getMapValue(mapField, picbed.type, defaultValue) === option.value"
|
||||
:checked="currentValuesMap[picbed.type] === option.value"
|
||||
:value="option.value"
|
||||
type="radio"
|
||||
class="peer hidden"
|
||||
@@ -203,13 +203,18 @@ const availablePicbeds = computed(() => {
|
||||
}))
|
||||
})
|
||||
|
||||
function getMapValue(mapObj: Record<string, any> | undefined, picbedType: string, defaultValue: any) {
|
||||
if (!mapObj) return defaultValue
|
||||
const rawMapObj = getRawData(mapObj)
|
||||
const value =
|
||||
rawMapObj[picbedType] !== undefined ? rawMapObj[picbedType] : globalValue !== undefined ? globalValue : defaultValue
|
||||
return typeof value === 'object' ? JSON.stringify(getRawData(value)) : value
|
||||
const currentValuesMap = computed(() => {
|
||||
if (!mapField) return {}
|
||||
|
||||
const result: Record<string, any> = {}
|
||||
for (const picbed of availablePicbeds.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) {
|
||||
if (id) {
|
||||
|
||||
@@ -905,6 +905,7 @@
|
||||
<SettingSection>
|
||||
<CustomSwitch
|
||||
v-model="advancedRename.enable"
|
||||
small
|
||||
:title="t('pages.settings.upload.enableAdvancedRname')"
|
||||
:description="t('pages.settings.upload.enableAdvancedRnameDesc')"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user