perf(固资图片): 未找到图片时文案优化提示

This commit is contained in:
runny committed 2026-07-15 11:25:29 +08:00
1 parent ffccf19ba2
commit d100a39cf8
1 file changed
+9 -1
@@ -27,12 +27,16 @@ function normalizeAssetImageErrorMessage(message: string): string {
if (lowerCaseMessage.includes('固定资产图片文档库未配置')) {
return '当前系统暂未配置固定资产图片文档库,暂时无法查看图片,请联系管理员处理。';
}
if (lowerCaseMessage.includes('请求的资源不存在')) {
return '设备管理员还未上传照片~';
}
if (lowerCaseMessage.includes('未找到资产')) {
return normalizedMessage;
}
return normalizedMessage || '检索固定资产图片失败';
}
export function useChatAssetImage(options: UseChatAssetImageOptions) {
const loading = ref(false);
@@ -76,7 +80,11 @@ export function useChatAssetImage(options: UseChatAssetImageOptions) {
} catch (err: unknown) {
const rawMessage = err instanceof Error ? err.message : '检索固定资产图片失败';
const message = normalizeAssetImageErrorMessage(rawMessage);
options.warn(`图片查询失败:${message}`);
if (message === '设备管理员还未上传照片~') {
options.warn(message);
} else {
options.warn(`图片查询失败:${message}`);
}
} finally {
loading.value = false;
}