|
- Component({
- /**
- * 组件的初始数据
- */
- data: {
- privacyContractName: '',
- showPrivacy: false
- },
- properties: {
-
- },
- /**
- * 组件的生命周期
- */
- pageLifetimes: {
- show() {
- const that = this
- wx.getPrivacySetting({
- success(res) {
- if (res.errMsg == "getPrivacySetting:ok") {
- that.setData({
- privacyContractName: res.privacyContractName,
- showPrivacy: res.needAuthorization
- })
- }
- }
- })
- }
- },
- /**
- * 组件的方法列表
- */
- methods: {
- // 打开隐私协议页面
- openPrivacyContract() {
- wx.openPrivacyContract({
- fail: () => {
- wx.showToast({
- title: '出错了',
- icon: 'error'
- })
- }
- })
- },
- // 拒绝隐私协议
- exitMiniProgram() {
- // 直接退出小程序
- wx.exitMiniProgram();
- },
- // 同意隐私协议
- handleAgreePrivacyAuthorization() {
- const that = this;
- that.setData({
- showPrivacy: false
- });
- // 同意后加载wifi模块
- this.triggerEvent('onStartWifi');
- },
- },
- })
|