删除接口,vue前端
接口//审核后台删除接口public function del_video(){$input = $this->getinput->json(array('id'));$this->db->where('id', $input['id']);$this->db->delete('...
·
接口
// 审核后台删除接口
public function del_video()
{
$input = $this->getinput->json(array('id'));
$this->db->where('id', $input['id']);
$this->db->delete('video');
$nu = $this->db->affected_rows();
if ($nu) {
$data['status'] = 0;
$data['msg'] = '删除成功';
echo json_encode($data);
} else {
$data['status'] = -1;
$data['msg'] = '删除失败';
echo json_encode($data);
}
}
vue前端
handleDelete: async function (item) {
let self = this;
this.$confirm('此操作将删除该视频, 是否删除?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'info'
}).then(async () => {
let {data} = await this.$http.post('/del_video', {id: item.id})
if (data.status == 0) {
this.$message({
showClose: true,
message: '删除成功',
type: 'success'
});
self.get_VideoList();
} else {
this.$message({
showClose: true,
message: data.msg,
type: data.code
});
}
}).catch(() => {
});
更多推荐
已为社区贡献1条内容
所有评论(0)