Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
company_app
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
毛细亚
company_app
Commits
3919afc3
提交
3919afc3
authored
6月 02, 2026
作者:
施汉文
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(game+report): 新增举报申请缓存
上级
b07fdcfa
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
9 行删除
+75
-9
game.js
src/store/modules/game.js
+9
-0
index.vue
src/views/popup/reportPopup/index.vue
+66
-9
没有找到文件。
src/store/modules/game.js
浏览文件 @
3919afc3
...
@@ -16,6 +16,7 @@ const state = {
...
@@ -16,6 +16,7 @@ const state = {
chatUserInfo
:
{},
// 当前选中的用户的详情
chatUserInfo
:
{},
// 当前选中的用户的详情
viewLoading
:
false
,
// 查看用户详情的时候 加载状态
viewLoading
:
false
,
// 查看用户详情的时候 加载状态
taskDetails
:
{},
// 任务详情
taskDetails
:
{},
// 任务详情
reportDrawerCache
:
null
,
// 举报抽屉表单缓存:关闭抽屉时用户选择保存则存储表单数据,下次打开时恢复
// 任务数据
// 任务数据
taskData
:
{
taskData
:
{
user_task
:
0
,
user_task
:
0
,
...
@@ -47,6 +48,14 @@ const mutations = {
...
@@ -47,6 +48,14 @@ const mutations = {
set_taskDetails
(
state
,
data
)
{
set_taskDetails
(
state
,
data
)
{
state
.
taskDetails
=
data
state
.
taskDetails
=
data
},
},
// 举报抽屉缓存:保存表单数据
set_reportDrawerCache
(
state
,
data
)
{
state
.
reportDrawerCache
=
data
},
// 举报抽屉缓存:清除
clear_reportDrawerCache
(
state
)
{
state
.
reportDrawerCache
=
null
},
// 设置任务数据
// 设置任务数据
set_taskData
(
state
,
data
)
{
set_taskData
(
state
,
data
)
{
state
.
taskData
=
{
state
.
taskData
=
{
...
...
src/views/popup/reportPopup/index.vue
浏览文件 @
3919afc3
...
@@ -344,18 +344,31 @@
...
@@ -344,18 +344,31 @@
cp_role_id_loading
:
false
,
cp_role_id_loading
:
false
,
serverNameList
:
[],
serverNameList
:
[],
searchUserOption
:
[],
searchUserOption
:
[],
eco_user_list
:
[]
// 生态运营人员列表
eco_user_list
:
[],
// 生态运营人员列表
initialFormSnapshot
:
''
// 举报抽屉缓存:打开时快照,用于关闭时对比是否有修改
}
}
},
},
watch
:
{
watch
:
{
show
(
newVal
,
oldVal
)
{
show
(
newVal
,
oldVal
)
{
if
(
newVal
)
{
// 举报抽屉缓存:组件由父级 :show.sync 常驻挂载,mounted 仅首次执行,
console
.
log
(
'显示弹窗'
)
// 故「重置/恢复缓存/快照基线」必须放 show 的 false→true 跳变(不能放 mounted)。
}
if
(
newVal
===
true
&&
oldVal
===
false
)
{
// 重新提交:抽屉再次打开时重新拉取生态运营(组件未销毁、仅 show 切换的场景)
if
(
this
.
reportInfo
&&
this
.
reportInfo
.
id
)
{
if
(
newVal
===
true
&&
oldVal
===
false
&&
this
.
reportInfo
&&
this
.
reportInfo
.
id
)
{
// 编辑/重新提交态:mounted 已回填表单,此处仅重新拉取生态运营
this
.
$nextTick
(()
=>
{
this
.
refreshEcoUserForResubmit
()
})
}
else
{
// 新建态:先重置为默认空表单(常驻组件不会自动清空),再恢复 vuex 缓存
this
.
reportForm
=
this
.
getDefaultReportForm
()
const
cache
=
this
.
$store
.
state
.
game
.
reportDrawerCache
if
(
cache
)
{
this
.
reportForm
=
this
.
$clone
(
cache
)
}
}
// 举报抽屉缓存:建立初始快照基线(回填/恢复落定后),关闭时据此判断是否有未提交修改
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
refreshEcoUserForResubmit
(
)
this
.
initialFormSnapshot
=
JSON
.
stringify
(
this
.
reportForm
)
})
})
}
}
},
},
...
@@ -417,6 +430,30 @@
...
@@ -417,6 +430,30 @@
},
},
methods
:
{
methods
:
{
/**
/**
* 举报抽屉缓存:新建态的默认空表单。
* 组件由父级 :show.sync 常驻挂载(非 v-if 销毁重建),打开时据此重置,
* 以保证「不保存关闭 / 提交成功」后下次打开为空表单。
*/
getDefaultReportForm
()
{
return
{
main_game_id
:
''
,
report_role_id_type
:
'cp_role_id'
,
role_id_type
:
'cp_role_id'
,
cp_role_id
:
[],
role_id
:
[],
role_name
:
[],
server_name
:
[],
violation_type
:
''
,
report_cp_role_id
:
''
,
report_role_id
:
''
,
report_role_name
:
''
,
report_server_name
:
''
,
eco_user
:
''
,
is_negotiation
:
''
,
remark
:
''
}
},
/**
* 从举报详情中取字段,兼容下划线 / 驼峰(列表接口字段名可能不一致)
* 从举报详情中取字段,兼容下划线 / 驼峰(列表接口字段名可能不一致)
*/
*/
pickReportInfoField
(
info
,
snakeKey
,
camelKey
)
{
pickReportInfoField
(
info
,
snakeKey
,
camelKey
)
{
...
@@ -750,7 +787,25 @@
...
@@ -750,7 +787,25 @@
})
})
},
},
close
()
{
close
()
{
this
.
$emit
(
'update:show'
,
false
)
// 举报抽屉缓存:关闭时检测是否有未提交的修改
const
hasChanges
=
JSON
.
stringify
(
this
.
reportForm
)
!==
this
.
initialFormSnapshot
if
(
hasChanges
)
{
this
.
$confirm
(
'是否保存当前输入?'
,
'提示'
,
{
confirmButtonText
:
'保存'
,
cancelButtonText
:
'不保存'
,
type
:
'warning'
}).
then
(()
=>
{
// 举报抽屉缓存:用户选择保存,存入 vuex
this
.
$store
.
commit
(
'game/set_reportDrawerCache'
,
this
.
$clone
(
this
.
reportForm
))
this
.
$emit
(
'update:show'
,
false
)
}).
catch
(()
=>
{
// 举报抽屉缓存:用户选择不保存,清除缓存
this
.
$store
.
commit
(
'game/clear_reportDrawerCache'
)
this
.
$emit
(
'update:show'
,
false
)
})
}
else
{
this
.
$emit
(
'update:show'
,
false
)
}
},
},
async
submit
()
{
async
submit
()
{
console
.
log
(
this
.
userInfo
,
'reportForm'
)
console
.
log
(
this
.
userInfo
,
'reportForm'
)
...
@@ -799,7 +854,9 @@
...
@@ -799,7 +854,9 @@
this
.
loading
=
false
this
.
loading
=
false
if
(
res
.
status_code
===
1
)
{
if
(
res
.
status_code
===
1
)
{
this
.
$message
.
success
(
'提交成功'
)
this
.
$message
.
success
(
'提交成功'
)
this
.
close
()
// 举报抽屉缓存:提交成功后清除缓存,并直接关闭(不走 close 的未保存确认逻辑)
this
.
$store
.
commit
(
'game/clear_reportDrawerCache'
)
this
.
$emit
(
'update:show'
,
false
)
if
(
this
.
reportInfo
&&
this
.
reportInfo
.
id
)
{
if
(
this
.
reportInfo
&&
this
.
reportInfo
.
id
)
{
this
.
$emit
(
'updateReportList'
)
this
.
$emit
(
'updateReportList'
)
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论