ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
1.引入百川 ~~~javascript const bcPlugin = uni.requireNativePlugin('dahui-baichuan'); ~~~ 2.使用百川操作 btnclick: function(e) { const bcPlugin = uni.requireNativePlugin('dahui-baichuan'); switch (e) { case 0: if (plus.device.vendor == 'Apple') { bcPlugin.BCSDKInitWithAppkey('25254125', 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 => { if (result.type == "success") { } else { //退出失败 console.log("code:" + result.code + " - " + "msg:" + result.msg); } }); } this.result = '点击了:' + this.btnTitles[e]; break; case 4: //淘宝购物车 if (plus.device.vendor == 'Apple') { bcPlugin.BCJumpMyCart(result => {}); } else { bcPlugin.OpenMyCart(result => {}); } this.result = '点击了:' + this.btnTitles[e]; break; case 5: //我的订单 if (plus.device.vendor == 'Apple') { bcPlugin.BCJumpMyOrder(result => {}); } else { bcPlugin.OpenMyOrders({ status: 0, type: true }, result => {}); } this.result = '点击了:' + this.btnTitles[e]; break; case 6: //商品详情 if (plus.device.vendor == 'Apple') { console.log(1) bcPlugin.BCGetCoupons( 'https://uland.taobao.com/coupon/edetail?e=DsKrW2Og2c0GQASttHIRqVUsT30sX6GSlg748JCXXlfeQisExutkDzXXf1nzB380Y7ZfcRoqLzwE6RxJuSwSUekDT8w2RNepbd76m3V5xpZ3zneZRqXhyxMvwTuSGg24K1NbuQlADbKEhvT77TNKyO1LRo38GBz3LiliFCIHAwkt%2FzOJQMDvl6zroKjs8vldxfFlZSCevAAa0iPzmm5%2BqiPFdOKp7MG6MGC8tMyxEpw%3D&traceId=0b837d2915581470482163194e', result => {}); } else { bcPlugin.url({ url: 'https://uland.taobao.com/coupon/edetail?e=DsKrW2Og2c0GQASttHIRqVUsT30sX6GSlg748JCXXlfeQisExutkDzXXf1nzB380Y7ZfcRoqLzwE6RxJuSwSUekDT8w2RNepbd76m3V5xpZ3zneZRqXhyxMvwTuSGg24K1NbuQlADbKEhvT77TNKyO1LRo38GBz3LiliFCIHAwkt%2FzOJQMDvl6zroKjs8vldxfFlZSCevAAa0iPzmm5%2BqiPFdOKp7MG6MGC8tMyxEpw%3D&traceId=0b837d2915581470482163194e' }, result => { }); } this.result = '点击了:' + this.btnTitles[e]; break; default: break; } }