uniapp小程序进阶整理

短振动,可用于picker组件

uni.vibrateShort({
    complete() {
        //振动后逻辑
    }
})

指纹识别

toSearch() {
    uni.startSoterAuthentication({
        //facial人脸识别,fingerPrint指纹识别
        requestAuthModes: ['fingerPrint'],
        challenge: '123456',
        authContent: '请用指纹',
        success(res) {
            console.log("识别成功", res)
        },
        fail(res) {
            console.log("识别失败", res)
        }
    })
},

客服

企业微信客服

uni.openCustomerServiceChat({
    extInfo: {
        //客服链接
        url: config.url
    },
    //企业微信id
    corpId: config.corpId,
    success(res) {},
    fail(res) {
        console.log(res)
    },
})

配置,参考网址https://work.weixin.qq.com/nl/act/p/a733314375294bdd

 

确认收货组件

openOrderConfirmView(items) {
    const that = this
    //拉起确认收货组件
    if (wx.openBusinessView) {
        wx.openBusinessView({
            businessType: 'weappOrderConfirm',
            extraData: {
                transaction_id: items.channelOrderNo
            },
            success(e) {
                if (e.extraData.status === 'success') {
                    // 用户确认收货成功,再执行自己的代码
                    that.receive()
                } else if (e.extraData.status === 'fail') {
                    // 用户确认收货失败
                    uni.showToast({
                        title: "确认收货失败!",
                        icon: "none",
                        duration: 3000
                    });
                }
            },
            fail(err) {
                uni.showToast({
                    title: "确认收货失败!",
                    icon: "none",
                    duration: 3000
                });
                console.log(err);
            },
            complete() {}
            });
    } else {
        //引导用户升级微信版本
        uni.showToast({
            title: "请升级微信版本",
            duration: 3000,
            icon: "none",
        });
    }
}

获取当前账号信息,如appId,version,插件信息等

uni.getAccountInfoSync().miniProgram.appId

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值