更新记录
1.0.1(2025-06-13)
- 修复iOS 18问题
1.0.0(2025-06-11)
南网eLink企业微信私有化部署登陆分享
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
- |
- |
- |
- |
4.4 |
12 |
× |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
× |
× |
× |
× |
× |
× |
- |
× |
× |
× |
× |
uni-app x
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
5.0 |
12 |
× |
× |
南网eLink 企业微信私有化部署,分享文本、文件、图片视频、链接、小程序、聊天记录等
集成步骤
- 登陆eLink管理平台,在"应用管理" -》 "应用" -》 "自建"里"创建应用"
- 点击应用进入应用详情,"开发者接口"点击"企业微信授权登陆"进入,添加iOS的Bundle ID(即包名),Android的包名和应用签名,应用签名从android资源下载"签名生成工具"apk安装到手机里获取https://developer.work.weixin.qq.com/document/path/91074
- 集成插件步骤请参考 https://www.cnblogs.com/wenrisheng/p/18323027
- 拷贝demo里的AndroidManifest.xml、Info.plist到项目根目录
- 将Info.plist里的wwauth35b0a570049b750c000005改为iOS的schema
- 修改common/key_center.js里的配置:
export const EnterpriseConfig = {
ios: {
schema: "wwauth35b0a570049b750c000005"// "应用管理" => 点击应用进入应用详情 => 企业微信授权登录
},
android: {
schema: "wwauth35b0a570049b750c000005" // "应用管理" => 点击应用进入应用详情 => 企业微信授权登录
},
corpId: "ww35b0a570049b750c", //企业ID,从“我的企业”-》“企业信息”-》企业ID
agentId: "1000005" // 应用的AgentId,"应用管理"里点击应用进入应用详情,详情页面有AgentId
}
接口
import {
UTSElink
} from "@/uni_modules/wrs-uts-elink"
import * as KeyCenter from '@/common/key_center.js'
UTSElink.onCallback((resp) => {
this.showMsg(JSON.stringify(resp))
let opt = resp.opt
switch (opt) {
case "onResp": {
let errCode = resp.errCode
if (errCode == 0) { // 业务成功
let type = resp.type
switch (type) { // 业务类型
// 登陆授权回调
case "SSOResp": {
let code = resp.code
// 如需获取用户信息,参考官方文档通过code获取用户信息:https://developer.work.weixin.qq.com/document/path/91193
this.showMsg("登陆成功")
}
break;
// 分享消息回调
case "SendMessageResp": {
this.showMsg("分享消息成功")
}
break;
default:
break;
}
}
}
break;
default:
break;
}
})
let params = {}
switch (uni.getSystemInfoSync().platform) {
// android
case 'android': {
params.schema = KeyCenter.EnterpriseConfig.android.schema
}
break;
case 'ios': {
params.appId = KeyCenter.EnterpriseConfig.ios.schema
params.corpId = KeyCenter.EnterpriseConfig.corpId //企业ID
params.agentId = KeyCenter.EnterpriseConfig.agentId// 应用的AgentId
}
break;
default:
break;
}
let flag = UTSElink.registerApp(params)
console.log("flag:" + flag)
let params = {}
params.state = "asfasdf" // 自定义的业务参数
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
}
// 登陆结果在onCallback的回调里
UTSElink.ssoLogin(params, (resp) => {
console.log(JSON.stringify(resp))
})
let params = {}
params.text = "企业微信提供了通讯录管理、应用管理、消息推送、身份验证、移动端SDK、素材、OA数据接口、企业支付、电子发票等API,管理员可以使用这些API,为企业接入更多个性化的办公应用。"
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
params.appName = "testat"
}
// ios的分享结果在onCallback里,android没有结果回调
UTSElink.shareTxt(params, (resp) => {
console.log(JSON.stringify(resp))
})
// 需要先 在应用主页 -》 设置 -> 关联小程序
let params = {}
// 小程序username(带@app后缀)
params.userName = "gh_dde54cb88ce7@app"
// 小程序path, 选填
params.path = "/"
params.hdImageData = this.imagePath
// 分享标题,必填
params.title = "用户需求"
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
params.appName = "testat"
}
// ios的分享结果在onCallback里,android没有结果回调
UTSElink.shareMiniApp(params, (resp) => {
console.log(JSON.stringify(resp))
})
let params = {}
params.filename = "icon.jpg"
params.path = this.imagePath
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
params.appName = "testat"
}
// ios的分享结果在onCallback里,android没有结果回调
UTSElink.shareFile(params, (resp) => {
console.log(JSON.stringify(resp))
})
let params = {}
params.filename = "icon.jpg"
params.path = this.imagePath
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
params.appName = "testat"
}
// ios的分享结果在onCallback里,android没有结果回调
UTSElink.shareImage(params, (resp) => {
console.log(JSON.stringify(resp))
})
let params = {}
params.filename = "video.mp4"
params.path = this.videoPath
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
params.appName = "testat"
}
// ios的分享结果在onCallback里,android没有结果回调
UTSElink.shareVideo(params, (resp) => {
console.log(JSON.stringify(resp))
})
let params = {}
params.title = "百度"
params.summary = "百度简介"
params.url = "https://www.baidu.com"
params.icon = this.imagePath
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
params.appName = "testat"
}
// ios的分享结果在onCallback里,android没有结果回调
UTSElink.shareLink(params, (resp) => {
console.log(JSON.stringify(resp))
})
let params = {}
params.title = "XXX的聊天记录"
params.contents = [{
name: "小明",
avatarUrl: "http://p.qlogo.cn/bizmail/BDHWBviaRjEgxSn7E5dBwXMM0bibQVVFXe6C6dhtAdsGMu7vL7AuNpIQ/100",
attachment: {
type: "text",
text: "关注你我健康"
}
}]
if (this.isAndroid) {
params.schema = KeyCenter.EnterpriseConfig.android.schema
params.appId = KeyCenter.EnterpriseConfig.corpId
params.agentId = KeyCenter.EnterpriseConfig.agentId
params.appName = "testat"
}
// ios的分享结果在onCallback里,android没有结果回调
UTSElink.shareForward(params, (resp) => {
console.log(JSON.stringify(resp))
})