平台兼容性

Android Android CPU类型 iOS
armeabi-v7a:未测试,arm64-v8a:未测试,x86:未测试

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


阿里百川电商sdk安卓版

功能如下

淘宝授权登录 退出淘宝登录
打开商品详情 打开店铺 URL打开page 打开我的购物车 打开我的订单 判断用户Session有效性 获取用户Session信息

使用说明

  1. 安卓请使用V5安全图片放入 \nativeplugins\dasu-alibaichuan\android\res\drawable(需要自己创建目录) ios请使用V4安全图片放入 \nativeplugins\dasu-alibaichuan\ios(需要自己创建目录) 2.在mainfest.json 源码视图中 配置app-plus->distribute -> ios (urlschemes必须tbopen前缀)

            "ios" : {
                "urltypes" : [
                    {
                        "urlschemes" : [ "tbopen您的appkey" ],//  示例:"urlschemes" : [ "tbopen25816822" ]
                        "id" : "tbopen"
                    }
                ],
                "urlschemewhitelist" : [ "taobao", "tianmao", "tbopen", "tmall" ]
            }
    

    3.app-plus节点增加下面两个配置

        "schemeWhitelist" : [ "tbopen", "tmall", "taobao", "tianmao" ],
        "appWhitelist" : [ "tbopen", "tmall", "taobao", "tianmao" ]

代码示例

