Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
company_app
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
毛细亚
company_app
Commits
0dcfcc50
提交
0dcfcc50
authored
6月 02, 2026
作者:
施汉文
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(reportPopup): 修复举报抽屉关闭事件重入问题
上级
3919afc3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
1 行删除
+12
-1
index.vue
src/views/popup/reportPopup/index.vue
+12
-1
没有找到文件。
src/views/popup/reportPopup/index.vue
浏览文件 @
0dcfcc50
...
...
@@ -345,7 +345,8 @@
serverNameList
:
[],
searchUserOption
:
[],
eco_user_list
:
[],
// 生态运营人员列表
initialFormSnapshot
:
''
// 举报抽屉缓存:打开时快照,用于关闭时对比是否有修改
initialFormSnapshot
:
''
,
// 举报抽屉缓存:打开时快照,用于关闭时对比是否有修改
isClosing
:
false
// 关闭重入守卫:el-drawer 在 visible 被程序置 false 时会再次 emit close,避免 close() 二次执行
}
},
watch
:
{
...
...
@@ -353,6 +354,8 @@
// 举报抽屉缓存:组件由父级 :show.sync 常驻挂载,mounted 仅首次执行,
// 故「重置/恢复缓存/快照基线」必须放 show 的 false→true 跳变(不能放 mounted)。
if
(
newVal
===
true
&&
oldVal
===
false
)
{
// 关闭重入守卫复位:重新打开抽屉时允许下一次正常关闭
this
.
isClosing
=
false
if
(
this
.
reportInfo
&&
this
.
reportInfo
.
id
)
{
// 编辑/重新提交态:mounted 已回填表单,此处仅重新拉取生态运营
this
.
$nextTick
(()
=>
{
...
...
@@ -787,6 +790,9 @@
})
},
close
()
{
// 关闭重入守卫:el-drawer 的 visible 监听器在程序置 false 时会再次 emit close,
// 自定义取消/返回未经过 el-drawer 的 hide(),closed 一直为 false,故 close() 会被重入。
if
(
this
.
isClosing
)
return
// 举报抽屉缓存:关闭时检测是否有未提交的修改
const
hasChanges
=
JSON
.
stringify
(
this
.
reportForm
)
!==
this
.
initialFormSnapshot
if
(
hasChanges
)
{
...
...
@@ -796,14 +802,17 @@
type
:
'warning'
}).
then
(()
=>
{
// 举报抽屉缓存:用户选择保存,存入 vuex
this
.
isClosing
=
true
this
.
$store
.
commit
(
'game/set_reportDrawerCache'
,
this
.
$clone
(
this
.
reportForm
))
this
.
$emit
(
'update:show'
,
false
)
}).
catch
(()
=>
{
// 举报抽屉缓存:用户选择不保存,清除缓存
this
.
isClosing
=
true
this
.
$store
.
commit
(
'game/clear_reportDrawerCache'
)
this
.
$emit
(
'update:show'
,
false
)
})
}
else
{
this
.
isClosing
=
true
this
.
$emit
(
'update:show'
,
false
)
}
},
...
...
@@ -855,6 +864,8 @@
if
(
res
.
status_code
===
1
)
{
this
.
$message
.
success
(
'提交成功'
)
// 举报抽屉缓存:提交成功后清除缓存,并直接关闭(不走 close 的未保存确认逻辑)
// 置 isClosing 守卫:阻止 el-drawer 重入的 close() 二次弹确认 / 把刚清掉的缓存又写回
this
.
isClosing
=
true
this
.
$store
.
commit
(
'game/clear_reportDrawerCache'
)
this
.
$emit
(
'update:show'
,
false
)
if
(
this
.
reportInfo
&&
this
.
reportInfo
.
id
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论