新增删除功能
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user