feat: 🚀 文章分类添加图片

This commit is contained in:
2025-07-18 15:05:07 +08:00
parent fd0aaee998
commit f867f50114
13 changed files with 83 additions and 465 deletions

View File

@@ -53,13 +53,19 @@ export const EDIT_FORM_DATA: FormItem[] = [
type: "treeSelect",
label: "所属分类: ",
options: []
},
{
prop: "icon",
type: "upImg",
label: "图片: "
}
];
export const EDIT_RULE_FORM = {
is_show: 1,
sort: 1,
sort: 0,
name: "",
pid: 0
pid: 0,
icon: ""
};
// editRuleForm: {},
//editFormData: [],

View File

@@ -76,6 +76,7 @@
<script setup lang="ts" name="articleClassListIndex">
import rulesForm from "@/components/rulesForm/index.vue";
import SearchForm from "@/components/SearchForm/index.vue";
import { integerRexg } from "@/utils/regexp/index";
import { addLabelValue } from "@/utils/addLabelValue";
import { h } from "@/utils/url";
@@ -174,7 +175,6 @@ const getArticleClassAddSave = async () => {
};
//文章编辑
const getArticleClassUpEdit = async () => {
console.log("编辑");
const result = await getArticleClassEditUpApi(dataStore.editRuleForm);
const { msg, code } = result;

View File

@@ -121,6 +121,7 @@ const dataStore = reactive<any>({
formData: FORM_DATA, // 搜索配置项 dataStore.formData
visible: false,
data: [],
type: "image",
isFirstRequest: true
});
@@ -140,6 +141,7 @@ const getProductCategoryList = async () => {
const result = await getProductCategoryListApi();
if (result?.code === 0) {
let dataClone: any = cloneDeep(result?.data);
console.log(dataClone, "=dataClone=");
dataStore.editFormData[7].options = addLabelValue(dataClone);
}
};
@@ -164,6 +166,7 @@ const buildTree = (data: any, outerLinkTo: any = "") => {
};
// let isFirstRequest = true;
const handleRadioGroupEmits = (value: any) => {
dataStore.type = value;
if (value === "video") {
dataStore.editFormData = EDIT_FORM_DATA1;
dataStore.rules = RULES1;
@@ -205,6 +208,7 @@ const getSystemUrls = async (node: any, resolve: any) => {
}
};
const setImgOrVideo = (result: any) => {
dataStore.type = result?.data?.type;
if (result?.data?.type === "image") {
dataStore.editFormData = cloneDeep(EDIT_FORM_DATA);
}
@@ -224,7 +228,7 @@ const getBannerRead = async (id: any) => {
if (result?.code === 0) {
setImgOrVideo(result);
getProductCategoryList();
if (!result?.data?.desc) {
if (result?.data?.type === "image" && !result?.data?.desc) {
formRef?.value?.editorRef[0]?.clearEditor();
}
nextTick(() => {
@@ -251,6 +255,7 @@ const getBannerRead = async (id: any) => {
};
const handleCheck = (checkedNodes: any, values: any) => {
const { checkedKeys } = values;
console.log(checkedKeys, "=checkedKeys=");
if (checkedKeys.length) {
dataStore.editRuleForm.link = checkedNodes.url;
dataStore.editRuleForm.link_to = checkedNodes.link_to;
@@ -333,7 +338,9 @@ const handleConfirmClick = () => {
const resetFields = () => {
if (!formRef.value!.ruleFormRef) return;
formRef!.value!.ruleFormRef.resetFields();
formRef?.value?.editorRef[0]?.clearEditor();
if (dataStore.type === "image") {
formRef?.value?.editorRef[0]?.clearEditor();
}
};
// 抽屉重置
const handleResetClick = () => {

View File

@@ -61,7 +61,7 @@ const $route = useRoute();
import { getCategorysApi } from "@/api/modules/downloadClass";
import { recursiveCompare } from "@/utils/recursiveCompare";
import { addLabelValue } from "@/utils/addLabelValue";
import { ElNotification } from "element-plus";
//深拷贝方法
import { cloneDeep } from "lodash-es";
import {
@@ -156,7 +156,6 @@ const excelUploadSuccess = (response: any, row: any) => {
if (response?.code === 0) {
row.file_path = response.data.path; // 假设后端返回的文件路径在 data.path 中
}
console.log(row, "====row========");
ElNotification({
title: "温馨提示",
message: `文件上传成功!`,