更新记录
1.0.2(2026-10-14)
更新使用说明教程
1.0.1(2026-10-14)
更新插件使用说明
1.0.0(2026-10-14)
发布插件
查看更多平台兼容性
uni-app(5.31)
| Vue2 | Vue2插件版本 | Vue3 | Vue3插件版本 | Chrome | Safari | app-vue | app-vue插件版本 | app-nvue | app-nvue插件版本 | Android | iOS | 鸿蒙 | 鸿蒙插件版本 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| √ | 1.0.2 | √ | 1.0.2 | × | × | √ | 1.0.2 | √ | 1.0.2 | × | × | 5.0.1(13) | 1.0.2 |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 小红书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| × | × | × | × | × | × | × | × | × | × | × | × |
uni-app x(5.31)
| Chrome | Safari | Android | iOS | 鸿蒙 | 鸿蒙插件版本 | 微信小程序 |
|---|---|---|---|---|---|---|
| × | × | × | × | 5.0.1(13) | 1.0.2 | × |
其他
| 多语言 | 暗黑模式 | 宽屏模式 | 蒸汽模式 |
|---|---|---|---|
| × | × | √ | √ |
鸿蒙 京东联盟 登录、唤起京东、在京东搜索、打开指定页面、加购物车-示例
创建应用
京东联盟官网:https://union.jd.com/index
- 注意:京东联盟创建应用需要审核,应用需要先上架应用商店,才会审核通过

获取并配置安全图片
- 点开审核通过的应用,下载SDK

- 文件解压后,包含以下三个文件:Demo、需要引入项目的SDK、安全图片

harmony-configs整体目录结构

阿里百川SDK配置
-
SDK存放路径:harmony-configs/localModules
-
在配置armony-configs/oh-package.json5
{
"modelVersion": "5.0.0",
"description": "Please describe the basic information.",
"dependencies": {
"@ohos/jdunion": "file:./localModules/JDUnionAdSdk_3.6.0.har"
},
"overrides": {
"@ohos/jdunion": "file:./localModules/JDUnionAdSdk_3.6.0.har"
},
"devDependencies": {
"@ohos/hypium": "1.0.18",
"@ohos/hamock": "1.0.0"
},
}
- 配置harmony-configs/entry/oh-package.json5
{
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {
"@ohos/jdunion": "file:./localModules/JDUnionAdSdk_3.6.0.har"
}
}
配置harmony-configs目录下的module.json5
-
在 abilities.skills.entities 里添加 "entity.system.browsable"
-
在 abilities.skills.actions 里添加 "ohos.want.action.viewData"
-
将 abilities.skills.uris.scheme 改成 sdkback+京东联盟应用的appkey
-
在 requestPermissions 里添加权限 ohos.permission.GET_NETWORK_INFO 和 ohos.permission.GET_WIFI_INFO
-
在 querySchemes 里添加 openapp.jdmobile
完整的json文件如下
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"phone",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:layered_image",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.home",
"entity.system.browsable"
],
"actions": [
"action.system.home",
"ohos.want.action.viewData"
],
"uris": [{
"scheme": "sdkbackad2e6eaf1343fc3962a6e17cb1ce0ae" //换成京东联盟应用的appkey
}],
}
]
}
],
"requestPermissions": [
{
"name": "ohos.permission.INTERNET"
},
{
"name": "ohos.permission.GET_NETWORK_INFO",
},
{
"name": "ohos.permission.GET_WIFI_INFO"
}
],
"metadata": [],
"querySchemes": [
"openapp.jdmobile",
],
}
方法使用说明
引用插件
// #ifdef APP-HARMONY
import * as jdunion from '@/uni_modules/hmos-jdunion'
// #endif
1. 初始化
jdunion.init(appkey, keySecret).then((res) => {
if (res) {
console.log('JDUnion Init Failure', res);
} else {
console.log('JDUnion Init Success');
}
}).cathc((err) => {
console.log('JDUnion Init Error', err.message);
})
2. 使用链接打开京东
jdunion.openJDUrlPage({
url: url.value,
paramOrCallback: (res) => {
console.log('openJDUrlPage paramOrCallback:', res)
},
callback: (res) => {
console.log('openJDUrlPage callback:', res)
},
})
3. 使用skuId打开京东
jdunion.openJDItemDetailsPage({
itemSKU: itemSKU.value,
paramOrCallback: (res) => {
console.log('openJDItemDetailsPage paramOrCallback:', res)
},
callback: (res) => {
console.log('openJDItemDetailsPage callback:', res)
},
})
4. 去京东App搜索
jdunion.openJDSearchPage({
searchKey: searchKey.value,
paramOrCallback: (res) => {
console.log('openJDSearchPage paramOrCallback:', res)
},
callback: (res) => {
console.log('openJDSearchPage callback:', res)
},
})
5. 打开购物车界面
jdunion.openJDCartPage({
paramOrCallback: (res) => {
console.log('openJDCartPage paramOrCallback:', res)
},
callback: (res) => {
console.log('openJDCartPage callback:', res)
},
})
6. 打开个人订单中心
jdunion.openJDOrderListPage({
paramOrCallback: (res) => {
console.log('openJDOrderListPage paramOrCallback:', res)
},
callback: (res) => {
console.log('openJDOrderListPage callback:', res)
},
})
7. 用户登录态验证
jdunion.openJDOrderListPage({
paramOrCallback: (res) => {
console.log('openJDOrderListPage paramOrCallback:', res)
},
callback: (res) => {
console.log('openJDOrderListPage callback:', res)
},
})
8. 用户登录
jdunion.login({
loginCheckCB: (res) => {
console.log('login loginCheckCB:', res)
}
})
9. 单品加入购物车
jdunion.addSkuToCart({
skuCartParam: {
skuId: skuId.value
},
resultCB: (res) => {
console.log('addSkuToCart resultCB:', res)
}
})
10. 多品批量加购
jdunion.addMultSkuToCart({
skuCartParam: {
skuIds: skuIds.value, // 需要批量添加的商品的skuId,多种商品通过","分隔。
skuCounts: skuCounts // 需要批量添加的商品的skuId对应的商品数量,必须与skuIds对应,多种商品通过","分隔。
},
resultCB: (res) => {
console.log('addMultSkuToCart resultCB:', res)
}
})
11. 直接打开指定页面
jdunion.openJDWebPage({
url: pageUrl.value,
adParam: {
keplerCustomerInfo: adParam.keplerCustomerInfo, // string|undefined 开普勒订单业务参数识别,上报到订单xml中心
positionId: adParam.positionId, // string|undefined 推广位Id,对应联盟转链入参推广位id
mopenbp7: adParam.mopenbp7, // string|undefined 设置返回小把手标识,如果已经设置了全局标识appBackTagID,则此参数失效
appName: adParam.appName, // string|undefined 特价版留用
appSchema: adParam.appSchema, // string|undefined 特价版留用
appBundleId: adParam.appBundleId // string|undefined 特价版留用
}
}).then((res) => {
if (res) {
console.log('openJDWebPage Failure:', res)
} else {
console.log('openJDWebPage Success')
}
})
12. 获取SDK版本
console.log('SDKVersion:', jdunion.getSdkVersion)

收藏人数:
购买普通授权版(
试用
赞赏(0)
下载 4
赞赏 0
下载 12680575
赞赏 1956
赞赏
京公网安备:11010802035340号