🐛 消息标记已读问题修复
This commit is contained in:
parent
205ce8921d
commit
9e0f74f8c0
@ -85,6 +85,7 @@
|
|||||||
read(id) {
|
read(id) {
|
||||||
let _ts = this;
|
let _ts = this;
|
||||||
this.$axios.$put('/api/notification/read/' + id).then(function () {
|
this.$axios.$put('/api/notification/read/' + id).then(function () {
|
||||||
|
_ts.$store.commit('notification/updateState', true)
|
||||||
_ts.currentChange(1);
|
_ts.currentChange(1);
|
||||||
}).catch(error => console.log(error));
|
}).catch(error => console.log(error));
|
||||||
},
|
},
|
||||||
|
@ -12,7 +12,8 @@ export const state = () => {
|
|||||||
list: {
|
list: {
|
||||||
fetching: false,
|
fetching: false,
|
||||||
data: getDefaultListData()
|
data: getDefaultListData()
|
||||||
}
|
},
|
||||||
|
updateState: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +24,9 @@ export const mutations = {
|
|||||||
},
|
},
|
||||||
updateListData(state, action) {
|
updateListData(state, action) {
|
||||||
state.list.data = action
|
state.list.data = action
|
||||||
|
},
|
||||||
|
updateState(state, action) {
|
||||||
|
state.updateState = action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,15 +37,20 @@ export const actions = {
|
|||||||
commit('updateListFetching', true)
|
commit('updateListFetching', true)
|
||||||
// 当前页判断
|
// 当前页判断
|
||||||
let currentData = JSON.parse(JSON.stringify(state)).list.data
|
let currentData = JSON.parse(JSON.stringify(state)).list.data
|
||||||
if (Number(params.page) === currentData.pagination.currentPage) {
|
let updateState = state.updateState
|
||||||
commit('updateListFetching', false)
|
if (!updateState) {
|
||||||
return
|
if (Number(params.page) === currentData?.pagination.currentPage) {
|
||||||
|
commit('updateListFetching', false)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
commit('updateListData', getDefaultListData())
|
commit('updateListData', getDefaultListData())
|
||||||
let data = {
|
let data = {
|
||||||
page: params.page || 1
|
page: params.page || 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commit('updateState', false)
|
||||||
|
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$get(`${NOTIFICATION_API_PATH}/all`, {
|
.$get(`${NOTIFICATION_API_PATH}/all`, {
|
||||||
params: data
|
params: data
|
||||||
|
Loading…
Reference in New Issue
Block a user