新增删除功能

This commit is contained in:
lion
2022-07-22 12:13:09 +08:00
parent ed257498c2
commit 2a87cd760e
6 changed files with 44 additions and 18 deletions
+21
View File
@@ -103,6 +103,17 @@ const actions = {
},
searchByKeyword(context, keyword){
context.commit("_searchByKeyword", keyword)
},
deleteGallery(context, gid){
axios.delete(base_url, {params:{AuthCode:state.AuthCode, gid:gid}}).then((res) => {
if(res.data.result === "success"){
ElMessage("删除成功")
context.commit("_deleteGallery", gid)
}
else{
ElMessage(res.data.data)
}
})
}
}
@@ -172,6 +183,16 @@ const mutations = {
if(state.searchTask.length === 0){
ElMessage("未找到该关键字的本子")
}
},
_deleteGallery(state, gid){
state.totalTask.map((currentValue, index, arr) => {
return currentValue.gid === gid ? null: currentValue
})
if(state.searchTask.length !== 1){
state.searchTask.map(currentValue => {
return currentValue.gid === gid ? null : currentValue
})
}
}
}