提交 5dadb0d1 作者: 施汉文

合并分支 'release' 到 'master'

Release

查看合并请求 !69
......@@ -16,6 +16,7 @@ const state = {
chatUserInfo: {}, // 当前选中的用户的详情
viewLoading:false, // 查看用户详情的时候 加载状态
taskDetails: {}, // 任务详情
reportDrawerCache: null, // 举报抽屉表单缓存:关闭抽屉时用户选择保存则存储表单数据,下次打开时恢复
// 任务数据
taskData: {
user_task: 0,
......@@ -47,6 +48,14 @@ const mutations = {
set_taskDetails(state, data) {
state.taskDetails = data
},
// 举报抽屉缓存:保存表单数据
set_reportDrawerCache(state, data) {
state.reportDrawerCache = data
},
// 举报抽屉缓存:清除
clear_reportDrawerCache(state) {
state.reportDrawerCache = null
},
// 设置任务数据
set_taskData(state, data) {
state.taskData = {
......
......@@ -69,67 +69,71 @@
></i>
</div>
<el-collapse-transition>
<el-collapse
v-show="showGameCode"
v-if="giftCodeGame.length > 0"
:disabled="disabled"
class="giftGameCollapse"
>
<el-collapse-item
v-for="(item, index) in giftCodeGame"
:key="index"
:title="item.label"
style="margin-bottom: 10px"
<div v-show="showGameCode">
<div style="margin-bottom: 8px">
<mainGameSelect width="100%" @result="handleGiftGameSelect" />
</div>
<el-collapse
v-if="giftCodeGame.length > 0"
:disabled="disabled"
class="giftGameCollapse"
>
<div v-if="giftCodeGame.length > 0">
<div
v-for="(items, indexs) in item.children"
:key="indexs"
class="gameListItemChange"
>
<div class="gameListItemApp gameListItemAppAC">
<p v-if="items.gift_package_group_name" class="gameName">
{{ items.gift_package_group_name }}
</p>
<div
class="rowFlex columnCenter spaceBetween"
style="margin-left: 20px"
>
<p class="rowFlex columnCenter spaceBetween">
<el-popover placement="top" width="300" trigger="hover">
<div>{{ items.name }}</div>
<div slot="reference" class="gameName">
{{ items.name }}
</div>
</el-popover>
<el-popover placement="top" trigger="hover">
<div
class="contentPopover"
v-html="items.content"
></div>
<el-button
slot="reference"
type="text"
size="medium"
style="margin-right: 10px"
>礼包内容</el-button
>
</el-popover>
<el-collapse-item
v-for="(item, index) in giftCodeGame"
:key="index"
:title="item.label"
style="margin-bottom: 10px"
>
<div v-if="giftCodeGame.length > 0">
<div
v-for="(items, indexs) in item.children"
:key="indexs"
class="gameListItemChange"
>
<div class="gameListItemApp gameListItemAppAC">
<p v-if="items.gift_package_group_name" class="gameName">
{{ items.gift_package_group_name }}
</p>
<el-button
size="mini"
type="primary"
:loading="loading"
@click="sendGameCodeCopyDialog(items)"
>发送礼包码</el-button
<div
class="rowFlex columnCenter spaceBetween"
style="margin-left: 20px"
>
<p class="rowFlex columnCenter spaceBetween">
<el-popover placement="top" width="300" trigger="hover">
<div>{{ items.name }}</div>
<div slot="reference" class="gameName">
{{ items.name }}
</div>
</el-popover>
<el-popover placement="top" trigger="hover">
<div
class="contentPopover"
v-html="items.content"
></div>
<el-button
slot="reference"
type="text"
size="medium"
style="margin-right: 10px"
>礼包内容</el-button
>
</el-popover>
</p>
<el-button
size="mini"
type="primary"
:loading="loading"
@click="sendGameCodeCopyDialog(items)"
>发送礼包码</el-button
>
</div>
</div>
</div>
</div>
</div>
<div v-else class="rowFlex allCenter">暂无游戏</div>
</el-collapse-item>
</el-collapse>
<div v-else class="rowFlex allCenter">暂无游戏</div>
</el-collapse-item>
</el-collapse>
</div>
</el-collapse-transition>
</div>
<giftCodeDialog
......@@ -154,6 +158,7 @@ import { passwardEncryption, createVipUrl } from "@/api/game";
import { giftCodeList, sendGiftCode, getZyouAuthLink } from "@/api/works";
import giftCodeDialog from "./giftCodeDialog.vue";
import flowerLinkDialog from "./flowerLinkDialog.vue";
import mainGameSelect from "@/components/mainGame.vue";
export default {
name: "vipTools",
data() {
......@@ -164,6 +169,7 @@ export default {
dialogVisible: false,
game_name: "",
flowerLinkDialogVisible: false,
giftMainGameId: "",
giftCodeForm: {
member_id: "",
username: "",
......@@ -178,6 +184,7 @@ export default {
components: {
giftCodeDialog,
flowerLinkDialog,
mainGameSelect,
},
mounted() {
this.requestGiftCode();
......@@ -308,6 +315,10 @@ export default {
this.$message.warning("暂无申诉自助链接");
}
},
handleGiftGameSelect(value) {
this.giftMainGameId = value;
this.requestGiftCode();
},
async requestGiftCode() {
this.giftCodeGame = [];
// 1 企微 2 微信
......@@ -315,6 +326,9 @@ export default {
userid: this.userid,
user_type: 1,
};
if (this.giftMainGameId) {
data.main_game_id = this.giftMainGameId;
}
const res = await giftCodeList(data);
if (res.status_code == 1 && res.data.length > 0) {
// this.giftCodeGame = res.data
......
......@@ -19,6 +19,7 @@
>
<el-form-item label="主游戏" prop="main_game_id">
<mainGameSelect
:key="`main-game-${formKey}`"
label=""
:default-value="reportForm.main_game_id"
style="width: 100%"
......@@ -138,6 +139,7 @@
</span>
</div>
<textEditor
:key="`text-editor-${formKey}`"
ref="textEditorRef"
:remark.sync="reportForm.remark"
domid="report_content"
......@@ -344,18 +346,41 @@
cp_role_id_loading: false,
serverNameList: [],
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: {
show(newVal, oldVal) {
if (newVal) {
console.log('显示弹窗')
}
// 重新提交:抽屉再次打开时重新拉取生态运营(组件未销毁、仅 show 切换的场景)
if (newVal === true && oldVal === false && this.reportInfo && this.reportInfo.id) {
// 举报抽屉缓存:组件由父级 :show.sync 常驻挂载,mounted 仅首次执行,
// 故「重置/恢复缓存/快照基线」必须放 show 的 false→true 跳变(不能放 mounted)。
if (newVal === true && oldVal === false) {
// 关闭重入守卫复位:重新打开抽屉时允许下一次正常关闭
this.isClosing = false
if (this.reportInfo && this.reportInfo.id) {
// 编辑/重新提交态:mounted 已回填表单,此处仅重新拉取生态运营
this.$nextTick(() => {
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.refreshEcoUserForResubmit()
this.initialFormSnapshot = JSON.stringify(this.reportForm)
})
}
},
......@@ -417,6 +442,30 @@
},
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) {
......@@ -750,7 +799,31 @@
})
},
close() {
this.$emit('update:show', false)
// 关闭重入守卫: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)
}
},
async submit() {
console.log(this.userInfo, 'reportForm')
......@@ -799,7 +872,11 @@
this.loading = false
if (res.status_code === 1) {
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) {
this.$emit('updateReportList')
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论