轮播图代码优化
This commit is contained in:
		
							parent
							
								
									18ca4de3e0
								
							
						
					
					
						commit
						58c6baae4c
					
				| 
						 | 
				
			
			@ -17,16 +17,18 @@ export const getSwiperListApi = (data) => {
 | 
			
		|||
  });
 | 
			
		||||
};
 | 
			
		||||
// 修改轮播图状态
 | 
			
		||||
export const editHomeSwiperTypeApi = () => {
 | 
			
		||||
export const editHomeSwiperTypeApi = (data) => {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: "/auth/getConfig",
 | 
			
		||||
    method: "get",
 | 
			
		||||
    url: "/material-mall/bm_slide_show/edit",
 | 
			
		||||
    method: "post",
 | 
			
		||||
    data,
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
// 删除轮播图
 | 
			
		||||
export const deleteHomeSwiperApi = () => {
 | 
			
		||||
export const deleteHomeSwiperApi = (id) => {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: "/auth/getConfig",
 | 
			
		||||
    method: "get",
 | 
			
		||||
    url: `/material-mall/bm_slide_show/del/${id}`,
 | 
			
		||||
    method: "post",
 | 
			
		||||
    data,
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -262,19 +262,18 @@ export default {
 | 
			
		|||
        })
 | 
			
		||||
        .catch(() => {});
 | 
			
		||||
    },
 | 
			
		||||
    onSwitchChange(val, row) {
 | 
			
		||||
      if (!val) {
 | 
			
		||||
        this.$confirm("确定禁用该轮播图吗?", "提示", {
 | 
			
		||||
          confirmButtonText: "确定",
 | 
			
		||||
          cancelButtonText: "取消",
 | 
			
		||||
          type: "warning",
 | 
			
		||||
        })
 | 
			
		||||
          .then(() => {})
 | 
			
		||||
          .catch(() => {
 | 
			
		||||
            row.isShow = true;
 | 
			
		||||
          });
 | 
			
		||||
    async onSwitchChange(val, row) {
 | 
			
		||||
      console.log(row, "列表消息");
 | 
			
		||||
      const { id } = row;
 | 
			
		||||
      const params = {
 | 
			
		||||
        id,
 | 
			
		||||
        delFlag: val ? 0 : 2,
 | 
			
		||||
      };
 | 
			
		||||
      const res = await editHomeSwiperTypeApi(params);
 | 
			
		||||
      if (res.code === 200) {
 | 
			
		||||
        this.$modal.msgSuccess("状态修改成功");
 | 
			
		||||
        this.getSwiperListData();
 | 
			
		||||
      }
 | 
			
		||||
      console.log(row, "row---");
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue