E企盈营销工具技术服务商 热线:4006-838-530

微信小程序基础库版本大小判断

E企盈直播平台营销卖货系统

wx.getSystemInfo({          success: function (res) {            var version = res.SDKVersion;            version = version.replace(/./g, “”)            console.log(version)            if (parseInt(version)<230) {// 小于230的版本 基础库            wx.showModal({                title: ‘提示’,                content: ‘该微信版本不支持网络通话,请更新微信!’,                showCancel : false,                success(res) {                  if (res.confirm) {                    console.log(‘用户点击确定’)                  } else if (res.cancel) {                    console.log(‘用户点击取消’)                  }                }              })            }          }常判断 2.3.0 版本的基础库,该版本以上可以调用 wx.getSetting() 获取权限,如下:wx.getSetting({            success(res) {              if (!res.authSetting[‘scope.camera’]) {   //摄像头                wx.authorize({                  scope: ‘scope.camera’,                  success() {                    console.log(‘授权成功’)                  }, fail() {                    wx.showModal({                      title: ‘提示’,                      content: ‘尚未进行授权,部分功能将无法使用’,                      showCancel: false,                      success(res) {                        if (res.confirm) {                          console.log(‘用户点击确定’)                          wx.openSetting({                            success: (res) => {                              if (!res.authSetting[‘scope.camera’]) {                                wx.authorize({                                  scope: ‘scope.camera’,                                  success() {                                    console.log(‘授权成功’);                                  }, fail() {                                    console.log(‘用户点击取消’);                                  }                                })                              }                            },                            fail: function () {                              console.log(“授权设置录音失败”);                            }                          })                        } else if (res.cancel) {                          console.log(‘用户点击取消’)                        }                      }                    })                  }                })              };

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序基础库版本大小判断
分享到: 更多 (0)
E企盈小程序直播营销卖货系统
E企盈直播平台营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