Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
dj-scrm-wx-work-attachment-customer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6e010eee
authored
Nov 11, 2021
by
zhouzy
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
3
2 parents
d2961911
81331e7c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
85 deletions
src/api/groupChat.js
src/api/index.js
src/api/wxConfig.js
src/views/customerGroup/index.vue
src/api/groupChat.js
View file @
6e010ee
const
url
=
'
/rop-scrm-ss
o/router'
const
url
=
'
http://192.168.2.42:8064/rop-scrm-entmicr
o/router'
const
returnAll
=
true
const
returnAll
=
true
export
default
{
export
default
{
/**获取群聊列表 */
/**获取群聊列表 */
getList
(
data
)
{
getList
(
data
)
{
data
.
method
=
'org.ore.api.one.template.list'
data
.
method
=
'org.ore.api.one.template.list'
data
.
pageSize
=
9999
data
.
pageNum
=
1
return
window
.
$HTTP
({
return
window
.
$HTTP
({
url
,
data
,
data
,
returnAll
returnAll
})
})
...
@@ -13,14 +16,16 @@ export default {
...
@@ -13,14 +16,16 @@ export default {
getDetail
(
data
)
{
getDetail
(
data
)
{
data
.
method
=
'org.ore.api.one.template.detail'
data
.
method
=
'org.ore.api.one.template.detail'
return
window
.
$HTTP
({
return
window
.
$HTTP
({
url
,
data
,
data
,
returnAll
returnAll
})
})
},
},
/**
创建
新的群聊 */
/**
保存
新的群聊 */
addChat
(
data
)
{
addChat
(
data
)
{
data
.
method
=
'org.ore.api.group.one.insert'
data
.
method
=
'org.ore.api.group.one.insert'
return
window
.
$HTTP
({
return
window
.
$HTTP
({
url
,
data
,
data
,
returnAll
returnAll
})
})
...
...
src/api/index.js
View file @
6e010ee
...
@@ -8,9 +8,9 @@
...
@@ -8,9 +8,9 @@
*/
*/
import
groupChat
from
'./groupChat'
import
groupChat
from
'./groupChat'
import
ssoApi
from
'./ssoApi'
import
ssoApi
from
'./ssoApi'
import
wx
_c
onfig
from
'./wxConfig'
import
wx
C
onfig
from
'./wxConfig'
export
{
export
{
ssoApi
,
ssoApi
,
groupChat
,
groupChat
,
wx
_c
onfig
wx
C
onfig
}
}
\ No newline at end of file
\ No newline at end of file
src/api/wxConfig.js
View file @
6e010ee
import
util
from
'@/utils/util'
import
util
from
'@/utils/util'
import
{
Notify
}
from
'vant'
import
{
Notify
}
from
'vant'
class
WxConfig
{
const
WxConfig
=
{
constructor
(
jsApiList
)
{
init
(
jsApiList
)
{
jsApiList
.
map
(
e
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
e
==
'chooseImage'
)
jsApiList
.
push
(
'getLocalImgData'
)
jsApiList
.
map
(
e
=>
{
})
if
(
e
==
'chooseImage'
)
jsApiList
.
push
(
'getLocalImgData'
)
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'#'
)
})
const
{
corpId
}
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'#'
)
/** 获取企微应用AgentConfig */
const
{
corpId
}
=
util
.
getLocalStorage
(
'dj_scrm_corpId'
)
let
data
=
{
/** 获取企微应用AgentConfig */
corpId
,
let
data
=
{
method
:
'scrm.api.work.wechat.get.agent.config'
,
corpId
,
url
:
redirectUrl
,
method
:
'scrm.api.work.wechat.get.agent.config'
,
appCode
:
'DJQWGJ'
url
:
redirectUrl
,
}
appCode
:
'DJQWGJ'
window
.
$HTTP
({
url
:
'/rop-scrm-wechat/router'
,
data
}).
then
(
obj
=>
{
if
(
obj
)
{
console
.
log
(
obj
)
wx
.
agentConfig
({
corpid
:
obj
.
corpId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
obj
.
agentId
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
:
obj
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
obj
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
obj
.
signature
,
// 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList
,
success
(
res
)
{
console
.
log
(
res
)
},
fail
(
err
)
{
console
.
log
(
err
)
}
})
}
else
{
Notify
(
'网络异常'
)
}
}
window
.
$HTTP
({
url
:
'/rop-scrm-wechat/router'
,
data
}).
then
(
obj
=>
{
if
(
obj
)
{
wx
.
agentConfig
({
corpid
:
obj
.
corpId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
obj
.
agentId
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
:
obj
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
obj
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
obj
.
signature
,
// 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList
,
success
(
res
)
{
console
.
log
(
res
,
'wx_config'
)
resolve
()
},
fail
(
err
)
{
console
.
log
(
err
,
'wx_config'
)
reject
()
}
})
}
else
{
Notify
(
'网络异常'
)
}
})
})
})
}
}
,
getContext
(
callBack
)
{
getContext
(
callBack
)
{
/**
/**
* entry String 场景值
* entry String 场景值
* shareTicket String 仅当转发时设置了withShareTicket转发到会话的消息进入才返回该字段,详见私密消息
* shareTicket String 仅当转发时设置了withShareTicket转发到会话的消息进入才返回该字段,详见私密消息
**/
**/
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
invoke
(
'getContext'
,
{},
({
err_msg
,
entry
,
shareTicket
})
=>
{
wx
.
invoke
(
'getContext'
,
{},
(
res
)
=>
{
console
.
log
(
res
)
let
{
err_msg
,
entry
,
shareTicket
}
=
res
/** entry 说明
/** entry 说明
*contact_profile 从联系人详情进入 3.0.24
*contact_profile 从联系人详情进入 3.0.24
*single_chat_tools 从单聊会话的工具栏进入 3.0.24
*single_chat_tools 从单聊会话的工具栏进入 3.0.24
...
@@ -65,87 +70,85 @@ class WxConfig {
...
@@ -65,87 +70,85 @@ class WxConfig {
}
}
})
})
})
})
}
}
,
/**获取当前外部联系人userid */
/**获取当前外部联系人userid */
getCurExternalContact
()
{
getCurExternalContact
()
{
return
this
.
getContext
((
resolve
,
{
return
new
Promise
((
resolve
,
reject
)
=>
{
entry
,
})
=>
{
wx
.
invoke
(
'getCurExternalContact'
,
{},
res
=>
{
wx
.
invoke
(
'getCurExternalContact'
,
{},
res
=>
{
if
(
entry
==
'contact_profile'
||
entry
==
'single_chat_tools'
)
{
if
(
res
.
err_msg
==
'getCurExternalContact:ok'
)
{
if
(
res
.
err_msg
==
'getCurExternalContact:ok'
)
{
resolve
(
res
.
userId
)
resolve
(
res
.
userId
)
}
}
else
{
}
else
{
Notify
(
'需有配置客户联系功能权限'
)
reject
(
res
)
}
}
})
})
},
/** 外部联系人选人接口 */
selectExternalContact
()
{
return
new
Promise
((
resolve
)
=>
{
wx
.
invoke
(
'selectExternalContact'
,
{
filterType
:
0
,
//0表示展示全部外部联系人列表,1表示仅展示未曾选择过的外部联系人。默认值为0;除了0与1,其他值非法。在企业微信2.4.22及以后版本支持该参数
},
res
=>
{
if
(
res
.
err_msg
==
"selectExternalContact:ok"
)
{
resolve
(
res
)
}
})
})
})
})
}
},
/**分享消息到当前会话 */
/**分享消息到当前会话 */
sendChatMessage
(
params
)
{
sendChatMessage
(
params
)
{
return
this
.
getContext
((
resolve
,
{
console
.
log
(
params
)
entry
,
return
new
Promise
((
resolve
)
=>
{
shareTicket
})
=>
{
wx
.
invoke
(
'sendChatMessage'
,
params
,
res
=>
{
wx
.
invoke
(
'sendChatMessage'
,
params
,
res
=>
{
if
(
entry
==
'chat_attachment'
)
{
console
.
log
(
res
)
if
(
res
.
err_msg
==
'sendChatMessage:ok'
)
{
if
(
res
.
err_msg
==
'sendChatMessage:ok'
)
{
resolve
()
resolve
()
}
}
else
{
Notify
(
'需有配置客户联系功能权限'
)
}
}
})
})
})
})
}
}
,
/**群发消息给客户 */
/**群发消息给客户 */
shareToExternalContact
(
params
)
{
shareToExternalContact
(
params
)
{
return
this
.
getContext
(
resolve
=>
{
return
new
Promise
((
resolve
)
=>
{
wx
.
invoke
(
'shareToExternalContact'
,
params
,
res
=>
{
wx
.
invoke
(
'shareToExternalContact'
,
params
,
res
=>
{
if
(
res
.
err_msg
==
'shareToExternalContact:ok'
)
{
if
(
res
.
err_msg
==
'shareToExternalContact:ok'
)
{
resolve
()
resolve
()
}
else
{
Notify
(
'需有配置客户联系功能权限'
)
}
}
})
})
})
})
}
}
,
/**群发消息到客户群 */
/**群发消息到客户群 */
shareToExternalChat
(
params
)
{
shareToExternalChat
(
params
)
{
return
this
.
getContext
(
resolve
=>
{
return
new
Promise
((
resolve
)
=>
{
wx
.
invoke
(
'shareToExternalChat'
,
params
,
res
=>
{
wx
.
invoke
(
'shareToExternalChat'
,
params
,
res
=>
{
if
(
res
.
err_msg
==
'shareToExternalChat:ok'
)
{
if
(
res
.
err_msg
==
'shareToExternalChat:ok'
)
{
resolve
()
resolve
()
}
else
{
Notify
(
'需有配置客户联系功能权限'
)
}
}
})
})
})
})
}
}
,
/**进入添加客户界面 */
/**进入添加客户界面 */
navigateToAddCustomer
()
{
navigateToAddCustomer
()
{
wx
.
invoke
(
'navigateToAddCustomer'
)
wx
.
invoke
(
'navigateToAddCustomer'
)
}
}
,
/**发表内容到客户朋友圈 */
/**发表内容到客户朋友圈 */
shareToExternalMoments
(
params
)
{
shareToExternalMoments
(
params
)
{
return
this
.
getContext
(
resolve
=>
{
return
new
Promise
((
resolve
)
=>
{
wx
.
invoke
(
'shareToExternalMoments'
,
params
,
res
=>
{
wx
.
invoke
(
'shareToExternalMoments'
,
params
,
res
=>
{
if
(
res
.
err_msg
==
'shareToExternalMoments:ok'
)
{
if
(
res
.
err_msg
==
'shareToExternalMoments:ok'
)
{
resolve
()
resolve
()
}
else
{
Notify
(
'需有配置客户联系功能权限'
)
}
}
})
})
})
})
}
}
,
/**打开会话 */
/**打开会话 */
openEnterpriseChat
({
openEnterpriseChat
({
...
@@ -173,7 +176,7 @@ class WxConfig {
...
@@ -173,7 +176,7 @@ class WxConfig {
}
}
})
})
})
})
}
}
,
/**企业微信扫一扫 */
/**企业微信扫一扫 */
scanQRCode
(
needResult
)
{
scanQRCode
(
needResult
)
{
...
@@ -192,7 +195,7 @@ class WxConfig {
...
@@ -192,7 +195,7 @@ class WxConfig {
}
}
})
})
})
})
}
}
,
/**获取本地图片接口 */
/**获取本地图片接口 */
getLocalImgData
(
localId
)
{
getLocalImgData
(
localId
)
{
...
@@ -207,7 +210,7 @@ class WxConfig {
...
@@ -207,7 +210,7 @@ class WxConfig {
}
}
})
})
})
})
}
}
,
/**拍照或从手机相册中选图接口 */
/**拍照或从手机相册中选图接口 */
chooseImage
(
count
=
1
)
{
chooseImage
(
count
=
1
)
{
...
@@ -231,7 +234,7 @@ class WxConfig {
...
@@ -231,7 +234,7 @@ class WxConfig {
}
}
})
})
})
})
}
}
,
/**预览图片接口 */
/**预览图片接口 */
previewImage
(
obj
)
{
previewImage
(
obj
)
{
...
@@ -239,7 +242,7 @@ class WxConfig {
...
@@ -239,7 +242,7 @@ class WxConfig {
* urls 需要预览的图片http链接列表
* urls 需要预览的图片http链接列表
*/
*/
wx
.
previewImage
(
obj
)
wx
.
previewImage
(
obj
)
}
}
,
/**上传图片接口 */
/**上传图片接口 */
uploadImage
(
localId
)
{
uploadImage
(
localId
)
{
...
@@ -253,7 +256,7 @@ class WxConfig {
...
@@ -253,7 +256,7 @@ class WxConfig {
}
}
})
})
})
})
}
}
,
/**下载图片接口 */
/**下载图片接口 */
downloadImage
(
serverId
)
{
downloadImage
(
serverId
)
{
...
@@ -267,7 +270,7 @@ class WxConfig {
...
@@ -267,7 +270,7 @@ class WxConfig {
})
})
})
})
}
}
,
/**使用企业微信内置地图查看位置接口 */
/**使用企业微信内置地图查看位置接口 */
openLocation
(
obj
)
{
openLocation
(
obj
)
{
...
@@ -279,7 +282,7 @@ class WxConfig {
...
@@ -279,7 +282,7 @@ class WxConfig {
scale, // 地图缩放级别,整形值,范围从1~28。默认为16
scale, // 地图缩放级别,整形值,范围从1~28。默认为16
*/
*/
wx
.
openLocation
(
obj
)
wx
.
openLocation
(
obj
)
}
}
,
/**获取地理位置接口 */
/**获取地理位置接口 */
getLocation
(
type
=
'wgs84'
)
{
getLocation
(
type
=
'wgs84'
)
{
...
@@ -291,7 +294,7 @@ class WxConfig {
...
@@ -291,7 +294,7 @@ class WxConfig {
}
}
})
})
})
})
}
}
,
/**自定义转发到会话 */
/**自定义转发到会话 */
shareAppMessage
(
obj
)
{
shareAppMessage
(
obj
)
{
...
...
src/views/customerGroup/index.vue
View file @
6e010ee
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment