随手精灵小程序,单独为了获取WIFI信息加强围栏告警功能能力
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5KB

  1. Component({
  2. /**
  3. * 组件的初始数据
  4. */
  5. data: {
  6. privacyContractName: '',
  7. showPrivacy: false
  8. },
  9. properties: {
  10. },
  11. /**
  12. * 组件的生命周期
  13. */
  14. pageLifetimes: {
  15. show() {
  16. const that = this
  17. wx.getPrivacySetting({
  18. success(res) {
  19. if (res.errMsg == "getPrivacySetting:ok") {
  20. that.setData({
  21. privacyContractName: res.privacyContractName,
  22. showPrivacy: res.needAuthorization
  23. })
  24. }
  25. }
  26. })
  27. }
  28. },
  29. /**
  30. * 组件的方法列表
  31. */
  32. methods: {
  33. // 打开隐私协议页面
  34. openPrivacyContract() {
  35. wx.openPrivacyContract({
  36. fail: () => {
  37. wx.showToast({
  38. title: '出错了',
  39. icon: 'error'
  40. })
  41. }
  42. })
  43. },
  44. // 拒绝隐私协议
  45. exitMiniProgram() {
  46. // 直接退出小程序
  47. wx.exitMiniProgram();
  48. },
  49. // 同意隐私协议
  50. handleAgreePrivacyAuthorization() {
  51. const that = this;
  52. that.setData({
  53. showPrivacy: false
  54. });
  55. // 同意后加载wifi模块
  56. this.triggerEvent('onStartWifi');
  57. },
  58. },
  59. })