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 个修改的文件
包含
434 行增加
和
58 行删除
+434
-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
+0
-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
差异被折叠。
点击展开。
src/views/components/quickSendGame/sendGame/sendSelectChannel.vue
0 → 100644
浏览文件 @
d97282f3
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论