const { openPrivacyContract } = require('../../utils/privacy'); Component({ data: { show: false, privacyContractName: '《用户隐私保护指引》', }, lifetimes: { attached() { if (typeof wx.onNeedPrivacyAuthorization !== 'function') { return; } wx.onNeedPrivacyAuthorization((resolve) => { this._privacyResolve = resolve; this.setData({ show: true }); }); }, }, methods: { openPrivacyContract() { openPrivacyContract(); }, handleDisagree() { this.setData({ show: false }); if (this._privacyResolve) { this._privacyResolve({ event: 'disagree' }); this._privacyResolve = null; } }, handleAgree() { this.setData({ show: false }); if (this._privacyResolve) { this._privacyResolve({ buttonId: 'agree-privacy-btn', event: 'agree', }); this._privacyResolve = null; } }, }, });