fix: 🧩 修复测试bug

This commit is contained in:
2025-03-31 17:01:27 +08:00
parent aeaf68307f
commit 716b383a87
23 changed files with 222 additions and 52 deletions

View File

@@ -37,6 +37,6 @@ export const getBannerListExportApi = (params: any) => {
}); });
}; };
//分类 //分类
export const getBannerClassListApi = () => { export const getBannerClassListApi = (params: any) => {
return http.get<any>(`/banner/list`); //v1/banner/list return http.get<any>(`/banner/list`, params); //v1/banner/list
}; };

View File

@@ -26,6 +26,6 @@ export const getCategorySortApi = (params: any) => {
return http.post<any>(`${ATT_C}/sort/${params.id}`, { sort: params.sort }); return http.post<any>(`${ATT_C}/sort/${params.id}`, { sort: params.sort });
}; };
//下载分类下拉列表 //下载分类下拉列表
export const getCategorysApi = () => { export const getCategorysApi = (params: any) => {
return http.get<any>(`/attachment/categorys`); return http.get<any>(`/attachment/categorys`, params);
}; };

View File

@@ -27,6 +27,6 @@ export const getVideoListExportApi = (params: any) => {
}); });
}; };
//视频分类 //视频分类
export const getVideoClassListApi = () => { export const getVideoClassListApi = (params: any) => {
return http.get<any>(`/video/categorys`); return http.get<any>(`/video/categorys`, params);
}; };

8
src/components.d.ts vendored
View File

