npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mvlock_sdk_wx

v1.1.5

Published

享宿科技人脸识别蓝牙智能锁微信小程序SDK

Downloads

20

Readme

mvlock_sdk_wx

享宿科技人脸识别蓝牙智能锁微信小程序SDK

接入步骤

1.安装sdk以及依赖:

ps: 如果在你的小程序根目录下面没有package.json文件,请先执行npm init,然后一路回车即可。

npm i mvlock_sdk_wx --save
npm i crypto-js --save

2.构建npm: 安装完sdk和依赖之后,在小程序编辑器里面点击构建npm;

3.引入sdk模块,然后初始化sdk,例如:

const MVLOCK_MP_SDK = require('./miniprogram_npm/mvlock_sdk_wx/index.js');

App({
  onLaunch: function () {
    MVLOCK_MP_SDK.init(this, {
      accessKey: 'dqwdoiqbccasc',
      accessSecret: 'dcnlksdncioshdioqwe',
      appId: '',
      userInfo: {
        mobile: 17682306667,
        nickname: '',
        sex: '',
        avatar: '',
        province: '',
        city: '',
      }
    });
  },
})
具体业务中可在获取到用户信息后进行初始化

init()方法第一个参数为app事例,必传;第二个参数为初始化数据,必传,类型为object. appId: 接入的小程序的appid; accessKey: 商户的key,由享宿科技提供;accessSecret: 商户的secret,由享宿科技提供; userInfo: 用户信息。其中mobile为用户手机号码,判断用户的唯一标志,必传;nickname、sex、avatar、province、city均为可传可不传;

4.人证合一开锁组件的使用: 创建一个放置开锁组件的页面,在这个页面的json文件中导入组件

"usingComponents": {
    "opening": "../../miniprogram_npm/mvlock_sdk_wx/opening"
}

ps: 具体路径根据实际情况编写

在wxml文件中使用组件

<opening initData="{{initData}}" bind:goToAuth="goToAuth"></opening>

在js文件中

Page({
    data: {
        initData: {
          mac_id: 'EE:06:68:9D:5E:F1',
        }
    },
    goToAuth(){
        wx.navigetor({
            url: '/pages/...',
        })
    }
})

initData为组件初始化数据,mac_ic锁的mac_id,必传;(暂时只有mac_id,后续可能会有更多拓展); goToAuth: 跳转到放置认证组件的页面的方法

5.人证合一认证组件的使用: 创建一个放置认证组件的页面,在这个页面的json文件中导入组件

"usingComponents": {
    "auth": "../../miniprogram_npm/mvlock_sdk_wx/auth"
}

在wxml文件中使用组件

<auth binduploadId='uploadId' binduploadFace='uploadFace' id='ocr'></auth>

在js文件中

Page({
    data: {},
    uploadId(e){
      this.getImgUrl().then(imgUrl=>{
        this.selectComponent("#ocr").ocrAuth(imgUrl);
      });
    },
    uploadFace(e){
      this.getAuthImgUrl().then(imgUrl=>{
        this.selectComponent("#ocr").faceAuth(imgUrl);
      }).catch(err=>{
        this.selectComponent("#ocr").faceAuthFail();
      })
    },
    // 模拟上传身份证图片,具体业务中替换成上传图片的接口
    getImgUrl(){
      return new Promise(resolve => {
        setTimeout(()=>{
          const imgUrl = 'https://xxxx.jpg';
          resolve(imgUrl);
        }, 1500)
      })
    },
    // 模拟上传拍照的图片,具体业务中替换成上传图片的接口
    getAuthImgUrl(){
      return new Promise(resolve => {
          setTimeout(()=>{
            const imgUrl = 'https://xxxx.png';
            resolve(imgUrl);
          }, 1500)
      })
    }
})

ps: 请添加安全域名后进行调试或者不校验合法域名: https://mp.mvlock.cn