mirror of
https://ghproxy.com/https://github.com/StreakingMan/solvable-sheep-game
synced 2025-07-07 20:58:17 +08:00
fix: 自定义主题icons完成度校验
This commit is contained in:
parent
d070c67d3f
commit
01d85610eb
|
@ -271,6 +271,15 @@ const ConfigDialog: FC<{
|
|||
const findIconError = iconErrors.find((i) => !!i);
|
||||
if (findIconError)
|
||||
return Promise.reject(`图标素材有错误:${findIconError}`);
|
||||
const findUnfinishedIconIdx = customTheme.icons.findIndex(
|
||||
(icon) => !icon.content
|
||||
);
|
||||
if (findUnfinishedIconIdx !== -1) {
|
||||
setIconErrors(makeIconErrors(findUnfinishedIconIdx, '请填写链接'));
|
||||
return Promise.reject(
|
||||
`第${findUnfinishedIconIdx + 1}图标素材未完成`
|
||||
);
|
||||
}
|
||||
|
||||
return Promise.resolve('');
|
||||
};
|
||||
|
@ -361,10 +370,8 @@ const ConfigDialog: FC<{
|
|||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
setTimeout(() => {
|
||||
setConfigError(e);
|
||||
setUploading(false);
|
||||
}, 3000);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -568,11 +575,12 @@ const ConfigDialog: FC<{
|
|||
placeholder={'或者输入https外链'}
|
||||
value={customTheme.icons[idx].content}
|
||||
onBlur={(e) => {
|
||||
if (!linkReg.test(e.target.value))
|
||||
setIconErrors(
|
||||
makeIconErrors(
|
||||
idx,
|
||||
'请输入https外链'
|
||||
linkReg.test(e.target.value)
|
||||
? ''
|
||||
: '请输入https外链'
|
||||
)
|
||||
);
|
||||
}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user