Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
company_app
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
毛细亚
company_app
Commits
d97282f3
提交
d97282f3
authored
6月 06, 2025
作者:
毛细亚
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改日志记录任务
上级
26ef2fa3
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
753 行增加
和
58 行删除
+753
-58
game.js
src/store/modules/game.js
+4
-0
index.js
src/utils/index.js
+73
-0
sendGame.vue
src/views/components/quickSendGame/sendGame.vue
+71
-58
selectChannel.vue
...views/components/quickSendGame/sendGame/selectChannel.vue
+319
-0
sendSelectChannel.vue
...s/components/quickSendGame/sendGame/sendSelectChannel.vue
+286
-0
没有找到文件。
src/store/modules/game.js
浏览文件 @
d97282f3
...
...
@@ -14,6 +14,7 @@ const state = {
bindGameUserList
:
[],
// 用户绑定的游戏角色
changeSelectWindow
:
false
,
// 切换客服窗口的时候 下发通知
gameUserInfo
:{},
send_game_log
:
null
,
// 转游发送渠道新增日志发送信息
chatUserInfo
:
{},
// 当前选中的用户的详情
}
...
...
@@ -35,6 +36,9 @@ const mutations = {
},
set_gameUserInfo
(
state
,
data
)
{
state
.
gameUserInfo
=
data
},
set_send_game_log
(
state
,
data
)
{
state
.
send_game_log
=
data
}
}
...
...
src/utils/index.js
浏览文件 @
d97282f3
...
...
@@ -10,6 +10,10 @@
*/
import
store
from
'@/store'
import
Clipboard
from
'clipboard'
import
{
getMediaId
}
from
'@/api/works'
import
{
Message
}
from
'element-ui'
import
*
as
ww
from
'@wecom/jssdk'
export
function
parseTime
(
time
,
cFormat
)
{
if
(
arguments
.
length
===
0
||
!
time
)
{
return
null
...
...
@@ -677,4 +681,72 @@ export const fallbackCopyTextToClipboard = function(text, successCallback, error
}
document
.
body
.
removeChild
(
textArea
)
}
// 企业微信发送聊天消息的通用方法
export
async
function
sendChatMessage
(
content
,
type
)
{
let
messageObj
=
{}
if
(
type
===
'text'
)
{
messageObj
=
{
msgtype
:
'text'
,
text
:
{
content
:
content
},
success
:
(
res
)
=>
{
console
.
log
(
res
,
'发送文本成功'
)
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'发送文本失败'
)
}
}
}
else
if
(
type
===
'link'
)
{
messageObj
=
{
msgtype
:
'news'
,
news
:
content
,
success
:
(
res
)
=>
{
console
.
log
(
res
,
'发送 news 成功'
)
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'发送 news 失败'
)
}
}
}
else
if
(
type
===
'image'
)
{
// 发送图片作为链接消息
if
(
content
)
{
try
{
const
res
=
await
getMediaId
({
url
:
content
})
if
(
res
.
status_code
==
1
)
{
messageObj
=
{
msgtype
:
'image'
,
image
:
{
mediaid
:
res
.
data
.
media_id
},
success
:
(
res
)
=>
{
console
.
log
(
res
,
'发送 image 成功'
)
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'发送 image 失败'
)
}
}
}
}
catch
(
error
)
{
console
.
error
(
'获取媒体ID失败:'
,
error
)
Message
.
error
(
'获取图片媒体ID失败'
)
return
}
}
else
{
Message
.
error
(
'图片链接不存在,无法发送'
)
return
}
}
else
if
(
type
===
'miniprogram'
)
{
messageObj
=
{
msgtype
:
'miniprogram'
,
miniprogram
:
content
}
}
console
.
log
(
messageObj
,
'发送消息对象'
)
ww
.
sendChatMessage
(
messageObj
)
}
\ No newline at end of file
src/views/components/quickSendGame/sendGame.vue
浏览文件 @
d97282f3
...
...
@@ -288,6 +288,19 @@
@
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
>
...
...
@@ -305,20 +318,23 @@
getLandingPageConfig
,
getMemberTransStatus
}
from
'@/api/game'
import
{
getRecentSendLog
,
markTransScene
,
getZqCserGroup
,
getZqCserWxBelong
,
getMediaId
}
from
'@/api/works'
import
{
getRecentSendLog
,
markTransScene
,
getZqCserGroup
,
getZqCserWxBelong
,
getMediaId
,
send_log_add
}
from
'@/api/works'
import
{
companyviewConfig
}
from
'@/api/user'
import
{
throttle
,
throttleStart
}
from
'@/utils/index'
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'
export
default
{
components
:
{
createChannel
,
sendPage
,
SendTransWxGame
,
SendTransAppGame
SendTransAppGame
,
selectChannel
,
sendSelectChannel
},
data
()
{
return
{
...
...
@@ -350,6 +366,9 @@
selectedAppGameList
:
[],
// 安卓或者 Ios 选择的游戏
sendGameInfoSave
:
{},
imageInfo
:
{},
showLayer
:
false
,
showSendChannel
:
false
,
channelInfoList
:{},
transMemberStatus
:
true
}
},
...
...
@@ -358,7 +377,7 @@
this
.
sendGameInfo
()
},
computed
:
{
...
mapState
(
'game'
,
[
'accountSelect'
,
'bindGameUserList'
,
'chatUserInfo'
,
'gameUserInfo'
]),
...
mapState
(
'game'
,
[
'accountSelect'
,
'bindGameUserList'
,
'chatUserInfo'
,
'gameUserInfo'
,
'send_game_log'
]),
...
mapState
(
'user'
,
[
'userInfo'
,
'corp_id'
])
},
// props: [ 'chatUserInfo', 'chatUser'],
...
...
@@ -380,7 +399,7 @@
}
},
methods
:
{
//
...mapMutations('game', ['set_send_game_log']),
...
mapMutations
(
'game'
,
[
'set_send_game_log'
]),
initDisable
(){
// 切换 w 账号的时候清空 conversionGameList 数据
this
.
conversionGameList
=
[]
...
...
@@ -391,6 +410,15 @@
this
.
disabled
=
true
}
},
channelInfo
(
info
)
{
this
.
channelInfoList
=
info
// 只有 1 个渠道的时候 直接发送不出现弹窗
if
(
info
.
channelList
.
length
===
1
)
{
this
.
showSendChannel
=
true
}
else
{
this
.
showLayer
=
true
}
},
requestConfig
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
companyviewConfig
({
corp_id
:
this
.
corp_id
}).
then
((
res
)
=>
{
...
...
@@ -932,6 +960,39 @@
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 方法 完成日志的收集工作 你需要帮我选一个最佳的方案来完成这个功能 尽量保证不出问题
*/
send_log_add
(
info
)
{
const
data
=
{
game_id
:
this
.
send_game_log
.
game_id
,
game_name
:
this
.
send_game_log
.
game_name
,
game_type
:
this
.
send_game_log
.
game_type
||
''
,
main_game_id
:
this
.
send_game_log
.
main_game_id
||
''
,
weixin_blongs_id
:
this
.
send_game_log
.
weixin_blongs_id
||
''
,
content
:
info
.
message
,
type
:
this
.
send_game_log
.
type
||
2
,
frontend_message_id
:
info
.
frontend_message_id
,
session_id
:
info
.
session_id
,
userid
:
this
.
chatUser
.
userid
,
external_userid
:
this
.
chatUser
.
external_userid
}
this
.
set_send_game_log
(
null
)
send_log_add
(
data
).
then
((
res
)
=>
{
if
(
res
.
status_code
===
1
)
{
console
.
log
(
'日志记录成功'
)
}
})
},
sendGameLog
(
item
)
{
item
&&
item
.
game_id
&&
item
.
game_name
?
this
.
set_send_game_log
({
game_id
:
item
.
game_id
,
game_name
:
item
.
game_name
,
game_type
:
item
.
game_type
||
''
,
main_game_id
:
item
.
main_game_id
,
weixin_blongs_id
:
item
.
weixin_blongs_id
,
type
:
item
.
type
||
''
})
:
''
},
...
...
@@ -1158,62 +1219,14 @@
// this.set_sendSkillMessage(list)
this
.
sendChatMessage
(
`游戏地址:
${
data
.
landing_page_url
}
\n账号:
${
data
.
username
}
\n密码:
${
data
.
password
}
`
,
'text'
)
},
sendChatMessage
(
content
,
type
){
let
message
=
{}
if
(
type
==
'text'
){
message
=
{
msgtype
:
'text'
,
text
:
{
content
:
content
},
success
:
(
res
)
=>
{
console
.
log
(
res
,
'发送文本成功'
)
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'发送文本失败'
)
}
}
}
else
if
(
type
==
'link'
){
message
=
{
msgtype
:
'news'
,
news
:
content
,
success
:
(
res
)
=>
{
console
.
log
(
res
,
'发送 news 成功'
)
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'发送 news 失败'
)
}
}
}
else
if
(
type
==
'image'
){
message
=
{
msgtype
:
'image'
,
image
:
{
mediaid
:
content
},
success
:
(
res
)
=>
{
console
.
log
(
res
,
'发送 image 成功'
)
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'发送 image 失败'
)
}
}
}
else
if
(
type
==
'miniprogram'
){
message
=
{
msgtype
:
'miniprogram'
,
miniprogram
:
content
,
}
}
console
.
log
(
message
,
'1231'
)
this
.
$ww
.
sendChatMessage
(
message
)
async
sendChatMessage
(
content
,
type
)
{
// 调用公共的sendChatMessage方法
await
sendChatMessage
(
content
,
type
)
},
async
getMediaId
(
picurl
){
// 发送图片作为链接消息
if
(
picurl
)
{
const
res
=
await
getMediaId
({
url
:
picurl
})
if
(
res
.
status_code
==
1
){
this
.
sendChatMessage
(
res
.
data
.
media_id
,
'image'
)
}
this
.
sendChatMessage
(
picurl
,
'image'
)
}
else
{
// 如果没有图片URL,提示用户
this
.
$message
.
error
(
'图片链接不存在,无法发送'
)
...
...
src/views/components/quickSendGame/sendGame/selectChannel.vue
0 → 100644
浏览文件 @
d97282f3
<
template
>
<el-drawer
:lock-scroll=
"true"
title=
"选择渠道"
:visible=
"show"
size=
"450px"
:append-to-body=
"true"
@
close=
"close"
>
<div
class=
"editLayer"
>
<el-form
:model=
"webForm"
label-width=
"100px"
>
<el-form-item
label=
"选择渠道"
>
<el-select
v-model=
"webForm.channel_id"
value-key=
"key"
filterable
placeholder=
"请选择"
style=
"width:320px;"
>
<el-option
v-for=
"item in channelInfoList.channelList"
:key=
"item.value"
:label=
"item.name"
:value=
"item"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<span
class=
"dialog-footer rowFlex"
>
<el-button
class=
"btn"
type=
"primary"
@
click=
"onConfirm"
>
确 定
</el-button>
<el-button
class=
"btn"
@
click=
"close"
>
取 消
</el-button>
</span>
</el-drawer>
</
template
>
<
script
>
import
{
recallChannelSeq
,
passwardEncryption
,
autoResetPassword
}
from
'@/api/game'
import
{
mapState
,
mapMutations
}
from
'vuex'
import
{
throttle
,
sendChatMessage
}
from
'@/utils/index'
import
{
zyouGetMemberLink
}
from
'@/api/works'
export
default
{
props
:
[
'show'
,
'channelInfoList'
,
'chatUser'
],
data
()
{
return
{
channelselectList
:
[],
webForm
:
{
channel_id
:
''
}
}
},
computed
:
{
...
mapState
(
'game'
,
[
'accountSelect'
,
'bindGameUserList'
]),
...
mapState
(
'user'
,
[
'userInfo'
])
},
methods
:
{
...
mapMutations
(
'game'
,
[
'set_send_game_log'
]),
close
()
{
this
.
$emit
(
'update:show'
,
false
)
},
onConfirm
()
{
if
(
this
.
webForm
.
channel_id
===
''
)
{
this
.
$message
.
warning
(
'请选择渠道'
)
return
false
}
// this.channelInfoList.use_type 1 转端 2转游 3 召回
if
(
this
.
channelInfoList
.
use_type
==
2
)
{
// 转游的时候调用接口获取 url 其他直接从 channelList 中获取 url
const
data
=
{
game_id
:
this
.
webForm
.
channel_id
.
game_id
,
member_id
:
this
.
accountSelect
,
zq_user_id
:
this
.
userInfo
.
id
,
use_type
:
this
.
channelInfoList
.
use_type
,
channel_key
:
this
.
webForm
.
channel_id
.
key
,
corp_id
:
this
.
chatUser
.
corp_id
,
userid
:
this
.
chatUser
.
userid
,
external_user_id
:
this
.
chatUser
.
external_userid
}
zyouGetMemberLink
(
data
).
then
(
res
=>
{
if
(
res
.
status_code
===
1
)
{
this
.
sendMessageToGame
(
res
.
data
.
data
)
this
.
$message
.
success
(
res
.
msg
)
this
.
close
()
}
})
}
else
{
this
.
sendMessageCall
()
this
.
set_send_game_log
({
game_id
:
this
.
webForm
.
channel_id
.
game_id
,
game_name
:
this
.
webForm
.
channel_id
.
game_name
,
main_game_id
:
this
.
webForm
.
channel_id
.
main_game_id
})
}
},
// 召回染色
async
recallChannelSeq
()
{
const
data
=
{
game_id
:
this
.
channelInfoList
.
game_id
,
member_id
:
this
.
accountSelect
,
key
:
this
.
webForm
.
channel_id
.
key
}
const
res
=
await
recallChannelSeq
(
data
)
},
sendMessageCall
()
{
// 转端的时候 区分发送类型 1:发送链接 2:发送密码 3:发送链接和密码
if
(
this
.
channelInfoList
.
use_type
==
1
)
{
// 转端
if
(
this
.
channelInfoList
.
sendType
==
1
)
{
this
.
sendLink
()
}
else
if
(
this
.
channelInfoList
.
sendType
==
2
)
{
this
.
sendPassword
()
}
else
if
(
this
.
channelInfoList
.
sendType
==
3
)
{
this
.
sendMessageThree
()
}
}
else
if
(
this
.
channelInfoList
.
use_type
==
3
)
{
// 召回
// 1微信小游戏 2 h5 3 安卓 4 ios 5 抖音小游戏
let
str
=
''
let
list
=
[]
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'游戏链接:'
+
this
.
webForm
.
channel_id
.
game_url
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
||
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'app链接:'
+
this
.
webForm
.
channel_id
.
game_url
}
else
{
}
if
(
this
.
webForm
.
channel_id
.
game_type
==
'1'
||
this
.
webForm
.
channel_id
.
game_type
==
'5'
)
{
// list = [{ msgtype: 'image', image: { picurl: this.webForm.channel_id.game_url + '?time=' + new Date().getTime() }}]
this
.
sendChatMessage
(
this
.
webForm
.
channel_id
.
game_url
+
'?time='
+
new
Date
().
getTime
(),
'image'
)
}
else
{
// list = [{ msgtype: 'text', text: { content: str }}]
this
.
sendChatMessage
(
str
,
'text'
)
}
// this.set_sendSkillMessage(list)
// 3:召回 召回的时候请求召回染色的接口
this
.
recallChannelSeq
()
}
this
.
close
()
},
handleAccount
()
{
if
(
this
.
bindGameUserList
.
length
>
0
)
{
const
account
=
this
.
bindGameUserList
.
find
(
(
item
)
=>
item
.
member_id
==
this
.
accountSelect
)
if
(
account
)
{
return
true
}
else
{
return
false
}
}
else
{
return
false
}
},
sendLink
:
throttle
(
function
(
item
,
type
)
{
const
result
=
this
.
handleAccount
()
if
(
!
result
)
{
this
.
$message
.
warning
(
'请稍后再试'
)
return
false
}
let
str
=
''
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'网页游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
)
{
str
=
'安卓游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'IOS游戏链接:'
}
else
{
}
// const list = [
// { msgtype: 'text', text: { content: `${str}${this.webForm.channel_id.game_url}` }}
// ]
this
.
sendChatMessage
(
`
${
str
}${
this
.
webForm
.
channel_id
.
game_url
}
`
,
'text'
)
// this.set_sendSkillMessage(list)
this
.
close
()
},
500
),
sendPassword
:
throttle
(
function
(
item
,
type
)
{
const
result
=
this
.
handleAccount
()
if
(
!
result
)
{
this
.
$message
.
warning
(
'请稍后再试'
)
return
false
}
let
str
=
''
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'网页游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
)
{
str
=
'安卓游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'IOS游戏链接:'
}
else
{
}
const
username
=
this
.
bindGameUserList
.
find
(
(
item
)
=>
item
.
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
.
close
()
})
.
catch
((
err
)
=>
{
const
list
=
[
{
msgtype
:
'text'
,
text
:
{
content
:
`账号:
${
username
}
`
}}
]
// this.set_sendSkillMessage(list)
this
.
sendChatMessage
(
`账号:
${
username
}
`
,
'text'
)
console
.
log
(
err
)
this
.
close
()
})
},
500
),
sendMessageThree
:
throttle
(
function
(
item
,
type
)
{
const
result
=
this
.
handleAccount
()
if
(
!
result
)
{
this
.
$message
.
warning
(
'请稍后再试'
)
return
false
}
let
str
=
''
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'网页游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
)
{
str
=
'安卓游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'IOS游戏链接:'
}
else
{
}
const
username
=
this
.
bindGameUserList
.
find
(
(
item
)
=>
item
.
member_id
==
this
.
accountSelect
).
username
passwardEncryption
({
member_id
:
this
.
accountSelect
})
.
then
((
res
)
=>
{
const
list
=
[
{
msgtype
:
'text'
,
text
:
{
content
:
`
${
str
}${
this
.
webForm
.
channel_id
.
game_url
}
\n账号:
${
username
}
\n密码:
${
res
.
data
.
encryptPassword
}
`
,
key
:
res
.
data
.
key
,
iv
:
res
.
data
.
iv
}
}
]
// this.set_sendSkillMessage(list)
this
.
sendChatMessage
(
`
${
str
}${
this
.
webForm
.
channel_id
.
game_url
}
\n账号:
${
username
}
\n密码:
${
res
.
data
.
encryptPassword
}
`
,
'text'
)
this
.
close
()
})
.
catch
((
err
)
=>
{
const
list
=
[
{
msgtype
:
'text'
,
text
:
{
content
:
`
${
str
}${
item
.
url
}
\n账号:
${
username
}
`
}
}
]
// this.set_sendSkillMessage(list)
this
.
sendChatMessage
(
`
${
str
}${
this
.
webForm
.
channel_id
.
game_url
}
\n账号:
${
username
}
`
,
'text'
)
this
.
close
()
})
},
500
),
sendMessageToGame
(
data
)
{
// 1微信小游戏 2 h5 3 安卓 4 ios 5 抖音小游戏
let
str
=
''
let
list
=
[]
if
(
data
.
game_type
==
2
)
{
str
=
'游戏链接:'
+
data
.
web_login_link
+
'
\
n'
+
'账号登录链接:'
+
data
.
web_login_member_link
}
else
if
(
data
.
game_type
==
3
||
data
.
game_type
==
4
)
{
str
=
'app链接:'
+
data
.
download
}
else
{
}
if
(
data
.
game_type
==
'1'
||
data
.
game_type
==
'5'
)
{
// list = [{ msgtype: 'image', image: { picurl: data.channel_qrcode + '?time=' + new Date().getTime() }}]
this
.
sendChatMessage
(
data
.
channel_qrcode
+
'?time='
+
new
Date
().
getTime
(),
'image'
)
}
else
{
if
(
data
.
password
&&
data
.
password
.
trim
()
!==
''
)
{
// list = [{ msgtype: 'text', text: { content: `${str} \n账号:${data.username} \n密码:${data.password}`, key: data.key, iv: data.iv }}]
this
.
sendChatMessage
(
`
${
str
}
\n账号:
${
data
.
username
}
\n密码:
${
data
.
password
}
`
,
'text'
)
}
else
{
// list = [{ msgtype: 'text', text: { content: `${str} \n账号:${data.username}` }}]
this
.
sendChatMessage
(
`
${
str
}
\n账号:
${
data
.
username
}
`
,
'text'
)
}
}
if
(
this
.
channelInfoList
.
use_type
==
2
)
{
this
.
set_send_game_log
({
game_id
:
this
.
webForm
.
channel_id
.
game_id
,
game_name
:
this
.
webForm
.
channel_id
.
game_name
})
}
// this.set_sendSkillMessage(list)
// this.sendChatMessage(str,'text')
},
async
sendChatMessage
(
content
,
type
)
{
// 调用公共的sendChatMessage方法
await
sendChatMessage
(
content
,
type
)
},
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.dialog-footer
{
width
:
calc
(
100%
-
20px
);
height
:
52px
;
position
:
absolute
;
right
:
20px
;
bottom
:
20px
;
padding-top
:
20px
;
border-top
:
1px
solid
rgba
(
0
,
0
,
0
,
0.06
);
justify-content
:
flex-end
;
.btn
{
width
:
84px
;
height
:
32px
;
}
}
</
style
>
\ No newline at end of file
src/views/components/quickSendGame/sendGame/sendSelectChannel.vue
0 → 100644
浏览文件 @
d97282f3
<
template
>
</
template
>
<
script
>
import
{
recallChannelSeq
,
autoResetPassword
,
passwardEncryption
}
from
'@/api/game'
import
{
mapState
,
mapMutations
}
from
'vuex'
import
{
zyouGetMemberLink
}
from
'@/api/works'
import
{
throttle
,
sendChatMessage
}
from
'@/utils/index'
export
default
{
props
:
[
'show'
,
'channelInfoList'
,
'chatUser'
],
data
()
{
return
{
channelselectList
:
[],
webForm
:
{
channel_id
:
''
}
}
},
watch
:
{
show
(
newVal
,
oldVal
)
{
if
(
newVal
)
{
this
.
webForm
.
channel_id
=
this
.
channelInfoList
.
channelList
[
0
]
console
.
log
(
this
.
channelInfoList
,
'channelInfoList'
,
this
.
webForm
)
this
.
onConfirm
()
}
}
},
computed
:
{
...
mapState
(
'game'
,
[
'accountSelect'
,
'bindGameUserList'
]),
...
mapState
(
'user'
,
[
'userInfo'
])
},
methods
:
{
...
mapMutations
(
'game'
,
[
'set_send_game_log'
]),
close
()
{
this
.
$emit
(
'update:show'
,
false
)
},
async
sendChatMessage
(
content
,
type
)
{
// 调用公共的sendChatMessage方法
await
sendChatMessage
(
content
,
type
)
},
// const list = [{ msgtype: 'text', text: { content: `${str}${item.url}` }}]
// this.set_sendSkillMessage(list)
onConfirm
()
{
if
(
this
.
webForm
.
channel_id
===
''
)
{
this
.
$message
.
warning
(
'请选择渠道'
)
return
false
}
// this.channelInfoList.use_type 1 转端 2转游 3 召回
if
(
this
.
channelInfoList
.
use_type
==
2
)
{
// 转游的时候调用接口获取 url 其他直接从 channelList 中获取 url
const
data
=
{
game_id
:
this
.
webForm
.
channel_id
.
game_id
,
member_id
:
this
.
accountSelect
,
zq_user_id
:
this
.
userInfo
.
id
,
use_type
:
this
.
channelInfoList
.
use_type
,
channel_key
:
this
.
webForm
.
channel_id
.
key
,
corp_id
:
this
.
chatUser
.
corp_id
,
userid
:
this
.
chatUser
.
userid
,
external_user_id
:
this
.
chatUser
.
external_userid
}
zyouGetMemberLink
(
data
).
then
(
res
=>
{
if
(
res
.
status_code
===
1
)
{
this
.
sendMessageToGame
(
res
.
data
.
data
)
this
.
$message
.
success
(
res
.
msg
)
this
.
close
()
}
})
}
else
{
this
.
sendMessageCall
()
}
},
// 召回染色
async
recallChannelSeq
()
{
const
data
=
{
game_id
:
this
.
channelInfoList
.
game_id
,
member_id
:
this
.
accountSelect
,
key
:
this
.
webForm
.
channel_id
.
key
}
const
res
=
await
recallChannelSeq
(
data
)
},
sendMessageCall
()
{
// 转端的时候 区分发送类型 1:发送链接 2:发送密码 3:发送链接和密码
if
(
this
.
channelInfoList
.
use_type
==
1
)
{
// 转端
if
(
this
.
channelInfoList
.
sendType
==
1
)
{
this
.
sendLink
()
}
else
if
(
this
.
channelInfoList
.
sendType
==
2
)
{
this
.
sendPassword
()
}
else
if
(
this
.
channelInfoList
.
sendType
==
3
)
{
this
.
sendMessageThree
()
}
}
else
if
(
this
.
channelInfoList
.
use_type
==
3
)
{
// 召回
// 1微信小游戏 2 h5 3 安卓 4 ios 5 抖音小游戏
let
str
=
''
let
list
=
[]
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'游戏链接:'
+
this
.
webForm
.
channel_id
.
game_url
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
||
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'app链接:'
+
this
.
webForm
.
channel_id
.
game_url
}
else
{
}
if
(
this
.
webForm
.
channel_id
.
game_type
==
'1'
||
this
.
webForm
.
channel_id
.
game_type
==
'5'
)
{
// list = [{ msgtype: 'image', image: { picurl: this.webForm.channel_id.game_url + '?time=' + new Date().getTime() }}]
this
.
sendChatMessage
(
this
.
webForm
.
channel_id
.
game_url
+
'?time='
+
new
Date
().
getTime
(),
'image'
)
}
else
{
// list = [{ msgtype: 'text', text: { content: str }}]
this
.
sendChatMessage
(
str
,
'text'
)
}
// this.set_sendSkillMessage(list)
// this.sendChatMessage(str,'text')
// 3:召回 召回的时候请求召回染色的接口
this
.
recallChannelSeq
()
}
this
.
close
()
},
handleAccount
()
{
if
(
this
.
bindGameUserList
.
length
>
0
)
{
const
account
=
this
.
bindGameUserList
.
find
(
(
item
)
=>
item
.
member_id
==
this
.
accountSelect
)
if
(
account
)
{
return
true
}
else
{
return
false
}
}
else
{
return
false
}
},
sendLink
:
throttle
(
function
(
item
,
type
)
{
const
result
=
this
.
handleAccount
()
if
(
!
result
)
{
this
.
$message
.
warning
(
'请稍后再试'
)
return
false
}
let
str
=
''
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'网页游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
)
{
str
=
'安卓游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'IOS游戏链接:'
}
else
{
}
// const list = [
// { msgtype: 'text', text: { content: `${str}${this.webForm.channel_id.game_url}` }}
// ]
// this.set_sendSkillMessage(list)
this
.
sendChatMessage
(
`
${
str
}${
this
.
webForm
.
channel_id
.
game_url
}
`
,
'text'
)
this
.
close
()
},
500
),
sendPassword
:
throttle
(
function
(
item
,
type
)
{
const
result
=
this
.
handleAccount
()
if
(
!
result
)
{
this
.
$message
.
warning
(
'请稍后再试'
)
return
false
}
let
str
=
''
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'网页游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
)
{
str
=
'安卓游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'IOS游戏链接:'
}
else
{
}
const
username
=
this
.
bindGameUserList
.
find
(
(
item
)
=>
item
.
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
.
close
()
})
.
catch
((
err
)
=>
{
// const list = [
// { msgtype: 'text', text: { content: `账号:${username}` }}
// ]
// this.set_sendSkillMessage(list)
this
.
sendChatMessage
(
`账号:
${
username
}
`
,
'text'
)
console
.
log
(
err
)
this
.
close
()
})
},
500
),
sendMessageThree
:
throttle
(
function
(
item
,
type
)
{
const
result
=
this
.
handleAccount
()
if
(
!
result
)
{
this
.
$message
.
warning
(
'请稍后再试'
)
return
false
}
let
str
=
''
if
(
this
.
webForm
.
channel_id
.
game_type
==
2
)
{
str
=
'网页游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
3
)
{
str
=
'安卓游戏链接:'
}
else
if
(
this
.
webForm
.
channel_id
.
game_type
==
4
)
{
str
=
'IOS游戏链接:'
}
else
{
}
const
username
=
this
.
bindGameUserList
.
find
(
(
item
)
=>
item
.
member_id
==
this
.
accountSelect
).
username
passwardEncryption
({
member_id
:
this
.
accountSelect
})
.
then
((
res
)
=>
{
// const list = [
// {
// msgtype: 'text',
// text: {
// content: `${str}${this.webForm.channel_id.game_url} \n账号:${username} \n密码:${res.data.encryptPassword}`,
// key: res.data.key, iv: res.data.iv
// }
// }
// ]
// this.set_sendSkillMessage(list)
this
.
sendChatMessage
(
`
${
str
}${
this
.
webForm
.
channel_id
.
game_url
}
\n账号:
${
username
}
\n密码:
${
res
.
data
.
encryptPassword
}
`
,
'text'
)
this
.
close
()
})
.
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
.
close
()
})
},
500
),
sendMessageToGame
(
data
)
{
// 1微信小游戏 2 h5 3 安卓 4 ios 5 抖音小游戏
let
str
=
''
let
list
=
[]
if
(
data
.
game_type
==
2
)
{
str
=
'游戏链接:'
+
data
.
web_login_link
+
'
\
n'
+
'账号登录链接:'
+
data
.
web_login_member_link
}
else
if
(
data
.
game_type
==
3
||
data
.
game_type
==
4
)
{
str
=
'app链接:'
+
data
.
download
}
else
{
}
if
(
data
.
game_type
==
'1'
||
data
.
game_type
==
'5'
)
{
// list = [{ msgtype: 'image', image: { picurl: data.channel_qrcode + '?time=' + new Date().getTime() }}]
this
.
sendChatMessage
(
data
.
channel_qrcode
+
'?time='
+
new
Date
().
getTime
(),
'image'
)
}
else
{
if
(
data
.
password
&&
data
.
password
.
trim
()
!==
''
)
{
// list = [{ msgtype: 'text', text: { content: `${str} \n账号:${data.username} \n密码:${data.password}`, key: data.key, iv: data.iv }}]
this
.
sendChatMessage
(
`
${
str
}
\n账号:
${
data
.
username
}
\n密码:
${
data
.
password
}
`
,
'text'
)
}
else
{
// list = [{ msgtype: 'text', text: { content: `${str} \n账号:${data.username}` }}]
this
.
sendChatMessage
(
`
${
str
}
\n账号:
${
data
.
username
}
`
,
'text'
)
}
}
// 转游的时候记录发送转游日志
if
(
this
.
channelInfoList
.
use_type
==
2
)
{
this
.
set_send_game_log
({
game_id
:
this
.
webForm
.
channel_id
.
game_id
,
game_name
:
this
.
webForm
.
channel_id
.
main_game_name
})
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.dialog-footer
{
width
:
calc
(
100%
-
20px
);
height
:
52px
;
position
:
absolute
;
right
:
20px
;
bottom
:
20px
;
padding-top
:
20px
;
border-top
:
1px
solid
rgba
(
0
,
0
,
0
,
0.06
);
justify-content
:
flex-end
;
.btn
{
width
:
84px
;
height
:
32px
;
}
}
</
style
>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论