fix: 🧩 修复BUG

This commit is contained in:
2025-03-27 10:34:06 +08:00
parent a66092dea0
commit 2694a0c905
5 changed files with 69 additions and 56 deletions

View File

@@ -54,14 +54,7 @@ const dataStore = reactive<any>({
editRuleForm: cloneDeep(EDIT_RULE_FORM),
editFormData: cloneDeep(EDIT_FORM_DATA) //抽屉表单配置项
});
//新增
const getArticleListAddSave = async () => {
const result = await getArticleListAddSaveApi(dataStore.editRuleForm);
if (result.code === 0) {
const { msg } = result;
useMsg("success", msg);
}
};
//文章分类
const getArticleClassData = async () => {
const result = await getArticleClassDataApi();
@@ -89,8 +82,38 @@ const getArticleListDetails = async () => {
console.log(data);
}
};
const convertDateFormat = (dateString: any) => {
const date = new Date(dateString);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};
//新增
const getArticleListAddSave = async () => {
if (dataStore.editRuleForm.release_time) {
dataStore.editRuleForm.release_time = convertDateFormat(dataStore.editRuleForm.release_time);
} else {
dataStore.editRuleForm.release_time = null;
}
const result = await getArticleListAddSaveApi(dataStore.editRuleForm);
if (result.code === 0) {
const { msg } = result;
useMsg("success", msg);
}
};
//更新
const getArticleListUp = async () => {
if (dataStore.editRuleForm.release_time) {
dataStore.editRuleForm.release_time = convertDateFormat(dataStore.editRuleForm.release_time);
} else {
dataStore.editRuleForm.release_time = null;
}
const result = await getArticleListUpApi({ id: $route.query.id, ...dataStore.editRuleForm });
if (result?.code === 0) {