Skip to content

Commit

Permalink
fix: delete confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
IITII committed Feb 24, 2024
1 parent 9b54f71 commit 532ae69
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/components/waterfall/PicWaterfall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default {
computed: {
...mapState({
reload_timeout: state => state.common.reload_timeout,
delete_confirm: state => state.common.delete_confirm,
node_title: state => state[self.storeName].title,
node_key: state => state[self.storeName].node_key,
node_dir: state => state[self.storeName].node_dir,
Expand Down Expand Up @@ -280,10 +281,14 @@ export default {
})
},
async btnClickDelDirs() {
if (window.confirm(`确定要删除 ${this.node_title} 吗?`)) {
await this.tryDelDirs(this.node_key, this.node_dir)
if (this.delete_confirm) {
if (window.confirm(`确定要删除 ${this.node_title} 吗?`)) {
await this.tryDelDirs(this.node_key, this.node_dir)
} else {
this.$log.debug('cancel delete')
}
} else {
this.$log.debug('cancel delete')
await this.tryDelDirs(this.node_key, this.node_dir)
}
},
btn_click_goto_top() {
Expand Down
4 changes: 4 additions & 0 deletions src/store/modules/common/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ export const reload_timeout = ({commit}, payload) => {
persistent.commonSet('reload_timeout', payload)
commit('reload_timeout', payload)
}
export const delete_confirm = ({commit}, payload) => {
persistent.commonSet('delete_confirm', payload)
commit('delete_confirm', payload)
}
1 change: 1 addition & 0 deletions src/store/modules/common/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export const background = state => state.background
export const tool_group_force_right = state => state.tool_group_force_right
export const image_shortcut = state => state.image_shortcut
export const reload_timeout = state => state.reload_timeout
export const delete_confirm = state => state.delete_confirm
1 change: 1 addition & 0 deletions src/store/modules/common/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export const background = (state, payload) => state.background = payload
export const tool_group_force_right = (state, payload) => state.tool_group_force_right = payload
export const image_shortcut = (state, payload) => state.image_shortcut = payload
export const reload_timeout = (state, payload) => state.reload_timeout = payload
export const delete_confirm = (state, payload) => state.delete_confirm = payload
3 changes: 2 additions & 1 deletion src/store/modules/common/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function () {
background: persistent.commonGet('background') || './images/1.webp',
tool_group_force_right: persistent.commonGet('tool_group_force_right') === 'true',
image_shortcut: persistent.commonGet('image_shortcut') !== 'false',
reload_timeout: parseInt(persistent.commonGet('reload_timeout')) || 500,
reload_timeout: parseInt(persistent.commonGet('reload_timeout')) || 300,
delete_confirm: persistent.commonGet('delete_confirm') !== 'false',
}
}

0 comments on commit 532ae69

Please sign in to comment.