h5.js 735 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * H5相关权限
  3. * @description 相关权限校验,调用在wechat/sdk.js
  4. * @param {String} scopeValue - 权限种类
  5. *
  6. */
  7. const TIPS_MAP = {
  8. 'userInfo': '用户信息',
  9. 'userLocation': '地理位置',
  10. 'address': '通信地址',
  11. 'record': '录音功能',
  12. 'writePhotosAlbum': '保存到相册',
  13. 'message': '订阅消息'
  14. }
  15. export default class H5Auth {
  16. constructor(scopeValue) {
  17. this.scopeValue = scopeValue
  18. }
  19. // 检测当前请求权限是否可用。
  20. checkAuth() {
  21. const that = this;
  22. return new Promise((resolve, reject) => {
  23. switch (that.scopeValue) {
  24. case 'writePhotosAlbum' || 'camera':
  25. resolve(1)
  26. break;
  27. default:
  28. resolve(1)
  29. break;
  30. }
  31. })
  32. }
  33. }