<template>
    <view class="content">
        <view>
            <text class="title">{{title}}</text>
        </view>
        <view class="uni-list">
            <view class="uni-list-cell" v-for="(item,index) in btnTitles" :key="index">
                <button class="uni-list-cell-navigate uni-navigate-right" @click="btnclick(index)">
                    {{item}}
                </button>
            </view>
        </view>
        <text>{{result}}</text>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                title: '阿里百川UniApp插件',
                btnTitles: [
                '百川初始化', 
                '授权并登录', 
                '用户是否已登录', 
                '退出登录',
                '跳转购物车', 
                '跳转到我的订单', 
                '跳转到优惠券',
                '打开淘宝商品'
                ],
                result: '',
            }
        },
        onLoad() {
        },
        methods: {
        btnclick: function(e) {
                const bcPlugin = uni.requireNativePlugin('dasu-alibaichuan');
                switch (e) {
                    case 0:
                        if (plus.device.vendor == 'Apple') {
                            bcPlugin.BCSDKInitWithAppkey('您的阿里百川appkey', result => {
                                uni.showModal({
                                    title: '百川初始化',
                                    content: 'code:' + result['code'] + '\nmessage:' + result['message']
                                })
                            });
                        }
                        this.result = '点击了:' + this.btnTitles[e];
                        break;
                    case 1:
                        if (plus.device.vendor == 'Apple') {
                            bcPlugin.BCAuth(result => {
                                uni.showModal({
                                    title: '授权登录',
                                    content: 'code:' + result['code'] + '\nmessage:' + result['message']
                                })
                            });
                        } else {
                            bcPlugin.login(result => {
                                if (result.type == "success") {
                                    uni.showToast({
                                        title: '授权成功'
                                    });
                                } else {
                                    //授权失败,包括用户取消登录 
                                    uni.showToast({
                                        title: '授权失败,如有异常,请联系客服。'
                                    });
                                }
                            });
                        }
                        this.result = '点击了:' + this.btnTitles[e];
                        break;
                    case 2:
                        if (plus.device.vendor == 'Apple') {
                            bcPlugin.BCIsUserLogin(result => {
                                uni.showModal({
                                    title: '用户是否登录',
                                    content: 'code:' + result['code'] + '\nmessage:' + result['message']
                                })
                            });
                        } else {
                            bcPlugin.checkSession(reg => {
                                if (reg) {
                                    //reg 存在 获取seesion
                                        uni.showModal({
                                        title: 'session',
                                        content: 'reg:'+reg
                                    })
                                } else {
                                    //reg过期 获取session
                                    bcPlugin.getSession(result => {});
                                }
                            });
                        }
                        this.result = '点击了:' + this.btnTitles[e];
                        break;
                        case 3:
                            if (plus.device.vendor == 'Apple') {
                                bcPlugin.BCUserLogout(result => {
                                    uni.showModal({
                                        title: '退出登陆',
                                        content: 'code:' + result['code'] + '\nmessage:' + result['message']
                                    })
                                });
                            } else {
                                bcPlugin.logout(result => {

                                      uni.showModal({
                                          title: '退出登陆',
                                          content: 'code:' + result['code'] + '\nmessage:' + result['message']
                                      })

                                });
                            }
                            this.result = '点击了:' + this.btnTitles[e];
                            break;
                    case 4:
                        if (plus.device.vendor == 'Apple') {
                            bcPlugin.BCJumpMyCart(result => {
                               uni.showModal({
                                title:'跳转到我的购物车',
                                content:'code:'+result['code'] + '\nmessage:' + result['message']
                               });
                            });
                        } else {
                            bcPlugin.OpenMyCart(result => {

                                  uni.showModal({
                                      title: '购物车',
                                      content: 'code:' + result['code'] + '\nmessage:' + result['message']
                                  })

                            });
                        }
                        this.result = '点击了:' + this.btnTitles[e];
                        break;      
                    case 5:
                        if (plus.device.vendor == 'Apple') {
                            bcPlugin.BCJumpMyOrder(result => {
                                uni.showModal({
                                    title:'跳转到我的订单',
                                    content:'code:'+result['code'] + '\nmessage:' + result['message']
                                });
                            });
                        } else {
                            bcPlugin.OpenMyOrders({status:0,type:true},result => {

                                uni.showToast({title:JSON.stringify(result),icon:'none'});

                                           if(result.type=="success")
                                           {
                                               //操作成功,返回内容 result.msg
                                             console.log("msg:"+result.msg);     
                                           }else{

                                              //失败
                                             console.log("code:"+result.code+" - "+"msg:"+result.msg);     
                                           }

                            });
                        }
                        this.result = '点击了:' + this.btnTitles[e];
                        break;  
                        case 6:
                        if (plus.device.vendor == 'Apple') {
                            bcPlugin.BCGetCoupons("https:\/\/uland.taobao.com/coupon/edetail?e=bv45wXFXDV0GQASttHIRqYvw81bTTFV3AoNz1oh6sSBw24URnwfVYZkqkkGn1ka4Io61VIt2QOAlLeoz%2FuwL9wBa6vm8LTMVFpTdiJGYMLzZzF%2F7iLsQj%2Bdth9k8bqqSHKTgBzHkoM7XTQC0vfau6E%2F9Zk7cDx8UPY2GSU4OeGfCMAzsjqHNZlTH5bfxlzo3&traceId=0b15337b15522805995965072e&union_lens=lensId:0b0fc0d4_0bf6_1696b223c3d_2b97&xId=TNqIni6VJhuZ9lqkONqDbz9lYtQjXIVM9Vi4arlsiXoIG879SnaSb2HjXpRzY0CIEsykszYfmZWzbvz2I68AfA",result => {
                                uni.showModal({
                                    title: '跳转优惠券',
                                    content: 'code:' + result['code'] + '\nmessage:' + result['message']
                                })
                            });
                        } else {
                            bcPlugin.url({url:"https:\/\/uland.taobao.com/coupon/edetail?e=bv45wXFXDV0GQASttHIRqYvw81bTTFV3AoNz1oh6sSBw24URnwfVYZkqkkGn1ka4Io61VIt2QOAlLeoz%2FuwL9wBa6vm8LTMVFpTdiJGYMLzZzF%2F7iLsQj%2Bdth9k8bqqSHKTgBzHkoM7XTQC0vfau6E%2F9Zk7cDx8UPY2GSU4OeGfCMAzsjqHNZlTH5bfxlzo3&traceId=0b15337b15522805995965072e&union_lens=lensId:0b0fc0d4_0bf6_1696b223c3d_2b97&xId=TNqIni6VJhuZ9lqkONqDbz9lYtQjXIVM9Vi4arlsiXoIG879SnaSb2HjXpRzY0CIEsykszYfmZWzbvz2I68AfA"},result => {

                                uni.showToast({title:JSON.stringify(result),icon:'none'});

                                           if(result.type=="success")
                                           {
                                               //操作成功,返回内容 result.msg
                                             console.log("msg:"+result.msg);     
                                           }else{

                                              //失败
                                             console.log("code:"+result.code+" - "+"msg:"+result.msg);     
                                           }

                            });
                        }
                        this.result = '点击了:' + this.btnTitles[e];
                        break;      
                }
            }    ,
            }
    }
</script>

<style>
    .content {
        text-align: center;
        height: 400upx;
    }

    .logo {
        height: 200upx;
        width: 200upx;
        margin-top: 20upx;
    }

    .title {
        font-size: 36upx;
        color: #8f8f94;
    }
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

作者未提供license.md

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问