更新记录
1.0.20251030(2025-10-30)
- 鸿蒙SDK对接
- 优化已知问题
1.0.20250831(2025-08-30)
更新README
1.0.20250830(2025-08-30)
- 实现andorid和ios分享逻辑
- 完善README
查看更多
平台兼容性
uni-app(4.07)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| - |
- |
- |
- |
- |
- |
√ |
12 |
√ |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| - |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x(4.07)
| Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
| - |
- |
- |
- |
- |
- |
引入插件
- 点击插件试用引入到项目
- 打包自定义基座包
- 按照下方示例测试
- 先插件试用,完全符合需求后购买
平台差异
Android
IOS
- 找到cms-workwx/app-ios/Info.plist 文件替换其中【scheme】为你自己的scheme
Harmony鸿蒙 (未进行真机测试,使用时有问题可在文档底部反馈我)
- 参照链接创建harmony-configs/entry/src/main/module.json5文件, 定义 querySchemes。
- 在harmony-configs/entry/src/main/module.json5的 "module"下增加 "querySchemes": ["wxworkapi","https"]

插件引入
import * as workwxUtils from "@/uni_modules/cms-workwx";
插件方法
| 方法 |
描述 |
参数 |
兼容性 |
| registerApp(WorkwxRegisterAppOption):boolean |
注册App |
WorkwxRegisterAppOption见下方 |
Android/IOS/Harmony |
| isInstalled():boolean |
是否安装企业微信 |
无 |
Android/IOS/Harmony |
| openApp():boolean |
打开企业微信 |
无 |
Android/IOS |
| login(LoginOption):void |
登录 |
LoginOption见下方 |
Android/IOS/Harmony |
| sendText(text:string):boolean |
分享文本 |
text:分享的文本 |
Android/IOS |
| sendImage(fileName:string, filePath:string):boolean |
分享图片 |
fileName:文件名, filePath:文件路径 |
Android/IOS/Harmony |
| sendVideo(fileName:string, filePath:string):boolean |
分享视频 |
fileName:文件名, filePath:文件路径 |
Android/IOS |
| sendFile(fileName:string, filePath:string):boolean |
分享文件 |
fileName:文件名, filePath:文件路径 |
Android/IOS/Harmony |
| sendLink(SendLinkOption):boolean |
分享链接 |
SendLinkOption见下方 |
Android/IOS/Harmony |
| sendMiniProgram(SendMiniProgramOption):void |
分享小程序 |
SendMiniProgramOption见下方 |
Android/IOS |
WorkwxRegisterAppOption
| 参数 |
类型 |
描述 |
必填 |
| scheme |
string |
第三方App的Scheme |
是 |
| corpid |
string |
第三方App所属企业的ID |
是 |
| appid |
string |
第三方App在企业内部的ID也就是AgentId |
是 |
LoginOption
| 参数 |
类型 |
描述 |
必填 |
| state |
string |
state 会在成功和失败原样返回 |
否 |
| success |
(code : string, state : string) => void |
成功回调 |
是 |
| fail |
(errCode : number, errMsg : string, state : string) => void |
失败回调 |
否 |
SendLinkOption
| 参数 |
类型 |
描述 |
必填 |
| thumbUrl |
string |
缩略图(鸿蒙下不可使用本地图片) |
是 |
| webpageUrl |
string |
链接 |
是 |
| title |
string |
标题 |
是 |
| desc |
string |
描述 |
是 |
SendMiniProgramOption
| 参数 |
类型 |
描述 |
必填 |
| username |
string |
必须是应用关联的小程序,注意要有@app后缀 gh_dde54cb88ce7@app |
是 |
| desc |
string |
描述 |
是 |
| title |
string |
标题 |
是 |
| hdImageUrl |
string |
图片 |
是 |
| path |
string |
小程序路径 |
否 |
| success |
() => void |
成功回调 |
否 |
| fail |
(errCode : number, errMsg : string) => void |
失败回调 |
否 |
注意
- 分享的文件并不是所有类型都可以分享 目前发现类型: .zip
- IOS下可以分享链接的缩略图可以使用本地选择的图片但注意图片大小 32kb
- Andorid Content URI路径文件拿取不到真实的文件名称,需使用插件市场其他插件本插件仅做最简示例
示例页面
所有方法需在 registerApp() 方法调用之后
<template>
<view>
<button type="primary" @click="registerApp">注册</button>
<button type="primary" @click="isInstalled">是否安装企业微信</button>
<button type="primary" @click="openWWApp">打开企业微信</button>
<button type="primary" @click="login">登陆</button>
<button type="primary" @click="sendText">分享文本</button>
<button type="primary" @click="sendImage">分享图片</button>
<button type="primary" @click="sendVideo">分享视频</button>
<button type="primary" @click="sendFile">分享文件</button>
<button type="primary" @click="sendLink">分享网页</button>
<button type="primary" @click="sendMiniProgram">分享小程序</button>
</view>
</template>
<script>
import * as workwxUtils from "@/uni_modules/cms-workwx";
export default {
methods: {
registerApp() {
this.showModal('registerApp', workwxUtils.registerApp({
// 第三方App的Scheme
scheme: "",
// 第三方App所属企业的ID
corpid: "",
// 第三方App在企业内部的ID也就是AgentId
appid: ""
}))
},
isInstalled(){;
this.showModal('isInstalled', workwxUtils.isInstalled() ? '已安装' : '未安装')
},
openWWApp(){
console.log('openApp:',workwxUtils.openApp());
},
login() {
workwxUtils.login({
state: "test",
success: (code, state) => {
this.showModal('login success', JSON.stringify({
code,
state
}));
},
fail: (errCode, errMsg, state) => {
this.showModal('login fail', JSON.stringify({
errCode,
errMsg,
state
}));
}
});
},
sendText() {
this.showModal("sendText", workwxUtils.sendText("一段文本"));
},
sendImage() {
uni.chooseImage({
count: 1,
success: (res) => {
let absPath = plus.io.convertLocalFileSystemURL(res.tempFilePaths[0]);
let splitArray = absPath.split('/');
let fileName = splitArray[splitArray.length - 1];
workwxUtils.sendImage(fileName, absPath)
}
});
},
sendVideo() {
uni.chooseVideo({
count: 1,
success: (res) => {
let absPath = plus.io.convertLocalFileSystemURL(res.tempFilePath);
let splitArray = absPath.split('/');
let fileName = splitArray[splitArray.length - 1];
workwxUtils.sendVideo(fileName, absPath)
}
});
},
sendFile() {
plus.io.chooseFile({
title: '选择文件',
filetypes: ['*'], // 允许所有文件类型
multiple: false,
}, (e) => {
if (e.files && e.files.length > 0) {
let osName = uni.getSystemInfoSync().osName;
let arr = e.files[0].split('/');
// 注:Andorid情况下如果获取到Content URI是拿不到真实文件名!需要用户使用其他文件选择插件,此处仅演示功能
let fileName = arr[arr.length - 1];
workwxUtils.sendFile(fileName, osName == 'ios' ? e.files[0] : plus.io.convertLocalFileSystemURL(e.files[0]))
}
}, (err) => {
uni.showToast({
title: '文件选择失败',
icon: 'none'
});
});
},
sendLink() {
workwxUtils.sendLink({
thumbUrl: "https://env-00jxt1cobn8u-static.normal.cloudstatic.cn/kuaiqucan/108.png", // 缩略图
webpageUrl: "https://ext.dcloud.net.cn/plugin?id=24912", // 链接
title: "UTS 企业微信", // 标题
desc: "这是一段描述这是一段描述这是一段描述,这是一段描述...", //描述
})
},
sendMiniProgram() {
uni.chooseImage({
count: 1,
success: (res) => {
let absPath = plus.io.convertLocalFileSystemURL(res.tempFilePaths[0]);
let splitArray = absPath.split('/');
let fileName = splitArray[splitArray.length - 1];
workwxUtils.sendMiniProgram({
//必须是应用关联的小程序,注意要有@app后缀
username: "gh_dde54cb88ce7@app",
title: "测试_MaHow",
hdImageUrl: absPath,
path: "/pages/plugin/index.html?plugid=1cbd3b7c8674e61769436b5e354ddb2f",
desc: "dddddd1",
success: () => {
console.log('分享小程序成功')
},
fail: (errCode, errMsg) => {
console.log(`分享小程序失败:errCode:${errCode},errMsg:${errMsg}`);
}
})
}
});
},
showModal(title, content) {
uni.showModal({
title,
content: content + ''
})
}
}
}
</script>
参考链接
IOS应用
需要帮助?有其他插件的需求?联系我!