@@ -16,6 +16,11 @@ declare module "vue" {
ElBreadcrumb: typeof import("element-plus/es")["ElBreadcrumb"]; ElBreadcrumb: typeof import("element-plus/es")["ElBreadcrumb"];
ElBreadcrumbItem: typeof import("element-plus/es")["ElBreadcrumbItem"]; ElBreadcrumbItem: typeof import("element-plus/es")["ElBreadcrumbItem"];
ElButton: typeof import("element-plus/es")["ElButton"]; ElButton: typeof import("element-plus/es")["ElButton"];
ElCarousel: typeof import("element-plus/es")["ElCarousel"];
ElCarouselItem: typeof import("element-plus/es")["ElCarouselItem"];
ElCheckbox: typeof import("element-plus/es")["ElCheckbox"];
ElCheckboxGroup: typeof import("element-plus/es")["ElCheckboxGroup"];
ElColorPicker: typeof import("element-plus/es")["ElColorPicker"];
ElContainer: typeof import("element-plus/es")["ElContainer"]; ElContainer: typeof import("element-plus/es")["ElContainer"];
ElDatePicker: typeof import("element-plus/es")["ElDatePicker"]; ElDatePicker: typeof import("element-plus/es")["ElDatePicker"];
ElDialog: typeof import("element-plus/es")["ElDialog"]; ElDialog: typeof import("element-plus/es")["ElDialog"];
@@ -37,6 +42,7 @@ declare module "vue" {
ElOption: typeof import("element-plus/es")["ElOption"]; ElOption: typeof import("element-plus/es")["ElOption"];
ElPagination: typeof import("element-plus/es")["ElPagination"]; ElPagination: typeof import("element-plus/es")["ElPagination"];
ElRadio: typeof import("element-plus/es")["ElRadio"]; ElRadio: typeof import("element-plus/es")["ElRadio"];
ElRadioButton: typeof import("element-plus/es")["ElRadioButton"];
ElRadioGroup: typeof import("element-plus/es")["ElRadioGroup"]; ElRadioGroup: typeof import("element-plus/es")["ElRadioGroup"];
ElScrollbar: typeof import("element-plus/es")["ElScrollbar"]; ElScrollbar: typeof import("element-plus/es")["ElScrollbar"];
ElSelect: typeof import("element-plus/es")["ElSelect"]; ElSelect: typeof import("element-plus/es")["ElSelect"];
@@ -47,6 +53,8 @@ declare module "vue" {
ElTabPane: typeof import("element-plus/es")["ElTabPane"]; ElTabPane: typeof import("element-plus/es")["ElTabPane"];
ElTabs: typeof import("element-plus/es")["ElTabs"]; ElTabs: typeof import("element-plus/es")["ElTabs"];
ElTag: typeof import("element-plus/es")["ElTag"]; ElTag: typeof import("element-plus/es")["ElTag"];
ElTooltip: typeof import("element-plus/es")["ElTooltip"];
ElTree: typeof import("element-plus/es")["ElTree"];
ElTreeSelect: typeof import("element-plus/es")["ElTreeSelect"]; ElTreeSelect: typeof import("element-plus/es")["ElTreeSelect"];
ElUpload: typeof import("element-plus/es")["ElUpload"]; ElUpload: typeof import("element-plus/es")["ElUpload"];
Empty: typeof import("./components/ProTable/components/Empty.vue")["default"]; Empty: typeof import("./components/ProTable/components/Empty.vue")["default"];

View File

@@ -56,7 +56,7 @@ import { ElNotification, formContextKey, formItemContextKey } from "element-plus
import type { UploadProps, UploadRequestOptions } from "element-plus"; import type { UploadProps, UploadRequestOptions } from "element-plus";
interface UploadFileProps { interface UploadFileProps {
imageUrl: string; // 图片地址 ==> 必传 imageUrl: any; // 图片地址 ==> 必传
api?: (params: any) => Promise<any>; // 上传图片的 api 方法,一般项目上传都是同一个 api 方法,在组件里直接引入即可 ==> 非必传 api?: (params: any) => Promise<any>; // 上传图片的 api 方法,一般项目上传都是同一个 api 方法,在组件里直接引入即可 ==> 非必传
drag?: boolean; // 是否支持拖拽上传 ==> 非必传(默认为 true drag?: boolean; // 是否支持拖拽上传 ==> 非必传(默认为 true
disabled?: boolean; // 是否禁用上传组件 ==> 非必传(默认为 false disabled?: boolean; // 是否禁用上传组件 ==> 非必传(默认为 false

View File

@@ -55,6 +55,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
} }
] ]
}, },
// {
// prop: "is_show1",
// placeholder: "",
// type: "radio",
// label: "是否启动: ",
// options: [
// {
// label: "是",
// value: 1
// },
// {
// label: "否",
// value: 0
// }
// ]
// },
{ {
prop: "link", prop: "link",
placeholder: "请输入", placeholder: "请输入",

View File

@@ -57,7 +57,7 @@ const dataStore = reactive<any>({
//文章分类 //文章分类
const getArticleClassData = async () => { const getArticleClassData = async () => {
const result = await getArticleClassDataApi(); const result = await getArticleClassDataApi({ is_show: 1 });
if (result?.code === 0) { if (result?.code === 0) {
const { data } = result; const { data } = result;
dataStore.editFormData[1].options = useSearchInfoArray(data); dataStore.editFormData[1].options = useSearchInfoArray(data);

View File

@@ -60,7 +60,7 @@ const dataStore = reactive<any>({
//文章分类(搜索条件) //文章分类(搜索条件)
const getArticleClassData = async () => { const getArticleClassData = async () => {
const result = await getArticleClassDataApi(); const result = await getArticleClassDataApi({ is_show: 0 });
if (result?.code === 0) { if (result?.code === 0) {
const { data } = result; const { data } = result;
dataStore.formData[1].options = useSearchInfoArray(data); dataStore.formData[1].options = useSearchInfoArray(data);
@@ -80,10 +80,6 @@ const handleAdd = (type: any) => {
//导出接口 //导出接口
const getArticleListExport = async () => { const getArticleListExport = async () => {
// searchParam,
// searchInitParam,
console.log(proTableRef?.value?.pageable, "===proTableRef?.value?.pageable==");
console.log(proTableRef?.value?.searchParam, "=dataStore.initParam=");
const result = await getArticleListExportApi({ const result = await getArticleListExportApi({
...proTableRef?.value?.searchParam, ...proTableRef?.value?.searchParam,
...proTableRef?.value?.pageable ...proTableRef?.value?.pageable

View File

@@ -50,12 +50,12 @@ export const COLUMNS = [
width: 160 width: 160
}, },
{ // {
align: "center", // align: "center",
label: "状态", // label: "状态",
prop: "status", // prop: "status",
width: 80 // width: 80
}, // },
{ prop: "operation", label: "操作", fixed: "right", width: 200 } { prop: "operation", label: "操作", fixed: "right", width: 200 }
]; ];

View File

@@ -49,6 +49,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
} }
] ]
}, },
{
prop: "status",
placeholder: "",
type: "radio",
label: "是否启动: ",
options: [
{
label: "是",
value: 1
},
{
label: "否",
value: 0
}
]
},
{ {
prop: "image", prop: "image",
type: "upImg", type: "upImg",
@@ -121,6 +137,22 @@ export const EDIT_FORM_DATA1: FormItem[] = [
} }
] ]
}, },
{
prop: "status",
placeholder: "",
type: "radio",
label: "是否启动: ",
options: [
{
label: "是",
value: 1
},
{
label: "否",
value: 0
}
]
},
{ {
prop: "image", prop: "image",
type: "upImg", type: "upImg",

View File

@@ -33,6 +33,11 @@ export const COLUMNS = [
label: "添加时间", label: "添加时间",
prop: "created_at" prop: "created_at"
}, },
{
align: "center",
label: "状态",
prop: "status",
width: 80
},
{ prop: "operation", label: "操作", fixed: "right", width: 200 } { prop: "operation", label: "操作", fixed: "right", width: 200 }
]; ];

View File

@@ -17,6 +17,11 @@
<template #sort="scope"> <template #sort="scope">
<el-input v-model="scope.row.sort" @blur="handleBlur(scope.row)" @input="handleInput(scope.row)"></el-input> <el-input v-model="scope.row.sort" @blur="handleBlur(scope.row)" @input="handleInput(scope.row)"></el-input>
</template> </template>
<template #status="scope">
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" effect="dark">{{
scope.row.status === 1 ? "启用" : "禁用"
}}</el-tag>
</template>
<template #operation="scope"> <template #operation="scope">
<el-button size="small" type="primary" @click="getBannerRead(scope.row.id)">编辑</el-button> <el-button size="small" type="primary" @click="getBannerRead(scope.row.id)">编辑</el-button>
<el-button size="small" type="danger" @click="getBannerDel(scope.row.id)">删除</el-button> <el-button size="small" type="danger" @click="getBannerDel(scope.row.id)">删除</el-button>
@@ -147,7 +152,7 @@ const buildTree = (data: any, outerLinkTo: any = "") => {
}; };
// let isFirstRequest = true; // let isFirstRequest = true;
const handleRadioGroupEmits = (value: any) => { const handleRadioGroupEmits = (value: any) => {
getBannerClassList(); // getBannerClassList();
if (value === "image") { if (value === "image") {
dataStore.isFirstRequest = true; dataStore.isFirstRequest = true;
dataStore.editFormData = EDIT_FORM_DATA; dataStore.editFormData = EDIT_FORM_DATA;
@@ -184,6 +189,13 @@ const getSystemUrls = async (node: any, resolve: any) => {
} }
} }
}; };
const setImgOrVideo = () => {
if (dataStore.editRuleForm.type === "image") {
dataStore.editFormData = EDIT_FORM_DATA;
} else {
dataStore.editFormData = EDIT_FORM_DATA1;
}
};
// 详情 // 详情
const getBannerRead = async (id: any) => { const getBannerRead = async (id: any) => {
dataStore.title = "编辑Banner"; dataStore.title = "编辑Banner";
@@ -191,6 +203,7 @@ const getBannerRead = async (id: any) => {
const result = await getBannerReadApi(id); const result = await getBannerReadApi(id);
if (result?.code === 0) { if (result?.code === 0) {
dataStore.editRuleForm = result?.data; dataStore.editRuleForm = result?.data;
setImgOrVideo();
if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) { if (dataStore.editRuleForm.link && dataStore.editRuleForm.link_to) {
let { id, name, link } = dataStore.editRuleForm.link_echo_data; let { id, name, link } = dataStore.editRuleForm.link_echo_data;
let obj: any = { let obj: any = {
@@ -239,18 +252,29 @@ const getBannerUp = async () => {
// 分类 // 分类
const getBannerClassList = async () => { const getBannerClassList = async () => {
const result = await getBannerClassListApi(); const result = await getBannerClassListApi({ is_show: 0 });
if (result?.code === 0) { if (result?.code === 0) {
let arr: any = []; let arr: any = [];
result?.data?.forEach((item: any) => { result?.data?.forEach((item: any) => {
arr.push({ value: item.id, label: item.name }); arr.push({ value: item.id, label: item.name });
}); });
console.log(arr, "========arr===============");
dataStore.formData[1].options = arr; dataStore.formData[1].options = arr;
dataStore.editFormData[4].options = arr; // dataStore.editFormData[4].options = arr;
} }
}; };
getBannerClassList(); getBannerClassList();
//详情里的分类
const getBannerClassEditList = async () => {
const result = await getBannerClassListApi({ is_show: 1 });
if (result?.code === 0) {
let arr: any = [];
result?.data?.forEach((item: any) => {
arr.push({ value: item.id, label: item.name });
});
dataStore.editFormData[4].options = arr;
}
};
getBannerClassEditList();
// 新增 getBannerListSave // 新增 getBannerListSave
const getBannerListSave = async () => { const getBannerListSave = async () => {
const result = await getBannerListSaveApi(dataStore.editRuleForm); const result = await getBannerListSaveApi(dataStore.editRuleForm);
@@ -343,6 +367,21 @@ const handleBlur = (row: any) => {
const handleInput = (row: any) => { const handleInput = (row: any) => {
row.sort = integerRexg(row.sort); row.sort = integerRexg(row.sort);
}; };
// watch(
// () => dataStore.editRuleForm.type,
// newVal => {
// console.log(dataStore.editRuleForm.type);
// if (newVal === "video") {
// dataStore.editFormData = EDIT_FORM_DATA1;
// } else {
// dataStore.editFormData = EDIT_FORM_DATA;
// }
// },
// {
// immediate: true,
// deep: true
// }
// );
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -55,6 +55,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
} }
] ]
}, },
// {
// prop: "is_show1",
// placeholder: "",
// type: "radio",
// label: "是否启动: ",
// options: [
// {
// label: "是",
// value: 1
// },
// {
// label: "否",
// value: 0
// }
// ]
// },
{ {
prop: "image", prop: "image",
type: "upImg", type: "upImg",

View File

@@ -48,12 +48,12 @@ export const COLUMNS = [
prop: "created_at" prop: "created_at"
}, },
{ // {
align: "center", // align: "center",
label: "状态", // label: "状态",
prop: "status", // prop: "status",
width: 80 // width: 80
}, // },
{ prop: "operation", label: "操作", fixed: "right", width: 200 } { prop: "operation", label: "操作", fixed: "right", width: 200 }
]; ];

View File

@@ -234,7 +234,7 @@ getAttachmentRead();
//分类 //分类
const getCategorys = async () => { const getCategorys = async () => {
const result = await getCategorysApi(); const result = await getCategorysApi({ is_show: 1 });
if (result?.code === 0) { if (result?.code === 0) {
let arr: any[] = []; let arr: any[] = [];

View File

@@ -151,7 +151,7 @@ const handleInput = (row: any) => {
row.sort = integerRexg(row.sort); row.sort = integerRexg(row.sort);
}; };
const getCategorys = async () => { const getCategorys = async () => {
const result = await getCategorysApi(); const result = await getCategorysApi({ is_show: 0 });
if (result?.code === 0) { if (result?.code === 0) {
let arr: any[] = []; let arr: any[] = [];

View File

@@ -49,12 +49,12 @@ export const COLUMNS = [
prop: "created_at" prop: "created_at"
}, },
{ // {
align: "center", // align: "center",
label: "状态", // label: "状态",
prop: "status", // prop: "status",
width: 80 // width: 80
}, // },
{ prop: "operation", label: "操作", fixed: "right", width: 200 } { prop: "operation", label: "操作", fixed: "right", width: 200 }
]; ];

View File

@@ -59,7 +59,12 @@
<el-radio :value="0" :label="0"></el-radio> <el-radio :value="0" :label="0"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="是否启用" style="width: 440px">
<el-radio-group v-model="_ruleFormParam.status">
<el-radio :value="1" :label="1"></el-radio>
<el-radio :value="0" :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="SEO标题"> <el-form-item label="SEO标题">
<el-input v-model="_ruleFormParam.seo_title" style="width: 440px" /> <el-input v-model="_ruleFormParam.seo_title" style="width: 440px" />
</el-form-item> </el-form-item>

View File

@@ -108,6 +108,24 @@ export const BASIC_INFO_FORM_DATA: FormItem[] = [
} }
] ]
}, },
{
prop: "is_show1",
placeholder: "",
type: "radio",
label: "是否启动: ",
options: [
{
label: "是",
value: 1
},
{
label: "否",
value: 0
}
]
},
{ {
prop: "seo_title", prop: "seo_title",
placeholder: "请输入", placeholder: "请输入",

View File

@@ -54,6 +54,22 @@ export const EDIT_FORM_DATA: FormItem[] = [
} }
] ]
}, },
// {
// prop: "is_show1",
// placeholder: "",
// type: "radio",
// label: "是否启动: ",
// options: [
// {
// label: "是",
// value: 1
// },
// {
// label: "否",
// value: 0
// }
// ]
// },
{ {
prop: "desc", prop: "desc",
placeholder: "请输入", placeholder: "请输入",

View File

@@ -48,12 +48,12 @@ export const COLUMNS = [
prop: "created_at" prop: "created_at"
}, },
{ // {
align: "center", // align: "center",
label: "状态", // label: "状态",
prop: "status", // prop: "status",
width: 80 // width: 80
}, // },
{ prop: "operation", label: "操作", fixed: "right", width: 200 } { prop: "operation", label: "操作", fixed: "right", width: 200 }
]; ];

View File

@@ -125,7 +125,7 @@ const handleResetClick = () => {
//视频分类接口 //视频分类接口
const getVideoClassList = async () => { const getVideoClassList = async () => {
const result = await getVideoClassListApi(); const result = await getVideoClassListApi({ is_show: 0 });
if (result?.code === 0) { if (result?.code === 0) {
let arr: any[] = []; let arr: any[] = [];
if (result?.data?.length) { if (result?.data?.length) {
@@ -141,6 +141,25 @@ const getVideoClassList = async () => {
} }
}; };
getVideoClassList(); getVideoClassList();
const getVideoClassEditList = async () => {
const result = await getVideoClassListApi({ is_show: 1 });
if (result?.code === 0) {
let arr: any[] = [];
if (result?.data?.length) {
result?.data?.forEach((item: any) => {
let obj = {
value: item.id,
label: item.name
};
arr.push(obj);
});
dataStore.editFormData[1].options = arr;
}
}
};
getVideoClassEditList();
//添加 //添加
const handleAdd = () => { const handleAdd = () => {
dataStore.visible = true; dataStore.visible = true;

View File

@@ -49,12 +49,12 @@ export const COLUMNS = [
prop: "created_at" prop: "created_at"
}, },
{ // {
align: "center", // align: "center",
label: "状态", // label: "状态",
prop: "status", // prop: "status",
width: 80 // width: 80
}, // },
{ prop: "operation", label: "操作", fixed: "right", width: 200 } { prop: "operation", label: "操作", fixed: "right", width: 200 }
]; ];