提交 e9099ce1 作者: 毛细亚

同步代码

上级 00afd8bc
<template>
<div class="sendGameContent">
<div
v-if="!disabled && bindGameUserList.length > 0"
class="btnRelease"
>
<div class="btntab">
<div
class="btn rowFlex allCenter"
:class="activeName == '1' ? 'btnActive' : ''"
:type="activeName == '1' ? 'primary' : ''"
@click="activeName = '1'"
>
转端
</div>
<div
class="btn rowFlex allCenter"
:class="activeName == '3' ? 'btnActive' : ''"
:type="activeName == '3' ? 'primary' : ''"
@click="recallTabChange"
>
召回
<div class="sendGameContent">
<div v-if="!disabled && bindGameUserList.length > 0" class="btnRelease">
<div class="btntab">
<el-radio-group border v-model="activeName" class="radio-group">
<el-radio-button border label="1" @click.native="activeName = '1'">转端</el-radio-button>
<el-radio-button border label="3" @click.native="recallTabChange">召回</el-radio-button>
<el-radio-button border label="2" @click.native="requestRegGameList">转游</el-radio-button>
</el-radio-group>
</div>
<div v-loading="contentLoading" class="gameList">
<!-- 转端 -->
<el-collapse v-if="activeName == '1' && conversionGameList.length > 0" :disabled="disabled"
@change="conversionChangeOld">
<el-collapse-item v-for="(item, index) in conversionGameList" :key="index" :title="item.game_text"
:name="item.game_type">
<div v-if="item.children && item.children.length > 0">
<div v-for="(items, indexs) in item.children" :key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween">
<p>{{ items.game_name + '/' + items.game_id }}</p>
<el-popover placement="top" width="160" trigger="hover">
<div>
<p class="sendLink" @click="sendLink(items, item.game_type)">
仅发送链接
</p>
<p class="sendLink" @click="sendPassword(items, item.game_type)">
仅发送账号密码
</p>
<p class="sendLink" @click="sendMessage(items, item.game_type)">
发送链接和账号密码
</p>
<p class="sendLink" @click="sendDownLoadPage(items, item.game_type, index)">
发送落地页
</p>
</div>
<el-button slot="reference" size="mini" :disabled="accountSelect == ''">发送</el-button>
</el-popover>
</div>
</div>
<div
class="btn rowFlex allCenter"
:class="activeName == '2' ? 'btnActive' : ''"
:type="activeName == '2' ? 'primary' : ''"
@click="requestRegGameList"
>
转游
<div v-else-if="gameLoding" class="channelLoading rowFlex allCenter">
<i class="el-icon-loading"></i>
<el-button type="text">加载中</el-button>
</div>
</div>
<div
v-loading="contentLoading"
class="gameList"
>
<!-- 转端 -->
<el-collapse
v-if="activeName == '1' && conversionGameList.length > 0"
:disabled="disabled"
@change="conversionChangeOld"
>
<el-collapse-item
v-for="(item,index) in conversionGameList"
:key="index"
:title="item.game_text"
:name="item.game_type"
>
<div v-if="item.children && item.children.length > 0">
<div
v-for="(items, indexs) in item.children"
:key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween"
>
<p>{{ items.game_name +'/'+items.game_id }}</p>
<el-popover
placement="top"
width="160"
trigger="hover"
>
<div>
<p
class="sendLink"
@click="sendLink(items,item.game_type)"
>
仅发送链接
</p>
<p
class="sendLink"
@click="sendPassword(items,item.game_type)"
>
仅发送账号密码
</p>
<p
class="sendLink"
@click="sendMessage(items,item.game_type)"
>
发送链接和账号密码
</p>
<p
class="sendLink"
@click="sendDownLoadPage(items,item.game_type,index)"
>
发送落地页
</p>
</div>
<el-button
slot="reference"
size="mini"
:disabled="accountSelect == ''"
>发送</el-button>
</el-popover>
</div>
</div>
<div
v-else-if="gameLoding"
class="channelLoading rowFlex allCenter"
>
<i class="el-icon-loading"></i>
<el-button type="text">加载中</el-button>
<div v-else class="rowFlex allCenter">暂无游戏</div>
</el-collapse-item>
</el-collapse>
<!-- 召回 -->
<div v-else-if="activeName == '3' && recallGameList.length > 0" class="collapseContent">
<!-- v-if="chatUser.task_type && chatUser.task_type == 7"-->
<el-button v-if='false' type="primary" style="margin-left:50px;" :loading="sendLoading"
@click="sendTaskChannel">根据任务一键发送链接</el-button>
<el-collapse :disabled="disabled" @change="recallChange">
<el-collapse-item v-for="(item, index) in recallGameList" :key="index" :title="item.game_text"
:name="item.game_type">
<div v-if="item.children && item.children.length > 0">
<div v-for="(items, indexs) in item.children" :key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween">
<p>{{ items.game_name + '/' + items.game_id }}</p>
<el-button slot="reference" size="mini" :disabled="accountSelect == ''"
@click="sendChannel(items)">发送</el-button>
</div>
<div
v-else
class="rowFlex allCenter"
>暂无游戏</div>
</el-collapse-item>
</el-collapse>
<!-- 召回 -->
<div
v-else-if="activeName == '3' && recallGameList.length > 0"
class="collapseContent"
>
<!-- v-if="chatUser.task_type && chatUser.task_type == 7"-->
<el-button
v-if='false'
type="primary"
style="margin-left:50px;"
:loading="sendLoading"
@click="sendTaskChannel"
>根据任务一键发送链接</el-button>
<el-collapse
:disabled="disabled"
@change="recallChange"
>
<el-collapse-item
v-for="(item,index) in recallGameList"
:key="index"
:title="item.game_text"
:name="item.game_type"
>
<div v-if="item.children && item.children.length > 0">
<div
v-for="(items, indexs) in item.children"
:key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween"
>
<p>{{ items.game_name +'/'+items.game_id }}</p>
<el-button
slot="reference"
size="mini"
:disabled="accountSelect == ''"
@click="sendChannel(items)"
>发送</el-button>
</div>
</div>
<div
v-else-if="gameLoding"
class="channelLoading rowFlex allCenter"
>
<i class="el-icon-loading"></i>
<el-button type="text">加载中</el-button>
</div>
<div
v-else
class="rowFlex allCenter"
>暂无游戏</div>
</el-collapse-item>
<!-- 新建渠道链接 -->
</el-collapse>
<div class="createChannel rowFlex allCenter">
<span class="label">找不到对应游戏的链接点此</span>
<el-button
type="text"
size="medium"
@click="showCreateChannel=true"
>新建渠道链接</el-button>
</div>
</div>
<!--
<div v-else-if="gameLoding" class="channelLoading rowFlex allCenter">
<i class="el-icon-loading"></i>
<el-button type="text">加载中</el-button>
</div>
<div v-else class="rowFlex allCenter">暂无游戏</div>
</el-collapse-item>
<!-- 新建渠道链接 -->
</el-collapse>
<div class="createChannel rowFlex allCenter">
<span class="label">找不到对应游戏的链接点此</span>
<el-button type="text" size="medium" @click="showCreateChannel = true">新建渠道链接</el-button>
</div>
</div>
<!--
转游
1.转游 h5 游戏走之前的逻辑发送链接和账号密码
2.小游戏 发送的时候 先判断有没有模版的配置消息 如果没有 走之前的逻辑 如果有 获取掌游的背景图和二位那 合成新的图片 发送合成的图片
3.安卓或者 IOS 点击发送的时候 先判断是否有配置落地页 如果没有 走之前的发送逻辑 如果有 加入到发送的暂存列表中 加入时 需要判断和列表中已有的游戏是否时同一个项目和主游戏下 如果不是 提示错误 如果是 加入到暂存列表中 获取当前游戏下的渠道 选择渠道信息 发送给掌游后端 安卓或者 IOS 游戏 只能选择一个单选
-->
<div v-else-if="activeName == '2'">
<el-collapse
:disabled="disabled"
>
<el-input
v-model="filterGameText"
placeholder="请输入游戏名 按回车搜索"
style="margin-top: 10px"
@keydown.enter.native="changeGameText"
@blur="changeGameText"
>
<i
slot="prefix"
class="el-input__icon el-icon-search"
></i>
</el-input>
<el-collapse-item
v-for="(item, index) in regGameList"
:key="index"
:title="item.label"
>
<div v-if="regGameList.length > 0">
<div
v-for="(items, indexs) in item.children"
:key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween"
>
<p>{{ items.label + "/" + items.id }}</p>
<!--game_type: 1 微信小游戏 2 H5 游戏 3 安卓游戏 4 IOS 游戏 5 抖音小游戏 -->
<!-- 微信小游戏 安卓游戏 IOS游戏 处理逻辑 -->
<el-popover
v-if="items.game_type == 1 || items.game_type == 3 || items.game_type == 4 "
placement="top"
trigger="click"
>
<p
class="sendLink"
@click="sendChannelGame(items,item)"
>
发送链接/渠道二维码
</p>
<p
class="sendLink"
@click="handleGameType(items,item,item.game_type,index)"
>
发送落地页
</p>
<el-button
slot="reference"
size="mini"
:disabled="accountSelect == ''"
>发送</el-button>
</el-popover>
<el-button
v-else
size="mini"
:disabled="accountSelect == ''"
@click="noH5AndroidIOSGame(items,item)"
>发送</el-button>
</div>
</div>
<!-- <div
<div v-else-if="activeName == '2'">
<el-collapse :disabled="disabled">
<el-input v-model="filterGameText" placeholder="请输入游戏名 按回车搜索" style="margin-top: 10px"
@keydown.enter.native="changeGameText" @blur="changeGameText">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<el-collapse-item v-for="(item, index) in regGameList" :key="index" :title="item.label">
<div v-if="regGameList.length > 0">
<div v-for="(items, indexs) in item.children" :key="indexs"
class="gameListItem rowFlex columnCenter spaceBetween">
<p>{{ items.label + "/" + items.id }}</p>
<!--game_type: 1 微信小游戏 2 H5 游戏 3 安卓游戏 4 IOS 游戏 5 抖音小游戏 -->
<!-- 微信小游戏 安卓游戏 IOS游戏 处理逻辑 -->
<el-popover v-if="items.game_type == 1 || items.game_type == 3 || items.game_type == 4"
placement="top" trigger="click">
<p class="sendLink" @click="sendChannelGame(items, item)">
发送链接/渠道二维码
</p>
<p class="sendLink" @click="handleGameType(items, item, item.game_type, index)">
发送落地页
</p>
<el-button slot="reference" size="mini" :disabled="accountSelect == ''">发送</el-button>
</el-popover>
<el-button v-else size="mini" :disabled="accountSelect == ''"
@click="noH5AndroidIOSGame(items, item)">发送</el-button>
</div>
</div>
<!-- <div
class="channelLoading rowFlex allCenter"
v-else-if="gameLoding && false"
>
<i class="el-icon-loading"></i>
<el-button type="text">加载中</el-button>
</div> -->
<div
v-else
class="rowFlex allCenter"
>暂无游戏</div>
</el-collapse-item>
</el-collapse>
<div class="createChannel rowFlex allCenter">
<span class="label">找不到对应游戏的链接点此</span>
<el-button
type="text"
size="medium"
@click="showCreateChannel=true"
>新建渠道链接</el-button>
</div>
</div>
<div v-else class="rowFlex allCenter">暂无游戏</div>
</el-collapse-item>
</el-collapse>
<div class="createChannel rowFlex allCenter">
<span class="label">找不到对应游戏的链接点此</span>
<el-button type="text" size="medium" @click="showCreateChannel = true">新建渠道链接</el-button>
</div>
</div>
<div v-else>
<p>暂未绑定关联账号,请先去绑定账号</p>
</div>
<!-- 新建渠道链接 -->
<createChannel
v-if="showCreateChannel"
:type="activeName"
:show="showCreateChannel"
:game-user-info="gameUserInfo"
@close="showCreateChannel = false"
/>
<sendPage v-if="showSendPage" :show.sync="showSendPage" :game-list="conversionGameList" @confirm="startSendPage" />
<!-- 小游戏转游判断 -->
<SendTransWxGame
v-if="showWxGameDrawer"
:show.sync="showWxGameDrawer"
:game-list="selectedWxGameList"
:chat-user-info="chatUserInfo"
@close="SendTransWxGameClose"
@confirm="handleWxGameConfirm"
/>
<SendTransAppGame
v-if="showAppGameDrawer"
:show.sync="showAppGameDrawer"
:game-list="selectedAppGameList"
:chat-user-info="chatUserInfo"
@close="SendTransAppGameClose"
@confirm="handleAppGameConfirm"
/>
<!-- 选择发送渠道 -->
<selectChannel
v-if="showLayer"
:show.sync="showLayer"
:chat-user="chatUserInfo"
:channel-info-list="channelInfoList"
/>
<!-- 如果选择发送的渠道链接只有一个 直接发送 -->
<sendSelectChannel
:show.sync="showSendChannel"
:chat-user="chatUserInfo"
:channel-info-list="channelInfoList"
/>
</div>
</div>
</template>
<script>
import { mapState, mapMutations,mapActions } from 'vuex'
import {
memberExtensionGameList,
passwardEncryption,
channelList,
selectSearch,
getTransferRecallGameList,
getGameConfig,
quickRecallChannelLink,
recallChannelSeq,
getLandingPageMemberLink,
getLandingPageConfig,
getMemberTransStatus
} from '@/api/game'
import { getRecentSendLog, markTransScene,getZqCserGroup,getZqCserWxBelong,getMediaId,send_log_add } from '@/api/works'
import { companyviewConfig } from '@/api/user'
import { throttle, throttleStart, sendChatMessage } from '@/utils/index'
import createChannel from './sendGame/createChannel'
import sendPage from './sendGame/SendTransPage.vue'
import SendTransWxGame from './sendGame/SendTransWxGame.vue'
import SendTransAppGame from './sendGame/SendTransAppGame.vue'
import selectChannel from './sendGame/selectChannel.vue'
import sendSelectChannel from './sendGame/sendSelectChannel.vue'
import gameLogMixin from '@/mixins/gameLogMixin'
export default {
mixins: [gameLogMixin],
components: {
createChannel,
sendPage,
SendTransWxGame,
SendTransAppGame,
selectChannel,
sendSelectChannel
},
data() {
return {
disabled: true,
showLayer: false,
showSendPage: false,
contentLoading: false,
gameLoding: false,
isReqeustData: false,
recallGameList: [], // 召回游戏列表
conversionGameList: [], // 转端游戏列表
weixin_blongs_id: [],
regGameList: [],
allRegGameList: [],
filterGameText: '',
channelselectList: [],
webForm: {
channel_id: ''
},
sendLoading: false,
belongList: [], // 项目列表
activeName: '1', // 转端 1 转游 2 召回 3
sendType: '', // 1 进发送链接 2 仅发送账号密码 3 发送链接和账号密码
showCreateChannel: false,
showImageComposer: false,
showWxGameDrawer: false,
showAppGameDrawer: false,
selectedWxGameList: [], // 微信小程序的选择的游戏
selectedAppGameList: [], // 安卓或者 Ios 选择的游戏
sendGameInfoSave: {},
imageInfo: {},
showLayer: false,
showSendChannel: false,
channelInfoList:{},
transMemberStatus: true
}
},
mounted() {
this.initDisable()
this.sendGameInfo()
},
computed: {
...mapState('game', ['accountSelect', 'bindGameUserList','chatUserInfo','gameUserInfo','send_game_log']),
...mapState('user', ['userInfo','corp_id'])
},
// props: [ 'chatUserInfo', 'chatUser'],
watch: {
accountSelect(newVal, oldVal) {
// 切换 w 账号的时候清空 conversionGameList 数据
this.conversionGameList = []
this.getMemberTransStatus()
if (newVal && newVal !== '' && this.bindGameUserList.length > 0) {
this.disabled = false
} else {
this.disabled = true
}
<div v-else>
<p>暂未绑定关联账号,请先去绑定账号</p>
</div>
<!-- 新建渠道链接 -->
<createChannel v-if="showCreateChannel" :type="activeName" :show="showCreateChannel" :game-user-info="gameUserInfo"
@close="showCreateChannel = false" />
<sendPage v-if="showSendPage" :show.sync="showSendPage" :game-list="conversionGameList" @confirm="startSendPage" />
<!-- 小游戏转游判断 -->
<SendTransWxGame v-if="showWxGameDrawer" :show.sync="showWxGameDrawer" :game-list="selectedWxGameList"
:chat-user-info="chatUserInfo" @close="SendTransWxGameClose" @confirm="handleWxGameConfirm" />
<SendTransAppGame v-if="showAppGameDrawer" :show.sync="showAppGameDrawer" :game-list="selectedAppGameList"
:chat-user-info="chatUserInfo" @close="SendTransAppGameClose" @confirm="handleAppGameConfirm" />
<!-- 选择发送渠道 -->
<selectChannel v-if="showLayer" :show.sync="showLayer" :chat-user="chatUserInfo"
:channel-info-list="channelInfoList" />
<!-- 如果选择发送的渠道链接只有一个 直接发送 -->
<sendSelectChannel :show.sync="showSendChannel" :chat-user="chatUserInfo" :channel-info-list="channelInfoList" />
</div>
</template>
<script>
import { mapState, mapMutations, mapActions } from 'vuex'
import {
memberExtensionGameList,
passwardEncryption,
channelList,
selectSearch,
getTransferRecallGameList,
getGameConfig,
quickRecallChannelLink,
recallChannelSeq,
getLandingPageMemberLink,
getLandingPageConfig,
getMemberTransStatus
} from '@/api/game'
import { getRecentSendLog, markTransScene, getZqCserGroup, getZqCserWxBelong, getMediaId, send_log_add } from '@/api/works'
import { companyviewConfig } from '@/api/user'
import { throttle, throttleStart, sendChatMessage } from '@/utils/index'
import createChannel from './sendGame/createChannel'
import sendPage from './sendGame/SendTransPage.vue'
import SendTransWxGame from './sendGame/SendTransWxGame.vue'
import SendTransAppGame from './sendGame/SendTransAppGame.vue'
import selectChannel from './sendGame/selectChannel.vue'
import sendSelectChannel from './sendGame/sendSelectChannel.vue'
import gameLogMixin from '@/mixins/gameLogMixin'
export default {
mixins: [gameLogMixin],
components: {
createChannel,
sendPage,
SendTransWxGame,
SendTransAppGame,
selectChannel,
sendSelectChannel
},
data() {
return {
disabled: true,
showLayer: false,
showSendPage: false,
contentLoading: false,
gameLoding: false,
isReqeustData: false,
recallGameList: [], // 召回游戏列表
conversionGameList: [], // 转端游戏列表
weixin_blongs_id: [],
regGameList: [],
allRegGameList: [],
filterGameText: '',
channelselectList: [],
webForm: {
channel_id: ''
},
activeName(newVal, oldVal) {
if (newVal) {
}
sendLoading: false,
belongList: [], // 项目列表
activeName: '1', // 转端 1 转游 2 召回 3
sendType: '', // 1 进发送链接 2 仅发送账号密码 3 发送链接和账号密码
showCreateChannel: false,
showImageComposer: false,
showWxGameDrawer: false,
showAppGameDrawer: false,
selectedWxGameList: [], // 微信小程序的选择的游戏
selectedAppGameList: [], // 安卓或者 Ios 选择的游戏
sendGameInfoSave: {},
imageInfo: {},
showLayer: false,
showSendChannel: false,
channelInfoList: {},
transMemberStatus: true
}
},
mounted() {
this.initDisable()
this.sendGameInfo()
},
computed: {
...mapState('game', ['accountSelect', 'bindGameUserList', 'chatUserInfo', 'gameUserInfo', 'send_game_log']),
...mapState('user', ['userInfo', 'corp_id'])
},
// props: [ 'chatUserInfo', 'chatUser'],
watch: {
accountSelect(newVal, oldVal) {
// 切换 w 账号的时候清空 conversionGameList 数据
this.conversionGameList = []
this.getMemberTransStatus()
if (newVal && newVal !== '' && this.bindGameUserList.length > 0) {
this.disabled = false
} else {
this.disabled = true
}
},
methods: {
...mapMutations('game', ['set_send_game_log']),
initDisable(){
// 切换 w 账号的时候清空 conversionGameList 数据
this.conversionGameList = []
this.getMemberTransStatus()
if (this.accountSelect && this.accountSelect !== '' && this.bindGameUserList.length > 0) {
activeName(newVal, oldVal) {
if (newVal) {
}
}
},
methods: {
...mapMutations('game', ['set_send_game_log']),
initDisable() {
// 切换 w 账号的时候清空 conversionGameList 数据
this.conversionGameList = []
this.getMemberTransStatus()
if (this.accountSelect && this.accountSelect !== '' && this.bindGameUserList.length > 0) {
this.disabled = false
} else {
} else {
this.disabled = true
}
}
},
channelInfo(info) {
this.channelInfoList = info
......@@ -422,899 +263,996 @@
this.showLayer = true
}
},
requestConfig() {
return new Promise((resolve, reject) => {
companyviewConfig({corp_id:this.corp_id}).then((res) => {
this.weixin_blongs_id = res.data.weixin_blongs_id
resolve()
})
requestConfig() {
return new Promise((resolve, reject) => {
companyviewConfig({ corp_id: this.corp_id }).then((res) => {
this.weixin_blongs_id = res.data.weixin_blongs_id
resolve()
})
},
// 请求当前 W 账号是否符合转端条件 如果不符合 提示 当前w账号不满足转端要求,请联系组长处理
async getMemberTransStatus() {
if (this.accountSelect && this.accountSelect !== '') {
const res = await getMemberTransStatus({ member_id: this.accountSelect })
if (res.status_code == 1) {
this.transMemberStatus = res.data.data.allow_trans || false
}
} else {
this.transMemberStatus = false
}
},
recallTabChange() {
this.activeName = '3'
this.sendGameRecallList()
},
async requestGameSendLog() {
this.filterGameText = ''
const res = await getRecentSendLog()
})
},
// 请求当前 W 账号是否符合转端条件 如果不符合 提示 当前w账号不满足转端要求,请联系组长处理
async getMemberTransStatus() {
if (this.accountSelect && this.accountSelect !== '') {
const res = await getMemberTransStatus({ member_id: this.accountSelect })
if (res.status_code == 1) {
if (res.status_code == 1 && res.data.length > 0) {
res.data.map((item) => {
item.label = item.game_name
item.id = item.game_id
})
}
this.regGameList.unshift({
label: '最近发送',
children: res.data
})
this.transMemberStatus = res.data.data.allow_trans || false
}
},
async sendGameInfo() {
this.activeName = '1'
this.conversionGameList = []
this.recallGameList = []
this.getMemberTransStatus()
await this.requestConfig()
this.sendGameList()
},
requestRegGameList() {
this.activeName = '2'
if (this.gameUserInfo.main_game_id || this.gameUserInfo.main_game_id == 0) {
this.contentLoading = true
const data = {
type: 'gameListWithType',
value: '',
use_type: 2,
game_id: this.gameUserInfo.main_game_id,
use_user_id: this.userInfo.id,
weixin_blongs_id: this.weixin_blongs_id
}
selectSearch(data).then((res) => {
this.contentLoading = false
if (res.status_code == 1) {
// 暂时隐藏快手小游戏
const ksGameIndex = res.data.data.findIndex(item => item.label === '快手小游戏')
if (ksGameIndex !== -1) {
res.data.data.splice(ksGameIndex, 1)
}
this.regGameList = res.data.data
this.allRegGameList = this.regGameList
}
this.requestGameSendLog()
setTimeout(() => {
this.contentLoading = false
}, 2000)
})
} else {
}
},
onConfirm() { },
// 召回发送渠道
sendChannel(items, type) {
items.type = 3
type ? this.sendType = type : ''
this.channelList(items)
},
// 转游发送渠道
sendChannelGame(items, item, type) {
console.log(items, 'items', item)
type ? this.sendType = type : ''
const gameInfo = this.$clone(items)
gameInfo.type = 2
this.channelList(gameInfo)
},
changeGameText() {
console.log(this.filterGameText)
if (this.filterGameText.trim() === '') {
this.regGameList = this.allRegGameList
} else {
const list = JSON.parse(JSON.stringify(this.allRegGameList))
list.map((item, index) => {
item.children = item.children.filter(
(items) => items.label.indexOf(this.filterGameText) !== -1
)
} else {
this.transMemberStatus = false
}
},
recallTabChange() {
this.activeName = '3'
this.sendGameRecallList()
},
async requestGameSendLog() {
this.filterGameText = ''
const res = await getRecentSendLog()
if (res.status_code == 1) {
if (res.status_code == 1 && res.data.length > 0) {
res.data.map((item) => {
item.label = item.game_name
item.id = item.game_id
})
this.regGameList = list
}
},
// 获取渠道列表
channelList(items) {
console.log(items, 'items')
this.regGameList.unshift({
label: '最近发送',
children: res.data
})
}
},
async sendGameInfo() {
this.activeName = '1'
this.conversionGameList = []
this.recallGameList = []
this.getMemberTransStatus()
await this.requestConfig()
this.sendGameList()
},
requestRegGameList() {
this.activeName = '2'
if (this.gameUserInfo.main_game_id || this.gameUserInfo.main_game_id == 0) {
this.contentLoading = true
const data = {
game_id: items.game_id || items.id,
page_size: 200,
page: 1,
zq_user_id: this.userInfo.id,
weixin_blongs_id: items.weixin_blongs_id ? [items.weixin_blongs_id] : this.weixin_blongs_id,
request_system: 'company_wx',
member_id: this.accountSelect,
use_type: this.activeName
type: 'gameListWithType',
value: '',
use_type: 2,
game_id: this.gameUserInfo.main_game_id,
use_user_id: this.userInfo.id,
weixin_blongs_id: this.weixin_blongs_id
}
channelList(data).then((res) => {
if (res?.data?.data?.data?.length > 0) {
// 只有一个的时候自动发送渠道链接
this.$emit('channelInfo', {
game_id: items.game_id,
use_type: this.activeName,
sendType: this.sendType,
channelList: res.data.data.data
})
this.sendGameLog(items)
} else {
this.$message.warning('请到掌游创建运营渠道')
}
})
},
showSendGameLayer() {
this.showLayer = true
},
async sendGameList() {
if (this.conversionGameList.length == 0) {
this.contentLoading = true
// 获取召回转端的游戏列表 user_type: 1 转端 3 召回
const res = await getGameConfig({ use_type: 1 })
selectSearch(data).then((res) => {
this.contentLoading = false
if (res.status_code === 1 && res.data.data.length > 0) {
const ksGameIndex = res.data.data.findIndex(item => item.game_type == 6)
if (ksGameIndex != -1) {
if (res.status_code == 1) {
// 暂时隐藏快手小游戏
const ksGameIndex = res.data.data.findIndex(item => item.label === '快手小游戏')
if (ksGameIndex !== -1) {
res.data.data.splice(ksGameIndex, 1)
this.conversionGameList = res.data.data
} else {
this.conversionGameList = res.data.data
}
this.regGameList = res.data.data
this.allRegGameList = this.regGameList
}
this.requestGameSendLog()
setTimeout(() => {
this.contentLoading = false
}, 2000)
}
},
async conversionChangeOld(value) {
console.log('请求数据', this.conversionGameList)
if (this.isReqeustData) {
return
}
try {
this.isReqeustData = true
this.gameLoding = true
// 使用 Promise.all 并发请求游戏列表数据
const promiseList = this.conversionGameList.map(async (item, index) => {
// 如果已有子项数据则跳过
if (this.conversionGameList[index].children?.length > 0) {
return
}
try {
const params = {
member_id: this.accountSelect,
type: item.game_type
}
const reslist = await memberExtensionGameList(params)
if (reslist.status_code === 1) {
// 使用解构赋值简化数据设置
const updates = {
children: reslist.data?.length > 0 ? reslist.data : [],
send_trans_page_id: '', // 转端要发送的游戏 ID
isReqeustData: true
}
Object.entries(updates).forEach(([key, value]) => {
this.$set(this.conversionGameList[index], key, value)
})
}
} catch (error) {
console.error(`Failed to fetch game list for index ${index}:`, error)
// 设置空数组作为默认值
this.$set(this.conversionGameList[index], 'children', [])
}
})
await Promise.all(promiseList)
this.handleConversionGameList()
} catch (error) {
console.error('Failed to fetch conversion game lists:', error)
} finally {
this.gameLoding = false
this.isReqeustData = false
}
},
// 处理转端数据 之前王鑫和冯渊说要隐藏破日开天游戏 至于什么时候放开 没说
handleConversionGameList() {
if (this.conversionGameList.length > 0) {
this.conversionGameList.forEach((item, index) => {
// 隐藏安卓游戏 安卓游戏 game_type: 3
if (item.game_type === 3 && item.children && item.children.length > 0) {
// 过滤掉 game_name 为"破日开天"的数据
const filteredChildren = item.children.filter(child => {
return child.game_name !== '破日开天' && child.game_name !== '英雄霸业'
})
this.$set(this.conversionGameList[index], 'children', filteredChildren)
}
// 隐藏 IOS 游戏 雄霸天下 有两个包 1 个是 691 一个是 819 王鑫说 暂时先隐藏 691 的功能
if (item.game_type === 4 && item.children && item.children.length > 0) {
const filteredChildren = item.children.filter(child => {
return Number(child.game_id) !== 691
})
this.$set(this.conversionGameList[index], 'children', filteredChildren)
}
})
} else {
}
},
onConfirm() { },
// 召回发送渠道
sendChannel(items, type) {
items.type = 3
type ? this.sendType = type : ''
this.channelList(items)
},
// 转游发送渠道
sendChannelGame(items, item, type) {
console.log(items, 'items', item)
type ? this.sendType = type : ''
const gameInfo = this.$clone(items)
gameInfo.type = 2
this.channelList(gameInfo)
},
changeGameText() {
console.log(this.filterGameText)
if (this.filterGameText.trim() === '') {
this.regGameList = this.allRegGameList
} else {
const list = JSON.parse(JSON.stringify(this.allRegGameList))
list.map((item, index) => {
item.children = item.children.filter(
(items) => items.label.indexOf(this.filterGameText) !== -1
)
})
this.regGameList = list
}
},
// 获取渠道列表
channelList(items) {
console.log(items, 'items')
const data = {
game_id: items.game_id || items.id,
page_size: 200,
page: 1,
zq_user_id: this.userInfo.id,
weixin_blongs_id: items.weixin_blongs_id ? [items.weixin_blongs_id] : this.weixin_blongs_id,
request_system: 'company_wx',
member_id: this.accountSelect,
use_type: this.activeName
}
channelList(data).then((res) => {
if (res?.data?.data?.data?.length > 0) {
// 只有一个的时候自动发送渠道链接
this.$emit('channelInfo', {
game_id: items.game_id,
use_type: this.activeName,
sendType: this.sendType,
channelList: res.data.data.data
})
console.log(this.conversionGameList, 'conversionGameList')
this.sendGameLog(items)
} else {
this.$message.warning('请到掌游创建运营渠道')
}
},
// 转端展开
async conversionChange(value) {
if (value && value.length > 0) {
const gameType = value[value.length - 1]
const gameIndex = this.conversionGameList.findIndex(item => item.game_type === gameType)
if (!this.conversionGameList[gameIndex].children || this.conversionGameList[gameIndex].children.length == 0) {
this.gameLoding = true
const params = {
page_size: 200,
page: 1,
zq_user_id: this.userInfo.id,
weixin_blongs_id: this.weixin_blongs_id,
use_type: 1,
member_id: this.accountSelect,
type: this.conversionGameList[gameIndex].game_type
}
const reslist = await getTransferRecallGameList(params)
this.gameLoding = false
if (reslist.status_code === 1 && reslist.data.data.length > 0) {
this.$set(this.conversionGameList[gameIndex], 'children', reslist.data.data)
} else {
this.$set(this.conversionGameList[gameIndex], 'children', [])
}
setTimeout(() => {
this.gameLoding = false
}, 2000)
})
},
showSendGameLayer() {
this.showLayer = true
},
async sendGameList() {
if (this.conversionGameList.length == 0) {
this.contentLoading = true
// 获取召回转端的游戏列表 user_type: 1 转端 3 召回
const res = await getGameConfig({ use_type: 1 })
this.contentLoading = false
if (res.status_code === 1 && res.data.data.length > 0) {
const ksGameIndex = res.data.data.findIndex(item => item.game_type == 6)
if (ksGameIndex != -1) {
res.data.data.splice(ksGameIndex, 1)
this.conversionGameList = res.data.data
} else {
this.conversionGameList = res.data.data
}
}
},
// 召回的游戏列表
async sendGameRecallList() {
if (this.recallGameList.length == 0) {
this.contentLoading = true
const res = await getGameConfig({ use_type: 3 })
setTimeout(() => {
this.contentLoading = false
if (res.status_code === 1 && res.data.data.length > 0) {
const ksGameIndex = res.data.data.findIndex(item => item.game_type == 6)
if (ksGameIndex !== -1) {
res.data.data.splice(ksGameIndex, 1)
this.recallGameList = res.data.data
} else {
this.recallGameList = res.data.data
}
}, 2000)
}
},
async conversionChangeOld(value) {
console.log('请求数据', this.conversionGameList)
if (this.isReqeustData) {
return
}
try {
this.isReqeustData = true
this.gameLoding = true
// 使用 Promise.all 并发请求游戏列表数据
const promiseList = this.conversionGameList.map(async (item, index) => {
// 如果已有子项数据则跳过
if (this.conversionGameList[index].children?.length > 0) {
return
}
setTimeout(() => {
this.contentLoading = false
}, 2000)
}
},
// 召回展开
async recallChange(value) {
if (value && value.length > 0) {
const gameType = value[value.length - 1]
const gameIndex = this.recallGameList.findIndex(item => item.game_type === gameType)
if (!this.recallGameList[gameIndex].children || this.recallGameList[gameIndex].children.length == 0) {
this.gameLoding = true
try {
const params = {
// type: 2,
page_size: 200,
page: 1,
zq_user_id: this.userInfo.id,
weixin_blongs_id: this.weixin_blongs_id,
use_type: 3,
member_id: this.accountSelect,
type: this.recallGameList[gameIndex].game_type
type: item.game_type
}
const reslist = await getTransferRecallGameList(params)
this.gameLoding = false
if (reslist.status_code === 1 && reslist.data.data.length > 0) {
this.$set(this.recallGameList[gameIndex], 'children', reslist.data.data)
} else {
this.$set(this.recallGameList[gameIndex], 'children', [])
const reslist = await memberExtensionGameList(params)
if (reslist.status_code === 1) {
// 使用解构赋值简化数据设置
const updates = {
children: reslist.data?.length > 0 ? reslist.data : [],
send_trans_page_id: '', // 转端要发送的游戏 ID
isReqeustData: true
}
Object.entries(updates).forEach(([key, value]) => {
this.$set(this.conversionGameList[index], key, value)
})
}
setTimeout(() => {
this.gameLoding = false
}, 2000)
} else {
console.log('之前请求过了')
} catch (error) {
console.error(`Failed to fetch game list for index ${index}:`, error)
// 设置空数组作为默认值
this.$set(this.conversionGameList[index], 'children', [])
}
}
},
showPopover() {
this.showCreateChannel = false
})
await Promise.all(promiseList)
this.handleConversionGameList()
} catch (error) {
console.error('Failed to fetch conversion game lists:', error)
} finally {
this.gameLoding = false
this.isReqeustData = false
},
handlePopover() {
this.showCreateChannel = false
},
handleAccount() {
if (this.bindGameUserList.length > 0) {
const account = this.bindGameUserList.find(
(item) => item.member_id == this.accountSelect
)
if (account) {
return true
}
},
// 处理转端数据 之前王鑫和冯渊说要隐藏破日开天游戏 至于什么时候放开 没说
handleConversionGameList() {
if (this.conversionGameList.length > 0) {
this.conversionGameList.forEach((item, index) => {
// 隐藏安卓游戏 安卓游戏 game_type: 3
if (item.game_type === 3 && item.children && item.children.length > 0) {
// 过滤掉 game_name 为"破日开天"的数据
const filteredChildren = item.children.filter(child => {
return child.game_name !== '破日开天' && child.game_name !== '英雄霸业'
})
this.$set(this.conversionGameList[index], 'children', filteredChildren)
}
// 隐藏 IOS 游戏 雄霸天下 有两个包 1 个是 691 一个是 819 王鑫说 暂时先隐藏 691 的功能
if (item.game_type === 4 && item.children && item.children.length > 0) {
const filteredChildren = item.children.filter(child => {
return Number(child.game_id) !== 691
})
this.$set(this.conversionGameList[index], 'children', filteredChildren)
}
})
console.log(this.conversionGameList, 'conversionGameList')
}
},
// 转端展开
async conversionChange(value) {
if (value && value.length > 0) {
const gameType = value[value.length - 1]
const gameIndex = this.conversionGameList.findIndex(item => item.game_type === gameType)
if (!this.conversionGameList[gameIndex].children || this.conversionGameList[gameIndex].children.length == 0) {
this.gameLoding = true
const params = {
page_size: 200,
page: 1,
zq_user_id: this.userInfo.id,
weixin_blongs_id: this.weixin_blongs_id,
use_type: 1,
member_id: this.accountSelect,
type: this.conversionGameList[gameIndex].game_type
}
const reslist = await getTransferRecallGameList(params)
this.gameLoding = false
if (reslist.status_code === 1 && reslist.data.data.length > 0) {
this.$set(this.conversionGameList[gameIndex], 'children', reslist.data.data)
} else {
return false
this.$set(this.conversionGameList[gameIndex], 'children', [])
}
setTimeout(() => {
this.gameLoding = false
}, 2000)
} else {
return false
}
},
sendLink: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
console.log(item, '转端发送仅发送链接')
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
}
},
// 召回的游戏列表
async sendGameRecallList() {
if (this.recallGameList.length == 0) {
this.contentLoading = true
const res = await getGameConfig({ use_type: 3 })
this.contentLoading = false
if (res.status_code === 1 && res.data.data.length > 0) {
const ksGameIndex = res.data.data.findIndex(item => item.game_type == 6)
if (ksGameIndex !== -1) {
res.data.data.splice(ksGameIndex, 1)
this.recallGameList = res.data.data
} else {
this.recallGameList = res.data.data
}
}
let str = ''
if (type == 2) {
str = '网页游戏链接:'
} else if (type == 3) {
str = '安卓游戏链接:'
} else if (type == 4) {
str = 'IOS游戏链接:'
setTimeout(() => {
this.contentLoading = false
}, 2000)
}
},
// 召回展开
async recallChange(value) {
if (value && value.length > 0) {
const gameType = value[value.length - 1]
const gameIndex = this.recallGameList.findIndex(item => item.game_type === gameType)
if (!this.recallGameList[gameIndex].children || this.recallGameList[gameIndex].children.length == 0) {
this.gameLoding = true
const params = {
// type: 2,
page_size: 200,
page: 1,
zq_user_id: this.userInfo.id,
weixin_blongs_id: this.weixin_blongs_id,
use_type: 3,
member_id: this.accountSelect,
type: this.recallGameList[gameIndex].game_type
}
const reslist = await getTransferRecallGameList(params)
this.gameLoding = false
if (reslist.status_code === 1 && reslist.data.data.length > 0) {
this.$set(this.recallGameList[gameIndex], 'children', reslist.data.data)
} else {
this.$set(this.recallGameList[gameIndex], 'children', [])
}
setTimeout(() => {
this.gameLoding = false
}, 2000)
} else {
console.log('之前请求过了')
}
// const list = [
// { msgtype: 'text', text: { content: `${str}${item.url}` }}
// ]
this.sendChatMessage(`${str}${item.url}`, 'text')
this.markTransScene(type)
item.type = 1
this.sendGameLog(item)
}, 500),
sendPassword: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
console.log(item, '转端仅发送账号密码')
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
).username
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
// const list = [
// {
// msgtype: 'text',
// text: { content: `账号:${username} \n密码:${res.data.encryptPassword}`, key: res.data.key, iv: res.data.iv }
// }
// ]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`账号:${username} \n密码:${res.data.encryptPassword}`, 'text')
this.markTransScene(type)
this.sendGameLog(item)
})
.catch((err) => {
const list = [
{ msgtype: 'text', text: { content: `账号:${username}` }}
]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`账号:${username}`, 'text')
item.type = 1
this.sendGameLog(item)
console.log(err)
})
}, 500),
sendMessage: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
}
let str = ''
if (type == 2) {
str = '网页游戏链接:'
} else if (type == 3) {
str = '安卓游戏链接:'
} else if (type == 4) {
str = 'IOS游戏链接:'
}
},
showPopover() {
this.showCreateChannel = false
this.isReqeustData = false
},
handlePopover() {
this.showCreateChannel = false
},
handleAccount() {
if (this.bindGameUserList.length > 0) {
const account = this.bindGameUserList.find(
(item) => item.member_id == this.accountSelect
)
if (account) {
return true
} else {
return false
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
).username
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
const list = [
{
msgtype: 'text',
text: {
content: `${str}${item.url} \n账号:${username} \n密码:${res.data.encryptPassword}`,
key: res.data.key, iv: res.data.iv
}
}
]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`${str}${item.url} \n账号:${username} \n密码:${res.data.encryptPassword}`, 'text')
this.markTransScene(type)
item.type = 1
this.sendGameLog(item)
})
.catch((err) => {
const list = [
{
msgtype: 'text',
text: { content: `${str}${item.url} \n账号:${username}` }
} else {
return false
}
},
sendLink: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
console.log(item, '转端发送仅发送链接')
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
}
let str = ''
if (type == 2) {
str = '网页游戏链接:'
} else if (type == 3) {
str = '安卓游戏链接:'
} else if (type == 4) {
str = 'IOS游戏链接:'
} else {
}
// const list = [
// { msgtype: 'text', text: { content: `${str}${item.url}` }}
// ]
this.sendChatMessage(`${str}${item.url}`, 'text')
this.markTransScene(type)
item.type = 1
this.sendGameLog(item)
}, 500),
sendPassword: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
console.log(item, '转端仅发送账号密码')
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
).username
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
// const list = [
// {
// msgtype: 'text',
// text: { content: `账号:${username} \n密码:${res.data.encryptPassword}`, key: res.data.key, iv: res.data.iv }
// }
// ]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`账号:${username} \n密码:${res.data.encryptPassword}`, 'text')
this.markTransScene(type)
this.sendGameLog(item)
})
.catch((err) => {
const list = [
{ msgtype: 'text', text: { content: `账号:${username}` } }
]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`账号:${username}`, 'text')
item.type = 1
this.sendGameLog(item)
console.log(err)
})
}, 500),
sendMessage: throttle(function (item, type) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
}
let str = ''
if (type == 2) {
str = '网页游戏链接:'
} else if (type == 3) {
str = '安卓游戏链接:'
} else if (type == 4) {
str = 'IOS游戏链接:'
} else {
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
).username
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
const list = [
{
msgtype: 'text',
text: {
content: `${str}${item.url} \n账号:${username} \n密码:${res.data.encryptPassword}`,
key: res.data.key, iv: res.data.iv
}
]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`${str}${item.url} \n账号:${username}`, 'text')
this.sendGameLog(item)
console.log(err)
})
}, 500),
// 发送游戏落地页
startSendPage(value) {
console.log(value, 'value')
// this.set_sendSkillMessage(list)
this.getMediaId(value, 'image')
},
// 转端发送落地页面
sendDownLoadPage: throttleStart(function(items, type, index) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`${str}${item.url} \n账号:${username} \n密码:${res.data.encryptPassword}`, 'text')
this.markTransScene(type)
item.type = 1
this.sendGameLog(item)
})
.catch((err) => {
const list = [
{
msgtype: 'text',
text: { content: `${str}${item.url} \n账号:${username}` }
}
]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`${str}${item.url} \n账号:${username}`, 'text')
this.sendGameLog(item)
console.log(err)
})
}, 500),
// 发送游戏落地页
startSendPage(value) {
console.log(value, 'value')
// this.set_sendSkillMessage(list)
this.getMediaId(value, 'image')
},
// 转端发送落地页面
sendDownLoadPage: throttleStart(function (items, type, index) {
if (!this.transMemberStatus) {
this.$message.warning('当前w账号不满足转端要求,请联系组长处理')
return
}
this.$set(this.conversionGameList[index], 'send_trans_page_id', items.game_id)
this.showSendPage = true
}, 500),
// 转端标记
async markTransScene(type) {
const data = {
external_userid: this.chatUserInfo.external_userid,
trans_scene: type
}
const res = await markTransScene(data)
if (res.status_code == 1) {
console.log('标记转端成功')
if (this.chatUserInfo.trans_scene && this.chatUserInfo.trans_scene !== '' && this.chatUserInfo.trans_scene != type) {
this.chatUserInfo.trans_scene = type
}
this.$set(this.conversionGameList[index], 'send_trans_page_id', items.game_id)
this.showSendPage = true
}, 500),
// 转端标记
async markTransScene(type) {
}
},
getZqCserWxBelong() {
return new Promise(async (resolve, reject) => {
const data = {
external_userid: this.chatUserInfo.external_userid,
trans_scene: type
zq_user_id: Number(this.userInfo.id)
}
const res = await markTransScene(data)
if (res.status_code == 1) {
console.log('标记转端成功')
if (this.chatUserInfo.trans_scene && this.chatUserInfo.trans_scene !== '' && this.chatUserInfo.trans_scene != type) {
this.chatUserInfo.trans_scene = type
}
}
},
getZqCserWxBelong() {
return new Promise(async (resolve, reject) => {
const data = {
zq_user_id: Number(this.userInfo.id)
}
const res = await getZqCserWxBelong(data)
if (res.status_code === 1 && res.data.data) {
this.belongList = res.data.data.map(item => {
return {
value: item.value,
label: item.label && item.label.split('-')[0] ? item.label.split('-')[0] : ''
}
})
resolve(this.belongList)
} else {
this.$message.warning('暂无绑定项目,请先绑定项目')
reject(null)
}
})
},
// 一键发送任务链接
async sendTaskChannel() {
let groupItem = {}
let belonsList = {}
const group = await getZqCserGroup({ zq_user_id: Number(this.userInfo.id) })
belonsList = await this.getZqCserWxBelong()
if (group.status_code == 1 && group.data.data.length > 0 && belonsList && belonsList.length > 0) {
groupItem = group.data.data[0]
const group_name_list = groupItem.label.split('-')
const data = {
blongs_name: belonsList[0].label,
member_id: this.accountSelect,
use_user_id: this.userInfo.id,
use_user_name: this.userInfo.username,
group_id: groupItem.value,
group_name: group_name_list[group_name_list.length - 1],
game_type: this.chatUserInfo.trans_scene || ''
}
this.sendLoading = true
try {
setTimeout(() => {
this.sendLoading = false
}, 3000)
const res = await quickRecallChannelLink(data)
this.sendLoading = false
if (res.status_code == 1) {
this.sendGameInfoSave = res.data.data
this.handleSendType(res.data.data)
this.$message.success(res.msg)
const res = await getZqCserWxBelong(data)
if (res.status_code === 1 && res.data.data) {
this.belongList = res.data.data.map(item => {
return {
value: item.value,
label: item.label && item.label.split('-')[0] ? item.label.split('-')[0] : ''
}
} catch (error) {
this.$message.error('获取召回链接失败,请重新再试')
this.sendLoading = false
}
})
resolve(this.belongList)
} else {
this.$message.error('获取分组失败,请到掌权添加分组')
return
this.$message.warning('暂无绑定项目,请先绑定项目')
reject(null)
}
},
/**
* 发送游戏日志
* @param {Object} item 游戏信息
* 1.send_log_add方法是发送游戏日志的接口
* 2.set_send_game_log 是储存在vuex中的需要发送的时候调用的 信息 也就是 send_log_add 中需要的信息
* 3.每次调用 sendGameLog 方法 或者 set_send_game_log方法 的时候都需要记录 send_game_log 的信息 然后 监听 send_game_log 变量的变化 然后调用 send_log_add 方法
* 4.你需要 查看 ./sendGame/*.vue 所有的 vue 文件 查看是否文件中有 sendGameLog 方法 如果有 你需要帮我自动完成日志的记录功能 需要的步骤如下
* 5.你需要 在 vuex 中 引入 send_game_log 变量 然后 监听 send_game_log 如果 新值存在 那么就调用 send_log_add
* 6.请你仔细查看 ./sendGame/*.vue 的所有 vue 文件 帮我 自动完成 send_log_add 的日志收集功能 如果需要特殊处理 的地方你需要仔细查看逻辑 并且 自动处理
* 7.你可以封装成一个 minix 或者你有更好的处理逻辑 来完成 发送游戏日志的收集工作
* 8.总结:每次调用 set_send_game_log 方法的时候 是在 vuex 中记录 需要发送的日志信息 你要监听 send_game_log 变量的变化 然后调用 send_log_add 方法 完成日志的收集工作 你需要帮我选一个最佳的方案来完成这个功能 尽量保证不出问题
*/
})
},
handleSendType(data) {
console.log(data, '获取一键发送的信息')
// 转端发送优先逻辑 不需要了 现在发送当前会话框选中的账号对应的注册游戏
data?.game_data?.game_type ? this.chatUserInfo.trans_scene = data.game_data.game_type : ''
if (this.chatUserInfo.trans_scene && this.chatUserInfo.trans_scene != 1) {
this.sendCreateChannel(data.game_data, data.game_data.game_type)
} else {
// 没有转端标记过,发送小程序链接 判断标题和封面是否存在 存在发小程序卡片 不存在发二维码
if (data.share_data.share_title && data.share_data.share_img) {
const miniprogramInfo =
{
appid: data.share_data.app_id,
rawid: data.share_data.raw_id,
channle_id: data.share_data.channel_key,
channle_name: data.share_data.channel_name,
title: data.share_data.share_title,
platform: 27,
page: data.share_data.page,
imgUrl: data.share_data.share_img
}
// this.set_sendSkillMessage(list)
this.sendChatMessage(miniprogramInfo, 'miniprogram')
const game_data = this.$clone(data.game_data)
game_data.type = 3
console.log(game_data, 'data----------')
this.sendGameLog(game_data)
} else {
// this.set_sendSkillMessage(list)
this.getMediaId(data.game_data.game_url,'image')
this.sendGameLog(data.game_data)
}
}
this.recallChannelSeq(data)
},
// 召回染色
async recallChannelSeq(data) {
const param = {
game_id: data.game_data.game_id,
// 一键发送任务链接
async sendTaskChannel() {
let groupItem = {}
let belonsList = {}
const group = await getZqCserGroup({ zq_user_id: Number(this.userInfo.id) })
belonsList = await this.getZqCserWxBelong()
if (group.status_code == 1 && group.data.data.length > 0 && belonsList && belonsList.length > 0) {
groupItem = group.data.data[0]
const group_name_list = groupItem.label.split('-')
const data = {
blongs_name: belonsList[0].label,
member_id: this.accountSelect,
key: data.game_data.channel_key || data.share_data.channel_key
}
const res = await recallChannelSeq(param)
},
sendCreateChannel: throttle(function (item, type) {
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
use_user_id: this.userInfo.id,
use_user_name: this.userInfo.username,
group_id: groupItem.value,
group_name: group_name_list[group_name_list.length - 1],
game_type: this.chatUserInfo.trans_scene || ''
}
let str = ''
if (type == 2) {
str = '网页游戏链接:'
} else if (type == 3) {
str = '安卓游戏链接:'
} else if (type == 4) {
str = 'IOS游戏链接:'
} else {
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
).username
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
const list = [
{
msgtype: 'text',
// 一键发送渠道任务相关的参数
taskInfo: {
task_id: this.chatUser.task_id,
game_id: item.game_id,
member_id: this.accountSelect,
channel_key: item.channel_key
},
text: {
content: `${str}${item.game_url} \n账号:${username} \n密码:${res.data.encryptPassword}`,
key: res.data.key, iv: res.data.iv
}
}
]
// 这里需要特殊处理,因为有taskInfo参数
// this.set_sendSkillMessage(list)
this.sendChatMessage(`${str}${item.game_url} \n账号:${username} \n密码:${res.data.encryptPassword}`, 'text')
item.type = 3
this.sendGameLog(item)
})
}, 500),
async getLandingPageConfig(items, item) {
this.sendLoading = true
try {
const params = {
main_game_id: items.main_game_id,
weixin_blongs_id: items.weixin_blongs_id,
type: items.game_type == 1 ? 2 : items.game_type == 3 || items.game_type == 4 ? 1 : ''
}
const res = await getLandingPageConfig(params)
if (res.status_code === 1 && res.data) {
return {
data: res.data,
game_type: items.game_type
}
} else {
return null
setTimeout(() => {
this.sendLoading = false
}, 3000)
const res = await quickRecallChannelLink(data)
this.sendLoading = false
if (res.status_code == 1) {
this.sendGameInfoSave = res.data.data
this.handleSendType(res.data.data)
this.$message.success(res.msg)
}
} catch (error) {
this.$message.error('获取召回链接失败,请重新再试')
this.sendLoading = false
}
},
// 处理微信小程序游戏
handleWechatMiniGame(items, item, index) {
try {
this.selectedWxGameList = []
// 直接替换微信小游戏列表(单选)
this.selectedWxGameList = [item]
this.selectedWxGameList[0].send_trans_game_id = items.id
this.selectedWxGameList[0].send_trans_game_info = items
this.showWxGameDrawer = true
return true
} catch (error) {
console.error('处理微信小游戏失败:', error)
return false
}
},
// 过滤游戏列表的公共方法
filterGameList(sourceGame, targetList) {
if (!sourceGame || !targetList?.length) return []
return targetList.filter(game =>
game.weixin_blongs_id === sourceGame.weixin_blongs_id &&
game.main_game_id === sourceGame.main_game_id
)
},
handleAndroidList(items, item) {
const androidGameList = this.regGameList.find(item => item.label.includes('安卓'))
if (androidGameList && androidGameList.children && androidGameList.children.length > 0) {
androidGameList.children = this.filterGameList(items, androidGameList.children)
} else {
this.$message.error('获取分组失败,请到掌权添加分组')
return
}
},
/**
* 发送游戏日志
* @param {Object} item 游戏信息
* 1.send_log_add方法是发送游戏日志的接口
* 2.set_send_game_log 是储存在vuex中的需要发送的时候调用的 信息 也就是 send_log_add 中需要的信息
* 3.每次调用 sendGameLog 方法 或者 set_send_game_log方法 的时候都需要记录 send_game_log 的信息 然后 监听 send_game_log 变量的变化 然后调用 send_log_add 方法
* 4.你需要 查看 ./sendGame/*.vue 所有的 vue 文件 查看是否文件中有 sendGameLog 方法 如果有 你需要帮我自动完成日志的记录功能 需要的步骤如下
* 5.你需要 在 vuex 中 引入 send_game_log 变量 然后 监听 send_game_log 如果 新值存在 那么就调用 send_log_add
* 6.请你仔细查看 ./sendGame/*.vue 的所有 vue 文件 帮我 自动完成 send_log_add 的日志收集功能 如果需要特殊处理 的地方你需要仔细查看逻辑 并且 自动处理
* 7.你可以封装成一个 minix 或者你有更好的处理逻辑 来完成 发送游戏日志的收集工作
* 8.总结:每次调用 set_send_game_log 方法的时候 是在 vuex 中记录 需要发送的日志信息 你要监听 send_game_log 变量的变化 然后调用 send_log_add 方法 完成日志的收集工作 你需要帮我选一个最佳的方案来完成这个功能 尽量保证不出问题
*/
handleSendType(data) {
console.log(data, '获取一键发送的信息')
// 转端发送优先逻辑 不需要了 现在发送当前会话框选中的账号对应的注册游戏
data?.game_data?.game_type ? this.chatUserInfo.trans_scene = data.game_data.game_type : ''
if (this.chatUserInfo.trans_scene && this.chatUserInfo.trans_scene != 1) {
this.sendCreateChannel(data.game_data, data.game_data.game_type)
} else {
// 没有转端标记过,发送小程序链接 判断标题和封面是否存在 存在发小程序卡片 不存在发二维码
if (data.share_data.share_title && data.share_data.share_img) {
const miniprogramInfo =
{
appid: data.share_data.app_id,
rawid: data.share_data.raw_id,
channle_id: data.share_data.channel_key,
channle_name: data.share_data.channel_name,
title: data.share_data.share_title,
platform: 27,
page: data.share_data.page,
imgUrl: data.share_data.share_img
}
// this.set_sendSkillMessage(list)
this.sendChatMessage(miniprogramInfo, 'miniprogram')
const game_data = this.$clone(data.game_data)
game_data.type = 3
console.log(game_data, 'data----------')
this.sendGameLog(game_data)
} else {
androidGameList.children = []
// this.set_sendSkillMessage(list)
this.getMediaId(data.game_data.game_url, 'image')
this.sendGameLog(data.game_data)
}
androidGameList.game_type = 3
if (items.game_type == 3) {
androidGameList.android_game_id = items.id
androidGameList.android_game_info = items
}
this.recallChannelSeq(data)
},
// 召回染色
async recallChannelSeq(data) {
const param = {
game_id: data.game_data.game_id,
member_id: this.accountSelect,
key: data.game_data.channel_key || data.share_data.channel_key
}
const res = await recallChannelSeq(param)
},
sendCreateChannel: throttle(function (item, type) {
const result = this.handleAccount()
if (!result) {
this.$message.warning('请稍后再试')
return false
}
let str = ''
if (type == 2) {
str = '网页游戏链接:'
} else if (type == 3) {
str = '安卓游戏链接:'
} else if (type == 4) {
str = 'IOS游戏链接:'
} else {
}
const username = this.bindGameUserList.find(
(items) => items.member_id == this.accountSelect
).username
passwardEncryption({ member_id: this.accountSelect })
.then((res) => {
const list = [
{
msgtype: 'text',
// 一键发送渠道任务相关的参数
taskInfo: {
task_id: this.chatUser.task_id,
game_id: item.game_id,
member_id: this.accountSelect,
channel_key: item.channel_key
},
text: {
content: `${str}${item.game_url} \n账号:${username} \n密码:${res.data.encryptPassword}`,
key: res.data.key, iv: res.data.iv
}
}
]
// 这里需要特殊处理,因为有taskInfo参数
// this.set_sendSkillMessage(list)
this.sendChatMessage(`${str}${item.game_url} \n账号:${username} \n密码:${res.data.encryptPassword}`, 'text')
item.type = 3
this.sendGameLog(item)
})
}, 500),
async getLandingPageConfig(items, item) {
try {
const params = {
main_game_id: items.main_game_id,
weixin_blongs_id: items.weixin_blongs_id,
type: items.game_type == 1 ? 2 : items.game_type == 3 || items.game_type == 4 ? 1 : ''
}
return androidGameList
},
handleIosList(items, item) {
const IOSGameList = this.regGameList.find(item => item.label.includes('IOS' || 'ios'))
IOSGameList.game_type = 4
if (IOSGameList && IOSGameList.children && IOSGameList.children.length > 0) {
IOSGameList.children = this.filterGameList(items, IOSGameList.children)
const res = await getLandingPageConfig(params)
if (res.status_code === 1 && res.data) {
return {
data: res.data,
game_type: items.game_type
}
} else {
IOSGameList.children = []
}
if (items.game_type == 4) {
IOSGameList.ios_game_id = items.id
IOSGameList.ios_game_info = items
return null
}
return IOSGameList
},
// 处理安卓 IOS 游戏
handleAppGameList(items, item, index) {
this.showAppGameDrawer = true
const androidGameList = this.handleAndroidList(items, item)
const IOSGameList = this.handleIosList(items, item)
androidGameList ? this.selectedAppGameList.push(androidGameList) : ''
IOSGameList ? this.selectedAppGameList.push(IOSGameList) : ''
console.log(this.selectedAppGameList, 'selectedAppGameList')
},
// 主方法
async handleGameType(items, item, type, index) {
if ((items.game_type == 1 || items.game_type == 3 || items.game_type == 4) && items.main_game_id && items.weixin_blongs_id) {
const result = await this.getLandingPageConfig(items, item)
if (result && result.data?.data?.tag) {
if (items.game_type == 1) {
// 处理微信小程序游戏
this.handleWechatMiniGame(items, item, index)
} else {
// 处理安卓/iOS游戏
this.handleAppGameList(items, item, index)
}
} catch (error) {
}
},
// 处理微信小程序游戏
handleWechatMiniGame(items, item, index) {
try {
this.selectedWxGameList = []
// 直接替换微信小游戏列表(单选)
this.selectedWxGameList = [item]
this.selectedWxGameList[0].send_trans_game_id = items.id
this.selectedWxGameList[0].send_trans_game_info = items
this.showWxGameDrawer = true
return true
} catch (error) {
console.error('处理微信小游戏失败:', error)
return false
}
},
// 过滤游戏列表的公共方法
filterGameList(sourceGame, targetList) {
if (!sourceGame || !targetList?.length) return []
return targetList.filter(game =>
game.weixin_blongs_id === sourceGame.weixin_blongs_id &&
game.main_game_id === sourceGame.main_game_id
)
},
handleAndroidList(items, item) {
const androidGameList = this.regGameList.find(item => item.label.includes('安卓'))
if (androidGameList && androidGameList.children && androidGameList.children.length > 0) {
androidGameList.children = this.filterGameList(items, androidGameList.children)
} else {
androidGameList.children = []
}
androidGameList.game_type = 3
if (items.game_type == 3) {
androidGameList.android_game_id = items.id
androidGameList.android_game_info = items
}
return androidGameList
},
handleIosList(items, item) {
const IOSGameList = this.regGameList.find(item => item.label.includes('IOS' || 'ios'))
IOSGameList.game_type = 4
if (IOSGameList && IOSGameList.children && IOSGameList.children.length > 0) {
IOSGameList.children = this.filterGameList(items, IOSGameList.children)
} else {
IOSGameList.children = []
}
if (items.game_type == 4) {
IOSGameList.ios_game_id = items.id
IOSGameList.ios_game_info = items
}
return IOSGameList
},
// 处理安卓 IOS 游戏
handleAppGameList(items, item, index) {
this.showAppGameDrawer = true
const androidGameList = this.handleAndroidList(items, item)
const IOSGameList = this.handleIosList(items, item)
androidGameList ? this.selectedAppGameList.push(androidGameList) : ''
IOSGameList ? this.selectedAppGameList.push(IOSGameList) : ''
console.log(this.selectedAppGameList, 'selectedAppGameList')
},
// 主方法
async handleGameType(items, item, type, index) {
if ((items.game_type == 1 || items.game_type == 3 || items.game_type == 4) && items.main_game_id && items.weixin_blongs_id) {
const result = await this.getLandingPageConfig(items, item)
if (result && result.data?.data?.tag) {
if (items.game_type == 1) {
// 处理微信小程序游戏
this.handleWechatMiniGame(items, item, index)
} else {
this.sendChannelGame(items, item)
// 处理安卓/iOS游戏
this.handleAppGameList(items, item, index)
}
} else {
this.sendChannelGame(items, item)
}
},
// 不是小游戏 安卓 IOS 游戏处理
noH5AndroidIOSGame(items, item) {
} else {
this.sendChannelGame(items, item)
},
// 小游戏游戏确认
async handleWxGameConfirm(value) {
console.log(value, 'value')
// const list = [
// {
// msgtype: 'image',
// image: {
// picurl: value
// }
// }
// ]
// this.set_sendSkillMessage(list)
this.getMediaId(value, 'image')
},
SendTransAppGameClose() {
this.selectedAppGameList = []
},
SendTransWxGameClose() {
this.selectedWxGameList = []
},
// 安卓或者 IOS 游戏处理
handleAppGameConfirm(data) {
this.selectedAppGameList = []
// const list = [
// {
// msgtype: 'text',
// text: {
// content: `游戏地址:${data.landing_page_url} \n账号:${data.username} \n密码:${data.password}`
// }
// }
// ]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`游戏地址:${data.landing_page_url} \n账号:${data.username} \n密码:${data.password}`,'text')
},
}
},
// 不是小游戏 安卓 IOS 游戏处理
noH5AndroidIOSGame(items, item) {
this.sendChannelGame(items, item)
},
// 小游戏游戏确认
async handleWxGameConfirm(value) {
console.log(value, 'value')
// const list = [
// {
// msgtype: 'image',
// image: {
// picurl: value
// }
// }
// ]
// this.set_sendSkillMessage(list)
this.getMediaId(value, 'image')
},
SendTransAppGameClose() {
this.selectedAppGameList = []
},
SendTransWxGameClose() {
this.selectedWxGameList = []
},
// 安卓或者 IOS 游戏处理
handleAppGameConfirm(data) {
this.selectedAppGameList = []
// const list = [
// {
// msgtype: 'text',
// text: {
// content: `游戏地址:${data.landing_page_url} \n账号:${data.username} \n密码:${data.password}`
// }
// }
// ]
// this.set_sendSkillMessage(list)
this.sendChatMessage(`游戏地址:${data.landing_page_url} \n账号:${data.username} \n密码:${data.password}`, 'text')
},
async getMediaId(picurl){
// 发送图片作为链接消息
if (picurl) {
this.sendChatMessage(picurl, 'image')
} else {
// 如果没有图片URL,提示用户
this.$message.error('图片链接不存在,无法发送')
}
},
}
async getMediaId(picurl) {
// 发送图片作为链接消息
if (picurl) {
this.sendChatMessage(picurl, 'image')
} else {
// 如果没有图片URL,提示用户
this.$message.error('图片链接不存在,无法发送')
}
},
}
</script>
<style lang="scss" scoped>
.sendGameContent{
width: 100%;
height: 100%;
overflow: auto;
}
</script>
<style lang="scss" scoped>
.sendGameContent {
width: 100%;
height: 100%;
overflow: auto;
.createChannel {
font-size: 14px;
margin-top: 16px;
padding: 0 16px;
.label {
color: #878787;
font-size: 12px;
margin-right: 5px;
}
}
.channelLoading {
color: #00bf8a;
font-size: 16px;
text-align: center;
padding: 20px;
}
.btnRelease {
position: relative;
padding-top: 40px;
// ::v-deep .el-collapse-item__header {
// border-bottom: none;
// background: #f7f8fa;
// }
}
.btntab {
width: 100%;
display: flex;
height: 36px;
position: absolute;
left: 0;
top: 0;
.btn {
flex: 1;
background: #fff;
.btntab {
width: 100%;
display: flex;
cursor: pointer;
}
.btnActive {
background: #00bf8a;
color: #fff;
}
}
.gameList {
width: 100%;
::v-deep .el-tabs__item {
width: 70px;
height: 44px;
margin: 12px 16px;
width: calc(100% - 32px);
.radio-group {
width: 100%;
::v-deep .el-radio-group {
width: 100%;
display: flex;
}
::v-deep .el-radio-button {
flex: 1;
height: 44px;
&__inner {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 500;
border-color: #f0f0f0;
}
}
}
}
.gameListItem {
.gameList {
width: 100%;
height: 40px;
background: #f7f8fa;
padding: 0 10px;
p {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
background: #fff;
::v-deep .el-collapse {
border: none;
.el-collapse-item {
border: none;
margin-bottom: 1px;
&__header {
height: 52px;
line-height: 52px;
background: #fff;
border: none;
border-bottom: 1px solid #f0f0f0;
padding: 0 16px;
font-size: 16px;
font-weight: 500;
color: #333;
.el-collapse-item__arrow {
color: #999;
font-size: 14px;
}
}
&__wrap {
border: none;
background: #fafafa;
}
&__content {
padding: 0;
background: #fafafa;
}
}
}
.gameListItem {
width: 100%;
height: 52px;
background: #fff;
padding: 0 16px;
border-bottom: 1px solid #f0f0f0;
display: flex;
align-items: center;
justify-content: space-between;
&:last-child {
border-bottom: none;
}
p {
font-size: 14px;
color: #333;
margin: 0;
flex: 1;
}
::v-deep .el-button {
background: #1890ff;
border-color: #1890ff;
color: #fff;
font-size: 14px;
height: 32px;
padding: 0 16px;
border-radius: 4px;
&:hover {
background: #40a9ff;
border-color: #40a9ff;
}
&:disabled {
background: #f5f5f5;
border-color: #d9d9d9;
color: #bfbfbf;
}
}
::v-deep .el-popover__reference {
.el-button {
background: #1890ff;
border-color: #1890ff;
color: #fff;
&:hover {
background: #40a9ff;
border-color: #40a9ff;
}
}
}
}
.collapseContent {
background: #fff;
}
// 搜索框样式
::v-deep .el-input {
margin: 16px;
width: calc(100% - 32px);
.el-input__inner {
border-radius: 6px;
border: 1px solid #d9d9d9;
height: 40px;
font-size: 14px;
&:focus {
border-color: #1890ff;
}
}
.el-input__prefix {
left: 12px;
}
}
.icon {
// 暂无游戏状态
.rowFlex.allCenter {
padding: 40px 0;
color: #999;
font-size: 14px;
cursor: pointer;
}
}
::v-deep .el-collapse {
border-top: none;
border-bottom: none;
}
::v-deep .el-collapse-item__header {
border-bottom: none;
}
::v-deep .el-collapse-item__wrap {
border-bottom: none;
}
::v-deep .el-collapse {
border-top: none;
border-bottom: none;
}
::v-deep .el-collapse-item {
border-radius: 4px;
background: #f7f8fa;
}
::v-deep .el-collapse-item__content {
padding: 5px;
}
::v-deep .el-collapse-item__wrap {
border-bottom: none;
}
}
}
</style>
<style>
.sendLink {
width: 150px;
height: 25px;
cursor: pointer;
}
.sendLink:hover {
color: #00bf8a;
}</style>
\ No newline at end of file
.sendLink {
width: 150px;
height: 25px;
cursor: pointer;
}
.sendLink:hover {
color: #00bf8a;
}
</style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论