提交 7ea438c4 作者: 毛细亚

🐞 fix: 优化复制指令和游戏分身包链接处理

上级 d55a4eec
...@@ -75,11 +75,29 @@ const copy = { ...@@ -75,11 +75,29 @@ const copy = {
unbind: function(el) { unbind: function(el) {
// 清理事件监听器和元素 // 清理事件监听器和元素
if (el.__copyIcon) { if (el.__copyIcon) {
el.__copyIcon.removeEventListener('click', null) try {
el.parentNode.removeChild(el.__copyIcon) // 移除事件监听器
const clickHandler = el.__copyIcon.__clickHandler
if (clickHandler) {
el.__copyIcon.removeEventListener('click', clickHandler)
delete el.__copyIcon.__clickHandler
}
// 安全地移除图标元素
if (el.__copyIcon && el.__copyIcon.parentNode) {
el.__copyIcon.parentNode.removeChild(el.__copyIcon)
} else if (el.__copyIcon && el.__copyIcon.remove) {
// 如果节点还在DOM中,使用 remove() 方法
el.__copyIcon.remove()
}
} catch (error) {
// 忽略移除节点时的错误,可能节点已经被移除了
console.warn('移除复制图标时出错:', error)
} finally {
delete el.__copyIcon delete el.__copyIcon
} }
} }
}
} }
export default copy export default copy
\ No newline at end of file
...@@ -1140,24 +1140,25 @@ export default { ...@@ -1140,24 +1140,25 @@ export default {
}, 500), }, 500),
// 转端发送游戏分身包 h5 安卓游戏 IOS游戏 发送分身包 // 转端发送游戏分身包 h5 安卓游戏 IOS游戏 发送分身包
async sendTransferCloneGame(type) { async sendTransferCloneGame(type) {
console.log(type, 'type')
const res = await memberRegGameCloneLink({ member_id: this.accountSelect }) const res = await memberRegGameCloneLink({ member_id: this.accountSelect })
if (res.status_code == 1) { if (res.status_code == 1) {
// 通过 type 判断 用 switch // 通过 type 判断 用 switch
switch (type) { switch (type) {
case 2: case 2:
if (!res?.data?.data?.h5_download_url) { if (!res?.data?.h5_download_url) {
this.$message.warning('H5安卓分身包链接不存在,请联系掌游配置') this.$message.warning('H5安卓分身包链接不存在,请联系掌游配置')
return return
} }
break break
case 3: case 3:
if (!res?.data?.data?.android_download_url) { if (!res?.data?.android_download_url) {
this.$message.warning('安卓分身包链接不存在,请联系掌游配置') this.$message.warning('安卓分身包链接不存在,请联系掌游配置')
return return
} }
break break
case 4: case 4:
if (!res?.data?.data?.ios_download_url) { if (!res?.data?.ios_download_url) {
this.$message.warning('IOS分身包链接不存在,请联系掌游配置') this.$message.warning('IOS分身包链接不存在,请联系掌游配置')
return return
} }
...@@ -1168,11 +1169,14 @@ export default { ...@@ -1168,11 +1169,14 @@ export default {
} }
let srt = '' let srt = ''
switch (type) { switch (type) {
case 'android': case 2:
srt = '安卓分身包链接: ' + res.data.data.android_download_url srt = 'H5分身包链接: ' + res.data.h5_download_url
break
case 3:
srt = '安卓分身包链接: ' + res.data.android_download_url
break break
case 'ios': case 4:
srt = 'IOS分身包链接: ' + res.data.data.ios_download_url srt = 'IOS分身包链接: ' + res.data.ios_download_url
break break
} }
const list = [ const list = [
......
...@@ -182,10 +182,9 @@ ...@@ -182,10 +182,9 @@
<span class="label">带教记录:</span> <span class="label">带教记录:</span>
<el-button <el-button
type="text" type="text"
class="text cursor-pointer" style="cursor: pointer;z-index:10;"
style="cursor: pointer;" @click.stop="openMentorRecordDrawer(items)"
@click="openMentorRecordDrawer(items)" >{{ items.teach_num || '-' }}次</el-button>
>{{ items.teach_num || '-' }} 次 1231</el-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -210,13 +209,13 @@ ...@@ -210,13 +209,13 @@
/> />
<!-- 带教记录弹窗 --> <!-- 带教记录弹窗 -->
<el-drawer <el-drawer
v-model="showMentorRecord" :show.sync="showMentorRecord"
drawer-title="带教记录" v-if="showMentorRecord"
drawer-size="400px" title="带教记录"
size="400px"
:append-to-body="true" :append-to-body="true"
> >
<mentorRecord <mentorRecord
v-if="showMentorRecord"
:role-id="currentRoleId" :role-id="currentRoleId"
:role-name="currentRoleName" :role-name="currentRoleName"
@refresh="handleMentorRecordRefresh" @refresh="handleMentorRecordRefresh"
...@@ -330,68 +329,6 @@ export default { ...@@ -330,68 +329,6 @@ export default {
}); });
} }
}, },
/**
* 打开带教记录弹窗
*/
openMentorRecordDrawer(roleItem) {
console.log(roleItem,'roleItem')
this.currentRoleId = roleItem.role_id
this.currentRoleName = `${roleItem.role_name}-${roleItem.server_name}`
this.showMentorRecord = true
},
/**
* 带教记录刷新后,更新角色列表中的带教次数
*/
async handleMentorRecordRefresh(roleId,teachingListLength) {
// 重新获取角色列表,更新带教次数
const index = this.roleList.findIndex(item => item.role_id === roleId)
if (index !== -1) {
this.$set(this.roleList[index], 'teach_num', teachingListLength)
}
this.roleList = this.roleList.concat([])
},
/**
* 处理角色展开时获取带教次数
* @param {Array} openedRoleIds - 新展开的角色ID数组
*/
handleChangeRoleTeachingNum(openedRoleIds) {
if (!openedRoleIds || openedRoleIds.length === 0) {
return
}
// 遍历新展开的角色,获取带教次数
openedRoleIds.forEach(roleId => {
const roleItem = this.roleList.find(item => item.role_id === roleId)
if (roleItem) {
// 如果已经存在 teach_num 字段,则不请求接口
if (roleItem.teach_num === undefined || roleItem.teach_num === null) {
this.getRoleTeachingNum(roleId)
}
}
})
},
/**
* 获取角色带教次数
* @param {String|Number} roleId - 角色ID
*/
async getRoleTeachingNum(roleId) {
try {
const res = await roleTeachingNum({
role_id: roleId
})
console.log(res,'res')
if (res.status_code === 1) {
// 更新对应角色的 teach_num 字段
const index = this.roleList.findIndex(item => item.role_id === roleId)
if (index !== -1) {
this.$set(this.roleList[index], 'teach_num', res.data.data?.role_teaching_num || 0)
this.roleList = [...this.roleList]
}
}
} catch (error) {
console.error('获取带教次数失败:', error)
}
},
async handleChange(v) { async handleChange(v) {
const index = this.roleList.findIndex( const index = this.roleList.findIndex(
(item) => v.includes(item.role_id) && !item.server_day (item) => v.includes(item.role_id) && !item.server_day
...@@ -444,6 +381,7 @@ export default { ...@@ -444,6 +381,7 @@ export default {
* 打开带教记录弹窗 * 打开带教记录弹窗
*/ */
openMentorRecordDrawer(roleItem) { openMentorRecordDrawer(roleItem) {
console.log(roleItem, 'roleItem')
this.currentRoleId = roleItem.role_id this.currentRoleId = roleItem.role_id
this.currentRoleName = `${roleItem.role_name}-${roleItem.server_name}` this.currentRoleName = `${roleItem.role_name}-${roleItem.server_name}`
this.showMentorRecord = true this.showMentorRecord = true
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论