Commit 6f373c21 by 胡悦

fix: 修复返回页面时消息列表不更新的问题

在 systemDetail.vue 中启用返回事件发射,并在 HomeFrame 的 created 钩子中统一监听 pageBack 事件来刷新消息列表。
移除 LeftSide.vue 中重复的监听,避免重复调用。
为 msgwebview.vue 和 imgPreview.vue 添加物理返回键处理,确保返回时也能触发数据刷新。
调整 ServiceList.vue 中的样式注释,避免布局问题。
1 parent 9da0dd8e

38.9 KB | W: | H:

29.5 KB | W: | H:

assets/images/common/case-notice.png
assets/images/common/case-notice.png
assets/images/common/case-notice.png
assets/images/common/case-notice.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -222,11 +222,7 @@ export default { ...@@ -222,11 +222,7 @@ export default {
}, },
}, },
created () { created () {
// 监听自定义事件
uni.$on('pageBack', () => {
console.log('pageBack')
this.getMessageInfo();
});
uni.$on('ActivityCenter', this.handleActivityCenter); uni.$on('ActivityCenter', this.handleActivityCenter);
// uni.$on('ActivityCenter', () => { // uni.$on('ActivityCenter', () => {
// console.log('ActivityCenter') // console.log('ActivityCenter')
......
...@@ -395,6 +395,13 @@ export default { ...@@ -395,6 +395,13 @@ export default {
deep: true deep: true
} }
}, },
created() {
// 监听自定义事件
uni.$on('pageBack', () => {
this.$refs.leftBox.getMessageInfo();
this.$refs.messageRef.getMessageSummary()
});
},
methods: { methods: {
// 处理开始测评(参考 detail.vue 的实现) // 处理开始测评(参考 detail.vue 的实现)
async handleStartAssessment () { async handleStartAssessment () {
......
...@@ -73,9 +73,20 @@ export default { ...@@ -73,9 +73,20 @@ export default {
// } // }
// }); // });
}, },
onBackPress(options) {
if (options.from === 'backbutton') {
// 阻止默认返回
this.back()
return true
}
return false
},
back () { back () {
if (this.isComponents) this.$emit('previewBack') if (this.isComponents) this.$emit('previewBack')
else uni.navigateBack() else {
uni.navigateBack()
uni.$emit('pageBack')
}
}, },
} }
} }
......
...@@ -32,6 +32,18 @@ export default { ...@@ -32,6 +32,18 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
onBackPress(options) {
if (options.from === 'backbutton') {
// 阻止默认返回
this.back()
return true
}
return false
},
back () {
uni.navigateBack()
uni.$emit('pageBack')
},
} }
} }
</script> </script>
......
...@@ -153,7 +153,7 @@ export default { ...@@ -153,7 +153,7 @@ export default {
} }
.message-index-box { .message-index-box {
margin: 0 toRpx(32); margin: 0 toRpx(32);
height: 100%; // height: 100%;
&.message-out { &.message-out {
padding-bottom: toRpx(40); padding-bottom: toRpx(40);
box-sizing: content-box; box-sizing: content-box;
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
// 返回 // 返回
back() { back() {
// this.showPage('MessageList') // this.showPage('MessageList')
// uni.$emit('pageBack'); uni.$emit('pageBack');
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
animationType: 'pop-out', animationType: 'pop-out',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!