后端:
/*** 删除指定id的投票信息* @param id* @return*/
@GetMapping("/delete/{id}")
@Transactional
public R delete(@PathVariable(value = "id")Integer id){voteDetailService.remove(new QueryWrapper<VoteDetail>().eq("vote_id",id)); // 删除用户投票详情voteItemService.remove(new QueryWrapper<VoteItem>().eq("vote_id",id)); // 删除投票选项voteService.removeById(id); // 删除投票return R.ok();
}
前端:
actionSet:function(){uni.showActionSheet({itemList:['删除当前投票'],success:(res)=>{if(res.tapIndex==0){uni.showModal({title:"系统提示?",content:"您确定要删除当前投票信息吗?",success:async (res2)=>{if(res2.confirm){const result=await requestUtil({url:"/vote/delete/"+this.vote.id,method:"get"});if(result.code==0){uni.showToast({icon:"success",title:"删除成功!"})}uni.switchTab({url:"/pages/create/create"})}}})}}})}