Commit 6e010eee by zhouzy

3

2 parents d2961911 81331e7c
const url = '/rop-scrm-sso/router' const url = 'http://192.168.2.42:8064/rop-scrm-entmicro/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
}) })
......
...@@ -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_config from './wxConfig' import wxConfig from './wxConfig'
export { export {
ssoApi, ssoApi,
groupChat, groupChat,
wx_config wxConfig
} }
\ No newline at end of file \ No newline at end of file
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) {
return new Promise((resolve, reject) => {
jsApiList.map(e => { jsApiList.map(e => {
if (e == 'chooseImage') jsApiList.push('getLocalImgData') if (e == 'chooseImage') jsApiList.push('getLocalImgData')
}) })
...@@ -19,7 +20,6 @@ class WxConfig { ...@@ -19,7 +20,6 @@ class WxConfig {
data data
}).then(obj => { }).then(obj => {
if (obj) { if (obj) {
console.log(obj)
wx.agentConfig({ wx.agentConfig({
corpid: obj.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致 corpid: obj.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: obj.agentId, // 必填,企业微信的应用id (e.g. 1000247) agentid: obj.agentId, // 必填,企业微信的应用id (e.g. 1000247)
...@@ -28,24 +28,29 @@ class WxConfig { ...@@ -28,24 +28,29 @@ class WxConfig {
signature: obj.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法, signature: obj.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList, jsApiList,
success(res) { success(res) {
console.log(res) console.log(res, 'wx_config')
resolve()
}, },
fail(err) { fail(err) {
console.log(err) console.log(err, 'wx_config')
reject()
} }
}) })
} else { } else {
Notify('网络异常') 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) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!