From bbf953f47a98dd12814cceaea609da69d6ac2517 Mon Sep 17 00:00:00 2001 From: yangchunlong <292345300@qq.com> Date: Fri, 11 Apr 2025 10:54:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=9A=80=20=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/articleClass.ts | 11 +- src/components/Upload/UploadVideo.vue | 5 +- src/views/QAManagement/list/edit.vue | 11 +- .../articleManagement/class/constant/edit.ts | 32 ++-- .../articleManagement/class/constant/rules.ts | 3 +- .../class/constant/search.ts | 4 +- .../articleManagement/class/constant/table.ts | 4 +- src/views/articleManagement/class/index.vue | 146 ++++++++++++++---- .../bannerManagement/list/constant/rules.ts | 2 +- .../videoManagement/class/constant/table.ts | 1 - 10 files changed, 156 insertions(+), 63 deletions(-) diff --git a/src/api/modules/articleClass.ts b/src/api/modules/articleClass.ts index ed325c7..9389f9b 100644 --- a/src/api/modules/articleClass.ts +++ b/src/api/modules/articleClass.ts @@ -5,6 +5,10 @@ const ARTICLE_CATEGORY = `/article/category`; export const getArticleClassListApi = (params: any) => { return http.get(`${ARTICLE_CATEGORY}/index`, params); }; +//文章分类下拉框 +export const getArticleClassApi = () => { + return http.get(`/article/categorys`); +}; //文章分类新增 export const getArticleClassAddSaveApi = (params: any) => { return http.post(`${ARTICLE_CATEGORY}/save`, params); @@ -15,12 +19,13 @@ export const getArticleClassDelApi = (params: any) => { }; //文章分类更新(用于编辑后) export const getArticleClassEditUpApi = (params: any) => { - const { id, name, sort, is_show, seo_title, seo_keywords, seo_desc } = params; + const { id, name, sort, is_show, pid, seo_title, seo_keywords, seo_desc } = params; return http.put(`/article/category/update/${id}`, { name, sort, is_show, + pid, seo_title, seo_keywords, seo_desc @@ -30,3 +35,7 @@ export const getArticleClassEditUpApi = (params: any) => { export const getArticleClassDetailsApi = (params: any) => { return http.get(`${ARTICLE_CATEGORY}/read/${params}`); }; +export const getArticleClassSortApi = (params: any) => { + const { id, sort } = params; + return http.post(`${ARTICLE_CATEGORY}/sort/${id}`, { sort }); +}; diff --git a/src/components/Upload/UploadVideo.vue b/src/components/Upload/UploadVideo.vue index 1ed8f10..bbac38a 100644 --- a/src/components/Upload/UploadVideo.vue +++ b/src/components/Upload/UploadVideo.vue @@ -15,7 +15,7 @@ :accept="fileType.join(',')" > - + @@ -45,7 +45,7 @@ interface UploadFileProps { fileType?: any[]; //视频类型限制 ==> 非必传(默认为[".mp4", ".avi", ".mov"]) borderRadius?: string; // 组件边框圆角 ==> 非必传(默认为 8px) } -const videoShowUrl = ref(null); +const videoShowUrl = ref(null); // 接受父组件参数 const props = withDefaults(defineProps(), { videoUrl: "", @@ -98,6 +98,7 @@ const handleHttpUpload = async (options: UploadRequestOptions) => { }; const handleInput = () => { + emit("update:videoUrl", videoShowUrl.value); console.log("会触发吗"); }; diff --git a/src/views/QAManagement/list/edit.vue b/src/views/QAManagement/list/edit.vue index 93950f1..b215dfd 100644 --- a/src/views/QAManagement/list/edit.vue +++ b/src/views/QAManagement/list/edit.vue @@ -20,7 +20,7 @@
- +
@@ -40,7 +40,7 @@ const $route = useRoute(); const activeName = ref("basicInfo"); //数据集合 const dataStore = reactive({ - value: "", + // value: "", editRuleForm: cloneDeep(EDIT_RULE_FORM), editFormData: cloneDeep(EDIT_FORM_DATA), rules: RULES @@ -58,12 +58,14 @@ const getQAListDetails = async () => { const { data } = result; //这里是传给基本信息组件的表单数据 dataStore.editRuleForm = cloneDeep(data); + dataStore.value = data.answer; } }; getQAListDetails(); //更新 const getQAListEditUp = async () => { + // dataStore.editRuleForm.answer = dataStore.value; const result: any = await getQAListEditUpApi(dataStore.editRuleForm); if (result?.code === 0) { useMsg("success", result?.msg); @@ -72,6 +74,7 @@ const getQAListEditUp = async () => { }; //新增 getQAListSaveApi const getQAListSave = async () => { + // dataStore.editRuleForm.answer = dataStore.value; const result: any = await getQAListSaveApi(dataStore.editRuleForm); if (result?.code === 0) { useMsg("success", result?.msg); @@ -88,6 +91,10 @@ const handleReset = () => { const resetFields = () => { if (!formRef.value!.ruleFormRef) return; formRef!.value!.ruleFormRef.resetFields(); + for (let key in dataStore.editRuleForm) { + dataStore.editRuleForm[key] = ""; + } + // dataStore.value = ""; }; const handleSubmit = () => { diff --git a/src/views/articleManagement/class/constant/edit.ts b/src/views/articleManagement/class/constant/edit.ts index 4eab278..8757073 100644 --- a/src/views/articleManagement/class/constant/edit.ts +++ b/src/views/articleManagement/class/constant/edit.ts @@ -46,34 +46,20 @@ export const EDIT_FORM_DATA: FormItem[] = [ value: 0 } ] + }, + { + prop: "pid", + placeholder: "请选择", + type: "treeSelect", + label: "所属分类: ", + options: [] } - - // { - // prop: "seo_title", - // placeholder: "请输入", - // type: "input", - // label: "SEO标题: " - // }, - // { - // prop: "seo_keywords", - // placeholder: "请输入", - // type: "input", - // label: "SEO关键词: " - // }, - // { - // prop: "seo_desc", - // placeholder: "请输入", - // type: "input", - // label: "SEO描述: " - // } ]; export const EDIT_RULE_FORM = { is_show: 1, - seo_desc: "", - seo_keywords: "", - seo_title: "", sort: 1, - name: "" + name: "", + pid: 0 }; // editRuleForm: {}, //editFormData: [], diff --git a/src/views/articleManagement/class/constant/rules.ts b/src/views/articleManagement/class/constant/rules.ts index f372d0c..293a00b 100644 --- a/src/views/articleManagement/class/constant/rules.ts +++ b/src/views/articleManagement/class/constant/rules.ts @@ -1,4 +1,5 @@ export const RULES = { name: [{ required: true, message: "文章分类名称不能为空 ! ", trigger: "blur" }], - sort: [{ required: true, message: "文章分类排序不能为空 ! ", trigger: "blur" }] + sort: [{ required: true, message: "文章分类排序不能为空 ! ", trigger: "blur" }], + pid: [{ required: true, message: "所属分类不能为空 ! ", trigger: "blur" }] }; diff --git a/src/views/articleManagement/class/constant/search.ts b/src/views/articleManagement/class/constant/search.ts index 48f6de7..264c687 100644 --- a/src/views/articleManagement/class/constant/search.ts +++ b/src/views/articleManagement/class/constant/search.ts @@ -26,6 +26,6 @@ export const FORM_DATA: FormItem[] = [ ]; export const RULE_FORM = { - page: 1, - size: 50 + // page: 1, + // size: 50 }; diff --git a/src/views/articleManagement/class/constant/table.ts b/src/views/articleManagement/class/constant/table.ts index 20d4e08..39c4e92 100644 --- a/src/views/articleManagement/class/constant/table.ts +++ b/src/views/articleManagement/class/constant/table.ts @@ -32,7 +32,5 @@ export const COLUMNS = [ render: (scope: RenderScope): VNode | string | any => { return YES_OR_NO[scope.row.is_show]; } - }, - - { prop: "operation", label: "操作", fixed: "right", width: 300 } + } ]; diff --git a/src/views/articleManagement/class/index.vue b/src/views/articleManagement/class/index.vue index 1a3350a..106c69f 100644 --- a/src/views/articleManagement/class/index.vue +++ b/src/views/articleManagement/class/index.vue @@ -4,24 +4,45 @@
添加
- - - +
+ + + + + + + + + + + + + + + +
+