轮播图代码优化

This commit is contained in:
BianLzhaoMin 2025-01-16 10:39:48 +08:00
parent 18ca4de3e0
commit 58c6baae4c
2 changed files with 19 additions and 18 deletions

View File

@ -17,16 +17,18 @@ export const getSwiperListApi = (data) => {
}); });
}; };
// 修改轮播图状态 // 修改轮播图状态
export const editHomeSwiperTypeApi = () => { export const editHomeSwiperTypeApi = (data) => {
return request({ return request({
url: "/auth/getConfig", url: "/material-mall/bm_slide_show/edit",
method: "get", method: "post",
data,
}); });
}; };
// 删除轮播图 // 删除轮播图
export const deleteHomeSwiperApi = () => { export const deleteHomeSwiperApi = (id) => {
return request({ return request({
url: "/auth/getConfig", url: `/material-mall/bm_slide_show/del/${id}`,
method: "get", method: "post",
data,
}); });
}; };

View File

@ -262,19 +262,18 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
onSwitchChange(val, row) { async onSwitchChange(val, row) {
if (!val) { console.log(row, "列表消息");
this.$confirm("确定禁用该轮播图吗?", "提示", { const { id } = row;
confirmButtonText: "确定", const params = {
cancelButtonText: "取消", id,
type: "warning", delFlag: val ? 0 : 2,
}) };
.then(() => {}) const res = await editHomeSwiperTypeApi(params);
.catch(() => { if (res.code === 200) {
row.isShow = true; this.$modal.msgSuccess("状态修改成功");
}); this.getSwiperListData();
} }
console.log(row, "row---");
}, },
}, },
}; };