1.上传优化

v1.0.0
sws 2024-10-11 16:18:28 +08:00
parent b1b34c5d00
commit 884cfb2da1
2 changed files with 34 additions and 31 deletions

View File

@ -68,7 +68,7 @@ service.interceptors.response.use(
}
},
(error: any) => {
if (error.response.data) {
if (error.response && error.response.data) {
const { msg, message } = error.response.data;
message_error(msg || message || '系统出错');
}

View File

@ -156,7 +156,7 @@ const init = () => {
//
const data_merge = (list: string[]) => {
list.forEach((item: any) => {
item.com_data = default_merge(item.com_data, item.key);;
item.com_data = default_merge(item.com_data, item.key);
});
return list;
};
@ -291,38 +291,41 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
});
//
const new_data = diy_data_transfor_form_data(clone_form);
DiyAPI.save(new_data).then((res) => {
//
if (!(is_export || is_preview)) {
ElMessage.success('保存成功');
}
if (close) {
ElMessageBox.confirm('您确定要关闭本页吗?', '提示')
.then(() => {
//
window.close();
})
.catch(() => {});
} else {
//
if (is_export) {
const index = window.location.href.lastIndexOf('?s=');
const pro_url = window.location.href.substring(0, index);
const new_url = import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url;
window.open(new_url + '?s=diyapi/diydownload/id/' + res.data + '.html', '_blank');
DiyAPI.save(new_data)
.then((res) => {
setTimeout(() => {
save_disabled.value = false;
}, 500);
//
if (!(is_export || is_preview)) {
ElMessage.success('保存成功');
}
if (is_preview) {
preview_dialog.value = true;
diy_id.value = String(res.data);
if (close) {
ElMessageBox.confirm('您确定要关闭本页吗?', '提示')
.then(() => {
//
window.close();
})
.catch(() => {});
} else {
//
if (is_export) {
const index = window.location.href.lastIndexOf('?s=');
const pro_url = window.location.href.substring(0, index);
const new_url = import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url;
window.open(new_url + '?s=diyapi/diydownload/id/' + res.data + '.html', '_blank');
}
if (is_preview) {
preview_dialog.value = true;
diy_id.value = String(res.data);
}
form.value.id = String(res.data);
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
}
form.value.id = String(res.data);
history.pushState({}, '', '?s=diy/saveinfo/id/' + res.data + '.html');
}
setTimeout(() => {
})
.catch((err) => {
save_disabled.value = false;
}, 500);
});
});
};
//#endregion ---------------------end
//