提交 5dadb0d1 作者: 施汉文

合并分支 'release' 到 'master'

Release

查看合并请求 !69
...@@ -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 = {
......
...@@ -69,8 +69,11 @@ ...@@ -69,8 +69,11 @@
></i> ></i>
</div> </div>
<el-collapse-transition> <el-collapse-transition>
<div v-show="showGameCode">
<div style="margin-bottom: 8px">
<mainGameSelect width="100%" @result="handleGiftGameSelect" />
</div>
<el-collapse <el-collapse
v-show="showGameCode"
v-if="giftCodeGame.length > 0" v-if="giftCodeGame.length > 0"
:disabled="disabled" :disabled="disabled"
class="giftGameCollapse" class="giftGameCollapse"
...@@ -130,6 +133,7 @@ ...@@ -130,6 +133,7 @@
<div v-else class="rowFlex allCenter">暂无游戏</div> <div v-else class="rowFlex allCenter">暂无游戏</div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</div>
</el-collapse-transition> </el-collapse-transition>
</div> </div>
<giftCodeDialog <giftCodeDialog
...@@ -154,6 +158,7 @@ import { passwardEncryption, createVipUrl } from "@/api/game"; ...@@ -154,6 +158,7 @@ import { passwardEncryption, createVipUrl } from "@/api/game";
import { giftCodeList, sendGiftCode, getZyouAuthLink } from "@/api/works"; import { giftCodeList, sendGiftCode, getZyouAuthLink } from "@/api/works";
import giftCodeDialog from "./giftCodeDialog.vue"; import giftCodeDialog from "./giftCodeDialog.vue";
import flowerLinkDialog from "./flowerLinkDialog.vue"; import flowerLinkDialog from "./flowerLinkDialog.vue";
import mainGameSelect from "@/components/mainGame.vue";
export default { export default {
name: "vipTools", name: "vipTools",
data() { data() {
...@@ -164,6 +169,7 @@ export default { ...@@ -164,6 +169,7 @@ export default {
dialogVisible: false, dialogVisible: false,
game_name: "", game_name: "",
flowerLinkDialogVisible: false, flowerLinkDialogVisible: false,
giftMainGameId: "",
giftCodeForm: { giftCodeForm: {
member_id: "", member_id: "",
username: "", username: "",
...@@ -178,6 +184,7 @@ export default { ...@@ -178,6 +184,7 @@ export default {
components: { components: {
giftCodeDialog, giftCodeDialog,
flowerLinkDialog, flowerLinkDialog,
mainGameSelect,
}, },
mounted() { mounted() {
this.requestGiftCode(); this.requestGiftCode();
...@@ -308,6 +315,10 @@ export default { ...@@ -308,6 +315,10 @@ export default {
this.$message.warning("暂无申诉自助链接"); this.$message.warning("暂无申诉自助链接");
} }
}, },
handleGiftGameSelect(value) {
this.giftMainGameId = value;
this.requestGiftCode();
},
async requestGiftCode() { async requestGiftCode() {
this.giftCodeGame = []; this.giftCodeGame = [];
// 1 企微 2 微信 // 1 企微 2 微信
...@@ -315,6 +326,9 @@ export default { ...@@ -315,6 +326,9 @@ export default {
userid: this.userid, userid: this.userid,
user_type: 1, user_type: 1,
}; };
if (this.giftMainGameId) {
data.main_game_id = this.giftMainGameId;
}
const res = await giftCodeList(data); const res = await giftCodeList(data);
if (res.status_code == 1 && res.data.length > 0) { if (res.status_code == 1 && res.data.length > 0) {
// this.giftCodeGame = res.data // this.giftCodeGame = res.data
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
> >
<el-form-item label="主游戏" prop="main_game_id"> <el-form-item label="主游戏" prop="main_game_id">
<mainGameSelect <mainGameSelect
:key="`main-game-${formKey}`"
label="" label=""
:default-value="reportForm.main_game_id" :default-value="reportForm.main_game_id"
style="width: 100%" style="width: 100%"
...@@ -138,6 +139,7 @@ ...@@ -138,6 +139,7 @@
</span> </span>
</div> </div>
<textEditor <textEditor
:key="`text-editor-${formKey}`"
ref="textEditorRef" ref="textEditorRef"
:remark.sync="reportForm.remark" :remark.sync="reportForm.remark"
domid="report_content" domid="report_content"
...@@ -344,19 +346,42 @@ ...@@ -344,19 +346,42 @@
cp_role_id_loading: false, cp_role_id_loading: false,
serverNameList: [], serverNameList: [],
searchUserOption: [], searchUserOption: [],
eco_user_list: [] // 生态运营人员列表 eco_user_list: [], // 生态运营人员列表
initialFormSnapshot: '', // 举报抽屉缓存:打开时快照,用于关闭时对比是否有修改
isClosing: false, // 关闭重入守卫:el-drawer 在 visible 被程序置 false 时会再次 emit close,避免 close() 二次执行
formKey: 0 // 子组件强制重建标识:mainGameSelect/textEditor 不随 reportForm prop 复位(前者空值不清、后者仅 mounted 读一次),每次打开自增以销毁重建,确保提交/缓存恢复后回显正确
} }
}, },
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 (newVal === true && oldVal === false && this.reportInfo && this.reportInfo.id) { this.isClosing = false
if (this.reportInfo && this.reportInfo.id) {
// 编辑/重新提交态:mounted 已回填表单,此处仅重新拉取生态运营
this.$nextTick(() => { this.$nextTick(() => {
this.refreshEcoUserForResubmit() this.refreshEcoUserForResubmit()
}) })
} else {
// 新建态:先重置为默认空表单(常驻组件不会自动清空),再恢复 vuex 缓存
this.reportForm = this.getDefaultReportForm()
// 生态运营是组件级状态(不在 reportForm 内),需单独清空,否则提交/关闭后重开会残留旧人员回显
this.eco_user_list = []
this.zyou_server_id_list = []
const cache = this.$store.state.game.reportDrawerCache
if (cache) {
this.reportForm = this.$clone(cache)
}
}
// 子组件强制重建:reportForm 已重置/回填/恢复落定,自增 key 让 mainGameSelect/textEditor
// 销毁重建,按最新 reportForm 重新初始化(否则提交后或缓存恢复时主游戏、详情会残留旧值)
this.formKey++
// 举报抽屉缓存:建立初始快照基线(回填/恢复落定后),关闭时据此判断是否有未提交修改
this.$nextTick(() => {
this.initialFormSnapshot = JSON.stringify(this.reportForm)
})
} }
}, },
/** /**
...@@ -417,6 +442,30 @@ ...@@ -417,6 +442,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 +799,31 @@ ...@@ -750,7 +799,31 @@
}) })
}, },
close() { 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) {
this.$confirm('是否保存当前输入?', '提示', {
confirmButtonText: '保存',
cancelButtonText: '不保存',
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) this.$emit('update:show', false)
}
}, },
async submit() { async submit() {
console.log(this.userInfo, 'reportForm') console.log(this.userInfo, 'reportForm')
...@@ -799,7 +872,11 @@ ...@@ -799,7 +872,11 @@
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 的未保存确认逻辑)
// 置 isClosing 守卫:阻止 el-drawer 重入的 close() 二次弹确认 / 把刚清掉的缓存又写回
this.isClosing = true
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论