fix(admin): adapt axios interceptor response in platform-config saving
这个提交包含在:
@@ -339,9 +339,11 @@ const removeFaqItem = (index: number) => {
|
|||||||
const fetchConfigs = async () => {
|
const fetchConfigs = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const { data: res } = await axios.get('/api/admin/system/configs');
|
const rawRes: any = await axios.get('/api/admin/system/configs');
|
||||||
if (res && res.code === 20000 && Array.isArray(res.data)) {
|
const res = rawRes.data || rawRes;
|
||||||
res.data.forEach((item: any) => {
|
const list = res.data || (Array.isArray(res) ? res : []);
|
||||||
|
if (Array.isArray(list)) {
|
||||||
|
list.forEach((item: any) => {
|
||||||
if (item.configKey === 'customer_service') {
|
if (item.configKey === 'customer_service') {
|
||||||
csForm.name = item.name;
|
csForm.name = item.name;
|
||||||
csForm.description = item.description;
|
csForm.description = item.description;
|
||||||
@@ -373,7 +375,7 @@ const fetchConfigs = async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
Message.error(err.response?.data?.message || '获取系统配置失败');
|
Message.error(err.response?.data?.message || err.message || '获取系统配置失败');
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
@@ -388,15 +390,16 @@ const saveConfig = async (key: string, form: any) => {
|
|||||||
status: form.status,
|
status: form.status,
|
||||||
valueJson: form.valueJson
|
valueJson: form.valueJson
|
||||||
};
|
};
|
||||||
const { data: res } = await axios.put(`/api/admin/system/configs/${key}`, payload);
|
const rawRes: any = await axios.put(`/api/admin/system/configs/${key}`, payload);
|
||||||
if (res && res.code === 20000) {
|
const res = rawRes.data || rawRes;
|
||||||
|
if (res && (res.code === 20000 || rawRes.status === 200)) {
|
||||||
Message.success('配置已保存并同步至小程序端');
|
Message.success('配置已保存并同步至小程序端');
|
||||||
fetchConfigs();
|
fetchConfigs();
|
||||||
} else {
|
} else {
|
||||||
Message.error(res?.message || '保存配置失败');
|
Message.error(res?.message || '保存配置失败');
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
Message.error(err.response?.data?.message || '保存配置异常,请检查内容是否含敏感词');
|
Message.error(err.response?.data?.message || err.message || '保存配置异常,请检查内容是否含敏感词');
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户